btrfs: switch extent_buffer::lock_nested to bool
authorDavid Sterba <dsterba@suse.com>
Fri, 24 Aug 2018 14:31:17 +0000 (16:31 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 29 Apr 2019 17:02:21 +0000 (19:02 +0200)
The member is tracking simple status of the lock, we can use bool for
that and make some room for further space reduction in the structure.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_io.c
fs/btrfs/extent_io.h
fs/btrfs/locking.c

index 97d32b80060ddda1900b0631d344e760e5d53174..d61b526dc8561ebc7a8174f4894b82d4e09ec073 100644 (file)
@@ -4679,7 +4679,7 @@ __alloc_extent_buffer(struct btrfs_fs_info *fs_info, u64 start,
        rwlock_init(&eb->lock);
        atomic_set(&eb->blocking_readers, 0);
        atomic_set(&eb->blocking_writers, 0);
-       eb->lock_nested = 0;
+       eb->lock_nested = false;
        init_waitqueue_head(&eb->write_lock_wq);
        init_waitqueue_head(&eb->read_lock_wq);
 
index 43a9530279db57fcb2499e9310258e129d659020..586baed0378056f37eb2bfefb18597fec783b13a 100644 (file)
@@ -162,7 +162,7 @@ struct extent_buffer {
 
        atomic_t blocking_writers;
        atomic_t blocking_readers;
-       short lock_nested;
+       bool lock_nested;
        /* >= 0 if eb belongs to a log tree, -1 otherwise */
        short log_index;
 
index 3f7b5989e31e21b690fa9f203122e523fcd459a4..6df03ba360266ca39bab3327774be10edc296103 100644 (file)
@@ -172,7 +172,7 @@ again:
                 * called on a partly (write-)locked tree.
                 */
                BUG_ON(eb->lock_nested);
-               eb->lock_nested = 1;
+               eb->lock_nested = true;
                read_unlock(&eb->lock);
                return;
        }
@@ -261,7 +261,7 @@ void btrfs_tree_read_unlock(struct extent_buffer *eb)
         * field only matters to the lock owner.
         */
        if (eb->lock_nested && current->pid == eb->lock_owner) {
-               eb->lock_nested = 0;
+               eb->lock_nested = false;
                return;
        }
        btrfs_assert_tree_read_locked(eb);
@@ -282,7 +282,7 @@ void btrfs_tree_read_unlock_blocking(struct extent_buffer *eb)
         * field only matters to the lock owner.
         */
        if (eb->lock_nested && current->pid == eb->lock_owner) {
-               eb->lock_nested = 0;
+               eb->lock_nested = false;
                return;
        }
        btrfs_assert_tree_read_locked(eb);