Skip to contentSkip to conversation

Btrfs: Fix inverted no_quota logic

PATCH In review [email protected] 2 participants 2 messages Jun 5, 2015 – Jun 8, 2015 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Btrfs: Fix inverted no_quota logic

From: Justin Maggard <[email protected]>

Both btrfs_add_delayed_tree_ref() and btrfs_add_delayed_data_ref() have inverted logic when setting the no_quota value for delayed refs. This is eventually double-checked in __btrfs_inc_extent_ref() and __btrfs_free_extent(), but not alloc_reserved_tree_block(), so it can throw off qgroup accounting.

---
 fs/btrfs/delayed-ref.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/delayed-ref.c +2 -2
index 8f8ed7d..b0ff795 100644
@@ -792,7 +792,7 @@ int btrfs_add_delayed_tree_ref(struct btrfs_fs_info *fs_info,
 	struct btrfs_delayed_ref_root *delayed_refs;
 
 	if (!is_fstree(ref_root) || !fs_info->quota_enabled)
-		no_quota = 0;
+		no_quota = 1;
 
 	BUG_ON(extent_op && extent_op->is_data);
 	ref = kmem_cache_alloc(btrfs_delayed_tree_ref_cachep, GFP_NOFS);
@@ -841,7 +841,7 @@ int btrfs_add_delayed_data_ref(struct btrfs_fs_info *fs_info,
 	struct btrfs_delayed_ref_root *delayed_refs;
 
 	if (!is_fstree(ref_root) || !fs_info->quota_enabled)
-		no_quota = 0;
+		no_quota = 1;
 
 	BUG_ON(extent_op && !extent_op->is_data);
 	ref = kmem_cache_alloc(btrfs_delayed_data_ref_cachep, GFP_NOFS);
Signature · 1 line
2.4.2
#1 lore raw

Hi, thanks for your patch.

But Fujitsu may push a huge quota related rework patchset and makes it no longer need to account quota at delayed-ref time.

So I'm afraid this patch with the next patch is not needed.

Thanks,
Qu

-------- Original Message --------
Subject: [PATCH] Btrfs: Fix inverted no_quota logic
From: <[email protected]>
To: <[email protected]>
Date: 2015年06月06日 07:07

Quoted 37 lines

From: Justin Maggard <[email protected]>

Both btrfs_add_delayed_tree_ref() and btrfs_add_delayed_data_ref() have inverted logic when setting the no_quota value for delayed refs. This is eventually double-checked in __btrfs_inc_extent_ref() and __btrfs_free_extent(), but not alloc_reserved_tree_block(), so it can throw off qgroup accounting.

---
  fs/btrfs/delayed-ref.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/delayed-ref.c +2 -2
index 8f8ed7d..b0ff795 100644
@@ -792,7 +792,7 @@ int btrfs_add_delayed_tree_ref(struct btrfs_fs_info *fs_info,
  	struct btrfs_delayed_ref_root *delayed_refs;
 
  	if (!is_fstree(ref_root) || !fs_info->quota_enabled)
-		no_quota = 0;
+		no_quota = 1;
 
  	BUG_ON(extent_op && extent_op->is_data);
  	ref = kmem_cache_alloc(btrfs_delayed_tree_ref_cachep, GFP_NOFS);
@@ -841,7 +841,7 @@ int btrfs_add_delayed_data_ref(struct btrfs_fs_info *fs_info,
  	struct btrfs_delayed_ref_root *delayed_refs;
 
  	if (!is_fstree(ref_root) || !fs_info->quota_enabled)
-		no_quota = 0;
+		no_quota = 1;
 
  	BUG_ON(extent_op && !extent_op->is_data);
  	ref = kmem_cache_alloc(btrfs_delayed_data_ref_cachep, GFP_NOFS);