1e2462113SFrancesco Romani /* 2e2462113SFrancesco Romani * QEMU System Emulator block write threshold notification 3e2462113SFrancesco Romani * 4e2462113SFrancesco Romani * Copyright Red Hat, Inc. 2014 5e2462113SFrancesco Romani * 6e2462113SFrancesco Romani * Authors: 7e2462113SFrancesco Romani * Francesco Romani <fromani@redhat.com> 8e2462113SFrancesco Romani * 9e2462113SFrancesco Romani * This work is licensed under the terms of the GNU LGPL, version 2 or later. 10e2462113SFrancesco Romani * See the COPYING.LIB file in the top-level directory. 11e2462113SFrancesco Romani */ 12ec150c7eSMarkus Armbruster 13e2462113SFrancesco Romani #ifndef BLOCK_WRITE_THRESHOLD_H 14e2462113SFrancesco Romani #define BLOCK_WRITE_THRESHOLD_H 15e2462113SFrancesco Romani 16e2462113SFrancesco Romani /* 17e2462113SFrancesco Romani * bdrv_write_threshold_set: 18e2462113SFrancesco Romani * 19e2462113SFrancesco Romani * Set the write threshold for block devices, in bytes. 20e2462113SFrancesco Romani * Notify when a write exceeds the threshold, meaning the device 21e2462113SFrancesco Romani * is becoming full, so it can be transparently resized. 22e2462113SFrancesco Romani * To be used with thin-provisioned block devices. 23e2462113SFrancesco Romani * 24e2462113SFrancesco Romani * Use threshold_bytes == 0 to disable. 25e2462113SFrancesco Romani */ 26e2462113SFrancesco Romani void bdrv_write_threshold_set(BlockDriverState *bs, uint64_t threshold_bytes); 27e2462113SFrancesco Romani 28e2462113SFrancesco Romani /* 29e2462113SFrancesco Romani * bdrv_write_threshold_get 30e2462113SFrancesco Romani * 31e2462113SFrancesco Romani * Get the configured write threshold, in bytes. 32e2462113SFrancesco Romani * Zero means no threshold configured. 33e2462113SFrancesco Romani */ 34e2462113SFrancesco Romani uint64_t bdrv_write_threshold_get(const BlockDriverState *bs); 35e2462113SFrancesco Romani 36e2462113SFrancesco Romani /* 37*94783301SVladimir Sementsov-Ogievskiy * bdrv_write_threshold_check_write 38*94783301SVladimir Sementsov-Ogievskiy * 39*94783301SVladimir Sementsov-Ogievskiy * Check whether the specified request exceeds the write threshold. 40*94783301SVladimir Sementsov-Ogievskiy * If so, send a corresponding event and disable write threshold checking. 41*94783301SVladimir Sementsov-Ogievskiy */ 42*94783301SVladimir Sementsov-Ogievskiy void bdrv_write_threshold_check_write(BlockDriverState *bs, int64_t offset, 43*94783301SVladimir Sementsov-Ogievskiy int64_t bytes); 44*94783301SVladimir Sementsov-Ogievskiy 45e2462113SFrancesco Romani #endif 46