qapi-visit: Honor prefix of discriminator enum
[qemu/kevin.git] / include / block / write-threshold.h
blobf1b899cd5f5ff4061fe11e16c8ac66dfd31195a4
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
15 #include <stdint.h>
17 #include "qemu/typedefs.h"
18 #include "qemu-common.h"
21 * bdrv_write_threshold_set:
23 * Set the write threshold for block devices, in bytes.
24 * Notify when a write exceeds the threshold, meaning the device
25 * is becoming full, so it can be transparently resized.
26 * To be used with thin-provisioned block devices.
28 * Use threshold_bytes == 0 to disable.
30 void bdrv_write_threshold_set(BlockDriverState *bs, uint64_t threshold_bytes);
33 * bdrv_write_threshold_get
35 * Get the configured write threshold, in bytes.
36 * Zero means no threshold configured.
38 uint64_t bdrv_write_threshold_get(const BlockDriverState *bs);
41 * bdrv_write_threshold_is_set
43 * Tell if a write threshold is set for a given BDS.
45 bool bdrv_write_threshold_is_set(const BlockDriverState *bs);
48 * bdrv_write_threshold_exceeded
50 * Return the extent of a write request that exceeded the threshold,
51 * or zero if the request is below the threshold.
52 * Return zero also if the threshold was not set.
54 * NOTE: here we assume the following holds for each request this code
55 * deals with:
57 * assert((req->offset + req->bytes) <= UINT64_MAX)
59 * Please not there is *not* an actual C assert().
61 uint64_t bdrv_write_threshold_exceeded(const BlockDriverState *bs,
62 const BdrvTrackedRequest *req);
64 #endif