Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

md/bcache: Combine two uuid_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: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20220714180729.1065367-33-bvanassche@acm.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Bart Van Assche and committed by
Jens Axboe
9a4fd6a2 4ce4c73f

+8 -8
+8 -8
drivers/md/bcache/super.c
··· 414 414 up(&c->uuid_write_mutex); 415 415 } 416 416 417 - static void uuid_io(struct cache_set *c, int op, unsigned long op_flags, 418 - struct bkey *k, struct closure *parent) 417 + static void uuid_io(struct cache_set *c, blk_opf_t opf, struct bkey *k, 418 + struct closure *parent) 419 419 { 420 420 struct closure *cl = &c->uuid_write; 421 421 struct uuid_entry *u; ··· 429 429 for (i = 0; i < KEY_PTRS(k); i++) { 430 430 struct bio *bio = bch_bbio_alloc(c); 431 431 432 - bio->bi_opf = REQ_SYNC | REQ_META | op_flags; 432 + bio->bi_opf = opf | REQ_SYNC | REQ_META; 433 433 bio->bi_iter.bi_size = KEY_SIZE(k) << 9; 434 434 435 435 bio->bi_end_io = uuid_endio; 436 436 bio->bi_private = cl; 437 - bio_set_op_attrs(bio, op, REQ_SYNC|REQ_META|op_flags); 438 437 bch_bio_map(bio, c->uuids); 439 438 440 439 bch_submit_bbio(bio, c, k, i); 441 440 442 - if (op != REQ_OP_WRITE) 441 + if ((opf & REQ_OP_MASK) != REQ_OP_WRITE) 443 442 break; 444 443 } 445 444 446 445 bch_extent_to_text(buf, sizeof(buf), k); 447 - pr_debug("%s UUIDs at %s\n", op == REQ_OP_WRITE ? "wrote" : "read", buf); 446 + pr_debug("%s UUIDs at %s\n", (opf & REQ_OP_MASK) == REQ_OP_WRITE ? 447 + "wrote" : "read", buf); 448 448 449 449 for (u = c->uuids; u < c->uuids + c->nr_uuids; u++) 450 450 if (!bch_is_zero(u->uuid, 16)) ··· 463 463 return "bad uuid pointer"; 464 464 465 465 bkey_copy(&c->uuid_bucket, k); 466 - uuid_io(c, REQ_OP_READ, 0, k, cl); 466 + uuid_io(c, REQ_OP_READ, k, cl); 467 467 468 468 if (j->version < BCACHE_JSET_VERSION_UUIDv1) { 469 469 struct uuid_entry_v0 *u0 = (void *) c->uuids; ··· 511 511 512 512 size = meta_bucket_pages(&ca->sb) * PAGE_SECTORS; 513 513 SET_KEY_SIZE(&k.key, size); 514 - uuid_io(c, REQ_OP_WRITE, 0, &k.key, &cl); 514 + uuid_io(c, REQ_OP_WRITE, &k.key, &cl); 515 515 closure_sync(&cl); 516 516 517 517 /* Only one bucket used for uuid write */