btrfs-progs: switch fs_info::system_allocs to bit
authorDavid Sterba <dsterba@suse.com>
Mon, 28 Aug 2017 15:16:51 +0000 (17:16 +0200)
committerDavid Sterba <dsterba@suse.com>
Fri, 8 Sep 2017 14:15:05 +0000 (16:15 +0200)
The value really is 0 or 1, the test in btrfs_reserve_extent can be
simplified.

Signed-off-by: David Sterba <dsterba@suse.com>
ctree.h
extent-tree.c

diff --git a/ctree.h b/ctree.h
index c95157d..4ad34f6 100644 (file)
--- a/ctree.h
+++ b/ctree.h
@@ -1126,8 +1126,8 @@ struct btrfs_fs_info {
 
        struct btrfs_fs_devices *fs_devices;
        struct list_head space_info;
-       int system_allocs;
 
+       unsigned int system_allocs:1;
        unsigned int readonly:1;
        unsigned int on_restoring:1;
        unsigned int is_chunk_recover:1;
index 81a17a3..f1cc4bf 100644 (file)
@@ -2663,8 +2663,7 @@ int btrfs_reserve_extent(struct btrfs_trans_handle *trans,
                alloc_profile = info->avail_data_alloc_bits &
                                info->data_alloc_profile;
                data = BTRFS_BLOCK_GROUP_DATA | alloc_profile;
-       } else if ((info->system_allocs > 0 || root == info->chunk_root) &&
-                  info->system_allocs >= 0) {
+       } else if (info->system_allocs == 1 || root == info->chunk_root) {
                alloc_profile = info->avail_system_alloc_bits &
                                info->system_alloc_profile;
                data = BTRFS_BLOCK_GROUP_SYSTEM | alloc_profile;