Commit 792e86ef authored by David Sterba's avatar David Sterba

btrfs: rename btrfs_submit_bio() to btrfs_submit_bbio()

The function name is a bit misleading as it submits the btrfs_bio
(bbio), rename it so we can use btrfs_submit_bio() when an actual bio is
submitted.
Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent ce4a71ee
...@@ -53,7 +53,7 @@ void btrfs_bio_init(struct btrfs_bio *bbio, struct btrfs_fs_info *fs_info, ...@@ -53,7 +53,7 @@ void btrfs_bio_init(struct btrfs_bio *bbio, struct btrfs_fs_info *fs_info,
/* /*
* Allocate a btrfs_bio structure. The btrfs_bio is the main I/O container for * Allocate a btrfs_bio structure. The btrfs_bio is the main I/O container for
* btrfs, and is used for all I/O submitted through btrfs_submit_bio. * btrfs, and is used for all I/O submitted through btrfs_submit_bbio().
* *
* Just like the underlying bio_alloc_bioset it will not fail as it is backed by * Just like the underlying bio_alloc_bioset it will not fail as it is backed by
* a mempool. * a mempool.
...@@ -211,7 +211,7 @@ static void btrfs_end_repair_bio(struct btrfs_bio *repair_bbio, ...@@ -211,7 +211,7 @@ static void btrfs_end_repair_bio(struct btrfs_bio *repair_bbio,
goto done; goto done;
} }
btrfs_submit_bio(repair_bbio, mirror); btrfs_submit_bbio(repair_bbio, mirror);
return; return;
} }
...@@ -280,7 +280,7 @@ static struct btrfs_failed_bio *repair_one_sector(struct btrfs_bio *failed_bbio, ...@@ -280,7 +280,7 @@ static struct btrfs_failed_bio *repair_one_sector(struct btrfs_bio *failed_bbio,
mirror = next_repair_mirror(fbio, failed_bbio->mirror_num); mirror = next_repair_mirror(fbio, failed_bbio->mirror_num);
btrfs_debug(fs_info, "submitting repair read to mirror %d", mirror); btrfs_debug(fs_info, "submitting repair read to mirror %d", mirror);
btrfs_submit_bio(repair_bbio, mirror); btrfs_submit_bbio(repair_bbio, mirror);
return fbio; return fbio;
} }
...@@ -777,7 +777,7 @@ static bool btrfs_submit_chunk(struct btrfs_bio *bbio, int mirror_num) ...@@ -777,7 +777,7 @@ static bool btrfs_submit_chunk(struct btrfs_bio *bbio, int mirror_num)
return true; return true;
} }
void btrfs_submit_bio(struct btrfs_bio *bbio, int mirror_num) void btrfs_submit_bbio(struct btrfs_bio *bbio, int mirror_num)
{ {
/* If bbio->inode is not populated, its file_offset must be 0. */ /* If bbio->inode is not populated, its file_offset must be 0. */
ASSERT(bbio->inode || bbio->file_offset == 0); ASSERT(bbio->inode || bbio->file_offset == 0);
...@@ -789,7 +789,7 @@ void btrfs_submit_bio(struct btrfs_bio *bbio, int mirror_num) ...@@ -789,7 +789,7 @@ void btrfs_submit_bio(struct btrfs_bio *bbio, int mirror_num)
/* /*
* Submit a repair write. * Submit a repair write.
* *
* This bypasses btrfs_submit_bio deliberately, as that writes all copies in a * This bypasses btrfs_submit_bbio() deliberately, as that writes all copies in a
* RAID setup. Here we only want to write the one bad copy, so we do the * RAID setup. Here we only want to write the one bad copy, so we do the
* mapping ourselves and submit the bio directly. * mapping ourselves and submit the bio directly.
* *
......
...@@ -29,7 +29,7 @@ typedef void (*btrfs_bio_end_io_t)(struct btrfs_bio *bbio); ...@@ -29,7 +29,7 @@ typedef void (*btrfs_bio_end_io_t)(struct btrfs_bio *bbio);
/* /*
* Highlevel btrfs I/O structure. It is allocated by btrfs_bio_alloc and * Highlevel btrfs I/O structure. It is allocated by btrfs_bio_alloc and
* passed to btrfs_submit_bio for mapping to the physical devices. * passed to btrfs_submit_bbio() for mapping to the physical devices.
*/ */
struct btrfs_bio { struct btrfs_bio {
/* /*
...@@ -42,7 +42,7 @@ struct btrfs_bio { ...@@ -42,7 +42,7 @@ struct btrfs_bio {
union { union {
/* /*
* For data reads: checksumming and original I/O information. * For data reads: checksumming and original I/O information.
* (for internal use in the btrfs_submit_bio machinery only) * (for internal use in the btrfs_submit_bbio() machinery only)
*/ */
struct { struct {
u8 *csum; u8 *csum;
...@@ -104,7 +104,7 @@ void btrfs_bio_end_io(struct btrfs_bio *bbio, blk_status_t status); ...@@ -104,7 +104,7 @@ void btrfs_bio_end_io(struct btrfs_bio *bbio, blk_status_t status);
/* Submit using blkcg_punt_bio_submit. */ /* Submit using blkcg_punt_bio_submit. */
#define REQ_BTRFS_CGROUP_PUNT REQ_FS_PRIVATE #define REQ_BTRFS_CGROUP_PUNT REQ_FS_PRIVATE
void btrfs_submit_bio(struct btrfs_bio *bbio, int mirror_num); void btrfs_submit_bbio(struct btrfs_bio *bbio, int mirror_num);
void btrfs_submit_repair_write(struct btrfs_bio *bbio, int mirror_num, bool dev_replace); void btrfs_submit_repair_write(struct btrfs_bio *bbio, int mirror_num, bool dev_replace);
int btrfs_repair_io_failure(struct btrfs_fs_info *fs_info, u64 ino, u64 start, int btrfs_repair_io_failure(struct btrfs_fs_info *fs_info, u64 ino, u64 start,
u64 length, u64 logical, struct folio *folio, u64 length, u64 logical, struct folio *folio,
......
...@@ -395,7 +395,7 @@ void btrfs_submit_compressed_write(struct btrfs_ordered_extent *ordered, ...@@ -395,7 +395,7 @@ void btrfs_submit_compressed_write(struct btrfs_ordered_extent *ordered,
cb->bbio.ordered = ordered; cb->bbio.ordered = ordered;
btrfs_add_compressed_bio_folios(cb); btrfs_add_compressed_bio_folios(cb);
btrfs_submit_bio(&cb->bbio, 0); btrfs_submit_bbio(&cb->bbio, 0);
} }
/* /*
...@@ -630,7 +630,7 @@ void btrfs_submit_compressed_read(struct btrfs_bio *bbio) ...@@ -630,7 +630,7 @@ void btrfs_submit_compressed_read(struct btrfs_bio *bbio)
if (memstall) if (memstall)
psi_memstall_leave(&pflags); psi_memstall_leave(&pflags);
btrfs_submit_bio(&cb->bbio, 0); btrfs_submit_bbio(&cb->bbio, 0);
return; return;
out_free_compressed_pages: out_free_compressed_pages:
......
...@@ -726,7 +726,7 @@ static void btrfs_dio_submit_io(const struct iomap_iter *iter, struct bio *bio, ...@@ -726,7 +726,7 @@ static void btrfs_dio_submit_io(const struct iomap_iter *iter, struct bio *bio,
} }
} }
btrfs_submit_bio(bbio, 0); btrfs_submit_bbio(bbio, 0);
} }
static const struct iomap_ops btrfs_dio_iomap_ops = { static const struct iomap_ops btrfs_dio_iomap_ops = {
......
...@@ -117,7 +117,7 @@ static void submit_one_bio(struct btrfs_bio_ctrl *bio_ctrl) ...@@ -117,7 +117,7 @@ static void submit_one_bio(struct btrfs_bio_ctrl *bio_ctrl)
bio_ctrl->compress_type != BTRFS_COMPRESS_NONE) bio_ctrl->compress_type != BTRFS_COMPRESS_NONE)
btrfs_submit_compressed_read(bbio); btrfs_submit_compressed_read(bbio);
else else
btrfs_submit_bio(bbio, 0); btrfs_submit_bbio(bbio, 0);
/* The bbio is owned by the end_io handler now */ /* The bbio is owned by the end_io handler now */
bio_ctrl->bbio = NULL; bio_ctrl->bbio = NULL;
...@@ -1800,7 +1800,7 @@ static noinline_for_stack void write_one_eb(struct extent_buffer *eb, ...@@ -1800,7 +1800,7 @@ static noinline_for_stack void write_one_eb(struct extent_buffer *eb,
folio_unlock(folio); folio_unlock(folio);
} }
} }
btrfs_submit_bio(bbio, 0); btrfs_submit_bbio(bbio, 0);
} }
/* /*
...@@ -3572,7 +3572,7 @@ int read_extent_buffer_pages(struct extent_buffer *eb, int wait, int mirror_num, ...@@ -3572,7 +3572,7 @@ int read_extent_buffer_pages(struct extent_buffer *eb, int wait, int mirror_num,
ASSERT(ret); ASSERT(ret);
} }
} }
btrfs_submit_bio(bbio, mirror_num); btrfs_submit_bbio(bbio, mirror_num);
done: done:
if (wait == WAIT_COMPLETE) { if (wait == WAIT_COMPLETE) {
......
...@@ -9152,7 +9152,7 @@ int btrfs_encoded_read_regular_fill_pages(struct btrfs_inode *inode, ...@@ -9152,7 +9152,7 @@ int btrfs_encoded_read_regular_fill_pages(struct btrfs_inode *inode,
if (bio_add_page(&bbio->bio, pages[i], bytes, 0) < bytes) { if (bio_add_page(&bbio->bio, pages[i], bytes, 0) < bytes) {
atomic_inc(&priv.pending); atomic_inc(&priv.pending);
btrfs_submit_bio(bbio, 0); btrfs_submit_bbio(bbio, 0);
bbio = btrfs_bio_alloc(BIO_MAX_VECS, REQ_OP_READ, fs_info, bbio = btrfs_bio_alloc(BIO_MAX_VECS, REQ_OP_READ, fs_info,
btrfs_encoded_read_endio, &priv); btrfs_encoded_read_endio, &priv);
...@@ -9167,7 +9167,7 @@ int btrfs_encoded_read_regular_fill_pages(struct btrfs_inode *inode, ...@@ -9167,7 +9167,7 @@ int btrfs_encoded_read_regular_fill_pages(struct btrfs_inode *inode,
} while (disk_io_size); } while (disk_io_size);
atomic_inc(&priv.pending); atomic_inc(&priv.pending);
btrfs_submit_bio(bbio, 0); btrfs_submit_bbio(bbio, 0);
if (atomic_dec_return(&priv.pending)) if (atomic_dec_return(&priv.pending))
io_wait_event(priv.wait, !atomic_read(&priv.pending)); io_wait_event(priv.wait, !atomic_read(&priv.pending));
......
...@@ -838,7 +838,7 @@ static void scrub_stripe_submit_repair_read(struct scrub_stripe *stripe, ...@@ -838,7 +838,7 @@ static void scrub_stripe_submit_repair_read(struct scrub_stripe *stripe,
bbio->bio.bi_iter.bi_size >= blocksize)) { bbio->bio.bi_iter.bi_size >= blocksize)) {
ASSERT(bbio->bio.bi_iter.bi_size); ASSERT(bbio->bio.bi_iter.bi_size);
atomic_inc(&stripe->pending_io); atomic_inc(&stripe->pending_io);
btrfs_submit_bio(bbio, mirror); btrfs_submit_bbio(bbio, mirror);
if (wait) if (wait)
wait_scrub_stripe_io(stripe); wait_scrub_stripe_io(stripe);
bbio = NULL; bbio = NULL;
...@@ -857,7 +857,7 @@ static void scrub_stripe_submit_repair_read(struct scrub_stripe *stripe, ...@@ -857,7 +857,7 @@ static void scrub_stripe_submit_repair_read(struct scrub_stripe *stripe,
if (bbio) { if (bbio) {
ASSERT(bbio->bio.bi_iter.bi_size); ASSERT(bbio->bio.bi_iter.bi_size);
atomic_inc(&stripe->pending_io); atomic_inc(&stripe->pending_io);
btrfs_submit_bio(bbio, mirror); btrfs_submit_bbio(bbio, mirror);
if (wait) if (wait)
wait_scrub_stripe_io(stripe); wait_scrub_stripe_io(stripe);
} }
...@@ -1683,7 +1683,7 @@ static void scrub_submit_extent_sector_read(struct scrub_ctx *sctx, ...@@ -1683,7 +1683,7 @@ static void scrub_submit_extent_sector_read(struct scrub_ctx *sctx,
bbio->bio.bi_iter.bi_size >= stripe_len)) { bbio->bio.bi_iter.bi_size >= stripe_len)) {
ASSERT(bbio->bio.bi_iter.bi_size); ASSERT(bbio->bio.bi_iter.bi_size);
atomic_inc(&stripe->pending_io); atomic_inc(&stripe->pending_io);
btrfs_submit_bio(bbio, mirror); btrfs_submit_bbio(bbio, mirror);
bbio = NULL; bbio = NULL;
} }
...@@ -1720,7 +1720,7 @@ static void scrub_submit_extent_sector_read(struct scrub_ctx *sctx, ...@@ -1720,7 +1720,7 @@ static void scrub_submit_extent_sector_read(struct scrub_ctx *sctx,
if (bbio) { if (bbio) {
ASSERT(bbio->bio.bi_iter.bi_size); ASSERT(bbio->bio.bi_iter.bi_size);
atomic_inc(&stripe->pending_io); atomic_inc(&stripe->pending_io);
btrfs_submit_bio(bbio, mirror); btrfs_submit_bbio(bbio, mirror);
} }
if (atomic_dec_and_test(&stripe->pending_io)) { if (atomic_dec_and_test(&stripe->pending_io)) {
...@@ -1776,7 +1776,7 @@ static void scrub_submit_initial_read(struct scrub_ctx *sctx, ...@@ -1776,7 +1776,7 @@ static void scrub_submit_initial_read(struct scrub_ctx *sctx,
mirror = calc_next_mirror(mirror, num_copies); mirror = calc_next_mirror(mirror, num_copies);
} }
btrfs_submit_bio(bbio, mirror); btrfs_submit_bbio(bbio, mirror);
} }
static bool stripe_has_metadata_error(struct scrub_stripe *stripe) static bool stripe_has_metadata_error(struct scrub_stripe *stripe)
......
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