diff mbox series

[2/2] block: Delete bio_set_prio()

Message ID 20241202111957.2311683-3-john.g.garry@oracle.com (mailing list archive)
State Accepted, archived
Delegated to: Mike Snitzer
Headers show
Series block: Delete bio_set_prio() and bio_prio() | expand

Commit Message

John Garry Dec. 2, 2024, 11:19 a.m. UTC
Since commit 43b62ce3ff0a ("block: move bio io prio to a new field"), macro
bio_set_prio() does nothing but set bio->bi_ioprio. All other places just
set bio->bi_ioprio directly, so replace bio_set_prio() remaining
callsites with setting bio->bi_ioprio directly and delete that macro.

Signed-off-by: John Garry <john.g.garry@oracle.com>
---
 drivers/block/rnbd/rnbd-srv.c | 2 +-
 drivers/md/bcache/movinggc.c  | 2 +-
 drivers/md/bcache/writeback.c | 2 +-
 fs/bcachefs/move.c            | 6 +++---
 include/linux/bio.h           | 2 --
 5 files changed, 6 insertions(+), 8 deletions(-)

Comments

Jinpu Wang Dec. 2, 2024, 11:33 a.m. UTC | #1
On Mon, Dec 2, 2024 at 12:20 PM John Garry <john.g.garry@oracle.com> wrote:
>
> Since commit 43b62ce3ff0a ("block: move bio io prio to a new field"), macro
> bio_set_prio() does nothing but set bio->bi_ioprio. All other places just
> set bio->bi_ioprio directly, so replace bio_set_prio() remaining
> callsites with setting bio->bi_ioprio directly and delete that macro.
>
> Signed-off-by: John Garry <john.g.garry@oracle.com>
lgtm, thx!
Acked-by: Jack Wang <jinpu.wang@ionos.com>
> ---
>  drivers/block/rnbd/rnbd-srv.c | 2 +-
>  drivers/md/bcache/movinggc.c  | 2 +-
>  drivers/md/bcache/writeback.c | 2 +-
>  fs/bcachefs/move.c            | 6 +++---
>  include/linux/bio.h           | 2 --
>  5 files changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv.c
> index 08ce6d96d04c..2ee6e9bd4e28 100644
> --- a/drivers/block/rnbd/rnbd-srv.c
> +++ b/drivers/block/rnbd/rnbd-srv.c
> @@ -167,7 +167,7 @@ static int process_rdma(struct rnbd_srv_session *srv_sess,
>         bio->bi_iter.bi_sector = le64_to_cpu(msg->sector);
>         prio = srv_sess->ver < RNBD_PROTO_VER_MAJOR ||
>                usrlen < sizeof(*msg) ? 0 : le16_to_cpu(msg->prio);
> -       bio_set_prio(bio, prio);
> +       bio->bi_ioprio = prio;
>
>         submit_bio(bio);
>
> diff --git a/drivers/md/bcache/movinggc.c b/drivers/md/bcache/movinggc.c
> index ef6abf33f926..45ca134cbf02 100644
> --- a/drivers/md/bcache/movinggc.c
> +++ b/drivers/md/bcache/movinggc.c
> @@ -82,7 +82,7 @@ static void moving_init(struct moving_io *io)
>         bio_init(bio, NULL, bio->bi_inline_vecs,
>                  DIV_ROUND_UP(KEY_SIZE(&io->w->key), PAGE_SECTORS), 0);
>         bio_get(bio);
> -       bio_set_prio(bio, IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0));
> +       bio->bi_ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0);
>
>         bio->bi_iter.bi_size    = KEY_SIZE(&io->w->key) << 9;
>         bio->bi_private         = &io->cl;
> diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c
> index c1d28e365910..453efbbdc8ee 100644
> --- a/drivers/md/bcache/writeback.c
> +++ b/drivers/md/bcache/writeback.c
> @@ -334,7 +334,7 @@ static void dirty_init(struct keybuf_key *w)
>         bio_init(bio, NULL, bio->bi_inline_vecs,
>                  DIV_ROUND_UP(KEY_SIZE(&w->key), PAGE_SECTORS), 0);
>         if (!io->dc->writeback_percent)
> -               bio_set_prio(bio, IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0));
> +               bio->bi_ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0);
>
>         bio->bi_iter.bi_size    = KEY_SIZE(&w->key) << 9;
>         bio->bi_private         = w;
> diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c
> index 0ef4a86850bb..67fb651f4af4 100644
> --- a/fs/bcachefs/move.c
> +++ b/fs/bcachefs/move.c
> @@ -292,8 +292,8 @@ int bch2_move_extent(struct moving_context *ctxt,
>         io->write_sectors       = k.k->size;
>
>         bio_init(&io->write.op.wbio.bio, NULL, io->bi_inline_vecs, pages, 0);
> -       bio_set_prio(&io->write.op.wbio.bio,
> -                    IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0));
> +       io->write.op.wbio.bio.bi_ioprio =
> +                    IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0);
>
>         if (bch2_bio_alloc_pages(&io->write.op.wbio.bio, sectors << 9,
>                                  GFP_KERNEL))
> @@ -303,7 +303,7 @@ int bch2_move_extent(struct moving_context *ctxt,
>         io->rbio.opts           = io_opts;
>         bio_init(&io->rbio.bio, NULL, io->bi_inline_vecs, pages, 0);
>         io->rbio.bio.bi_vcnt = pages;
> -       bio_set_prio(&io->rbio.bio, IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0));
> +       io->rbio.bio.bi_ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0);
>         io->rbio.bio.bi_iter.bi_size = sectors << 9;
>
>         io->rbio.bio.bi_opf             = REQ_OP_READ;
> diff --git a/include/linux/bio.h b/include/linux/bio.h
> index 61e6db44d464..2e7bd5d66ef4 100644
> --- a/include/linux/bio.h
> +++ b/include/linux/bio.h
> @@ -19,8 +19,6 @@ static inline unsigned int bio_max_segs(unsigned int nr_segs)
>         return min(nr_segs, BIO_MAX_VECS);
>  }
>
> -#define bio_set_prio(bio, prio)                ((bio)->bi_ioprio = prio)
> -
>  #define bio_iter_iovec(bio, iter)                              \
>         bvec_iter_bvec((bio)->bi_io_vec, (iter))
>
> --
> 2.31.1
>
Coly Li Dec. 2, 2024, 4:21 p.m. UTC | #2
On Mon, Dec 02, 2024 at 11:19:57AM +0000, John Garry wrote:
> Since commit 43b62ce3ff0a ("block: move bio io prio to a new field"), macro
> bio_set_prio() does nothing but set bio->bi_ioprio. All other places just
> set bio->bi_ioprio directly, so replace bio_set_prio() remaining
> callsites with setting bio->bi_ioprio directly and delete that macro.
> 
> Signed-off-by: John Garry <john.g.garry@oracle.com>
> ---
>  drivers/block/rnbd/rnbd-srv.c | 2 +-
>  drivers/md/bcache/movinggc.c  | 2 +-
>  drivers/md/bcache/writeback.c | 2 +-
>  fs/bcachefs/move.c            | 6 +++---
>  include/linux/bio.h           | 2 --
>  5 files changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv.c
> index 08ce6d96d04c..2ee6e9bd4e28 100644
> --- a/drivers/block/rnbd/rnbd-srv.c
> +++ b/drivers/block/rnbd/rnbd-srv.c
> @@ -167,7 +167,7 @@ static int process_rdma(struct rnbd_srv_session *srv_sess,
>  	bio->bi_iter.bi_sector = le64_to_cpu(msg->sector);
>  	prio = srv_sess->ver < RNBD_PROTO_VER_MAJOR ||
>  	       usrlen < sizeof(*msg) ? 0 : le16_to_cpu(msg->prio);
> -	bio_set_prio(bio, prio);
> +	bio->bi_ioprio = prio;
>  
>  	submit_bio(bio);
>  
> diff --git a/drivers/md/bcache/movinggc.c b/drivers/md/bcache/movinggc.c
> index ef6abf33f926..45ca134cbf02 100644
> --- a/drivers/md/bcache/movinggc.c
> +++ b/drivers/md/bcache/movinggc.c
> @@ -82,7 +82,7 @@ static void moving_init(struct moving_io *io)
>  	bio_init(bio, NULL, bio->bi_inline_vecs,
>  		 DIV_ROUND_UP(KEY_SIZE(&io->w->key), PAGE_SECTORS), 0);
>  	bio_get(bio);
> -	bio_set_prio(bio, IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0));
> +	bio->bi_ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0);
>  
>  	bio->bi_iter.bi_size	= KEY_SIZE(&io->w->key) << 9;
>  	bio->bi_private		= &io->cl;
> diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c
> index c1d28e365910..453efbbdc8ee 100644
> --- a/drivers/md/bcache/writeback.c
> +++ b/drivers/md/bcache/writeback.c
> @@ -334,7 +334,7 @@ static void dirty_init(struct keybuf_key *w)
>  	bio_init(bio, NULL, bio->bi_inline_vecs,
>  		 DIV_ROUND_UP(KEY_SIZE(&w->key), PAGE_SECTORS), 0);
>  	if (!io->dc->writeback_percent)
> -		bio_set_prio(bio, IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0));
> +		bio->bi_ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0);
>  
>  	bio->bi_iter.bi_size	= KEY_SIZE(&w->key) << 9;
>  	bio->bi_private		= w;


For bcache part, Acked-by: Coly Li <colyli@suse.de>

Thanks.

Coly Li
diff mbox series

Patch

diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv.c
index 08ce6d96d04c..2ee6e9bd4e28 100644
--- a/drivers/block/rnbd/rnbd-srv.c
+++ b/drivers/block/rnbd/rnbd-srv.c
@@ -167,7 +167,7 @@  static int process_rdma(struct rnbd_srv_session *srv_sess,
 	bio->bi_iter.bi_sector = le64_to_cpu(msg->sector);
 	prio = srv_sess->ver < RNBD_PROTO_VER_MAJOR ||
 	       usrlen < sizeof(*msg) ? 0 : le16_to_cpu(msg->prio);
-	bio_set_prio(bio, prio);
+	bio->bi_ioprio = prio;
 
 	submit_bio(bio);
 
diff --git a/drivers/md/bcache/movinggc.c b/drivers/md/bcache/movinggc.c
index ef6abf33f926..45ca134cbf02 100644
--- a/drivers/md/bcache/movinggc.c
+++ b/drivers/md/bcache/movinggc.c
@@ -82,7 +82,7 @@  static void moving_init(struct moving_io *io)
 	bio_init(bio, NULL, bio->bi_inline_vecs,
 		 DIV_ROUND_UP(KEY_SIZE(&io->w->key), PAGE_SECTORS), 0);
 	bio_get(bio);
-	bio_set_prio(bio, IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0));
+	bio->bi_ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0);
 
 	bio->bi_iter.bi_size	= KEY_SIZE(&io->w->key) << 9;
 	bio->bi_private		= &io->cl;
diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c
index c1d28e365910..453efbbdc8ee 100644
--- a/drivers/md/bcache/writeback.c
+++ b/drivers/md/bcache/writeback.c
@@ -334,7 +334,7 @@  static void dirty_init(struct keybuf_key *w)
 	bio_init(bio, NULL, bio->bi_inline_vecs,
 		 DIV_ROUND_UP(KEY_SIZE(&w->key), PAGE_SECTORS), 0);
 	if (!io->dc->writeback_percent)
-		bio_set_prio(bio, IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0));
+		bio->bi_ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0);
 
 	bio->bi_iter.bi_size	= KEY_SIZE(&w->key) << 9;
 	bio->bi_private		= w;
diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c
index 0ef4a86850bb..67fb651f4af4 100644
--- a/fs/bcachefs/move.c
+++ b/fs/bcachefs/move.c
@@ -292,8 +292,8 @@  int bch2_move_extent(struct moving_context *ctxt,
 	io->write_sectors	= k.k->size;
 
 	bio_init(&io->write.op.wbio.bio, NULL, io->bi_inline_vecs, pages, 0);
-	bio_set_prio(&io->write.op.wbio.bio,
-		     IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0));
+	io->write.op.wbio.bio.bi_ioprio =
+		     IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0);
 
 	if (bch2_bio_alloc_pages(&io->write.op.wbio.bio, sectors << 9,
 				 GFP_KERNEL))
@@ -303,7 +303,7 @@  int bch2_move_extent(struct moving_context *ctxt,
 	io->rbio.opts		= io_opts;
 	bio_init(&io->rbio.bio, NULL, io->bi_inline_vecs, pages, 0);
 	io->rbio.bio.bi_vcnt = pages;
-	bio_set_prio(&io->rbio.bio, IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0));
+	io->rbio.bio.bi_ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0);
 	io->rbio.bio.bi_iter.bi_size = sectors << 9;
 
 	io->rbio.bio.bi_opf		= REQ_OP_READ;
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 61e6db44d464..2e7bd5d66ef4 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -19,8 +19,6 @@  static inline unsigned int bio_max_segs(unsigned int nr_segs)
 	return min(nr_segs, BIO_MAX_VECS);
 }
 
-#define bio_set_prio(bio, prio)		((bio)->bi_ioprio = prio)
-
 #define bio_iter_iovec(bio, iter)				\
 	bvec_iter_bvec((bio)->bi_io_vec, (iter))