9pfs: fix dependencies
[qemu.git] / include / block / write-threshold.h
blob234d2193e0eaed80a2fe0568a1427df745ee615a
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 "qemu-common.h"
18 * bdrv_write_threshold_set:
20 * Set the write threshold for block devices, in bytes.
21 * Notify when a write exceeds the threshold, meaning the device
22 * is becoming full, so it can be transparently resized.
23 * To be used with thin-provisioned block devices.
25 * Use threshold_bytes == 0 to disable.
27 void bdrv_write_threshold_set(BlockDriverState *bs, uint64_t threshold_bytes);
30 * bdrv_write_threshold_get
32 * Get the configured write threshold, in bytes.
33 * Zero means no threshold configured.
35 uint64_t bdrv_write_threshold_get(const BlockDriverState *bs);
38 * bdrv_write_threshold_is_set
40 * Tell if a write threshold is set for a given BDS.
42 bool bdrv_write_threshold_is_set(const BlockDriverState *bs);
45 * bdrv_write_threshold_exceeded
47 * Return the extent of a write request that exceeded the threshold,
48 * or zero if the request is below the threshold.
49 * Return zero also if the threshold was not set.
51 * NOTE: here we assume the following holds for each request this code
52 * deals with:
54 * assert((req->offset + req->bytes) <= UINT64_MAX)
56 * Please not there is *not* an actual C assert().
58 uint64_t bdrv_write_threshold_exceeded(const BlockDriverState *bs,
59 const BdrvTrackedRequest *req);
61 #endif