linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvmet: stop using bio_set_op_attrs
@ 2019-10-29  7:12 Christoph Hellwig
  2019-10-29  7:27 ` Chaitanya Kulkarni
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Christoph Hellwig @ 2019-10-29  7:12 UTC (permalink / raw)
  To: linux-nvme

bio_set_op_attrs has been long deprecated, replace it with a direct
assignment of the flags to bio->bi_opf.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/target/io-cmd-bdev.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/nvme/target/io-cmd-bdev.c b/drivers/nvme/target/io-cmd-bdev.c
index 07e4f8c579d3..b6fca0e421ef 100644
--- a/drivers/nvme/target/io-cmd-bdev.c
+++ b/drivers/nvme/target/io-cmd-bdev.c
@@ -149,7 +149,7 @@ static void nvmet_bdev_execute_rw(struct nvmet_req *req)
 	struct scatterlist *sg;
 	struct blk_plug plug;
 	sector_t sector;
-	int op, op_flags = 0, i;
+	int op, i;
 
 	if (!nvmet_check_data_len(req, nvmet_rw_len(req)))
 		return;
@@ -160,16 +160,15 @@ static void nvmet_bdev_execute_rw(struct nvmet_req *req)
 	}
 
 	if (req->cmd->rw.opcode == nvme_cmd_write) {
-		op = REQ_OP_WRITE;
-		op_flags = REQ_SYNC | REQ_IDLE;
+		op = REQ_OP_WRITE | REQ_SYNC | REQ_IDLE;
 		if (req->cmd->rw.control & cpu_to_le16(NVME_RW_FUA))
-			op_flags |= REQ_FUA;
+			op |= REQ_FUA;
 	} else {
 		op = REQ_OP_READ;
 	}
 
 	if (is_pci_p2pdma_page(sg_page(req->sg)))
-		op_flags |= REQ_NOMERGE;
+		op |= REQ_NOMERGE;
 
 	sector = le64_to_cpu(req->cmd->rw.slba);
 	sector <<= (req->ns->blksize_shift - 9);
@@ -184,7 +183,7 @@ static void nvmet_bdev_execute_rw(struct nvmet_req *req)
 	bio->bi_iter.bi_sector = sector;
 	bio->bi_private = req;
 	bio->bi_end_io = nvmet_bio_done;
-	bio_set_op_attrs(bio, op, op_flags);
+	bio->bi_opf = op;
 
 	blk_start_plug(&plug);
 	for_each_sg(req->sg, sg, req->sg_cnt, i) {
@@ -195,7 +194,7 @@ static void nvmet_bdev_execute_rw(struct nvmet_req *req)
 			bio = bio_alloc(GFP_KERNEL, min(sg_cnt, BIO_MAX_PAGES));
 			bio_set_dev(bio, req->ns->bdev);
 			bio->bi_iter.bi_sector = sector;
-			bio_set_op_attrs(bio, op, op_flags);
+			bio->bi_opf = op;
 
 			bio_chain(bio, prev);
 			submit_bio(prev);
-- 
2.20.1


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvmet: stop using bio_set_op_attrs
  2019-10-29  7:12 [PATCH] nvmet: stop using bio_set_op_attrs Christoph Hellwig
@ 2019-10-29  7:27 ` Chaitanya Kulkarni
  2019-10-29  7:54 ` Johannes Thumshirn
  2019-10-29  8:16 ` Keith Busch
  2 siblings, 0 replies; 4+ messages in thread
From: Chaitanya Kulkarni @ 2019-10-29  7:27 UTC (permalink / raw)
  To: Christoph Hellwig, linux-nvme

Looks good.

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>

On 10/29/2019 12:12 AM, Christoph Hellwig wrote:
> bio_set_op_attrs has been long deprecated, replace it with a direct
> assignment of the flags to bio->bi_opf.
>
> Signed-off-by: Christoph Hellwig<hch@lst.de>
> ---
>   drivers/nvme/target/io-cmd-bdev.c | 13 ++++++-------
>   1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/nvme/target/io-cmd-bdev.c b/drivers/nvme/target/io-cmd-bdev.c
> index 07e4f8c579d3..b6fca0e421ef 100644
> --- a/drivers/nvme/target/io-cmd-bdev.c
> +++ b/drivers/nvme/target/io-cmd-bdev.c
> @@ -149,7 +149,7 @@ static void nvmet_bdev_execute_rw(struct nvmet_req *req)
>   	struct scatterlist *sg;
>   	struct blk_plug plug;
>   	sector_t sector;
> -	int op, op_flags = 0, i;
> +	int op, i;
>
>   	if (!nvmet_check_data_len(req, nvmet_rw_len(req)))
>   		return;
> @@ -160,16 +160,15 @@ static void nvmet_bdev_execute_rw(struct nvmet_req *req)
>   	}
>
>   	if (req->cmd->rw.opcode == nvme_cmd_write) {
> -		op = REQ_OP_WRITE;
> -		op_flags = REQ_SYNC | REQ_IDLE;
> +		op = REQ_OP_WRITE | REQ_SYNC | REQ_IDLE;
>   		if (req->cmd->rw.control & cpu_to_le16(NVME_RW_FUA))
> -			op_flags |= REQ_FUA;
> +			op |= REQ_FUA;
>   	} else {

Is it possible to initialize op = REQ_OP_READ and get rid of this else
block unless that makes code hard to read ? This can be done with the
time of applying patch.

>   		op = REQ_OP_READ;
>   	}
>


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvmet: stop using bio_set_op_attrs
  2019-10-29  7:12 [PATCH] nvmet: stop using bio_set_op_attrs Christoph Hellwig
  2019-10-29  7:27 ` Chaitanya Kulkarni
@ 2019-10-29  7:54 ` Johannes Thumshirn
  2019-10-29  8:16 ` Keith Busch
  2 siblings, 0 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2019-10-29  7:54 UTC (permalink / raw)
  To: Christoph Hellwig, linux-nvme

Looks good,

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
-- 
Johannes Thumshirn                            SUSE Labs Filesystems
jthumshirn@suse.de                                +49 911 74053 689
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5
90409 Nürnberg
Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvmet: stop using bio_set_op_attrs
  2019-10-29  7:12 [PATCH] nvmet: stop using bio_set_op_attrs Christoph Hellwig
  2019-10-29  7:27 ` Chaitanya Kulkarni
  2019-10-29  7:54 ` Johannes Thumshirn
@ 2019-10-29  8:16 ` Keith Busch
  2 siblings, 0 replies; 4+ messages in thread
From: Keith Busch @ 2019-10-29  8:16 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-nvme

Thanks, applied to nvme-5.5.

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-29  8:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-29  7:12 [PATCH] nvmet: stop using bio_set_op_attrs Christoph Hellwig
2019-10-29  7:27 ` Chaitanya Kulkarni
2019-10-29  7:54 ` Johannes Thumshirn
2019-10-29  8:16 ` Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).