1 /*
2  * QEMU System Emulator block write threshold notification
3  *
4  * Copyright Red Hat, Inc. 2014
5  *
6  * Authors:
7  *  Francesco Romani <fromani@redhat.com>
8  *
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.
11  */
12 
13 #ifndef BLOCK_WRITE_THRESHOLD_H
14 #define BLOCK_WRITE_THRESHOLD_H
15 
16 #include "qemu/typedefs.h"
17 
18 /*
19  * bdrv_write_threshold_set:
20  *
21  * Set the write threshold for block devices, in bytes.
22  * Notify when a write exceeds the threshold, meaning the device
23  * is becoming full, so it can be transparently resized.
24  * To be used with thin-provisioned block devices.
25  *
26  * Use threshold_bytes == 0 to disable.
27  */
28 void bdrv_write_threshold_set(BlockDriverState *bs, uint64_t threshold_bytes);
29 
30 /*
31  * bdrv_write_threshold_get
32  *
33  * Get the configured write threshold, in bytes.
34  * Zero means no threshold configured.
35  */
36 uint64_t bdrv_write_threshold_get(const BlockDriverState *bs);
37 
38 /*
39  * bdrv_write_threshold_check_write
40  *
41  * Check whether the specified request exceeds the write threshold.
42  * If so, send a corresponding event and disable write threshold checking.
43  */
44 void bdrv_write_threshold_check_write(BlockDriverState *bs, int64_t offset,
45                                       int64_t bytes);
46 
47 #endif
48