All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: remove bio_set_op_attrs
@ 2022-12-06 14:40 ` Christoph Hellwig
  0 siblings, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2022-12-06 14:40 UTC (permalink / raw)
  To: axboe, snitzer
  Cc: colyli, song, linux-block, linux-raid, linux-bcache, dm-devel

This macro is obsolete, so replace the last few uses with open coded
bi_opf assignments.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/md/bcache/movinggc.c  |  2 +-
 drivers/md/bcache/request.c   |  2 +-
 drivers/md/bcache/writeback.c |  4 ++--
 drivers/md/dm-thin.c          |  2 +-
 drivers/md/raid1.c            | 12 ++++++------
 drivers/md/raid10.c           | 18 +++++++++---------
 include/linux/blk_types.h     |  7 -------
 7 files changed, 20 insertions(+), 27 deletions(-)

diff --git a/drivers/md/bcache/movinggc.c b/drivers/md/bcache/movinggc.c
index 99499d1f6e6666..9f32901fdad102 100644
--- a/drivers/md/bcache/movinggc.c
+++ b/drivers/md/bcache/movinggc.c
@@ -160,7 +160,7 @@ static void read_moving(struct cache_set *c)
 		moving_init(io);
 		bio = &io->bio.bio;
 
-		bio_set_op_attrs(bio, REQ_OP_READ, 0);
+		bio->bi_opf = REQ_OP_READ;
 		bio->bi_end_io	= read_moving_endio;
 
 		if (bch_bio_alloc_pages(bio, GFP_KERNEL))
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index 3427555b0ccae4..39c7b607f8aad8 100644
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -244,7 +244,7 @@ static void bch_data_insert_start(struct closure *cl)
 		trace_bcache_cache_insert(k);
 		bch_keylist_push(&op->insert_keys);
 
-		bio_set_op_attrs(n, REQ_OP_WRITE, 0);
+		n->bi_opf = REQ_OP_WRITE;
 		bch_submit_bbio(n, op->c, k, 0);
 	} while (n != bio);
 
diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c
index 0285b676e9834a..d4a5fc0650bb29 100644
--- a/drivers/md/bcache/writeback.c
+++ b/drivers/md/bcache/writeback.c
@@ -434,7 +434,7 @@ static void write_dirty(struct closure *cl)
 	 */
 	if (KEY_DIRTY(&w->key)) {
 		dirty_init(w);
-		bio_set_op_attrs(&io->bio, REQ_OP_WRITE, 0);
+		io->bio.bi_opf = REQ_OP_WRITE;
 		io->bio.bi_iter.bi_sector = KEY_START(&w->key);
 		bio_set_dev(&io->bio, io->dc->bdev);
 		io->bio.bi_end_io	= dirty_endio;
@@ -547,7 +547,7 @@ static void read_dirty(struct cached_dev *dc)
 			io->sequence    = sequence++;
 
 			dirty_init(w);
-			bio_set_op_attrs(&io->bio, REQ_OP_READ, 0);
+			io->bio.bi_opf = REQ_OP_READ;
 			io->bio.bi_iter.bi_sector = PTR_OFFSET(&w->key, 0);
 			bio_set_dev(&io->bio, dc->disk.c->cache->bdev);
 			io->bio.bi_end_io	= read_dirty_endio;
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index e76c96c760a9b5..c2b5a537f5b8ad 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -410,7 +410,7 @@ static void end_discard(struct discard_op *op, int r)
 		 * need to wait for the chain to complete.
 		 */
 		bio_chain(op->bio, op->parent_bio);
-		bio_set_op_attrs(op->bio, REQ_OP_DISCARD, 0);
+		op->bio->bi_opf = REQ_OP_DISCARD;
 		submit_bio(op->bio);
 	}
 
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 58f705f4294801..68a9e2d9985b2f 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1321,7 +1321,7 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio,
 	read_bio->bi_iter.bi_sector = r1_bio->sector +
 		mirror->rdev->data_offset;
 	read_bio->bi_end_io = raid1_end_read_request;
-	bio_set_op_attrs(read_bio, op, do_sync);
+	read_bio->bi_opf = op | do_sync;
 	if (test_bit(FailFast, &mirror->rdev->flags) &&
 	    test_bit(R1BIO_FailFast, &r1_bio->state))
 	        read_bio->bi_opf |= MD_FAILFAST;
@@ -2254,7 +2254,7 @@ static void sync_request_write(struct mddev *mddev, struct r1bio *r1_bio)
 			continue;
 		}
 
-		bio_set_op_attrs(wbio, REQ_OP_WRITE, 0);
+		wbio->bi_opf = REQ_OP_WRITE;
 		if (test_bit(FailFast, &conf->mirrors[i].rdev->flags))
 			wbio->bi_opf |= MD_FAILFAST;
 
@@ -2419,7 +2419,7 @@ static int narrow_write_error(struct r1bio *r1_bio, int i)
 					       GFP_NOIO, &mddev->bio_set);
 		}
 
-		bio_set_op_attrs(wbio, REQ_OP_WRITE, 0);
+		wbio->bi_opf = REQ_OP_WRITE;
 		wbio->bi_iter.bi_sector = r1_bio->sector;
 		wbio->bi_iter.bi_size = r1_bio->sectors << 9;
 
@@ -2770,7 +2770,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr,
 			if (i < conf->raid_disks)
 				still_degraded = 1;
 		} else if (!test_bit(In_sync, &rdev->flags)) {
-			bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
+			bio->bi_opf = REQ_OP_WRITE;
 			bio->bi_end_io = end_sync_write;
 			write_targets ++;
 		} else {
@@ -2797,7 +2797,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr,
 					if (disk < 0)
 						disk = i;
 				}
-				bio_set_op_attrs(bio, REQ_OP_READ, 0);
+				bio->bi_opf = REQ_OP_READ;
 				bio->bi_end_io = end_sync_read;
 				read_targets++;
 			} else if (!test_bit(WriteErrorSeen, &rdev->flags) &&
@@ -2809,7 +2809,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr,
 				 * if we are doing resync or repair. Otherwise, leave
 				 * this device alone for this sync request.
 				 */
-				bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
+				bio->bi_opf = REQ_OP_WRITE;
 				bio->bi_end_io = end_sync_write;
 				write_targets++;
 			}
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 9a6503f5cb982e..6c66357f92f559 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1254,7 +1254,7 @@ static void raid10_read_request(struct mddev *mddev, struct bio *bio,
 	read_bio->bi_iter.bi_sector = r10_bio->devs[slot].addr +
 		choose_data_offset(r10_bio, rdev);
 	read_bio->bi_end_io = raid10_end_read_request;
-	bio_set_op_attrs(read_bio, op, do_sync);
+	read_bio->bi_opf = op | do_sync;
 	if (test_bit(FailFast, &rdev->flags) &&
 	    test_bit(R10BIO_FailFast, &r10_bio->state))
 	        read_bio->bi_opf |= MD_FAILFAST;
@@ -1301,7 +1301,7 @@ static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_bio,
 	mbio->bi_iter.bi_sector	= (r10_bio->devs[n_copy].addr +
 				   choose_data_offset(r10_bio, rdev));
 	mbio->bi_end_io	= raid10_end_write_request;
-	bio_set_op_attrs(mbio, op, do_sync | do_fua);
+	mbio->bi_opf = op | do_sync | do_fua;
 	if (!replacement && test_bit(FailFast,
 				     &conf->mirrors[devnum].rdev->flags)
 			 && enough(conf, devnum))
@@ -2933,7 +2933,7 @@ static int narrow_write_error(struct r10bio *r10_bio, int i)
 		wsector = r10_bio->devs[i].addr + (sector - r10_bio->sector);
 		wbio->bi_iter.bi_sector = wsector +
 				   choose_data_offset(r10_bio, rdev);
-		bio_set_op_attrs(wbio, REQ_OP_WRITE, 0);
+		wbio->bi_opf = REQ_OP_WRITE;
 
 		if (submit_bio_wait(wbio) < 0)
 			/* Failure! */
@@ -3542,7 +3542,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
 				bio->bi_next = biolist;
 				biolist = bio;
 				bio->bi_end_io = end_sync_read;
-				bio_set_op_attrs(bio, REQ_OP_READ, 0);
+				bio->bi_opf = REQ_OP_READ;
 				if (test_bit(FailFast, &rdev->flags))
 					bio->bi_opf |= MD_FAILFAST;
 				from_addr = r10_bio->devs[j].addr;
@@ -3567,7 +3567,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
 					bio->bi_next = biolist;
 					biolist = bio;
 					bio->bi_end_io = end_sync_write;
-					bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
+					bio->bi_opf = REQ_OP_WRITE;
 					bio->bi_iter.bi_sector = to_addr
 						+ mrdev->data_offset;
 					bio_set_dev(bio, mrdev->bdev);
@@ -3588,7 +3588,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
 				bio->bi_next = biolist;
 				biolist = bio;
 				bio->bi_end_io = end_sync_write;
-				bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
+				bio->bi_opf = REQ_OP_WRITE;
 				bio->bi_iter.bi_sector = to_addr +
 					mreplace->data_offset;
 				bio_set_dev(bio, mreplace->bdev);
@@ -3742,7 +3742,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
 			bio->bi_next = biolist;
 			biolist = bio;
 			bio->bi_end_io = end_sync_read;
-			bio_set_op_attrs(bio, REQ_OP_READ, 0);
+			bio->bi_opf = REQ_OP_READ;
 			if (test_bit(FailFast, &rdev->flags))
 				bio->bi_opf |= MD_FAILFAST;
 			bio->bi_iter.bi_sector = sector + rdev->data_offset;
@@ -3764,7 +3764,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
 			bio->bi_next = biolist;
 			biolist = bio;
 			bio->bi_end_io = end_sync_write;
-			bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
+			bio->bi_opf = REQ_OP_WRITE;
 			if (test_bit(FailFast, &rdev->flags))
 				bio->bi_opf |= MD_FAILFAST;
 			bio->bi_iter.bi_sector = sector + rdev->data_offset;
@@ -4970,7 +4970,7 @@ static sector_t reshape_request(struct mddev *mddev, sector_t sector_nr,
 		b->bi_iter.bi_sector = r10_bio->devs[s/2].addr +
 			rdev2->new_data_offset;
 		b->bi_end_io = end_reshape_write;
-		bio_set_op_attrs(b, REQ_OP_WRITE, 0);
+		b->bi_opf = REQ_OP_WRITE;
 		b->bi_next = blist;
 		blist = b;
 	}
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index e0b098089ef2b7..99be590f952f6e 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -472,13 +472,6 @@ static inline enum req_op bio_op(const struct bio *bio)
 	return bio->bi_opf & REQ_OP_MASK;
 }
 
-/* obsolete, don't use in new code */
-static inline void bio_set_op_attrs(struct bio *bio, enum req_op op,
-				    blk_opf_t op_flags)
-{
-	bio->bi_opf = op | op_flags;
-}
-
 static inline bool op_is_write(blk_opf_t op)
 {
 	return !!(op & (__force blk_opf_t)1);
-- 
2.35.1


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

* [dm-devel] [PATCH] block: remove bio_set_op_attrs
@ 2022-12-06 14:40 ` Christoph Hellwig
  0 siblings, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2022-12-06 14:40 UTC (permalink / raw)
  To: axboe, snitzer
  Cc: linux-raid, dm-devel, colyli, linux-block, song, linux-bcache

This macro is obsolete, so replace the last few uses with open coded
bi_opf assignments.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/md/bcache/movinggc.c  |  2 +-
 drivers/md/bcache/request.c   |  2 +-
 drivers/md/bcache/writeback.c |  4 ++--
 drivers/md/dm-thin.c          |  2 +-
 drivers/md/raid1.c            | 12 ++++++------
 drivers/md/raid10.c           | 18 +++++++++---------
 include/linux/blk_types.h     |  7 -------
 7 files changed, 20 insertions(+), 27 deletions(-)

diff --git a/drivers/md/bcache/movinggc.c b/drivers/md/bcache/movinggc.c
index 99499d1f6e6666..9f32901fdad102 100644
--- a/drivers/md/bcache/movinggc.c
+++ b/drivers/md/bcache/movinggc.c
@@ -160,7 +160,7 @@ static void read_moving(struct cache_set *c)
 		moving_init(io);
 		bio = &io->bio.bio;
 
-		bio_set_op_attrs(bio, REQ_OP_READ, 0);
+		bio->bi_opf = REQ_OP_READ;
 		bio->bi_end_io	= read_moving_endio;
 
 		if (bch_bio_alloc_pages(bio, GFP_KERNEL))
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index 3427555b0ccae4..39c7b607f8aad8 100644
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -244,7 +244,7 @@ static void bch_data_insert_start(struct closure *cl)
 		trace_bcache_cache_insert(k);
 		bch_keylist_push(&op->insert_keys);
 
-		bio_set_op_attrs(n, REQ_OP_WRITE, 0);
+		n->bi_opf = REQ_OP_WRITE;
 		bch_submit_bbio(n, op->c, k, 0);
 	} while (n != bio);
 
diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c
index 0285b676e9834a..d4a5fc0650bb29 100644
--- a/drivers/md/bcache/writeback.c
+++ b/drivers/md/bcache/writeback.c
@@ -434,7 +434,7 @@ static void write_dirty(struct closure *cl)
 	 */
 	if (KEY_DIRTY(&w->key)) {
 		dirty_init(w);
-		bio_set_op_attrs(&io->bio, REQ_OP_WRITE, 0);
+		io->bio.bi_opf = REQ_OP_WRITE;
 		io->bio.bi_iter.bi_sector = KEY_START(&w->key);
 		bio_set_dev(&io->bio, io->dc->bdev);
 		io->bio.bi_end_io	= dirty_endio;
@@ -547,7 +547,7 @@ static void read_dirty(struct cached_dev *dc)
 			io->sequence    = sequence++;
 
 			dirty_init(w);
-			bio_set_op_attrs(&io->bio, REQ_OP_READ, 0);
+			io->bio.bi_opf = REQ_OP_READ;
 			io->bio.bi_iter.bi_sector = PTR_OFFSET(&w->key, 0);
 			bio_set_dev(&io->bio, dc->disk.c->cache->bdev);
 			io->bio.bi_end_io	= read_dirty_endio;
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index e76c96c760a9b5..c2b5a537f5b8ad 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -410,7 +410,7 @@ static void end_discard(struct discard_op *op, int r)
 		 * need to wait for the chain to complete.
 		 */
 		bio_chain(op->bio, op->parent_bio);
-		bio_set_op_attrs(op->bio, REQ_OP_DISCARD, 0);
+		op->bio->bi_opf = REQ_OP_DISCARD;
 		submit_bio(op->bio);
 	}
 
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 58f705f4294801..68a9e2d9985b2f 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1321,7 +1321,7 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio,
 	read_bio->bi_iter.bi_sector = r1_bio->sector +
 		mirror->rdev->data_offset;
 	read_bio->bi_end_io = raid1_end_read_request;
-	bio_set_op_attrs(read_bio, op, do_sync);
+	read_bio->bi_opf = op | do_sync;
 	if (test_bit(FailFast, &mirror->rdev->flags) &&
 	    test_bit(R1BIO_FailFast, &r1_bio->state))
 	        read_bio->bi_opf |= MD_FAILFAST;
@@ -2254,7 +2254,7 @@ static void sync_request_write(struct mddev *mddev, struct r1bio *r1_bio)
 			continue;
 		}
 
-		bio_set_op_attrs(wbio, REQ_OP_WRITE, 0);
+		wbio->bi_opf = REQ_OP_WRITE;
 		if (test_bit(FailFast, &conf->mirrors[i].rdev->flags))
 			wbio->bi_opf |= MD_FAILFAST;
 
@@ -2419,7 +2419,7 @@ static int narrow_write_error(struct r1bio *r1_bio, int i)
 					       GFP_NOIO, &mddev->bio_set);
 		}
 
-		bio_set_op_attrs(wbio, REQ_OP_WRITE, 0);
+		wbio->bi_opf = REQ_OP_WRITE;
 		wbio->bi_iter.bi_sector = r1_bio->sector;
 		wbio->bi_iter.bi_size = r1_bio->sectors << 9;
 
@@ -2770,7 +2770,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr,
 			if (i < conf->raid_disks)
 				still_degraded = 1;
 		} else if (!test_bit(In_sync, &rdev->flags)) {
-			bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
+			bio->bi_opf = REQ_OP_WRITE;
 			bio->bi_end_io = end_sync_write;
 			write_targets ++;
 		} else {
@@ -2797,7 +2797,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr,
 					if (disk < 0)
 						disk = i;
 				}
-				bio_set_op_attrs(bio, REQ_OP_READ, 0);
+				bio->bi_opf = REQ_OP_READ;
 				bio->bi_end_io = end_sync_read;
 				read_targets++;
 			} else if (!test_bit(WriteErrorSeen, &rdev->flags) &&
@@ -2809,7 +2809,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr,
 				 * if we are doing resync or repair. Otherwise, leave
 				 * this device alone for this sync request.
 				 */
-				bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
+				bio->bi_opf = REQ_OP_WRITE;
 				bio->bi_end_io = end_sync_write;
 				write_targets++;
 			}
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 9a6503f5cb982e..6c66357f92f559 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1254,7 +1254,7 @@ static void raid10_read_request(struct mddev *mddev, struct bio *bio,
 	read_bio->bi_iter.bi_sector = r10_bio->devs[slot].addr +
 		choose_data_offset(r10_bio, rdev);
 	read_bio->bi_end_io = raid10_end_read_request;
-	bio_set_op_attrs(read_bio, op, do_sync);
+	read_bio->bi_opf = op | do_sync;
 	if (test_bit(FailFast, &rdev->flags) &&
 	    test_bit(R10BIO_FailFast, &r10_bio->state))
 	        read_bio->bi_opf |= MD_FAILFAST;
@@ -1301,7 +1301,7 @@ static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_bio,
 	mbio->bi_iter.bi_sector	= (r10_bio->devs[n_copy].addr +
 				   choose_data_offset(r10_bio, rdev));
 	mbio->bi_end_io	= raid10_end_write_request;
-	bio_set_op_attrs(mbio, op, do_sync | do_fua);
+	mbio->bi_opf = op | do_sync | do_fua;
 	if (!replacement && test_bit(FailFast,
 				     &conf->mirrors[devnum].rdev->flags)
 			 && enough(conf, devnum))
@@ -2933,7 +2933,7 @@ static int narrow_write_error(struct r10bio *r10_bio, int i)
 		wsector = r10_bio->devs[i].addr + (sector - r10_bio->sector);
 		wbio->bi_iter.bi_sector = wsector +
 				   choose_data_offset(r10_bio, rdev);
-		bio_set_op_attrs(wbio, REQ_OP_WRITE, 0);
+		wbio->bi_opf = REQ_OP_WRITE;
 
 		if (submit_bio_wait(wbio) < 0)
 			/* Failure! */
@@ -3542,7 +3542,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
 				bio->bi_next = biolist;
 				biolist = bio;
 				bio->bi_end_io = end_sync_read;
-				bio_set_op_attrs(bio, REQ_OP_READ, 0);
+				bio->bi_opf = REQ_OP_READ;
 				if (test_bit(FailFast, &rdev->flags))
 					bio->bi_opf |= MD_FAILFAST;
 				from_addr = r10_bio->devs[j].addr;
@@ -3567,7 +3567,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
 					bio->bi_next = biolist;
 					biolist = bio;
 					bio->bi_end_io = end_sync_write;
-					bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
+					bio->bi_opf = REQ_OP_WRITE;
 					bio->bi_iter.bi_sector = to_addr
 						+ mrdev->data_offset;
 					bio_set_dev(bio, mrdev->bdev);
@@ -3588,7 +3588,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
 				bio->bi_next = biolist;
 				biolist = bio;
 				bio->bi_end_io = end_sync_write;
-				bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
+				bio->bi_opf = REQ_OP_WRITE;
 				bio->bi_iter.bi_sector = to_addr +
 					mreplace->data_offset;
 				bio_set_dev(bio, mreplace->bdev);
@@ -3742,7 +3742,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
 			bio->bi_next = biolist;
 			biolist = bio;
 			bio->bi_end_io = end_sync_read;
-			bio_set_op_attrs(bio, REQ_OP_READ, 0);
+			bio->bi_opf = REQ_OP_READ;
 			if (test_bit(FailFast, &rdev->flags))
 				bio->bi_opf |= MD_FAILFAST;
 			bio->bi_iter.bi_sector = sector + rdev->data_offset;
@@ -3764,7 +3764,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
 			bio->bi_next = biolist;
 			biolist = bio;
 			bio->bi_end_io = end_sync_write;
-			bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
+			bio->bi_opf = REQ_OP_WRITE;
 			if (test_bit(FailFast, &rdev->flags))
 				bio->bi_opf |= MD_FAILFAST;
 			bio->bi_iter.bi_sector = sector + rdev->data_offset;
@@ -4970,7 +4970,7 @@ static sector_t reshape_request(struct mddev *mddev, sector_t sector_nr,
 		b->bi_iter.bi_sector = r10_bio->devs[s/2].addr +
 			rdev2->new_data_offset;
 		b->bi_end_io = end_reshape_write;
-		bio_set_op_attrs(b, REQ_OP_WRITE, 0);
+		b->bi_opf = REQ_OP_WRITE;
 		b->bi_next = blist;
 		blist = b;
 	}
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index e0b098089ef2b7..99be590f952f6e 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -472,13 +472,6 @@ static inline enum req_op bio_op(const struct bio *bio)
 	return bio->bi_opf & REQ_OP_MASK;
 }
 
-/* obsolete, don't use in new code */
-static inline void bio_set_op_attrs(struct bio *bio, enum req_op op,
-				    blk_opf_t op_flags)
-{
-	bio->bi_opf = op | op_flags;
-}
-
 static inline bool op_is_write(blk_opf_t op)
 {
 	return !!(op & (__force blk_opf_t)1);
-- 
2.35.1

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


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

* Re: [PATCH] block: remove bio_set_op_attrs
  2022-12-06 14:40 ` [dm-devel] " Christoph Hellwig
@ 2022-12-06 14:46   ` Coly Li
  -1 siblings, 0 replies; 14+ messages in thread
From: Coly Li @ 2022-12-06 14:46 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, snitzer, Song Liu, linux-block, linux-raid,
	linux-bcache, dm-devel



> 2022年12月6日 22:40,Christoph Hellwig <hch@lst.de> 写道:
> 
> This macro is obsolete, so replace the last few uses with open coded
> bi_opf assignments.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Acked-by: Coly Li <colyli@suse.de <mailto:colyli@suse.de>>


BTW, may I ask why bio_set_op_attrs() is removed. Quite long time ago it was added to avoid open code, and now we remove it to use open coded assignments. What is the motivation for now?

Thanks.

Coly Li


> ---
> drivers/md/bcache/movinggc.c  |  2 +-
> drivers/md/bcache/request.c   |  2 +-
> drivers/md/bcache/writeback.c |  4 ++--
> drivers/md/dm-thin.c          |  2 +-
> drivers/md/raid1.c            | 12 ++++++------
> drivers/md/raid10.c           | 18 +++++++++---------
> include/linux/blk_types.h     |  7 -------
> 7 files changed, 20 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/md/bcache/movinggc.c b/drivers/md/bcache/movinggc.c
> index 99499d1f6e6666..9f32901fdad102 100644
> --- a/drivers/md/bcache/movinggc.c
> +++ b/drivers/md/bcache/movinggc.c
> @@ -160,7 +160,7 @@ static void read_moving(struct cache_set *c)
> moving_init(io);
> bio = &io->bio.bio;
> 
> - bio_set_op_attrs(bio, REQ_OP_READ, 0);
> + bio->bi_opf = REQ_OP_READ;
> bio->bi_end_io = read_moving_endio;
> 
> if (bch_bio_alloc_pages(bio, GFP_KERNEL))
> diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
> index 3427555b0ccae4..39c7b607f8aad8 100644
> --- a/drivers/md/bcache/request.c
> +++ b/drivers/md/bcache/request.c
> @@ -244,7 +244,7 @@ static void bch_data_insert_start(struct closure *cl)
> trace_bcache_cache_insert(k);
> bch_keylist_push(&op->insert_keys);
> 
> - bio_set_op_attrs(n, REQ_OP_WRITE, 0);
> + n->bi_opf = REQ_OP_WRITE;
> bch_submit_bbio(n, op->c, k, 0);
> } while (n != bio);
> 
> diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c
> index 0285b676e9834a..d4a5fc0650bb29 100644
> --- a/drivers/md/bcache/writeback.c
> +++ b/drivers/md/bcache/writeback.c
> @@ -434,7 +434,7 @@ static void write_dirty(struct closure *cl)
> */
> if (KEY_DIRTY(&w->key)) {
> dirty_init(w);
> - bio_set_op_attrs(&io->bio, REQ_OP_WRITE, 0);
> + io->bio.bi_opf = REQ_OP_WRITE;
> io->bio.bi_iter.bi_sector = KEY_START(&w->key);
> bio_set_dev(&io->bio, io->dc->bdev);
> io->bio.bi_end_io = dirty_endio;
> @@ -547,7 +547,7 @@ static void read_dirty(struct cached_dev *dc)
> io->sequence    = sequence++;
> 
> dirty_init(w);
> - bio_set_op_attrs(&io->bio, REQ_OP_READ, 0);
> + io->bio.bi_opf = REQ_OP_READ;
> io->bio.bi_iter.bi_sector = PTR_OFFSET(&w->key, 0);
> bio_set_dev(&io->bio, dc->disk.c->cache->bdev);
> io->bio.bi_end_io = read_dirty_endio;
> diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
> index e76c96c760a9b5..c2b5a537f5b8ad 100644
> --- a/drivers/md/dm-thin.c
> +++ b/drivers/md/dm-thin.c
> @@ -410,7 +410,7 @@ static void end_discard(struct discard_op *op, int r)
> * need to wait for the chain to complete.
> */
> bio_chain(op->bio, op->parent_bio);
> - bio_set_op_attrs(op->bio, REQ_OP_DISCARD, 0);
> + op->bio->bi_opf = REQ_OP_DISCARD;
> submit_bio(op->bio);
> }
> 
> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
> index 58f705f4294801..68a9e2d9985b2f 100644
> --- a/drivers/md/raid1.c
> +++ b/drivers/md/raid1.c
> @@ -1321,7 +1321,7 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio,
> read_bio->bi_iter.bi_sector = r1_bio->sector +
> mirror->rdev->data_offset;
> read_bio->bi_end_io = raid1_end_read_request;
> - bio_set_op_attrs(read_bio, op, do_sync);
> + read_bio->bi_opf = op | do_sync;
> if (test_bit(FailFast, &mirror->rdev->flags) &&
>    test_bit(R1BIO_FailFast, &r1_bio->state))
>        read_bio->bi_opf |= MD_FAILFAST;
> @@ -2254,7 +2254,7 @@ static void sync_request_write(struct mddev *mddev, struct r1bio *r1_bio)
> continue;
> }
> 
> - bio_set_op_attrs(wbio, REQ_OP_WRITE, 0);
> + wbio->bi_opf = REQ_OP_WRITE;
> if (test_bit(FailFast, &conf->mirrors[i].rdev->flags))
> wbio->bi_opf |= MD_FAILFAST;
> 
> @@ -2419,7 +2419,7 @@ static int narrow_write_error(struct r1bio *r1_bio, int i)
>       GFP_NOIO, &mddev->bio_set);
> }
> 
> - bio_set_op_attrs(wbio, REQ_OP_WRITE, 0);
> + wbio->bi_opf = REQ_OP_WRITE;
> wbio->bi_iter.bi_sector = r1_bio->sector;
> wbio->bi_iter.bi_size = r1_bio->sectors << 9;
> 
> @@ -2770,7 +2770,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr,
> if (i < conf->raid_disks)
> still_degraded = 1;
> } else if (!test_bit(In_sync, &rdev->flags)) {
> - bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
> + bio->bi_opf = REQ_OP_WRITE;
> bio->bi_end_io = end_sync_write;
> write_targets ++;
> } else {
> @@ -2797,7 +2797,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr,
> if (disk < 0)
> disk = i;
> }
> - bio_set_op_attrs(bio, REQ_OP_READ, 0);
> + bio->bi_opf = REQ_OP_READ;
> bio->bi_end_io = end_sync_read;
> read_targets++;
> } else if (!test_bit(WriteErrorSeen, &rdev->flags) &&
> @@ -2809,7 +2809,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr,
> * if we are doing resync or repair. Otherwise, leave
> * this device alone for this sync request.
> */
> - bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
> + bio->bi_opf = REQ_OP_WRITE;
> bio->bi_end_io = end_sync_write;
> write_targets++;
> }
> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
> index 9a6503f5cb982e..6c66357f92f559 100644
> --- a/drivers/md/raid10.c
> +++ b/drivers/md/raid10.c
> @@ -1254,7 +1254,7 @@ static void raid10_read_request(struct mddev *mddev, struct bio *bio,
> read_bio->bi_iter.bi_sector = r10_bio->devs[slot].addr +
> choose_data_offset(r10_bio, rdev);
> read_bio->bi_end_io = raid10_end_read_request;
> - bio_set_op_attrs(read_bio, op, do_sync);
> + read_bio->bi_opf = op | do_sync;
> if (test_bit(FailFast, &rdev->flags) &&
>    test_bit(R10BIO_FailFast, &r10_bio->state))
>        read_bio->bi_opf |= MD_FAILFAST;
> @@ -1301,7 +1301,7 @@ static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_bio,
> mbio->bi_iter.bi_sector = (r10_bio->devs[n_copy].addr +
>   choose_data_offset(r10_bio, rdev));
> mbio->bi_end_io = raid10_end_write_request;
> - bio_set_op_attrs(mbio, op, do_sync | do_fua);
> + mbio->bi_opf = op | do_sync | do_fua;
> if (!replacement && test_bit(FailFast,
>     &conf->mirrors[devnum].rdev->flags)
> && enough(conf, devnum))
> @@ -2933,7 +2933,7 @@ static int narrow_write_error(struct r10bio *r10_bio, int i)
> wsector = r10_bio->devs[i].addr + (sector - r10_bio->sector);
> wbio->bi_iter.bi_sector = wsector +
>   choose_data_offset(r10_bio, rdev);
> - bio_set_op_attrs(wbio, REQ_OP_WRITE, 0);
> + wbio->bi_opf = REQ_OP_WRITE;
> 
> if (submit_bio_wait(wbio) < 0)
> /* Failure! */
> @@ -3542,7 +3542,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
> bio->bi_next = biolist;
> biolist = bio;
> bio->bi_end_io = end_sync_read;
> - bio_set_op_attrs(bio, REQ_OP_READ, 0);
> + bio->bi_opf = REQ_OP_READ;
> if (test_bit(FailFast, &rdev->flags))
> bio->bi_opf |= MD_FAILFAST;
> from_addr = r10_bio->devs[j].addr;
> @@ -3567,7 +3567,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
> bio->bi_next = biolist;
> biolist = bio;
> bio->bi_end_io = end_sync_write;
> - bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
> + bio->bi_opf = REQ_OP_WRITE;
> bio->bi_iter.bi_sector = to_addr
> + mrdev->data_offset;
> bio_set_dev(bio, mrdev->bdev);
> @@ -3588,7 +3588,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
> bio->bi_next = biolist;
> biolist = bio;
> bio->bi_end_io = end_sync_write;
> - bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
> + bio->bi_opf = REQ_OP_WRITE;
> bio->bi_iter.bi_sector = to_addr +
> mreplace->data_offset;
> bio_set_dev(bio, mreplace->bdev);
> @@ -3742,7 +3742,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
> bio->bi_next = biolist;
> biolist = bio;
> bio->bi_end_io = end_sync_read;
> - bio_set_op_attrs(bio, REQ_OP_READ, 0);
> + bio->bi_opf = REQ_OP_READ;
> if (test_bit(FailFast, &rdev->flags))
> bio->bi_opf |= MD_FAILFAST;
> bio->bi_iter.bi_sector = sector + rdev->data_offset;
> @@ -3764,7 +3764,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
> bio->bi_next = biolist;
> biolist = bio;
> bio->bi_end_io = end_sync_write;
> - bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
> + bio->bi_opf = REQ_OP_WRITE;
> if (test_bit(FailFast, &rdev->flags))
> bio->bi_opf |= MD_FAILFAST;
> bio->bi_iter.bi_sector = sector + rdev->data_offset;
> @@ -4970,7 +4970,7 @@ static sector_t reshape_request(struct mddev *mddev, sector_t sector_nr,
> b->bi_iter.bi_sector = r10_bio->devs[s/2].addr +
> rdev2->new_data_offset;
> b->bi_end_io = end_reshape_write;
> - bio_set_op_attrs(b, REQ_OP_WRITE, 0);
> + b->bi_opf = REQ_OP_WRITE;
> b->bi_next = blist;
> blist = b;
> }
> diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
> index e0b098089ef2b7..99be590f952f6e 100644
> --- a/include/linux/blk_types.h
> +++ b/include/linux/blk_types.h
> @@ -472,13 +472,6 @@ static inline enum req_op bio_op(const struct bio *bio)
> return bio->bi_opf & REQ_OP_MASK;
> }
> 
> -/* obsolete, don't use in new code */
> -static inline void bio_set_op_attrs(struct bio *bio, enum req_op op,
> -    blk_opf_t op_flags)
> -{
> - bio->bi_opf = op | op_flags;
> -}
> -
> static inline bool op_is_write(blk_opf_t op)
> {
> return !!(op & (__force blk_opf_t)1);
> -- 
> 2.35.1
> 


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

* Re: [dm-devel] [PATCH] block: remove bio_set_op_attrs
@ 2022-12-06 14:46   ` Coly Li
  0 siblings, 0 replies; 14+ messages in thread
From: Coly Li @ 2022-12-06 14:46 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, linux-raid, snitzer, dm-devel, linux-block, Song Liu,
	linux-bcache



> 2022年12月6日 22:40,Christoph Hellwig <hch@lst.de> 写道:
> 
> This macro is obsolete, so replace the last few uses with open coded
> bi_opf assignments.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Acked-by: Coly Li <colyli@suse.de <mailto:colyli@suse.de>>


BTW, may I ask why bio_set_op_attrs() is removed. Quite long time ago it was added to avoid open code, and now we remove it to use open coded assignments. What is the motivation for now?

Thanks.

Coly Li


> ---
> drivers/md/bcache/movinggc.c  |  2 +-
> drivers/md/bcache/request.c   |  2 +-
> drivers/md/bcache/writeback.c |  4 ++--
> drivers/md/dm-thin.c          |  2 +-
> drivers/md/raid1.c            | 12 ++++++------
> drivers/md/raid10.c           | 18 +++++++++---------
> include/linux/blk_types.h     |  7 -------
> 7 files changed, 20 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/md/bcache/movinggc.c b/drivers/md/bcache/movinggc.c
> index 99499d1f6e6666..9f32901fdad102 100644
> --- a/drivers/md/bcache/movinggc.c
> +++ b/drivers/md/bcache/movinggc.c
> @@ -160,7 +160,7 @@ static void read_moving(struct cache_set *c)
> moving_init(io);
> bio = &io->bio.bio;
> 
> - bio_set_op_attrs(bio, REQ_OP_READ, 0);
> + bio->bi_opf = REQ_OP_READ;
> bio->bi_end_io = read_moving_endio;
> 
> if (bch_bio_alloc_pages(bio, GFP_KERNEL))
> diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
> index 3427555b0ccae4..39c7b607f8aad8 100644
> --- a/drivers/md/bcache/request.c
> +++ b/drivers/md/bcache/request.c
> @@ -244,7 +244,7 @@ static void bch_data_insert_start(struct closure *cl)
> trace_bcache_cache_insert(k);
> bch_keylist_push(&op->insert_keys);
> 
> - bio_set_op_attrs(n, REQ_OP_WRITE, 0);
> + n->bi_opf = REQ_OP_WRITE;
> bch_submit_bbio(n, op->c, k, 0);
> } while (n != bio);
> 
> diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c
> index 0285b676e9834a..d4a5fc0650bb29 100644
> --- a/drivers/md/bcache/writeback.c
> +++ b/drivers/md/bcache/writeback.c
> @@ -434,7 +434,7 @@ static void write_dirty(struct closure *cl)
> */
> if (KEY_DIRTY(&w->key)) {
> dirty_init(w);
> - bio_set_op_attrs(&io->bio, REQ_OP_WRITE, 0);
> + io->bio.bi_opf = REQ_OP_WRITE;
> io->bio.bi_iter.bi_sector = KEY_START(&w->key);
> bio_set_dev(&io->bio, io->dc->bdev);
> io->bio.bi_end_io = dirty_endio;
> @@ -547,7 +547,7 @@ static void read_dirty(struct cached_dev *dc)
> io->sequence    = sequence++;
> 
> dirty_init(w);
> - bio_set_op_attrs(&io->bio, REQ_OP_READ, 0);
> + io->bio.bi_opf = REQ_OP_READ;
> io->bio.bi_iter.bi_sector = PTR_OFFSET(&w->key, 0);
> bio_set_dev(&io->bio, dc->disk.c->cache->bdev);
> io->bio.bi_end_io = read_dirty_endio;
> diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
> index e76c96c760a9b5..c2b5a537f5b8ad 100644
> --- a/drivers/md/dm-thin.c
> +++ b/drivers/md/dm-thin.c
> @@ -410,7 +410,7 @@ static void end_discard(struct discard_op *op, int r)
> * need to wait for the chain to complete.
> */
> bio_chain(op->bio, op->parent_bio);
> - bio_set_op_attrs(op->bio, REQ_OP_DISCARD, 0);
> + op->bio->bi_opf = REQ_OP_DISCARD;
> submit_bio(op->bio);
> }
> 
> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
> index 58f705f4294801..68a9e2d9985b2f 100644
> --- a/drivers/md/raid1.c
> +++ b/drivers/md/raid1.c
> @@ -1321,7 +1321,7 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio,
> read_bio->bi_iter.bi_sector = r1_bio->sector +
> mirror->rdev->data_offset;
> read_bio->bi_end_io = raid1_end_read_request;
> - bio_set_op_attrs(read_bio, op, do_sync);
> + read_bio->bi_opf = op | do_sync;
> if (test_bit(FailFast, &mirror->rdev->flags) &&
>    test_bit(R1BIO_FailFast, &r1_bio->state))
>        read_bio->bi_opf |= MD_FAILFAST;
> @@ -2254,7 +2254,7 @@ static void sync_request_write(struct mddev *mddev, struct r1bio *r1_bio)
> continue;
> }
> 
> - bio_set_op_attrs(wbio, REQ_OP_WRITE, 0);
> + wbio->bi_opf = REQ_OP_WRITE;
> if (test_bit(FailFast, &conf->mirrors[i].rdev->flags))
> wbio->bi_opf |= MD_FAILFAST;
> 
> @@ -2419,7 +2419,7 @@ static int narrow_write_error(struct r1bio *r1_bio, int i)
>       GFP_NOIO, &mddev->bio_set);
> }
> 
> - bio_set_op_attrs(wbio, REQ_OP_WRITE, 0);
> + wbio->bi_opf = REQ_OP_WRITE;
> wbio->bi_iter.bi_sector = r1_bio->sector;
> wbio->bi_iter.bi_size = r1_bio->sectors << 9;
> 
> @@ -2770,7 +2770,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr,
> if (i < conf->raid_disks)
> still_degraded = 1;
> } else if (!test_bit(In_sync, &rdev->flags)) {
> - bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
> + bio->bi_opf = REQ_OP_WRITE;
> bio->bi_end_io = end_sync_write;
> write_targets ++;
> } else {
> @@ -2797,7 +2797,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr,
> if (disk < 0)
> disk = i;
> }
> - bio_set_op_attrs(bio, REQ_OP_READ, 0);
> + bio->bi_opf = REQ_OP_READ;
> bio->bi_end_io = end_sync_read;
> read_targets++;
> } else if (!test_bit(WriteErrorSeen, &rdev->flags) &&
> @@ -2809,7 +2809,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr,
> * if we are doing resync or repair. Otherwise, leave
> * this device alone for this sync request.
> */
> - bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
> + bio->bi_opf = REQ_OP_WRITE;
> bio->bi_end_io = end_sync_write;
> write_targets++;
> }
> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
> index 9a6503f5cb982e..6c66357f92f559 100644
> --- a/drivers/md/raid10.c
> +++ b/drivers/md/raid10.c
> @@ -1254,7 +1254,7 @@ static void raid10_read_request(struct mddev *mddev, struct bio *bio,
> read_bio->bi_iter.bi_sector = r10_bio->devs[slot].addr +
> choose_data_offset(r10_bio, rdev);
> read_bio->bi_end_io = raid10_end_read_request;
> - bio_set_op_attrs(read_bio, op, do_sync);
> + read_bio->bi_opf = op | do_sync;
> if (test_bit(FailFast, &rdev->flags) &&
>    test_bit(R10BIO_FailFast, &r10_bio->state))
>        read_bio->bi_opf |= MD_FAILFAST;
> @@ -1301,7 +1301,7 @@ static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_bio,
> mbio->bi_iter.bi_sector = (r10_bio->devs[n_copy].addr +
>   choose_data_offset(r10_bio, rdev));
> mbio->bi_end_io = raid10_end_write_request;
> - bio_set_op_attrs(mbio, op, do_sync | do_fua);
> + mbio->bi_opf = op | do_sync | do_fua;
> if (!replacement && test_bit(FailFast,
>     &conf->mirrors[devnum].rdev->flags)
> && enough(conf, devnum))
> @@ -2933,7 +2933,7 @@ static int narrow_write_error(struct r10bio *r10_bio, int i)
> wsector = r10_bio->devs[i].addr + (sector - r10_bio->sector);
> wbio->bi_iter.bi_sector = wsector +
>   choose_data_offset(r10_bio, rdev);
> - bio_set_op_attrs(wbio, REQ_OP_WRITE, 0);
> + wbio->bi_opf = REQ_OP_WRITE;
> 
> if (submit_bio_wait(wbio) < 0)
> /* Failure! */
> @@ -3542,7 +3542,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
> bio->bi_next = biolist;
> biolist = bio;
> bio->bi_end_io = end_sync_read;
> - bio_set_op_attrs(bio, REQ_OP_READ, 0);
> + bio->bi_opf = REQ_OP_READ;
> if (test_bit(FailFast, &rdev->flags))
> bio->bi_opf |= MD_FAILFAST;
> from_addr = r10_bio->devs[j].addr;
> @@ -3567,7 +3567,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
> bio->bi_next = biolist;
> biolist = bio;
> bio->bi_end_io = end_sync_write;
> - bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
> + bio->bi_opf = REQ_OP_WRITE;
> bio->bi_iter.bi_sector = to_addr
> + mrdev->data_offset;
> bio_set_dev(bio, mrdev->bdev);
> @@ -3588,7 +3588,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
> bio->bi_next = biolist;
> biolist = bio;
> bio->bi_end_io = end_sync_write;
> - bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
> + bio->bi_opf = REQ_OP_WRITE;
> bio->bi_iter.bi_sector = to_addr +
> mreplace->data_offset;
> bio_set_dev(bio, mreplace->bdev);
> @@ -3742,7 +3742,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
> bio->bi_next = biolist;
> biolist = bio;
> bio->bi_end_io = end_sync_read;
> - bio_set_op_attrs(bio, REQ_OP_READ, 0);
> + bio->bi_opf = REQ_OP_READ;
> if (test_bit(FailFast, &rdev->flags))
> bio->bi_opf |= MD_FAILFAST;
> bio->bi_iter.bi_sector = sector + rdev->data_offset;
> @@ -3764,7 +3764,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
> bio->bi_next = biolist;
> biolist = bio;
> bio->bi_end_io = end_sync_write;
> - bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
> + bio->bi_opf = REQ_OP_WRITE;
> if (test_bit(FailFast, &rdev->flags))
> bio->bi_opf |= MD_FAILFAST;
> bio->bi_iter.bi_sector = sector + rdev->data_offset;
> @@ -4970,7 +4970,7 @@ static sector_t reshape_request(struct mddev *mddev, sector_t sector_nr,
> b->bi_iter.bi_sector = r10_bio->devs[s/2].addr +
> rdev2->new_data_offset;
> b->bi_end_io = end_reshape_write;
> - bio_set_op_attrs(b, REQ_OP_WRITE, 0);
> + b->bi_opf = REQ_OP_WRITE;
> b->bi_next = blist;
> blist = b;
> }
> diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
> index e0b098089ef2b7..99be590f952f6e 100644
> --- a/include/linux/blk_types.h
> +++ b/include/linux/blk_types.h
> @@ -472,13 +472,6 @@ static inline enum req_op bio_op(const struct bio *bio)
> return bio->bi_opf & REQ_OP_MASK;
> }
> 
> -/* obsolete, don't use in new code */
> -static inline void bio_set_op_attrs(struct bio *bio, enum req_op op,
> -    blk_opf_t op_flags)
> -{
> - bio->bi_opf = op | op_flags;
> -}
> -
> static inline bool op_is_write(blk_opf_t op)
> {
> return !!(op & (__force blk_opf_t)1);
> -- 
> 2.35.1
> 

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel

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

* Re: [dm-devel] [PATCH] block: remove bio_set_op_attrs
  2022-12-06 14:46   ` [dm-devel] " Coly Li
@ 2022-12-06 14:49     ` Christoph Hellwig
  -1 siblings, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2022-12-06 14:49 UTC (permalink / raw)
  To: Coly Li
  Cc: Jens Axboe, linux-block, snitzer, dm-devel, linux-raid, Song Liu,
	linux-bcache, Christoph Hellwig

On Tue, Dec 06, 2022 at 10:46:31PM +0800, Coly Li wrote:
> BTW, may I ask why bio_set_op_attrs() is removed. Quite long time ago it was added to avoid open code, and now we remove it to use open coded assignments. What is the motivation for now?

It was added when the flags encoding was a mess.  Now that the RQF_
flags are split out things have become much simpler and we don't need
to hide a simple assignment of a value to a field.

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


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

* Re: [PATCH] block: remove bio_set_op_attrs
@ 2022-12-06 14:49     ` Christoph Hellwig
  0 siblings, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2022-12-06 14:49 UTC (permalink / raw)
  To: Coly Li
  Cc: Christoph Hellwig, Jens Axboe, snitzer, Song Liu, linux-block,
	linux-raid, linux-bcache, dm-devel

On Tue, Dec 06, 2022 at 10:46:31PM +0800, Coly Li wrote:
> BTW, may I ask why bio_set_op_attrs() is removed. Quite long time ago it was added to avoid open code, and now we remove it to use open coded assignments. What is the motivation for now?

It was added when the flags encoding was a mess.  Now that the RQF_
flags are split out things have become much simpler and we don't need
to hide a simple assignment of a value to a field.

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

* Re: [dm-devel] [PATCH] block: remove bio_set_op_attrs
  2022-12-06 14:49     ` Christoph Hellwig
@ 2022-12-06 14:51       ` Coly Li
  -1 siblings, 0 replies; 14+ messages in thread
From: Coly Li @ 2022-12-06 14:51 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, linux-raid, snitzer, linux-bcache, linux-block,
	Song Liu, dm-devel



> 2022年12月6日 22:49,Christoph Hellwig <hch@lst.de> 写道:
> 
> On Tue, Dec 06, 2022 at 10:46:31PM +0800, Coly Li wrote:
>> BTW, may I ask why bio_set_op_attrs() is removed. Quite long time ago it was added to avoid open code, and now we remove it to use open coded assignments. What is the motivation for now?
> 
> It was added when the flags encoding was a mess.  Now that the RQF_
> flags are split out things have become much simpler and we don't need
> to hide a simple assignment of a value to a field.

I see. Thanks for doing this.

Coly Li

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel

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

* Re: [dm-devel] [PATCH] block: remove bio_set_op_attrs
@ 2022-12-06 14:51       ` Coly Li
  0 siblings, 0 replies; 14+ messages in thread
From: Coly Li @ 2022-12-06 14:51 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, linux-block, snitzer, dm-devel, linux-raid, Song Liu,
	linux-bcache



> 2022年12月6日 22:49,Christoph Hellwig <hch@lst.de> 写道:
> 
> On Tue, Dec 06, 2022 at 10:46:31PM +0800, Coly Li wrote:
>> BTW, may I ask why bio_set_op_attrs() is removed. Quite long time ago it was added to avoid open code, and now we remove it to use open coded assignments. What is the motivation for now?
> 
> It was added when the flags encoding was a mess.  Now that the RQF_
> flags are split out things have become much simpler and we don't need
> to hide a simple assignment of a value to a field.

I see. Thanks for doing this.

Coly Li


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

* Re: [PATCH] block: remove bio_set_op_attrs
  2022-12-06 14:40 ` [dm-devel] " Christoph Hellwig
@ 2022-12-06 18:55   ` Bart Van Assche
  -1 siblings, 0 replies; 14+ messages in thread
From: Bart Van Assche @ 2022-12-06 18:55 UTC (permalink / raw)
  To: Christoph Hellwig, axboe, snitzer
  Cc: colyli, song, linux-block, linux-raid, linux-bcache, dm-devel

On 12/6/22 06:40, Christoph Hellwig wrote:
> This macro is obsolete, so replace the last few uses with open coded
> bi_opf assignments.

For the entire patch:

Reviewed-by: Bart Van Assche <bvanassche@acm.org>

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

* Re: [dm-devel] [PATCH] block: remove bio_set_op_attrs
@ 2022-12-06 18:55   ` Bart Van Assche
  0 siblings, 0 replies; 14+ messages in thread
From: Bart Van Assche @ 2022-12-06 18:55 UTC (permalink / raw)
  To: Christoph Hellwig, axboe, snitzer
  Cc: linux-raid, dm-devel, colyli, linux-block, song, linux-bcache

On 12/6/22 06:40, Christoph Hellwig wrote:
> This macro is obsolete, so replace the last few uses with open coded
> bi_opf assignments.

For the entire patch:

Reviewed-by: Bart Van Assche <bvanassche@acm.org>

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


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

* Re: [PATCH] block: remove bio_set_op_attrs
  2022-12-06 14:40 ` [dm-devel] " Christoph Hellwig
@ 2022-12-07  9:26   ` Johannes Thumshirn
  -1 siblings, 0 replies; 14+ messages in thread
From: Johannes Thumshirn @ 2022-12-07  9:26 UTC (permalink / raw)
  To: Christoph Hellwig, axboe, snitzer
  Cc: colyli, song, linux-block, linux-raid, linux-bcache, dm-devel

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [dm-devel] [PATCH] block: remove bio_set_op_attrs
@ 2022-12-07  9:26   ` Johannes Thumshirn
  0 siblings, 0 replies; 14+ messages in thread
From: Johannes Thumshirn @ 2022-12-07  9:26 UTC (permalink / raw)
  To: Christoph Hellwig, axboe, snitzer
  Cc: linux-raid, dm-devel, colyli, linux-block, song, linux-bcache

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


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

* Re: [PATCH] block: remove bio_set_op_attrs
  2022-12-06 14:40 ` [dm-devel] " Christoph Hellwig
@ 2022-12-07 16:43   ` Jens Axboe
  -1 siblings, 0 replies; 14+ messages in thread
From: Jens Axboe @ 2022-12-07 16:43 UTC (permalink / raw)
  To: snitzer, Christoph Hellwig
  Cc: colyli, song, linux-block, linux-raid, linux-bcache, dm-devel


On Tue, 06 Dec 2022 15:40:57 +0100, Christoph Hellwig wrote:
> This macro is obsolete, so replace the last few uses with open coded
> bi_opf assignments.
> 
> 

Applied, thanks!

[1/1] block: remove bio_set_op_attrs
      commit: c34b7ac65087554627f4840f4ecd6f2107a68fd1

Best regards,
-- 
Jens Axboe



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

* Re: [dm-devel] [PATCH] block: remove bio_set_op_attrs
@ 2022-12-07 16:43   ` Jens Axboe
  0 siblings, 0 replies; 14+ messages in thread
From: Jens Axboe @ 2022-12-07 16:43 UTC (permalink / raw)
  To: snitzer, Christoph Hellwig
  Cc: linux-raid, dm-devel, colyli, linux-block, song, linux-bcache


On Tue, 06 Dec 2022 15:40:57 +0100, Christoph Hellwig wrote:
> This macro is obsolete, so replace the last few uses with open coded
> bi_opf assignments.
> 
> 

Applied, thanks!

[1/1] block: remove bio_set_op_attrs
      commit: c34b7ac65087554627f4840f4ecd6f2107a68fd1

Best regards,
-- 
Jens Axboe


--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


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

end of thread, other threads:[~2022-12-07 16:49 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-06 14:40 [PATCH] block: remove bio_set_op_attrs Christoph Hellwig
2022-12-06 14:40 ` [dm-devel] " Christoph Hellwig
2022-12-06 14:46 ` Coly Li
2022-12-06 14:46   ` [dm-devel] " Coly Li
2022-12-06 14:49   ` Christoph Hellwig
2022-12-06 14:49     ` Christoph Hellwig
2022-12-06 14:51     ` [dm-devel] " Coly Li
2022-12-06 14:51       ` Coly Li
2022-12-06 18:55 ` Bart Van Assche
2022-12-06 18:55   ` [dm-devel] " Bart Van Assche
2022-12-07  9:26 ` Johannes Thumshirn
2022-12-07  9:26   ` [dm-devel] " Johannes Thumshirn
2022-12-07 16:43 ` Jens Axboe
2022-12-07 16:43   ` [dm-devel] " Jens Axboe

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.