Skip to content

Commit 70146f2

Browse files
committed
btrfs: enhance extent_io_tree error reports
Pass the type of the extent io tree operation which failed in the report helper. The message wording and contents is updated, though locking might be the cause of the error it's probably not the only one and we're interested in the state. Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 3a97347 commit 70146f2

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

fs/btrfs/extent-io-tree.c

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,14 @@ static inline struct extent_state *tree_search(struct extent_io_tree *tree, u64
313313
return tree_search_for_insert(tree, offset, NULL, NULL);
314314
}
315315

316-
static void extent_io_tree_panic(struct extent_io_tree *tree, int err)
316+
static void extent_io_tree_panic(const struct extent_io_tree *tree,
317+
const struct extent_state *state,
318+
const char *opname,
319+
int err)
317320
{
318321
btrfs_panic(tree->fs_info, err,
319-
"locking error: extent tree was modified by another thread while locked");
322+
"extent io tree error on %s state start %llu end %llu",
323+
opname, state->start, state->end);
320324
}
321325

322326
static void merge_prev_state(struct extent_io_tree *tree, struct extent_state *state)
@@ -676,7 +680,7 @@ int __clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
676680
goto search_again;
677681
err = split_state(tree, state, prealloc, start);
678682
if (err)
679-
extent_io_tree_panic(tree, err);
683+
extent_io_tree_panic(tree, state, "split", err);
680684

681685
prealloc = NULL;
682686
if (err)
@@ -698,7 +702,7 @@ int __clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
698702
goto search_again;
699703
err = split_state(tree, state, prealloc, end + 1);
700704
if (err)
701-
extent_io_tree_panic(tree, err);
705+
extent_io_tree_panic(tree, state, "split", err);
702706

703707
if (wake)
704708
wake_up(&state->wq);
@@ -1133,7 +1137,7 @@ static int __set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
11331137
goto search_again;
11341138
err = split_state(tree, state, prealloc, start);
11351139
if (err)
1136-
extent_io_tree_panic(tree, err);
1140+
extent_io_tree_panic(tree, state, "split", err);
11371141

11381142
prealloc = NULL;
11391143
if (err)
@@ -1181,7 +1185,7 @@ static int __set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
11811185
inserted_state = insert_state(tree, prealloc, bits, changeset);
11821186
if (IS_ERR(inserted_state)) {
11831187
err = PTR_ERR(inserted_state);
1184-
extent_io_tree_panic(tree, err);
1188+
extent_io_tree_panic(tree, prealloc, "insert", err);
11851189
}
11861190

11871191
cache_state(inserted_state, cached_state);
@@ -1209,7 +1213,7 @@ static int __set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
12091213
goto search_again;
12101214
err = split_state(tree, state, prealloc, end + 1);
12111215
if (err)
1212-
extent_io_tree_panic(tree, err);
1216+
extent_io_tree_panic(tree, state, "split", err);
12131217

12141218
set_state_bits(tree, prealloc, bits, changeset);
12151219
cache_state(prealloc, cached_state);
@@ -1363,7 +1367,7 @@ int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
13631367
}
13641368
err = split_state(tree, state, prealloc, start);
13651369
if (err)
1366-
extent_io_tree_panic(tree, err);
1370+
extent_io_tree_panic(tree, state, "split", err);
13671371
prealloc = NULL;
13681372
if (err)
13691373
goto out;
@@ -1411,7 +1415,7 @@ int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
14111415
inserted_state = insert_state(tree, prealloc, bits, NULL);
14121416
if (IS_ERR(inserted_state)) {
14131417
err = PTR_ERR(inserted_state);
1414-
extent_io_tree_panic(tree, err);
1418+
extent_io_tree_panic(tree, prealloc, "insert", err);
14151419
}
14161420
cache_state(inserted_state, cached_state);
14171421
if (inserted_state == prealloc)
@@ -1434,7 +1438,7 @@ int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
14341438

14351439
err = split_state(tree, state, prealloc, end + 1);
14361440
if (err)
1437-
extent_io_tree_panic(tree, err);
1441+
extent_io_tree_panic(tree, state, "split", err);
14381442

14391443
set_state_bits(tree, prealloc, bits, NULL);
14401444
cache_state(prealloc, cached_state);

0 commit comments

Comments
 (0)