target-i386: Fix addr16 prefix
[qemu/ar7.git] / include / block / write-threshold.h
blob8a79505ada920caea26ed0fb9bd0f34395dd2221
1 /*
2 * QEMU System Emulator block write threshold notification
4 * Copyright Red Hat, Inc. 2014
6 * Authors:
7 * Francesco Romani <fromani@redhat.com>
9 * This work is licensed under the terms of the GNU LGPL, version 2 or later.
10 * See the COPYING.LIB file in the top-level directory.
12 #ifndef BLOCK_WRITE_THRESHOLD_H
13 #define BLOCK_WRITE_THRESHOLD_H
16 #include "qemu/typedefs.h"
17 #include "qemu-common.h"
20 * bdrv_write_threshold_set:
22 * Set the write threshold for block devices, in bytes.
23 * Notify when a write exceeds the threshold, meaning the device
24 * is becoming full, so it can be transparently resized.
25 * To be used with thin-provisioned block devices.
27 * Use threshold_bytes == 0 to disable.
29 void bdrv_write_threshold_set(BlockDriverState *bs, uint64_t threshold_bytes);
32 * bdrv_write_threshold_get
34 * Get the configured write threshold, in bytes.
35 * Zero means no threshold configured.
37 uint64_t bdrv_write_threshold_get(const BlockDriverState *bs);
40 * bdrv_write_threshold_is_set
42 * Tell if a write threshold is set for a given BDS.
44 bool bdrv_write_threshold_is_set(const BlockDriverState *bs);
47 * bdrv_write_threshold_exceeded
49 * Return the extent of a write request that exceeded the threshold,
50 * or zero if the request is below the threshold.
51 * Return zero also if the threshold was not set.
53 * NOTE: here we assume the following holds for each request this code
54 * deals with:
56 * assert((req->offset + req->bytes) <= UINT64_MAX)
58 * Please not there is *not* an actual C assert().
60 uint64_t bdrv_write_threshold_exceeded(const BlockDriverState *bs,
61 const BdrvTrackedRequest *req);
63 #endif