Commit c3a3b19b authored by Qu Wenruo's avatar Qu Wenruo Committed by David Sterba
Browse files

btrfs: rename struct btrfs_io_bio to btrfs_bio



Previously we had "struct btrfs_bio", which records IO context for
mirrored IO and RAID56, and "strcut btrfs_io_bio", which records extra
btrfs specific info for logical bytenr bio.

With "btrfs_bio" renamed to "btrfs_io_context", we are safe to rename
"btrfs_io_bio" to "btrfs_bio" which is a more suitable name now.

The struct btrfs_bio changes meaning by this commit. There was a
suggested name like btrfs_logical_bio but it's a bit long and we'd
prefer to use a shorter name.

This could be a concern for backports to older kernels where the
different meaning could possibly cause confusion or bugs. Comparing the
new and old structures, there's no overlap among the struct members so a
build would break in case of incorrect backport.

We haven't had many backports to bio code anyway so this is more of a
theoretical cause of bugs and a matter of precaution but we'll need to
keep the semantic change in mind.

Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent cd8e0cca
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1561,7 +1561,7 @@ static int btrfsic_read_block(struct btrfsic_state *state,
		struct bio *bio;
		unsigned int j;

		bio = btrfs_io_bio_alloc(num_pages - i);
		bio = btrfs_bio_alloc(num_pages - i);
		bio_set_dev(bio, block_ctx->dev->bdev);
		bio->bi_iter.bi_sector = dev_bytenr >> 9;
		bio->bi_opf = REQ_OP_READ;
+8 −8
Original line number Diff line number Diff line
@@ -179,9 +179,9 @@ static int check_compressed_csum(struct btrfs_inode *inode, struct bio *bio,
			if (memcmp(&csum, cb_sum, csum_size) != 0) {
				btrfs_print_data_csum_error(inode, disk_start,
						csum, cb_sum, cb->mirror_num);
				if (btrfs_io_bio(bio)->device)
				if (btrfs_bio(bio)->device)
					btrfs_dev_stat_inc_and_print(
						btrfs_io_bio(bio)->device,
						btrfs_bio(bio)->device,
						BTRFS_DEV_STAT_CORRUPTION_ERRS);
				return -EIO;
			}
@@ -208,7 +208,7 @@ static void end_compressed_bio_read(struct bio *bio)
	struct inode *inode;
	struct page *page;
	unsigned int index;
	unsigned int mirror = btrfs_io_bio(bio)->mirror_num;
	unsigned int mirror = btrfs_bio(bio)->mirror_num;
	int ret = 0;

	if (bio->bi_status)
@@ -224,7 +224,7 @@ static void end_compressed_bio_read(struct bio *bio)
	 * Record the correct mirror_num in cb->orig_bio so that
	 * read-repair can work properly.
	 */
	btrfs_io_bio(cb->orig_bio)->mirror_num = mirror;
	btrfs_bio(cb->orig_bio)->mirror_num = mirror;
	cb->mirror_num = mirror;

	/*
@@ -418,7 +418,7 @@ blk_status_t btrfs_submit_compressed_write(struct btrfs_inode *inode, u64 start,
	cb->orig_bio = NULL;
	cb->nr_pages = nr_pages;

	bio = btrfs_io_bio_alloc(BIO_MAX_VECS);
	bio = btrfs_bio_alloc(BIO_MAX_VECS);
	bio->bi_iter.bi_sector = first_byte >> SECTOR_SHIFT;
	bio->bi_opf = bio_op | write_flags;
	bio->bi_private = cb;
@@ -491,7 +491,7 @@ blk_status_t btrfs_submit_compressed_write(struct btrfs_inode *inode, u64 start,
				bio_endio(bio);
			}

			bio = btrfs_io_bio_alloc(BIO_MAX_VECS);
			bio = btrfs_bio_alloc(BIO_MAX_VECS);
			bio->bi_iter.bi_sector = first_byte >> SECTOR_SHIFT;
			bio->bi_opf = bio_op | write_flags;
			bio->bi_private = cb;
@@ -750,7 +750,7 @@ blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
	/* include any pages we added in add_ra-bio_pages */
	cb->len = bio->bi_iter.bi_size;

	comp_bio = btrfs_io_bio_alloc(BIO_MAX_VECS);
	comp_bio = btrfs_bio_alloc(BIO_MAX_VECS);
	comp_bio->bi_iter.bi_sector = cur_disk_byte >> SECTOR_SHIFT;
	comp_bio->bi_opf = REQ_OP_READ;
	comp_bio->bi_private = cb;
@@ -809,7 +809,7 @@ blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
				bio_endio(comp_bio);
			}

			comp_bio = btrfs_io_bio_alloc(BIO_MAX_VECS);
			comp_bio = btrfs_bio_alloc(BIO_MAX_VECS);
			comp_bio->bi_iter.bi_sector = cur_disk_byte >> SECTOR_SHIFT;
			comp_bio->bi_opf = REQ_OP_READ;
			comp_bio->bi_private = cb;
+4 −2
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ extern struct kmem_cache *btrfs_free_space_cachep;
extern struct kmem_cache *btrfs_free_space_bitmap_cachep;
struct btrfs_ordered_sum;
struct btrfs_ref;
struct btrfs_bio;

#define BTRFS_MAGIC 0x4D5F53665248425FULL /* ascii _BHRfS_M, no null */

@@ -3140,8 +3141,9 @@ u64 btrfs_file_extent_end(const struct btrfs_path *path);
/* inode.c */
blk_status_t btrfs_submit_data_bio(struct inode *inode, struct bio *bio,
				   int mirror_num, unsigned long bio_flags);
unsigned int btrfs_verify_data_csum(struct btrfs_io_bio *io_bio, u32 bio_offset,
				    struct page *page, u64 start, u64 end);
unsigned int btrfs_verify_data_csum(struct btrfs_bio *bbio,
				    u32 bio_offset, struct page *page,
				    u64 start, u64 end);
struct extent_map *btrfs_get_extent_fiemap(struct btrfs_inode *inode,
					   u64 start, u64 len);
noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
+1 −1
Original line number Diff line number Diff line
@@ -683,7 +683,7 @@ static int validate_subpage_buffer(struct page *page, u64 start, u64 end,
	return ret;
}

int btrfs_validate_metadata_buffer(struct btrfs_io_bio *io_bio,
int btrfs_validate_metadata_buffer(struct btrfs_bio *bbio,
				   struct page *page, u64 start, u64 end,
				   int mirror)
{
+1 −1
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ void btrfs_btree_balance_dirty(struct btrfs_fs_info *fs_info);
void btrfs_btree_balance_dirty_nodelay(struct btrfs_fs_info *fs_info);
void btrfs_drop_and_free_fs_root(struct btrfs_fs_info *fs_info,
				 struct btrfs_root *root);
int btrfs_validate_metadata_buffer(struct btrfs_io_bio *io_bio,
int btrfs_validate_metadata_buffer(struct btrfs_bio *bbio,
				   struct page *page, u64 start, u64 end,
				   int mirror);
blk_status_t btrfs_submit_metadata_bio(struct inode *inode, struct bio *bio,
Loading