diff options
author | Josef Bacik <josef@toxicpanda.com> | 2020-08-20 17:46:08 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2020-10-07 12:12:17 +0200 |
commit | ca9d473a3e300bcddc73c00fdf2f4bf6ca43c4a2 (patch) | |
tree | ce8598f6b0a01f7fc44e7d495dba46011b2dd8d6 /fs/btrfs/ctree.c | |
parent | btrfs: introduce BTRFS_NESTING_NEW_ROOT for adding new roots (diff) | |
download | linux-ca9d473a3e300bcddc73c00fdf2f4bf6ca43c4a2.tar.xz linux-ca9d473a3e300bcddc73c00fdf2f4bf6ca43c4a2.zip |
btrfs: use BTRFS_NESTED_NEW_ROOT for double splits
I've made this change separate since it requires both of the newly added
NESTED flags and I didn't want to slip it into one of those changes.
If we do a double split of a node we can end up doing a
BTRFS_NESTED_SPLIT on level 0, which throws lockdep off because it
appears as a double lock. Since we're maxed out on subclasses, use
BTRFS_NESTED_NEW_ROOT if we had to do a double split. This is OK
because we won't have to do a double split if we had to insert a new
root, and the new root would be at a higher level anyway.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/ctree.c')
-rw-r--r-- | fs/btrfs/ctree.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index d61ea238ad8a..7dbfa365eb18 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -4324,8 +4324,18 @@ again: else btrfs_item_key(l, &disk_key, mid); + /* + * We have to about BTRFS_NESTING_NEW_ROOT here if we've done a double + * split, because we're only allowed to have MAX_LOCKDEP_SUBCLASSES + * subclasses, which is 8 at the time of this patch, and we've maxed it + * out. In the future we could add a + * BTRFS_NESTING_SPLIT_THE_SPLITTENING if we need to, but for now just + * use BTRFS_NESTING_NEW_ROOT. + */ right = alloc_tree_block_no_bg_flush(trans, root, 0, &disk_key, 0, - l->start, 0, BTRFS_NESTING_SPLIT); + l->start, 0, num_doubles ? + BTRFS_NESTING_NEW_ROOT : + BTRFS_NESTING_SPLIT); if (IS_ERR(right)) return PTR_ERR(right); |