linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: tytso@mit.edu, darrick.wong@oracle.com
Cc: linux-ext4@vger.kernel.org
Subject: [PATCH 1/5] ext4: Find the group descriptors on a 1k-block bigalloc, meta_bg filesystem
Date: Thu, 01 May 2014 16:17:27 -0700	[thread overview]
Message-ID: <20140501231727.892.45729.stgit@birch.djwong.org> (raw)
In-Reply-To: <20140501231720.892.58712.stgit@birch.djwong.org>

On a filesystem with a 1k block size, the group descriptors live in
block 2, not block 1.  If the filesystem has bigalloc,meta_bg set,
however, the calculation of the group descriptor table location does
not take this into account and returns the wrong block number.  Fix
the calculation to return the correct value for this case.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/ext4/super.c |   10 ++++++++++
 1 file changed, 10 insertions(+)


diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 6f9e6fa..32967cb 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2404,6 +2404,16 @@ static ext4_fsblk_t descriptor_loc(struct super_block *sb,
 	if (ext4_bg_has_super(sb, bg))
 		has_super = 1;
 
+	/*
+	 * If we have a meta_bg fs with 1k blocks, group 0's GDT is at
+	 * block 2, not 1.  If s_first_data_block == 0 (bigalloc is enabled
+	 * on modern mke2fs or blksize > 1k on older mke2fs) then we must
+	 * compensate.
+	 */
+	if (sb->s_blocksize == 1024 && nr == 0 &&
+	    le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block) == 0)
+		has_super++;
+
 	return (has_super + ext4_group_first_block_no(sb, bg));
 }
 


  reply	other threads:[~2014-05-01 23:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-01 23:17 [PATCH 0/5] miscellaneous kernel ext4 fixes Darrick J. Wong
2014-05-01 23:17 ` Darrick J. Wong [this message]
2014-05-01 23:17 ` [PATCH 2/5] ext4: fix block bitmap initialization under sparse_super2 Darrick J. Wong
2014-05-12 14:16   ` Theodore Ts'o
2014-05-01 23:17 ` [PATCH 3/5] ext4: fix block bitmap validation when bigalloc, ^flex_bg Darrick J. Wong
2014-05-12 14:22   ` Theodore Ts'o
2014-05-01 23:17 ` [PATCH 4/5] ext4: don't crash when validating block bitmap Darrick J. Wong
2014-05-12 14:24   ` Theodore Ts'o
2014-05-13 22:33     ` Darrick J. Wong
2014-05-01 23:17 ` [PATCH 5/5] ext4: enforce ext5 feature set and mount options Darrick J. Wong
2014-05-02  9:47   ` Lukáš Czerner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140501231727.892.45729.stgit@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).