[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210119050631.57073-19-chaitanya.kulkarni@wdc.com>
Date: Mon, 18 Jan 2021 21:06:12 -0800
From: Chaitanya Kulkarni <chaitanya.kulkarni@....com>
To: linux-block@...r.kernel.org, linux-xfs@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
drbd-dev@...ts.linbit.com, linux-bcache@...r.kernel.org,
linux-raid@...r.kernel.org, linux-nvme@...ts.infradead.org,
linux-scsi@...r.kernel.org, target-devel@...r.kernel.org,
linux-btrfs@...r.kernel.org, linux-ext4@...r.kernel.org,
cluster-devel@...hat.com
Cc: jfs-discussion@...ts.sourceforge.net, dm-devel@...hat.com,
axboe@...nel.dk, philipp.reisner@...bit.com,
lars.ellenberg@...bit.com, efremov@...ux.com, colyli@...e.de,
kent.overstreet@...il.com, agk@...hat.com, snitzer@...hat.com,
song@...nel.org, hch@....de, sagi@...mberg.me,
martin.petersen@...cle.com, viro@...iv.linux.org.uk, clm@...com,
josef@...icpanda.com, dsterba@...e.com, tytso@....edu,
adilger.kernel@...ger.ca, rpeterso@...hat.com, agruenba@...hat.com,
darrick.wong@...cle.com, shaggy@...nel.org, damien.lemoal@....com,
naohiro.aota@....com, jth@...nel.org, tj@...nel.org,
osandov@...com, bvanassche@....org, gustavo@...eddedor.com,
asml.silence@...il.com, jefflexu@...ux.alibaba.com,
Chaitanya Kulkarni <chaitanya.kulkarni@....com>
Subject: [RFC PATCH 18/37] bcache: use bio_init_fields in journal
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@....com>
---
drivers/md/bcache/journal.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c
index aefbdb7e003b..0aabcb5cf2ad 100644
--- a/drivers/md/bcache/journal.c
+++ b/drivers/md/bcache/journal.c
@@ -54,12 +54,10 @@ reread: left = ca->sb.bucket_size - offset;
len = min_t(unsigned int, left, PAGE_SECTORS << JSET_BITS);
bio_reset(bio);
- bio->bi_iter.bi_sector = bucket + offset;
- bio_set_dev(bio, ca->bdev);
+ bio_init_fields(bio, ca->bdev, bucket + offset,
+ &cl, journal_read_endio, 0, 0);
bio->bi_iter.bi_size = len << 9;
- bio->bi_end_io = journal_read_endio;
- bio->bi_private = &cl;
bio_set_op_attrs(bio, REQ_OP_READ, 0);
bch_bio_map(bio, data);
@@ -588,6 +586,7 @@ static void do_journal_discard(struct cache *ca)
{
struct journal_device *ja = &ca->journal;
struct bio *bio = &ja->discard_bio;
+ sector_t sect;
if (!ca->discard) {
ja->discard_idx = ja->last_idx;
@@ -613,12 +612,10 @@ static void do_journal_discard(struct cache *ca)
bio_init(bio, bio->bi_inline_vecs, 1);
bio_set_op_attrs(bio, REQ_OP_DISCARD, 0);
- bio->bi_iter.bi_sector = bucket_to_sector(ca->set,
- ca->sb.d[ja->discard_idx]);
- bio_set_dev(bio, ca->bdev);
bio->bi_iter.bi_size = bucket_bytes(ca);
- bio->bi_end_io = journal_discard_endio;
-
+ sect = bucket_to_sector(ca->set, ca->sb.d[ja->discard_idx]);
+ bio_init_fields(bio, ca->bdev, sect, NULL,
+ journal_discard_endio, 0, 0);
closure_get(&ca->set->cl);
INIT_WORK(&ja->discard_work, journal_discard_work);
queue_work(bch_journal_wq, &ja->discard_work);
@@ -774,12 +771,10 @@ static void journal_write_unlocked(struct closure *cl)
atomic_long_add(sectors, &ca->meta_sectors_written);
bio_reset(bio);
- bio->bi_iter.bi_sector = PTR_OFFSET(k, i);
- bio_set_dev(bio, ca->bdev);
bio->bi_iter.bi_size = sectors << 9;
- bio->bi_end_io = journal_write_endio;
- bio->bi_private = w;
+ bio_init_fields(bio, ca->bdev, PTR_OFFSET(k, i), w,
+ journal_write_endio, 0, 0);
bio_set_op_attrs(bio, REQ_OP_WRITE,
REQ_SYNC|REQ_META|REQ_PREFLUSH|REQ_FUA);
bch_bio_map(bio, w->data);
--
2.22.1
Powered by blists - more mailing lists