Skip to contentSkip to conversation

ext3: Count journal as bsddf overhead in ext3_statfs

PATCH In review Eric Sandeen 2 participants 2 messages Oct 15, 2013 – Oct 16, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ext3: Count journal as bsddf overhead in ext3_statfs

ext4 counts journal space as bsddf overhead, but ext3 does not.

For some reason when I patched ext4 I thought I should leave ext3 alone, but frankly it makes more sense to fix it, I think.

Otherwise we get inconsistent behavior from ext3 under ext3.ko, and ext3 under ext4.ko, which is not at all desirable...

This is testable by xfstests shared/289, though it will need modification because it currently special-cases ext3.

---

fs/ext3/super.c +4 -0
index c50c761..37fd31e 100644
@@ -2825,6 +2825,10 @@ static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf)
 		 * bitmap, and an inode table.
 		 */
 		overhead += ngroups * (2 + sbi->s_itb_per_group);
+
+		/* Add the journal blocks as well */
+                overhead += sbi->s_journal->j_maxlen;
+
 		sbi->s_overhead_last = overhead;
 		smp_wmb();
 		sbi->s_blocks_last = le32_to_cpu(es->s_blocks_count);
#1 lore raw
Quoted 5 lines · Eric Sandeen

ext4 counts journal space as bsddf overhead, but ext3 does not.

For some reason when I patched ext4 I thought I should leave ext3 alone, but frankly it makes more sense to fix it, I think.

Quoted 7 lines

Otherwise we get inconsistent behavior from ext3 under ext3.ko, and ext3 under ext4.ko, which is not at all desirable...

This is testable by xfstests shared/289, though it will need modification because it currently special-cases ext3.

OK, fair enough. Applied to my tree.

Honza

Quoted 18 lines

---

fs/ext3/super.c +4 -0
index c50c761..37fd31e 100644
@@ -2825,6 +2825,10 @@ static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf)
 		 * bitmap, and an inode table.
 		 */
 		overhead += ngroups * (2 + sbi->s_itb_per_group);
+
+		/* Add the journal blocks as well */
+                overhead += sbi->s_journal->j_maxlen;
+
 		sbi->s_overhead_last = overhead;
 		smp_wmb();
 		sbi->s_blocks_last = le32_to_cpu(es->s_blocks_count);
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR