All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] Reduce code duplication
@ 2017-04-18 23:10 Bart Van Assche
  2017-04-18 23:10 ` [PATCH 1/5] block: Export blk_init_request_from_bio() Bart Van Assche
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Bart Van Assche @ 2017-04-18 23:10 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, Bart Van Assche

Hello Jens,

This series contains three patches intended to reduce code duplication
and two patches that simplify / optimize I/O priority handling. Please
consider these patches for kernel v4.12.

Thanks,

Bart.

Bart Van Assche (5):
  block: Export blk_init_request_from_bio()
  null_blk: Use blk_init_request_from_bio() instead of open-coding it
  lightnvm: Use blk_init_request_from_bio() instead of open-coding it
  block: Inline blk_rq_set_prio()
  block: Optimize ioprio_best()

 block/blk-core.c             | 12 +++++++-----
 block/blk-mq.c               |  2 +-
 block/blk.h                  |  1 -
 block/ioprio.c               | 12 +-----------
 drivers/block/null_blk.c     |  9 +--------
 drivers/nvme/host/lightnvm.c |  6 +-----
 include/linux/blkdev.h       | 15 +--------------
 7 files changed, 12 insertions(+), 45 deletions(-)

-- 
2.12.2

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

* [PATCH 1/5] block: Export blk_init_request_from_bio()
  2017-04-18 23:10 [PATCH 0/5] Reduce code duplication Bart Van Assche
@ 2017-04-18 23:10 ` Bart Van Assche
  2017-04-19  6:16   ` Christoph Hellwig
  2017-04-18 23:10 ` [PATCH 2/5] null_blk: Use blk_init_request_from_bio() instead of open-coding it Bart Van Assche
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Bart Van Assche @ 2017-04-18 23:10 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Bart Van Assche, Christoph Hellwig,
	Matias Bjørling, Adam Manzanares

Export this function such that it becomes available to block
drivers.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Matias Bjørling <m@bjorling.me>
Cc: Adam Manzanares <adam.manzanares@wdc.com>
---
 block/blk-core.c       | 5 +++--
 block/blk-mq.c         | 2 +-
 block/blk.h            | 1 -
 include/linux/blkdev.h | 1 +
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index ab1ecf71cb27..c274aed2ca3f 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1633,7 +1633,7 @@ unsigned int blk_plug_queued_count(struct request_queue *q)
 	return ret;
 }
 
-void init_request_from_bio(struct request *req, struct bio *bio)
+void blk_init_request_from_bio(struct request *req, struct bio *bio)
 {
 	if (bio->bi_opf & REQ_RAHEAD)
 		req->cmd_flags |= REQ_FAILFAST_MASK;
@@ -1645,6 +1645,7 @@ void init_request_from_bio(struct request *req, struct bio *bio)
 		req->ioprio = bio_prio(bio);
 	blk_rq_bio_prep(req->q, req, bio);
 }
+EXPORT_SYMBOL(blk_init_request_from_bio);
 
 static blk_qc_t blk_queue_bio(struct request_queue *q, struct bio *bio)
 {
@@ -1735,7 +1736,7 @@ static blk_qc_t blk_queue_bio(struct request_queue *q, struct bio *bio)
 	 * We don't worry about that case for efficiency. It won't happen
 	 * often, and the elevators are able to handle it.
 	 */
-	init_request_from_bio(req, bio);
+	blk_init_request_from_bio(req, bio);
 
 	if (test_bit(QUEUE_FLAG_SAME_COMP, &q->queue_flags))
 		req->cpu = raw_smp_processor_id();
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 4d8368f657ac..a3a2e9c40453 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1410,7 +1410,7 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule)
 
 static void blk_mq_bio_to_request(struct request *rq, struct bio *bio)
 {
-	init_request_from_bio(rq, bio);
+	blk_init_request_from_bio(rq, bio);
 
 	blk_account_io_start(rq, true);
 }
diff --git a/block/blk.h b/block/blk.h
index 07d375183f31..cc8e61cdc229 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -60,7 +60,6 @@ void blk_free_flush_queue(struct blk_flush_queue *q);
 int blk_init_rl(struct request_list *rl, struct request_queue *q,
 		gfp_t gfp_mask);
 void blk_exit_rl(struct request_list *rl);
-void init_request_from_bio(struct request *req, struct bio *bio);
 void blk_rq_bio_prep(struct request_queue *q, struct request *rq,
 			struct bio *bio);
 void blk_queue_bypass_start(struct request_queue *q);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 7cadaa0cc0b9..e1ea875ec048 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -924,6 +924,7 @@ extern int blk_register_queue(struct gendisk *disk);
 extern void blk_unregister_queue(struct gendisk *disk);
 extern blk_qc_t generic_make_request(struct bio *bio);
 extern void blk_rq_init(struct request_queue *q, struct request *rq);
+extern void blk_init_request_from_bio(struct request *req, struct bio *bio);
 extern void blk_put_request(struct request *);
 extern void __blk_put_request(struct request_queue *, struct request *);
 extern struct request *blk_get_request(struct request_queue *, int, gfp_t);
-- 
2.12.2

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

* [PATCH 2/5] null_blk: Use blk_init_request_from_bio() instead of open-coding it
  2017-04-18 23:10 [PATCH 0/5] Reduce code duplication Bart Van Assche
  2017-04-18 23:10 ` [PATCH 1/5] block: Export blk_init_request_from_bio() Bart Van Assche
@ 2017-04-18 23:10 ` Bart Van Assche
  2017-04-19  6:18   ` Christoph Hellwig
  2017-04-18 23:10 ` [PATCH 3/5] lightnvm: " Bart Van Assche
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Bart Van Assche @ 2017-04-18 23:10 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Bart Van Assche, Christoph Hellwig,
	Matias Bjørling, Adam Manzanares

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>
Cc: 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(-)

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;
 
-- 
2.12.2

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

* [PATCH 3/5] lightnvm: Use blk_init_request_from_bio() instead of open-coding it
  2017-04-18 23:10 [PATCH 0/5] Reduce code duplication Bart Van Assche
  2017-04-18 23:10 ` [PATCH 1/5] block: Export blk_init_request_from_bio() Bart Van Assche
  2017-04-18 23:10 ` [PATCH 2/5] null_blk: Use blk_init_request_from_bio() instead of open-coding it Bart Van Assche
@ 2017-04-18 23:10 ` Bart Van Assche
  2017-04-19  6:19   ` Christoph Hellwig
  2017-04-18 23:10 ` [PATCH 4/5] block: Inline blk_rq_set_prio() Bart Van Assche
  2017-04-18 23:10 ` [PATCH 5/5] block: Optimize ioprio_best() Bart Van Assche
  4 siblings, 1 reply; 13+ messages in thread
From: Bart Van Assche @ 2017-04-18 23:10 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Bart Van Assche, Christoph Hellwig,
	Matias Bjørling, Adam Manzanares

This patch changes the behavior of the lightnvm driver 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.
* The bio sector offset is copied into req->__sector instead of
  retaining the value -1 set by blk_mq_alloc_request().
* req->errors is initialized to zero.

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

diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index 4b78090518e1..b76e2e36fef4 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -511,11 +511,7 @@ static int nvme_nvm_submit_io(struct nvm_dev *dev, struct nvm_rq *rqd)
 	rq->cmd_flags &= ~REQ_FAILFAST_DRIVER;
 
 	if (bio) {
-		rq->ioprio = bio_prio(bio);
-		rq->__data_len = bio->bi_iter.bi_size;
-		rq->bio = rq->biotail = bio;
-		if (bio_has_data(bio))
-			rq->nr_phys_segments = bio_phys_segments(q, bio);
+		blk_init_request_from_bio(rq, bio);
 	} else {
 		rq->ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, IOPRIO_NORM);
 		rq->__data_len = 0;
-- 
2.12.2

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

* [PATCH 4/5] block: Inline blk_rq_set_prio()
  2017-04-18 23:10 [PATCH 0/5] Reduce code duplication Bart Van Assche
                   ` (2 preceding siblings ...)
  2017-04-18 23:10 ` [PATCH 3/5] lightnvm: " Bart Van Assche
@ 2017-04-18 23:10 ` Bart Van Assche
  2017-04-19  6:20   ` Christoph Hellwig
  2017-04-18 23:10 ` [PATCH 5/5] block: Optimize ioprio_best() Bart Van Assche
  4 siblings, 1 reply; 13+ messages in thread
From: Bart Van Assche @ 2017-04-18 23:10 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Bart Van Assche, Christoph Hellwig, Matias Bjørling

Since only a single caller remains, inline blk_rq_set_prio(). Initialize
req->ioprio even if no I/O priority has been set in the bio nor in the
I/O context.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Adam Manzanares <adam.manzanares@wdc.com>
Tested-by: Adam Manzanares <adam.manzanares@wdc.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Matias Bjørling <m@bjorling.me>
---
 block/blk-core.c       |  7 ++++---
 include/linux/blkdev.h | 14 --------------
 2 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index c274aed2ca3f..7374b02370fa 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1635,14 +1635,15 @@ unsigned int blk_plug_queued_count(struct request_queue *q)
 
 void blk_init_request_from_bio(struct request *req, struct bio *bio)
 {
+	struct io_context *ioc = rq_ioc(bio);
+
 	if (bio->bi_opf & REQ_RAHEAD)
 		req->cmd_flags |= REQ_FAILFAST_MASK;
 
 	req->errors = 0;
 	req->__sector = bio->bi_iter.bi_sector;
-	blk_rq_set_prio(req, rq_ioc(bio));
-	if (ioprio_valid(bio_prio(bio)))
-		req->ioprio = bio_prio(bio);
+	req->ioprio = ioprio_valid(bio_prio(bio)) ? bio_prio(bio) : ioc ?
+		ioc->ioprio : IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, 0);
 	blk_rq_bio_prep(req->q, req, bio);
 }
 EXPORT_SYMBOL(blk_init_request_from_bio);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index e1ea875ec048..28f713803871 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1088,20 +1088,6 @@ static inline unsigned int blk_rq_count_bios(struct request *rq)
 }
 
 /*
- * blk_rq_set_prio - associate a request with prio from ioc
- * @rq: request of interest
- * @ioc: target iocontext
- *
- * Assocate request prio with ioc prio so request based drivers
- * can leverage priority information.
- */
-static inline void blk_rq_set_prio(struct request *rq, struct io_context *ioc)
-{
-	if (ioc)
-		rq->ioprio = ioc->ioprio;
-}
-
-/*
  * Request issue related functions.
  */
 extern struct request *blk_peek_request(struct request_queue *q);
-- 
2.12.2

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

* [PATCH 5/5] block: Optimize ioprio_best()
  2017-04-18 23:10 [PATCH 0/5] Reduce code duplication Bart Van Assche
                   ` (3 preceding siblings ...)
  2017-04-18 23:10 ` [PATCH 4/5] block: Inline blk_rq_set_prio() Bart Van Assche
@ 2017-04-18 23:10 ` Bart Van Assche
  2017-04-19  6:21   ` Christoph Hellwig
  4 siblings, 1 reply; 13+ messages in thread
From: Bart Van Assche @ 2017-04-18 23:10 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Bart Van Assche, Christoph Hellwig, Matias Bjørling

Since ioprio_best() translates IOPRIO_CLASS_NONE into IOPRIO_CLASS_BE
and since lower numerical priority values represent a higher priority
a simple numerical comparison is sufficient.

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

diff --git a/block/ioprio.c b/block/ioprio.c
index 0c47a00f92a8..4b120c9cf7e8 100644
--- a/block/ioprio.c
+++ b/block/ioprio.c
@@ -163,22 +163,12 @@ static int get_task_ioprio(struct task_struct *p)
 
 int ioprio_best(unsigned short aprio, unsigned short bprio)
 {
-	unsigned short aclass;
-	unsigned short bclass;
-
 	if (!ioprio_valid(aprio))
 		aprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, IOPRIO_NORM);
 	if (!ioprio_valid(bprio))
 		bprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, IOPRIO_NORM);
 
-	aclass = IOPRIO_PRIO_CLASS(aprio);
-	bclass = IOPRIO_PRIO_CLASS(bprio);
-	if (aclass == bclass)
-		return min(aprio, bprio);
-	if (aclass > bclass)
-		return bprio;
-	else
-		return aprio;
+	return min(aprio, bprio);
 }
 
 SYSCALL_DEFINE2(ioprio_get, int, which, int, who)
-- 
2.12.2

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

* Re: [PATCH 1/5] block: Export blk_init_request_from_bio()
  2017-04-18 23:10 ` [PATCH 1/5] block: Export blk_init_request_from_bio() Bart Van Assche
@ 2017-04-19  6:16   ` Christoph Hellwig
  0 siblings, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2017-04-19  6:16 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Jens Axboe, linux-block, Christoph Hellwig, Matias Bjørling,
	Adam Manzanares

> +EXPORT_SYMBOL(blk_init_request_from_bio);

EXPORT_SYMBOL_GPL for block layer internals, please.

Otherwise this looks fine:

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH 2/5] null_blk: Use blk_init_request_from_bio() instead of open-coding it
  2017-04-18 23:10 ` [PATCH 2/5] null_blk: Use blk_init_request_from_bio() instead of open-coding it Bart Van Assche
@ 2017-04-19  6:18   ` Christoph Hellwig
  0 siblings, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2017-04-19  6:18 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Jens Axboe, linux-block, Christoph Hellwig, Matias Bjørling,
	Adam Manzanares

Looks fine,

Reviewed-by: Christoph Hellwig <hch@lst.de>

Although I wonder why the nvme lighnvm support cares about
a NULL-bio the null_blk one does not?

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

* Re: [PATCH 3/5] lightnvm: Use blk_init_request_from_bio() instead of open-coding it
  2017-04-18 23:10 ` [PATCH 3/5] lightnvm: " Bart Van Assche
@ 2017-04-19  6:19   ` Christoph Hellwig
  0 siblings, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2017-04-19  6:19 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Jens Axboe, linux-block, Christoph Hellwig, Matias Bjørling,
	Adam Manzanares

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH 4/5] block: Inline blk_rq_set_prio()
  2017-04-18 23:10 ` [PATCH 4/5] block: Inline blk_rq_set_prio() Bart Van Assche
@ 2017-04-19  6:20   ` Christoph Hellwig
  2017-04-19 14:38     ` Jens Axboe
  0 siblings, 1 reply; 13+ messages in thread
From: Christoph Hellwig @ 2017-04-19  6:20 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Jens Axboe, linux-block, Christoph Hellwig, Matias Bjørling

> +	req->ioprio = ioprio_valid(bio_prio(bio)) ? bio_prio(bio) : ioc ?
> +		ioc->ioprio : IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, 0);

I think this would be a tad cleaner with a traditional if / else if / else
chain, e.g.

	if (ioprio_valid(bio_prio(bio)))
		req->ioprio = bio_prio(bio);
	else if (ioc)
		req->ioprio = ioc->ioprio;
	else
		req->ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, 0);

But otherwise the patch looks good to me:

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH 5/5] block: Optimize ioprio_best()
  2017-04-18 23:10 ` [PATCH 5/5] block: Optimize ioprio_best() Bart Van Assche
@ 2017-04-19  6:21   ` Christoph Hellwig
  0 siblings, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2017-04-19  6:21 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Jens Axboe, linux-block, Christoph Hellwig, Matias Bjørling

On Tue, Apr 18, 2017 at 04:10:37PM -0700, Bart Van Assche wrote:
> Since ioprio_best() translates IOPRIO_CLASS_NONE into IOPRIO_CLASS_BE
> and since lower numerical priority values represent a higher priority
> a simple numerical comparison is sufficient.

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH 4/5] block: Inline blk_rq_set_prio()
  2017-04-19  6:20   ` Christoph Hellwig
@ 2017-04-19 14:38     ` Jens Axboe
  2017-04-19 15:54       ` Bart Van Assche
  0 siblings, 1 reply; 13+ messages in thread
From: Jens Axboe @ 2017-04-19 14:38 UTC (permalink / raw)
  To: Christoph Hellwig, Bart Van Assche; +Cc: linux-block, Matias Bjørling

On 04/19/2017 12:20 AM, Christoph Hellwig wrote:
>> +	req->ioprio = ioprio_valid(bio_prio(bio)) ? bio_prio(bio) : ioc ?
>> +		ioc->ioprio : IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, 0);
> 
> I think this would be a tad cleaner with a traditional if / else if / else
> chain, e.g.
> 
> 	if (ioprio_valid(bio_prio(bio)))
> 		req->ioprio = bio_prio(bio);
> 	else if (ioc)
> 		req->ioprio = ioc->ioprio;
> 	else
> 		req->ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, 0);

Agree, I hate ternaries with a vengeance, and a doubly nested one is
almost a shooting offense.

Bart, care to respin with this fixed and the GPL export modification?

-- 
Jens Axboe

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

* Re: [PATCH 4/5] block: Inline blk_rq_set_prio()
  2017-04-19 14:38     ` Jens Axboe
@ 2017-04-19 15:54       ` Bart Van Assche
  0 siblings, 0 replies; 13+ messages in thread
From: Bart Van Assche @ 2017-04-19 15:54 UTC (permalink / raw)
  To: hch, axboe; +Cc: m, linux-block

On Wed, 2017-04-19 at 08:38 -0600, Jens Axboe wrote:
> On 04/19/2017 12:20 AM, Christoph Hellwig wrote:
> > > +	req->ioprio =3D ioprio_valid(bio_prio(bio)) ? bio_prio(bio) : ioc ?
> > > +		ioc->ioprio : IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, 0);
> >=20
> > I think this would be a tad cleaner with a traditional if / else if / e=
lse
> > chain, e.g.
> >=20
> > 	if (ioprio_valid(bio_prio(bio)))
> > 		req->ioprio =3D bio_prio(bio);
> > 	else if (ioc)
> > 		req->ioprio =3D ioc->ioprio;
> > 	else
> > 		req->ioprio =3D IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, 0);
>=20
> Agree, I hate ternaries with a vengeance, and a doubly nested one is
> almost a shooting offense.
>=20
> Bart, care to respin with this fixed and the GPL export modification?

Hello Christoph and Jens,

Thanks for the review and the feedback. I will make the proposed changes
and repost this patch series.

Bart.=

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

end of thread, other threads:[~2017-04-19 15:54 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-18 23:10 [PATCH 0/5] Reduce code duplication Bart Van Assche
2017-04-18 23:10 ` [PATCH 1/5] block: Export blk_init_request_from_bio() Bart Van Assche
2017-04-19  6:16   ` Christoph Hellwig
2017-04-18 23:10 ` [PATCH 2/5] null_blk: Use blk_init_request_from_bio() instead of open-coding it Bart Van Assche
2017-04-19  6:18   ` Christoph Hellwig
2017-04-18 23:10 ` [PATCH 3/5] lightnvm: " Bart Van Assche
2017-04-19  6:19   ` Christoph Hellwig
2017-04-18 23:10 ` [PATCH 4/5] block: Inline blk_rq_set_prio() Bart Van Assche
2017-04-19  6:20   ` Christoph Hellwig
2017-04-19 14:38     ` Jens Axboe
2017-04-19 15:54       ` Bart Van Assche
2017-04-18 23:10 ` [PATCH 5/5] block: Optimize ioprio_best() Bart Van Assche
2017-04-19  6:21   ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.