diff options
author | Christoph Hellwig <hch@lst.de> | 2010-12-16 19:36:31 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2010-12-17 16:11:03 +0100 |
commit | bb8bf76fb1c4afa116a7f11fee559b3cca671a4a (patch) | |
tree | 3869081b39a96da24bff96e06099794960dd9ccf /block_int.h | |
parent | 61d9d6b091aa04e5e5bd20951aa689a5bbe65aed (diff) | |
download | qemu-bb8bf76fb1c4afa116a7f11fee559b3cca671a4a.zip qemu-bb8bf76fb1c4afa116a7f11fee559b3cca671a4a.tar.gz qemu-bb8bf76fb1c4afa116a7f11fee559b3cca671a4a.tar.bz2 |
block: add discard support
Add a new bdrv_discard method to free blocks in a mapping image, and a new
drive property to set the granularity for these discard. If no discard
granularity support is set discard support is disabled.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block_int.h')
-rw-r--r-- | block_int.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/block_int.h b/block_int.h index 6b3b098..eb5cd42 100644 --- a/block_int.h +++ b/block_int.h @@ -72,6 +72,8 @@ struct BlockDriver { BlockDriverCompletionFunc *cb, void *opaque); BlockDriverAIOCB *(*bdrv_aio_flush)(BlockDriverState *bs, BlockDriverCompletionFunc *cb, void *opaque); + int (*bdrv_discard)(BlockDriverState *bs, int64_t sector_num, + int nb_sectors); int (*bdrv_aio_multiwrite)(BlockDriverState *bs, BlockRequest *reqs, int num_reqs); @@ -227,6 +229,7 @@ typedef struct BlockConf { uint16_t min_io_size; uint32_t opt_io_size; int32_t bootindex; + uint32_t discard_granularity; } BlockConf; static inline unsigned int get_physical_block_exp(BlockConf *conf) @@ -250,6 +253,8 @@ static inline unsigned int get_physical_block_exp(BlockConf *conf) _conf.physical_block_size, 512), \ DEFINE_PROP_UINT16("min_io_size", _state, _conf.min_io_size, 0), \ DEFINE_PROP_UINT32("opt_io_size", _state, _conf.opt_io_size, 0), \ - DEFINE_PROP_INT32("bootindex", _state, _conf.bootindex, -1) \ + DEFINE_PROP_INT32("bootindex", _state, _conf.bootindex, -1), \ + DEFINE_PROP_UINT32("discard_granularity", _state, \ + _conf.discard_granularity, 0) #endif /* BLOCK_INT_H */ |