From a1e17216dc445a3b951a9b1f65564767223e4be0 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Mon, 12 May 2014 10:14:10 -0400 Subject: [PATCH] add patch find-the-group-descriptors-on-a-1k-bigalloc,meta_bg-fs --- ...e-group-descriptors-on-a-1k-bigalloc,meta_bg-fs | 38 ++++++++++++++++++++++ series | 1 + 2 files changed, 39 insertions(+) create mode 100644 find-the-group-descriptors-on-a-1k-bigalloc,meta_bg-fs diff --git a/find-the-group-descriptors-on-a-1k-bigalloc,meta_bg-fs b/find-the-group-descriptors-on-a-1k-bigalloc,meta_bg-fs new file mode 100644 index 00000000..fc4ad064 --- /dev/null +++ b/find-the-group-descriptors-on-a-1k-bigalloc,meta_bg-fs @@ -0,0 +1,38 @@ +ext4: find the group descriptors on a 1k-block bigalloc,meta_bg filesystem + +From: "Darrick J. Wong" + +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 +Signed-off-by: "Theodore Ts'o" +--- + fs/ext4/super.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/fs/ext4/super.c b/fs/ext4/super.c +index 7f52a54..d968c64 100644 +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -2420,6 +2420,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)); + } + + diff --git a/series b/series index 7ab5c0cc..e732e9e7 100644 --- a/series +++ b/series @@ -12,6 +12,7 @@ remove-obsoleted-check fix-data-integrity-sync-in-ordered-mode avoid-unneeded-lookup-when-xattr-name-is-invalid +find-the-group-descriptors-on-a-1k-bigalloc,meta_bg-fs add-fallocate-mode-blocking-for-debugging -- 2.11.4.GIT