Skip to contentSkip to conversation

btrfs: fix wrong data space statistics

PATCH In review Miao Xie 2 participants 2 messages Jan 5, 2011 – Jan 12, 2011 Btrfs file system

lore
Share & tools
lore

Miao Xie

author
#0 lore raw

PATCH v3 1/6 btrfs: fix wrong data space statistics

Josef has implemented mixed data/metadata chunks, we must add those chunks' space just like data chunks.

---
 fs/btrfs/super.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
fs/btrfs/super.c +3 -4
index 61bd79a..1d21208 100644
@@ -768,11 +768,10 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf)
 
 	rcu_read_lock();
 	list_for_each_entry_rcu(found, head, list) {
-		if (found->flags & (BTRFS_BLOCK_GROUP_METADATA |
-				    BTRFS_BLOCK_GROUP_SYSTEM))
-			total_used_data += found->disk_total;
-		else
+		if (found->flags & BTRFS_BLOCK_GROUP_DATA)
 			total_used_data += found->disk_used;
+		else
+			total_used_data += found->disk_total;
 		total_used += found->disk_used;
 	}
 	rcu_read_unlock();
Signature · 1 line
1.7.2.3
Reviewed-by on v3 1/6
#1 lore raw
Quoted 4 lines · Miao Xie

Josef has implemented mixed data/metadata chunks, we must add those chunks' space just like data chunks.

Thanks,

Josef

Quoted 29 lines
---
 fs/btrfs/super.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
fs/btrfs/super.c +3 -4
index 61bd79a..1d21208 100644
@@ -768,11 +768,10 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf)
 
 	rcu_read_lock();
 	list_for_each_entry_rcu(found, head, list) {
-		if (found->flags & (BTRFS_BLOCK_GROUP_METADATA |
-				    BTRFS_BLOCK_GROUP_SYSTEM))
-			total_used_data += found->disk_total;
-		else
+		if (found->flags & BTRFS_BLOCK_GROUP_DATA)
 			total_used_data += found->disk_used;
+		else
+			total_used_data += found->disk_total;
 		total_used += found->disk_used;
 	}
 	rcu_read_unlock();
Signature · 5 lines
1.7.2.3
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html