Commit 650c9ca
btrfs: do not BUG_ON() on failure to migrate space when replacing extents
At btrfs_replace_file_extents(), if we fail to migrate reserved metadata
space from the transaction block reserve into the local block reserve,
we trigger a BUG_ON(). This is because it should not be possible to have
a failure here, as we reserved more space when we started the transaction
than the space we want to migrate. However having a BUG_ON() is way too
drastic, we can perfectly handle the failure and return the error to the
caller. So just do that instead, and add a WARN_ON() to make it easier
to notice the failure if it ever happens (which is particularly useful
for fstests, and the warning will trigger a failure of a test case).
Reviewed-by: Boris Burkov <[email protected]>
Signed-off-by: Filipe Manana <[email protected]>
Signed-off-by: David Sterba <[email protected]>1 parent 983d820 commit 650c9ca
1 file changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2718 | 2718 | | |
2719 | 2719 | | |
2720 | 2720 | | |
2721 | | - | |
| 2721 | + | |
| 2722 | + | |
2722 | 2723 | | |
2723 | 2724 | | |
2724 | 2725 | | |
| |||
2837 | 2838 | | |
2838 | 2839 | | |
2839 | 2840 | | |
2840 | | - | |
| 2841 | + | |
| 2842 | + | |
2841 | 2843 | | |
2842 | 2844 | | |
2843 | 2845 | | |
| |||
0 commit comments