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

btrfs: stop tracking failed reads in the I/O tree



There is a separate I/O failure tree to track the fail reads, so remove
the extra EXTENT_DAMAGED bit in the I/O tree as it's set but never used.

Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
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 23408d81
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@ struct io_failure_record;
#define EXTENT_NODATASUM	(1U << 7)
#define EXTENT_CLEAR_META_RESV	(1U << 8)
#define EXTENT_NEED_WAIT	(1U << 9)
#define EXTENT_DAMAGED		(1U << 10)
#define EXTENT_NORESERVE	(1U << 11)
#define EXTENT_QGROUP_RESERVED	(1U << 12)
#define EXTENT_CLEAR_DATA_RESV	(1U << 13)
+2 −15
Original line number Diff line number Diff line
@@ -519,20 +519,14 @@ static struct io_failure_record *get_failrec(struct btrfs_inode *inode, u64 star
	return failrec;
}

static int free_io_failure(struct btrfs_inode *inode,
static void free_io_failure(struct btrfs_inode *inode,
			    struct io_failure_record *rec)
{
	int ret;

	spin_lock(&inode->io_failure_lock);
	rb_erase(&rec->rb_node, &inode->io_failure_tree);
	spin_unlock(&inode->io_failure_lock);

	ret = clear_extent_bits(&inode->io_tree, rec->bytenr,
				rec->bytenr + rec->len - 1,
				EXTENT_DAMAGED);
	kfree(rec);
	return ret;
}

/*
@@ -742,7 +736,6 @@ static struct io_failure_record *btrfs_get_io_failure_record(struct inode *inode
	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
	u64 start = bbio->file_offset + bio_offset;
	struct io_failure_record *failrec;
	struct extent_io_tree *tree = &BTRFS_I(inode)->io_tree;
	const u32 sectorsize = fs_info->sectorsize;
	int ret;

@@ -796,12 +789,6 @@ static struct io_failure_record *btrfs_get_io_failure_record(struct inode *inode
		kfree(failrec);
		return ERR_PTR(ret);
	}
	ret = set_extent_bits(tree, start, start + sectorsize - 1,
			      EXTENT_DAMAGED);
	if (ret) {
		free_io_failure(BTRFS_I(inode), failrec);
		return ERR_PTR(ret);
	}

	return failrec;
}
+0 −1
Original line number Diff line number Diff line
@@ -80,7 +80,6 @@ static void extent_flag_to_str(const struct extent_state *state, char *dest)
	PRINT_ONE_FLAG(state, dest, cur, NODATASUM);
	PRINT_ONE_FLAG(state, dest, cur, CLEAR_META_RESV);
	PRINT_ONE_FLAG(state, dest, cur, NEED_WAIT);
	PRINT_ONE_FLAG(state, dest, cur, DAMAGED);
	PRINT_ONE_FLAG(state, dest, cur, NORESERVE);
	PRINT_ONE_FLAG(state, dest, cur, QGROUP_RESERVED);
	PRINT_ONE_FLAG(state, dest, cur, CLEAR_DATA_RESV);
+0 −1
Original line number Diff line number Diff line
@@ -153,7 +153,6 @@ FLUSH_STATES
	{ EXTENT_NODATASUM,		"NODATASUM"},		\
	{ EXTENT_CLEAR_META_RESV,	"CLEAR_META_RESV"},	\
	{ EXTENT_NEED_WAIT,		"NEED_WAIT"},		\
	{ EXTENT_DAMAGED,		"DAMAGED"},		\
	{ EXTENT_NORESERVE,		"NORESERVE"},		\
	{ EXTENT_QGROUP_RESERVED,	"QGROUP_RESERVED"},	\
	{ EXTENT_CLEAR_DATA_RESV,	"CLEAR_DATA_RESV"},	\