diff mbox

[v2,2/5] null_blk: Use blk_init_request_from_bio() instead of open-coding it

Message ID 20170419210128.28374-3-bart.vanassche@sandisk.com (mailing list archive)
State New, archived
Headers show

Commit Message

Bart Van Assche April 19, 2017, 9:01 p.m. UTC
This patch changes the behavior of the null_blk driver for the
LightNVM mode as follows:
* REQ_FAILFAST_MASK is set for read-ahead requests.
* If no I/O priority has been set in the bio, the I/O priority is
  copied from the I/O context.
* The rq_disk member is initialized if bio->bi_bdev != NULL.
* req->errors is initialized to zero.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Matias Bjørling <m@bjorling.me>
Cc: Adam Manzanares <adam.manzanares@wdc.com>
---
 drivers/block/null_blk.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

Comments

Johannes Thumshirn April 20, 2017, 8:30 a.m. UTC | #1
On Wed, Apr 19, 2017 at 02:01:25PM -0700, Bart Van Assche wrote:
> This patch changes the behavior of the null_blk driver for the
> LightNVM mode as follows:
> * REQ_FAILFAST_MASK is set for read-ahead requests.
> * If no I/O priority has been set in the bio, the I/O priority is
>   copied from the I/O context.
> * The rq_disk member is initialized if bio->bi_bdev != NULL.
> * req->errors is initialized to zero.
> 
> Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Cc: Matias Bjørling <m@bjorling.me>
> Cc: Adam Manzanares <adam.manzanares@wdc.com>
> ---

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
diff mbox

Patch

diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c
index f93906ff31e8..e79e3d24e229 100644
--- a/drivers/block/null_blk.c
+++ b/drivers/block/null_blk.c
@@ -443,14 +443,7 @@  static int null_lnvm_submit_io(struct nvm_dev *dev, struct nvm_rq *rqd)
 	if (IS_ERR(rq))
 		return -ENOMEM;
 
-	rq->__sector = bio->bi_iter.bi_sector;
-	rq->ioprio = bio_prio(bio);
-
-	if (bio_has_data(bio))
-		rq->nr_phys_segments = bio_phys_segments(q, bio);
-
-	rq->__data_len = bio->bi_iter.bi_size;
-	rq->bio = rq->biotail = bio;
+	blk_init_request_from_bio(rq, bio);
 
 	rq->end_io_data = rqd;