Update crypto patches
[ext4-patch-queue.git] / dont-count-external-journal-blocks-as-overhead
blob4a9b8490f5e901f785a9a709e8fac188a4304906
1 ext4: don't count external journal blocks as overhead
3 From: Eric Sandeen <sandeen@redhat.com>
5 This was fixed for ext3 with:
7 e6d8fb3 ext3: Count internal journal as bsddf overhead in ext3_statfs
9 but was never fixed for ext4.
11 With a large external journal and no used disk blocks, df comes
12 out negative without this, as journal blocks are added to the
13 overhead & subtracted from used blocks unconditionally.
15 Signed-off-by: Eric Sandeen <sandeen@redhat.com>
16 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
17 ---
19 ps: since this is stored in the on-disk superblock now, I'm not
20 sure how to fix up old filesystems, or if it matters much.
22 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
23 index 2c9e686..9674578 100644
24 --- a/fs/ext4/super.c
25 +++ b/fs/ext4/super.c
26 @@ -3338,8 +3338,8 @@ int ext4_calculate_overhead(struct super_block *sb)
27                         memset(buf, 0, PAGE_SIZE);
28                 cond_resched();
29         }
30 -       /* Add the journal blocks as well */
31 -       if (sbi->s_journal)
32 +       /* Add the internal journal blocks as well */
33 +       if (sbi->s_journal && !sbi->journal_bdev)
34                 overhead += EXT4_NUM_B2C(sbi, sbi->s_journal->j_maxlen);
36         sbi->s_overhead = overhead;
39 To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
40 the body of a message to majordomo@vger.kernel.org
41 More majordomo info at  http://vger.kernel.org/majordomo-info.html