dm bufio: implement discard
Add functions dm_bufio_issue_discard and dm_bufio_discard_buffers. dm_bufio_issue_discard sends discard request to the underlying device. dm_bufio_discard_buffers frees buffers in the range and then calls dm_bufio_issue_discard. Also, factor out block_to_sector for reuse in dm_bufio_issue_discard. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
This commit is contained in:
parent
d3c7b35c20
commit
6fbeb0048e
2 changed files with 76 additions and 5 deletions
|
|
@ -118,6 +118,18 @@ int dm_bufio_write_dirty_buffers(struct dm_bufio_client *c);
|
|||
*/
|
||||
int dm_bufio_issue_flush(struct dm_bufio_client *c);
|
||||
|
||||
/*
|
||||
* Send a discard request to the underlying device.
|
||||
*/
|
||||
int dm_bufio_issue_discard(struct dm_bufio_client *c, sector_t block, sector_t count);
|
||||
|
||||
/*
|
||||
* Free the specified range of buffers. If a buffer is held by other process, it
|
||||
* is not freed. If a buffer is dirty, it is discarded without writeback.
|
||||
* Finally, send the discard request to the device.
|
||||
*/
|
||||
int dm_bufio_discard_buffers(struct dm_bufio_client *c, sector_t block, sector_t count);
|
||||
|
||||
/*
|
||||
* Like dm_bufio_release but also move the buffer to the new
|
||||
* block. dm_bufio_write_dirty_buffers is needed to commit the new block.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue