public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: Simplify the bio cloning implementation
@ 2018-06-26 22:26 Bart Van Assche
  2018-06-27  1:13 ` Ming Lei
  0 siblings, 1 reply; 6+ messages in thread
From: Bart Van Assche @ 2018-06-26 22:26 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, Christoph Hellwig, Bart Van Assche, Ming Lei

There is no good reason to use different code paths for different
request operations. Hence remove the switch/case statement from
bio_clone_bioset().

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ming Lei <ming.lei@redhat.com>
---
 block/bio.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/block/bio.c b/block/bio.c
index f7e3d88bd0b6..4c27cc9ea55e 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -691,19 +691,8 @@ struct bio *bio_clone_bioset(struct bio *bio_src, gfp_t gfp_mask,
 	bio->bi_iter.bi_sector	= bio_src->bi_iter.bi_sector;
 	bio->bi_iter.bi_size	= bio_src->bi_iter.bi_size;
 
-	switch (bio_op(bio)) {
-	case REQ_OP_DISCARD:
-	case REQ_OP_SECURE_ERASE:
-	case REQ_OP_WRITE_ZEROES:
-		break;
-	case REQ_OP_WRITE_SAME:
-		bio->bi_io_vec[bio->bi_vcnt++] = bio_src->bi_io_vec[0];
-		break;
-	default:
-		bio_for_each_segment(bv, bio_src, iter)
-			bio->bi_io_vec[bio->bi_vcnt++] = bv;
-		break;
-	}
+	bio_for_each_segment(bv, bio_src, iter)
+		bio->bi_io_vec[bio->bi_vcnt++] = bv;
 
 	if (bio_integrity(bio_src)) {
 		int ret;
-- 
2.17.1

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

end of thread, other threads:[~2018-06-28  0:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-26 22:26 [PATCH] block: Simplify the bio cloning implementation Bart Van Assche
2018-06-27  1:13 ` Ming Lei
2018-06-27 17:48   ` Bart Van Assche
2018-06-27 23:20     ` Ming Lei
2018-06-27 23:55       ` Bart Van Assche
2018-06-28  0:08         ` Ming Lei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox