Commit 552eee3b authored by Bart Van Assche's avatar Bart Van Assche Committed by Jens Axboe

md/bcache: Combine two prio_io() arguments

Improve uniformity in the kernel of handling of request operation and
flags by passing these as a single argument.

Cc: Coly Li <colyli@suse.de>
Cc: Mingzhe Zou <mingzhe.zou@easystack.cn>
Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20220714180729.1065367-34-bvanassche@acm.orgSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 9a4fd6a2
...@@ -587,8 +587,7 @@ static void prio_endio(struct bio *bio) ...@@ -587,8 +587,7 @@ static void prio_endio(struct bio *bio)
closure_put(&ca->prio); closure_put(&ca->prio);
} }
static void prio_io(struct cache *ca, uint64_t bucket, int op, static void prio_io(struct cache *ca, uint64_t bucket, blk_opf_t opf)
unsigned long op_flags)
{ {
struct closure *cl = &ca->prio; struct closure *cl = &ca->prio;
struct bio *bio = bch_bbio_alloc(ca->set); struct bio *bio = bch_bbio_alloc(ca->set);
...@@ -601,7 +600,7 @@ static void prio_io(struct cache *ca, uint64_t bucket, int op, ...@@ -601,7 +600,7 @@ static void prio_io(struct cache *ca, uint64_t bucket, int op,
bio->bi_end_io = prio_endio; bio->bi_end_io = prio_endio;
bio->bi_private = ca; bio->bi_private = ca;
bio_set_op_attrs(bio, op, REQ_SYNC|REQ_META|op_flags); bio->bi_opf = opf | REQ_SYNC | REQ_META;
bch_bio_map(bio, ca->disk_buckets); bch_bio_map(bio, ca->disk_buckets);
closure_bio_submit(ca->set, bio, &ca->prio); closure_bio_submit(ca->set, bio, &ca->prio);
...@@ -661,7 +660,7 @@ int bch_prio_write(struct cache *ca, bool wait) ...@@ -661,7 +660,7 @@ int bch_prio_write(struct cache *ca, bool wait)
BUG_ON(bucket == -1); BUG_ON(bucket == -1);
mutex_unlock(&ca->set->bucket_lock); mutex_unlock(&ca->set->bucket_lock);
prio_io(ca, bucket, REQ_OP_WRITE, 0); prio_io(ca, bucket, REQ_OP_WRITE);
mutex_lock(&ca->set->bucket_lock); mutex_lock(&ca->set->bucket_lock);
ca->prio_buckets[i] = bucket; ca->prio_buckets[i] = bucket;
...@@ -705,7 +704,7 @@ static int prio_read(struct cache *ca, uint64_t bucket) ...@@ -705,7 +704,7 @@ static int prio_read(struct cache *ca, uint64_t bucket)
ca->prio_last_buckets[bucket_nr] = bucket; ca->prio_last_buckets[bucket_nr] = bucket;
bucket_nr++; bucket_nr++;
prio_io(ca, bucket, REQ_OP_READ, 0); prio_io(ca, bucket, REQ_OP_READ);
if (p->csum != if (p->csum !=
bch_crc64(&p->magic, meta_bucket_bytes(&ca->sb) - 8)) { bch_crc64(&p->magic, meta_bucket_bytes(&ca->sb) - 8)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment