btrfs: check quota status earlier and don't do unnecessary frees
authorDavid Sterba <dsterba@suse.com>
Mon, 13 Feb 2017 13:05:24 +0000 (14:05 +0100)
committerDavid Sterba <dsterba@suse.com>
Fri, 17 Feb 2017 11:03:50 +0000 (12:03 +0100)
Status of quotas should be the first check in
btrfs_qgroup_account_extent and we can return immediatelly, no need to
do no-op ulist frees.

Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/qgroup.c

index 627126daf25be4238b8837135328cfba3d3a9475..0d3c9a1062b047d51a01c865b5bf3a003b609ed0 100644 (file)
@@ -1945,13 +1945,14 @@ btrfs_qgroup_account_extent(struct btrfs_trans_handle *trans,
        u64 nr_old_roots = 0;
        int ret = 0;
 
+       if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags))
+               return 0;
+
        if (new_roots)
                nr_new_roots = new_roots->nnodes;
        if (old_roots)
                nr_old_roots = old_roots->nnodes;
 
-       if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags))
-               goto out_free;
        BUG_ON(!fs_info->quota_root);
 
        trace_btrfs_qgroup_account_extent(fs_info, bytenr, num_bytes,