Commit cb3a12d9 authored by David Sterba's avatar David Sterba
Browse files

btrfs: rename bio_flags in parameters and switch type



Several functions take parameter bio_flags that was simplified to just
compress type, unify it and change the type accordingly.

Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 0ff40013
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3253,7 +3253,7 @@ u64 btrfs_file_extent_end(const struct btrfs_path *path);

/* inode.c */
void btrfs_submit_data_bio(struct inode *inode, struct bio *bio,
			   int mirror_num, unsigned long bio_flags);
			   int mirror_num, enum btrfs_compression_type compress_type);
unsigned int btrfs_verify_data_csum(struct btrfs_bio *bbio,
				    u32 bio_offset, struct page *page,
				    u64 start, u64 end);
+15 −14
Original line number Diff line number Diff line
@@ -178,7 +178,8 @@ static int add_extent_changeset(struct extent_state *state, u32 bits,
	return ret;
}

static void submit_one_bio(struct bio *bio, int mirror_num, unsigned long bio_flags)
static void submit_one_bio(struct bio *bio, int mirror_num,
			   enum btrfs_compression_type compress_type)
{
	struct extent_io_tree *tree = bio->bi_private;

@@ -189,7 +190,7 @@ static void submit_one_bio(struct bio *bio, int mirror_num, unsigned long bio_fl

	if (is_data_inode(tree->private_data))
		btrfs_submit_data_bio(tree->private_data, bio, mirror_num,
					    bio_flags);
					    compress_type);
	else
		btrfs_submit_metadata_bio(tree->private_data, bio, mirror_num);
	/*
@@ -3246,7 +3247,7 @@ struct bio *btrfs_bio_clone_partial(struct bio *orig, u64 offset, u64 size)
 *                a contiguous page to the previous one
 * @size:	portion of page that we want to write
 * @pg_offset:	starting offset in the page
 * @bio_flags:	flags of the current bio to see if we can merge them
 * @compress_type:   compression type of the current bio to see if we can merge them
 *
 * Attempt to add a page to bio considering stripe alignment etc.
 *
@@ -3258,7 +3259,7 @@ static int btrfs_bio_add_page(struct btrfs_bio_ctrl *bio_ctrl,
			      struct page *page,
			      u64 disk_bytenr, unsigned int size,
			      unsigned int pg_offset,
			      unsigned long bio_flags)
			      enum btrfs_compression_type compress_type)
{
	struct bio *bio = bio_ctrl->bio;
	u32 bio_size = bio->bi_iter.bi_size;
@@ -3270,7 +3271,7 @@ static int btrfs_bio_add_page(struct btrfs_bio_ctrl *bio_ctrl,
	ASSERT(bio);
	/* The limit should be calculated when bio_ctrl->bio is allocated */
	ASSERT(bio_ctrl->len_to_oe_boundary && bio_ctrl->len_to_stripe_boundary);
	if (bio_ctrl->bio_flags != bio_flags)
	if (bio_ctrl->bio_flags != compress_type)
		return 0;

	if (bio_ctrl->bio_flags != BTRFS_COMPRESS_NONE)
@@ -3359,7 +3360,7 @@ static int alloc_new_bio(struct btrfs_inode *inode,
			 unsigned int opf,
			 bio_end_io_t end_io_func,
			 u64 disk_bytenr, u32 offset, u64 file_offset,
			 unsigned long bio_flags)
			 enum btrfs_compression_type compress_type)
{
	struct btrfs_fs_info *fs_info = inode->root->fs_info;
	struct bio *bio;
@@ -3370,12 +3371,12 @@ static int alloc_new_bio(struct btrfs_inode *inode,
	 * For compressed page range, its disk_bytenr is always @disk_bytenr
	 * passed in, no matter if we have added any range into previous bio.
	 */
	if (bio_flags != BTRFS_COMPRESS_NONE)
	if (compress_type != BTRFS_COMPRESS_NONE)
		bio->bi_iter.bi_sector = disk_bytenr >> SECTOR_SHIFT;
	else
		bio->bi_iter.bi_sector = (disk_bytenr + offset) >> SECTOR_SHIFT;
	bio_ctrl->bio = bio;
	bio_ctrl->bio_flags = bio_flags;
	bio_ctrl->bio_flags = compress_type;
	bio->bi_end_io = end_io_func;
	bio->bi_private = &inode->io_tree;
	bio->bi_opf = opf;
@@ -3434,7 +3435,7 @@ static int alloc_new_bio(struct btrfs_inode *inode,
 * @end_io_func:     end_io callback for new bio
 * @mirror_num:	     desired mirror to read/write
 * @prev_bio_flags:  flags of previous bio to see if we can merge the current one
 * @bio_flags:	flags of the current bio to see if we can merge them
 * @compress_type:   compress type for current bio
 */
static int submit_extent_page(unsigned int opf,
			      struct writeback_control *wbc,
@@ -3443,7 +3444,7 @@ static int submit_extent_page(unsigned int opf,
			      size_t size, unsigned long pg_offset,
			      bio_end_io_t end_io_func,
			      int mirror_num,
			      unsigned long bio_flags,
			      enum btrfs_compression_type compress_type,
			      bool force_bio_submit)
{
	int ret = 0;
@@ -3468,7 +3469,7 @@ static int submit_extent_page(unsigned int opf,
			ret = alloc_new_bio(inode, bio_ctrl, wbc, opf,
					    end_io_func, disk_bytenr, offset,
					    page_offset(page) + cur,
					    bio_flags);
					    compress_type);
			if (ret < 0)
				return ret;
		}
@@ -3476,14 +3477,14 @@ static int submit_extent_page(unsigned int opf,
		 * We must go through btrfs_bio_add_page() to ensure each
		 * page range won't cross various boundaries.
		 */
		if (bio_flags != BTRFS_COMPRESS_NONE)
		if (compress_type != BTRFS_COMPRESS_NONE)
			added = btrfs_bio_add_page(bio_ctrl, page, disk_bytenr,
					size - offset, pg_offset + offset,
					bio_flags);
					compress_type);
		else
			added = btrfs_bio_add_page(bio_ctrl, page,
					disk_bytenr + offset, size - offset,
					pg_offset + offset, bio_flags);
					pg_offset + offset, compress_type);

		/* Metadata page range should never be split */
		if (!is_data_inode(&inode->vfs_inode))
+1 −1
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ struct extent_io_tree;

typedef void (submit_bio_hook_t)(struct inode *inode, struct bio *bio,
					 int mirror_num,
					 unsigned long bio_flags);
					 enum btrfs_compression_type compress_type);

typedef blk_status_t (extent_submit_bio_start_t)(struct inode *inode,
		struct bio *bio, u64 dio_file_offset);
+4 −3
Original line number Diff line number Diff line
@@ -2573,7 +2573,7 @@ static blk_status_t extract_ordered_extent(struct btrfs_inode *inode,
 *    c-3) otherwise:			async submit
 */
void btrfs_submit_data_bio(struct inode *inode, struct bio *bio,
			   int mirror_num, unsigned long bio_flags)
			   int mirror_num, enum btrfs_compression_type compress_type)
{
	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
	struct btrfs_root *root = BTRFS_I(inode)->root;
@@ -2602,7 +2602,7 @@ void btrfs_submit_data_bio(struct inode *inode, struct bio *bio,
		if (ret)
			goto out;

		if (bio_flags != BTRFS_COMPRESS_NONE) {
		if (compress_type != BTRFS_COMPRESS_NONE) {
			/*
			 * btrfs_submit_compressed_read will handle completing
			 * the bio if there were any errors, so just return
@@ -7834,7 +7834,8 @@ static void btrfs_dio_private_put(struct btrfs_dio_private *dip)
}

static void submit_dio_repair_bio(struct inode *inode, struct bio *bio,
				  int mirror_num, unsigned long bio_flags)
				  int mirror_num,
				  enum btrfs_compression_type compress_type)
{
	struct btrfs_dio_private *dip = bio->bi_private;
	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);