All of lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND][PATCH 2/2] ext4: use journal inode to determine journal overhead
@ 2016-09-22 15:07 Eric Whitney
  2016-09-30  6:12 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Whitney @ 2016-09-22 15:07 UTC (permalink / raw)
  To: linux-ext4; +Cc: tytso

When a file system contains an internal journal that has not been
loaded, use the journal inode's i_size field to determine its
contribution to the file system's overhead.  (The journal's j_maxlen
field is normally used to determine its size, but it's unavailable when
the journal has not been loaded.)

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
---
 fs/ext4/super.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 4b0ca25..1a7b6fd 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3210,6 +3210,8 @@ int ext4_calculate_overhead(struct super_block *sb)
 {
 	struct ext4_sb_info *sbi = EXT4_SB(sb);
 	struct ext4_super_block *es = sbi->s_es;
+	struct inode *j_inode;
+	unsigned int j_blocks, j_inum = le32_to_cpu(es->s_journal_inum);
 	ext4_group_t i, ngroups = ext4_get_groups_count(sb);
 	ext4_fsblk_t overhead = 0;
 	char *buf = (char *) get_zeroed_page(GFP_NOFS);
@@ -3240,10 +3242,23 @@ int ext4_calculate_overhead(struct super_block *sb)
 			memset(buf, 0, PAGE_SIZE);
 		cond_resched();
 	}
-	/* Add the internal journal blocks as well */
+
+	/*
+	 * Add the internal journal blocks whether the journal has been
+	 * loaded or not
+	 */
 	if (sbi->s_journal && !sbi->journal_bdev)
 		overhead += EXT4_NUM_B2C(sbi, sbi->s_journal->j_maxlen);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RESEND][PATCH 2/2] ext4: use journal inode to determine journal overhead
  2016-09-22 15:07 [RESEND][PATCH 2/2] ext4: use journal inode to determine journal overhead Eric Whitney
@ 2016-09-30  6:12 ` Theodore Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2016-09-30  6:12 UTC (permalink / raw)
  To: Eric Whitney; +Cc: linux-ext4

On Thu, Sep 22, 2016 at 11:07:52AM -0400, Eric Whitney wrote:
> When a file system contains an internal journal that has not been
> loaded, use the journal inode's i_size field to determine its
> contribution to the file system's overhead.  (The journal's j_maxlen
> field is normally used to determine its size, but it's unavailable when
> the journal has not been loaded.)
> 
> Signed-off-by: Eric Whitney <enwlinux@gmail.com>

Thanks, applied.

							- Ted

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-30  6:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-22 15:07 [RESEND][PATCH 2/2] ext4: use journal inode to determine journal overhead Eric Whitney
2016-09-30  6:12 ` Theodore Ts'o

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.