[PATCH 1/7] block: remove bio_set_prio and bio_prio

Christoph Hellwig
2018-12-13T20:32:22Z

There is no good reason to not just use the fields directly.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
block/blk-core.c | 2 +-
block/blk-merge.c | 2 +-
drivers/md/bcache/movinggc.c | 2 +-
drivers/md/bcache/writeback.c | 2 +-
include/linux/bio.h | 3 ---
5 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 268d2b8e9843..34619001a5dd 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -734,7 +734,7 @@ void blk_init_request_from_bio(struct request *req, struct bio *bio)
req->cmd_flags |= REQ_FAILFAST_MASK;

req->__sector = bio->bi_iter.bi_sector;
- req->ioprio = bio_prio(bio);
+ req->ioprio = bio->bi_ioprio;
req->write_hint = bio->bi_write_hint;
blk_rq_bio_prep(req->q, req, bio);
}
diff --git a/block/blk-merge.c b/block/blk-merge.c
index 9da5629d0887..09591daf4993 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -882,7 +882,7 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio)
if (rq->write_hint != bio->bi_write_hint)
return false;

- if (rq->ioprio != bio_prio(bio))
+ if (rq->ioprio != bio->bi_ioprio)
return false;

return true;
diff --git a/drivers/md/bcache/movinggc.c b/drivers/md/bcache/movinggc.c
index 7891fb512736..3bc85277e284 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, bio->bi_inline_vecs,
DIV_ROUND_UP(KEY_SIZE(&io->w->key), PAGE_SECTORS));
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 73f0efac2b9f..09620652c786 100644
--- a/drivers/md/bcache/writeback.c
+++ b/drivers/md/bcache/writeback.c
@@ -250,7 +250,7 @@ static void dirty_init(struct keybuf_key *w)
bio_init(bio, bio->bi_inline_vecs,
DIV_ROUND_UP(KEY_SIZE(&w->key), PAGE_SECTORS));
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/include/linux/bio.h b/include/linux/bio.h
index 7380b094dcca..261b15483c69 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -44,9 +44,6 @@
#define BIO_MAX_PAGES 256
#endif

-#define bio_prio(bio) (bio)->bi_ioprio
-#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.19.2