Message ID | 20190711175328.16430-7-chaitanya.kulkarni@wdc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | null_blk: add missing write-zeroes and discard support | expand |
On 19-07-11 10:53:26, Chaitanya Kulkarni wrote: > This patch adds support for memory backed REQ_OP_WRITE_ZEROES > operations for the null_blk bio mode. > > Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> Hi Chaitanya, This patch looks like good to me merged with 4th patch which is about the null_handle_rq(). I think it would be great if a commit covers the actual callers for those introduced. But code looks good to me :) Thanks!
diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c index d463bde001b6..30cb90553167 100644 --- a/drivers/block/null_blk_main.c +++ b/drivers/block/null_blk_main.c @@ -1147,6 +1147,7 @@ static int null_handle_rq(struct nullb_cmd *cmd) static int null_handle_bio(struct nullb_cmd *cmd) { + unsigned int blk_bio_bytes = bio_sectors(cmd->bio) << SECTOR_SHIFT; struct bio *bio = cmd->bio; struct nullb *nullb = cmd->nq->dev->nullb; int err; @@ -1157,10 +1158,15 @@ static int null_handle_bio(struct nullb_cmd *cmd) sector = bio->bi_iter.bi_sector; - if (bio_op(bio) == REQ_OP_DISCARD) { - null_handle_discard(nullb, sector, - bio_sectors(bio) << SECTOR_SHIFT); + switch (bio_op(bio)) { + case REQ_OP_DISCARD: + null_handle_discard(nullb, sector, blk_bio_bytes); + return 0; + case REQ_OP_WRITE_ZEROES: + null_handle_write_zeroes(nullb, sector, blk_bio_bytes); return 0; + default: + break; } spin_lock_irq(&nullb->lock);
This patch adds support for memory backed REQ_OP_WRITE_ZEROES operations for the null_blk bio mode. Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> --- drivers/block/null_blk_main.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)