Skip to content

Commit 9e2aff9

Browse files
Christoph Hellwigkdave
authored andcommitted
btrfs: stop using lock_extent in btrfs_buffer_uptodate
The only other place that locks extents on the btree inode is read_extent_buffer_subpage while reading in the partial page for a buffer. This means locking the extent in btrfs_buffer_uptodate does not synchronize with anything on non-subpage file systems, and on subpage file systems it only waits for a parallel read(-ahead) to finish, which seems to be counter to what the callers actually expect. Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent f3d315e commit 9e2aff9

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

fs/btrfs/disk-io.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,6 @@ static void csum_tree_block(struct extent_buffer *buf, u8 *result)
112112
*/
113113
int btrfs_buffer_uptodate(struct extent_buffer *eb, u64 parent_transid, int atomic)
114114
{
115-
struct inode *btree_inode = eb->pages[0]->mapping->host;
116-
struct extent_io_tree *io_tree = &BTRFS_I(btree_inode)->io_tree;
117-
struct extent_state *cached_state = NULL;
118-
int ret = 1;
119-
120115
if (!extent_buffer_uptodate(eb))
121116
return 0;
122117

@@ -126,19 +121,16 @@ int btrfs_buffer_uptodate(struct extent_buffer *eb, u64 parent_transid, int atom
126121
if (atomic)
127122
return -EAGAIN;
128123

129-
lock_extent(io_tree, eb->start, eb->start + eb->len - 1, &cached_state);
130124
if (!extent_buffer_uptodate(eb) ||
131125
btrfs_header_generation(eb) != parent_transid) {
132126
btrfs_err_rl(eb->fs_info,
133127
"parent transid verify failed on logical %llu mirror %u wanted %llu found %llu",
134128
eb->start, eb->read_mirror,
135129
parent_transid, btrfs_header_generation(eb));
136130
clear_extent_buffer_uptodate(eb);
137-
ret = 0;
131+
return 0;
138132
}
139-
unlock_extent(io_tree, eb->start, eb->start + eb->len - 1,
140-
&cached_state);
141-
return ret;
133+
return 1;
142134
}
143135

144136
static bool btrfs_supported_super_csum(u16 csum_type)

0 commit comments

Comments
 (0)