diff options
author | David Sterba <dsterba@suse.com> | 2018-08-24 15:53:42 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2019-04-29 19:02:20 +0200 |
commit | 225948dedc9d3ac514eb1f4b7318d541cfd80aaf (patch) | |
tree | e59450535eebd25104b96a8e6cad956affb282ea /fs/btrfs/locking.c | |
parent | 843ccf9f46baff289946e897b11fd813de62d06f (diff) |
btrfs: add assertion helpers for spinning readers
Add helpers for conditional DEBUG build to assert that the extent buffer
spinning_readers constraints are met. Will be used in followup patches.
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/locking.c')
-rw-r--r-- | fs/btrfs/locking.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c index a5a3c5118f61..2dd3ae524aa3 100644 --- a/fs/btrfs/locking.c +++ b/fs/btrfs/locking.c @@ -32,10 +32,23 @@ static void btrfs_assert_no_spinning_writers(struct extent_buffer *eb) WARN_ON(atomic_read(&eb->spinning_writers)); } +static void btrfs_assert_spinning_readers_get(struct extent_buffer *eb) +{ + atomic_inc(&eb->spinning_readers); +} + +static void btrfs_assert_spinning_readers_put(struct extent_buffer *eb) +{ + WARN_ON(atomic_read(&eb->spinning_readers) == 0); + atomic_dec(&eb->spinning_readers); +} + #else static void btrfs_assert_spinning_writers_get(struct extent_buffer *eb) { } static void btrfs_assert_spinning_writers_put(struct extent_buffer *eb) { } static void btrfs_assert_no_spinning_writers(struct extent_buffer *eb) { } +static void btrfs_assert_spinning_readers_put(struct extent_buffer *eb) { } +static void btrfs_assert_spinning_readers_get(struct extent_buffer *eb) { } #endif void btrfs_set_lock_blocking_read(struct extent_buffer *eb) |