Add 'discard' request handling
Some block devices benefit from a hint that they can forget the contents of certain sectors. Add basic support for this to the block core, along with a 'blkdev_issue_discard()' helper function which issues such requests. The caller doesn't get to provide an end_io functio, since blkdev_issue_discard() will automatically split the request up into multiple bios if appropriate. Neither does the function wait for completion -- it's expected that callers won't care about when, or even _if_, the request completes. It's only a hint to the device anyway. By definition, the file system doesn't _care_ about these sectors any more. [With feedback from OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> and Jens Axboe <jens.axboe@oracle.com] Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
This commit is contained in:
committed by
Jens Axboe
parent
d628eaef31
commit
fb2dce862d
@@ -86,7 +86,8 @@ extern int dir_notify_enable;
|
||||
#define READ_META (READ | (1 << BIO_RW_META))
|
||||
#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC))
|
||||
#define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNC))
|
||||
#define WRITE_BARRIER ((1 << BIO_RW) | (1 << BIO_RW_BARRIER))
|
||||
#define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER))
|
||||
#define WRITE_DISCARD (WRITE | (1 << BIO_RW_DISCARD))
|
||||
|
||||
#define SEL_IN 1
|
||||
#define SEL_OUT 2
|
||||
|
Reference in New Issue
Block a user