* [PATCH 0/2] Some block rsv fixes
@ 2020-10-26 18:18 Josef Bacik
2020-10-26 18:18 ` [PATCH 1/2] btrfs: print the block rsv type when we fail our reservation Josef Bacik
2020-10-26 18:18 ` [PATCH 2/2] btrfs: fix min reserved size calculation in merge_reloc_root Josef Bacik
0 siblings, 2 replies; 3+ messages in thread
From: Josef Bacik @ 2020-10-26 18:18 UTC (permalink / raw)
To: linux-btrfs, kernel-team
Hello,
Nikolay has noticed that -o enospc_debug was getting some warnings in
btrfs_use_block_rsv() on some tests. I dug into them and one class is easy to
fix as it's a straight regression. The other one is going to require some more
debugging, so in the meantime here's the two patches I have so far that can be
merged. The first is just to make my life easier when debugging these problems,
and the second is the actual regression fix. It should probably be tagged for
stable as well since the regression was backported to stable. Thanks,
Josef
Josef Bacik (2):
btrfs: print the block rsv type when we fail our reservation
btrfs: fix min reserved size calculation in merge_reloc_root
fs/btrfs/block-rsv.c | 3 ++-
fs/btrfs/relocation.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
--
2.26.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] btrfs: print the block rsv type when we fail our reservation
2020-10-26 18:18 [PATCH 0/2] Some block rsv fixes Josef Bacik
@ 2020-10-26 18:18 ` Josef Bacik
2020-10-26 18:18 ` [PATCH 2/2] btrfs: fix min reserved size calculation in merge_reloc_root Josef Bacik
1 sibling, 0 replies; 3+ messages in thread
From: Josef Bacik @ 2020-10-26 18:18 UTC (permalink / raw)
To: linux-btrfs, kernel-team
To help with debugging, print the type of the block rsv when we fail to
use our target block rsv in btrfs_use_block_rsv.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
fs/btrfs/block-rsv.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/block-rsv.c b/fs/btrfs/block-rsv.c
index 4651f8bf890b..04a6226e0388 100644
--- a/fs/btrfs/block-rsv.c
+++ b/fs/btrfs/block-rsv.c
@@ -519,7 +519,8 @@ struct btrfs_block_rsv *btrfs_use_block_rsv(struct btrfs_trans_handle *trans,
/*DEFAULT_RATELIMIT_BURST*/ 1);
if (__ratelimit(&_rs))
WARN(1, KERN_DEBUG
- "BTRFS: block rsv returned %d\n", ret);
+ "BTRFS: block rsv %d returned %d\n",
+ block_rsv->type, ret);
}
try_reserve:
ret = btrfs_reserve_metadata_bytes(root, block_rsv, blocksize,
--
2.26.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] btrfs: fix min reserved size calculation in merge_reloc_root
2020-10-26 18:18 [PATCH 0/2] Some block rsv fixes Josef Bacik
2020-10-26 18:18 ` [PATCH 1/2] btrfs: print the block rsv type when we fail our reservation Josef Bacik
@ 2020-10-26 18:18 ` Josef Bacik
1 sibling, 0 replies; 3+ messages in thread
From: Josef Bacik @ 2020-10-26 18:18 UTC (permalink / raw)
To: linux-btrfs, kernel-team
The minimum reserve size was adjusted to take into account the height of
the tree we are merging, however we can have a root with a level == 0.
What we want is root_level + 1 to get the number of nodes we may have to
cow. This fixes the enospc_debug warning pops with btrfs/101.
44d354abf33e ("btrfs: relocation: review the call sites which can be interrupted by signal")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
fs/btrfs/relocation.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 3602806d71bd..e1332f78d618 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -1696,7 +1696,8 @@ static noinline_for_stack int merge_reloc_root(struct reloc_control *rc,
* Thus the needed metadata size is at most root_level * nodesize,
* and * 2 since we have two trees to COW.
*/
- min_reserved = fs_info->nodesize * btrfs_root_level(root_item) * 2;
+ min_reserved = fs_info->nodesize *
+ (btrfs_root_level(root_item) + 1) * 2;
memset(&next_key, 0, sizeof(next_key));
while (1) {
--
2.26.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-10-26 18:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-26 18:18 [PATCH 0/2] Some block rsv fixes Josef Bacik
2020-10-26 18:18 ` [PATCH 1/2] btrfs: print the block rsv type when we fail our reservation Josef Bacik
2020-10-26 18:18 ` [PATCH 2/2] btrfs: fix min reserved size calculation in merge_reloc_root Josef Bacik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox