summaryrefslogtreecommitdiff
path: root/fs/btrfs/locking.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2018-08-24 16:15:51 +0200
committerDavid Sterba <dsterba@suse.com>2019-04-29 19:02:21 +0200
commit5c9c799ab78336a4161b16126952a7e1320a8c77 (patch)
treec419a5edcab793e6ed655ace2cb53649262be61e /fs/btrfs/locking.c
parent58a2ddaedbf74b8a209426128c130cc9f0dbd11b (diff)
btrfs: use assertion helpers for extent buffer read lock counters
Use the helpers where open coded. On non-debug builds, the warnings will not trigger and extent_buffer::read_locks become unused and can be moved to the appropriate section, saving a few bytes. 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.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c
index d3bb19835ab4..1088cf322fdd 100644
--- a/fs/btrfs/locking.c
+++ b/fs/btrfs/locking.c
@@ -164,7 +164,7 @@ again:
atomic_read(&eb->blocking_writers) == 0);
goto again;
}
- atomic_inc(&eb->read_locks);
+ btrfs_assert_tree_read_locks_get(eb);
btrfs_assert_spinning_readers_get(eb);
}
@@ -183,7 +183,7 @@ int btrfs_tree_read_lock_atomic(struct extent_buffer *eb)
read_unlock(&eb->lock);
return 0;
}
- atomic_inc(&eb->read_locks);
+ btrfs_assert_tree_read_locks_get(eb);
btrfs_assert_spinning_readers_get(eb);
return 1;
}
@@ -204,7 +204,7 @@ int btrfs_try_tree_read_lock(struct extent_buffer *eb)
read_unlock(&eb->lock);
return 0;
}
- atomic_inc(&eb->read_locks);
+ btrfs_assert_tree_read_locks_get(eb);
btrfs_assert_spinning_readers_get(eb);
return 1;
}
@@ -248,7 +248,7 @@ void btrfs_tree_read_unlock(struct extent_buffer *eb)
}
btrfs_assert_tree_read_locked(eb);
btrfs_assert_spinning_readers_put(eb);
- atomic_dec(&eb->read_locks);
+ btrfs_assert_tree_read_locks_put(eb);
read_unlock(&eb->lock);
}
@@ -272,7 +272,7 @@ void btrfs_tree_read_unlock_blocking(struct extent_buffer *eb)
/* atomic_dec_and_test implies a barrier */
if (atomic_dec_and_test(&eb->blocking_readers))
cond_wake_up_nomb(&eb->read_lock_wq);
- atomic_dec(&eb->read_locks);
+ btrfs_assert_tree_read_locks_put(eb);
}
/*