diff options
author | Josef Bacik <josef@toxicpanda.com> | 2020-08-20 17:46:04 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2020-10-07 12:12:16 +0200 |
commit | bf77467a93bdf11d815f5c5f25206a0d058da8de (patch) | |
tree | de61ced135cc6209b53edc8829335969cb9c8ec8 /fs/btrfs/locking.h | |
parent | btrfs: introduce BTRFS_NESTING_COW for cow'ing blocks (diff) | |
download | linux-bf77467a93bdf11d815f5c5f25206a0d058da8de.tar.xz linux-bf77467a93bdf11d815f5c5f25206a0d058da8de.zip |
btrfs: introduce BTRFS_NESTING_LEFT/BTRFS_NESTING_RIGHT
Our lockdep maps are based on rootid+level, however in some cases we
will lock adjacent blocks on the same level, namely in searching forward
or in split/balance. Because of this lockdep will complain, so we need
a separate subclass to indicate to lockdep that these are different
locks.
lock leaf -> BTRFS_NESTING_NORMAL
cow leaf -> BTRFS_NESTING_COW
split leaf
lock left -> BTRFS_NESTING_LEFT
lock right -> BTRFS_NESTING_RIGHT
The above graph illustrates the need for this new nesting subclass.
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/locking.h')
-rw-r--r-- | fs/btrfs/locking.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/btrfs/locking.h b/fs/btrfs/locking.h index 8b47ba34fb03..5844bc1c8410 100644 --- a/fs/btrfs/locking.h +++ b/fs/btrfs/locking.h @@ -33,6 +33,18 @@ enum btrfs_lock_nesting { BTRFS_NESTING_COW, /* + * Oftentimes we need to lock adjacent nodes on the same level while + * still holding the lock on the original node we searched to, such as + * for searching forward or for split/balance. + * + * Because of this we need to indicate to lockdep that this is + * acceptable by having a different subclass for each of these + * operations. + */ + BTRFS_NESTING_LEFT, + BTRFS_NESTING_RIGHT, + + /* * We are limited to MAX_LOCKDEP_SUBLCLASSES number of subclasses, so * add this in here and add a static_assert to keep us from going over * the limit. As of this writing we're limited to 8, and we're |