Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf8cddd3 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by David Sterba
Browse files

btrfs: don't abuse REQ_OP_* flags for btrfs_map_block



btrfs_map_block supports different types of mappings, which to a large
extent resemble block layer operations.  But they don't always do, and
currently btrfs dangerously overlays it's own flag over the block layer
flags.  This is just asking for a conflict, so introduce a different
map flags enum inside of btrfs instead.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent e5517c2a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1539,7 +1539,7 @@ static int btrfsic_map_block(struct btrfsic_state *state, u64 bytenr, u32 len,
	struct btrfs_device *device;

	length = len;
	ret = btrfs_map_block(state->root->fs_info, READ,
	ret = btrfs_map_block(state->root->fs_info, BTRFS_MAP_READ,
			      bytenr, &length, &multi, mirror_num);

	if (ret) {
+0 −3
Original line number Diff line number Diff line
@@ -90,9 +90,6 @@ static const int btrfs_csum_sizes[] = { 4 };
/* four bytes for CRC32 */
#define BTRFS_EMPTY_DIR_SIZE 0

/* specific to btrfs_map_block(), therefore not in include/linux/blk_types.h */
#define REQ_GET_READ_MIRRORS	(1 << 30)

/* ioprio of readahead is set to idle */
#define BTRFS_IOPRIO_READA (IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0))

+1 −1
Original line number Diff line number Diff line
@@ -2036,7 +2036,7 @@ int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr,
	 */
	btrfs_bio_counter_inc_blocked(root->fs_info);
	/* Tell the block device(s) that the sectors can be discarded */
	ret = btrfs_map_block(root->fs_info, REQ_OP_DISCARD,
	ret = btrfs_map_block(root->fs_info, BTRFS_MAP_DISCARD,
			      bytenr, &num_bytes, &bbio, 0);
	/* Error condition is -ENOMEM */
	if (!ret) {
+1 −1
Original line number Diff line number Diff line
@@ -2029,7 +2029,7 @@ int repair_io_failure(struct inode *inode, u64 start, u64 length, u64 logical,
	 * read repair operation.
	 */
	btrfs_bio_counter_inc_blocked(fs_info);
	ret = btrfs_map_block(fs_info, WRITE, logical,
	ret = btrfs_map_block(fs_info, BTRFS_MAP_WRITE, logical,
			      &map_length, &bbio, mirror_num);
	if (ret) {
		btrfs_bio_counter_dec(fs_info);
+3 −3
Original line number Diff line number Diff line
@@ -1864,7 +1864,7 @@ int btrfs_merge_bio_hook(struct page *page, unsigned long offset,

	length = bio->bi_iter.bi_size;
	map_length = length;
	ret = btrfs_map_block(root->fs_info, bio_op(bio), logical,
	ret = btrfs_map_block(root->fs_info, btrfs_op(bio), logical,
			      &map_length, NULL, 0);
	if (ret < 0)
		return ret;
@@ -8406,7 +8406,7 @@ static int btrfs_submit_direct_hook(struct btrfs_dio_private *dip,
	int i;

	map_length = orig_bio->bi_iter.bi_size;
	ret = btrfs_map_block(root->fs_info, bio_op(orig_bio),
	ret = btrfs_map_block(root->fs_info, btrfs_op(orig_bio),
			      start_sector << 9, &map_length, NULL, 0);
	if (ret)
		return -EIO;
@@ -8472,7 +8472,7 @@ static int btrfs_submit_direct_hook(struct btrfs_dio_private *dip,
			btrfs_io_bio(bio)->logical = file_offset;

			map_length = orig_bio->bi_iter.bi_size;
			ret = btrfs_map_block(root->fs_info, bio_op(orig_bio),
			ret = btrfs_map_block(root->fs_info, btrfs_op(orig_bio),
					      start_sector << 9,
					      &map_length, NULL, 0);
			if (ret) {
Loading