MAINTAINERS: Make section QOM cover hw/core/*bus.c as well
[qemu/armbru.git] / include / block / write-threshold.h
blobc646f267a45c7139854013e612e0a43aa82b52fc
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.
13 #ifndef BLOCK_WRITE_THRESHOLD_H
14 #define BLOCK_WRITE_THRESHOLD_H
16 #include "block/block_int.h"
19 * bdrv_write_threshold_set:
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.
26 * Use threshold_bytes == 0 to disable.
28 void bdrv_write_threshold_set(BlockDriverState *bs, uint64_t threshold_bytes);
31 * bdrv_write_threshold_get
33 * Get the configured write threshold, in bytes.
34 * Zero means no threshold configured.
36 uint64_t bdrv_write_threshold_get(const BlockDriverState *bs);
39 * bdrv_write_threshold_is_set
41 * Tell if a write threshold is set for a given BDS.
43 bool bdrv_write_threshold_is_set(const BlockDriverState *bs);
46 * bdrv_write_threshold_exceeded
48 * Return the extent of a write request that exceeded the threshold,
49 * or zero if the request is below the threshold.
50 * Return zero also if the threshold was not set.
52 * NOTE: here we assume the following holds for each request this code
53 * deals with:
55 * assert((req->offset + req->bytes) <= UINT64_MAX)
57 * Please not there is *not* an actual C assert().
59 uint64_t bdrv_write_threshold_exceeded(const BlockDriverState *bs,
60 const BdrvTrackedRequest *req);
62 #endif