diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2020-02-07 23:59:25 +0300 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2020-05-15 17:29:35 +0300 |
commit | 6fbeb0048e6b93f7b7f195864f3ddc876ac4d42e (patch) | |
tree | d4e81956f5c878632bdd583caa7bc0c3244c3b37 /include/linux/dm-bufio.h | |
parent | d3c7b35c20d60650bac8b55c17b194adda03a979 (diff) | |
download | linux-6fbeb0048e6b93f7b7f195864f3ddc876ac4d42e.tar.xz |
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>
Diffstat (limited to 'include/linux/dm-bufio.h')
-rw-r--r-- | include/linux/dm-bufio.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/dm-bufio.h b/include/linux/dm-bufio.h index 3c8b7d274bd9..07e1f163e299 100644 --- a/include/linux/dm-bufio.h +++ b/include/linux/dm-bufio.h @@ -119,6 +119,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. */ |