diff mbox

[02/12] libext2fs: automatically enable meta_bg to avoid filling up BG 0

Message ID 20151012215642.29065.18353.stgit@birch.djwong.org
State Not Applicable, archived
Headers show

Commit Message

Darrick Wong Oct. 12, 2015, 9:56 p.m. UTC
If during formatting we'd lose more than half of a block group to
group descriptors and other metadata, enable the meta_bg feature.
This enables us to create >500T filesystems with default options.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 lib/ext2fs/initialize.c |    5 +++++
 1 file changed, 5 insertions(+)



--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Andreas Dilger Oct. 13, 2015, 2:34 a.m. UTC | #1
The commit comment says enable meta_bg if 1/2 of the block group
is full, but the code checks for 3/4 of the block group is full.  Which one
Should it be?

Cheers, Andreas

> On Oct 12, 2015, at 15:56, Darrick J. Wong <darrick.wong@oracle.com> wrote:
> 
> If during formatting we'd lose more than half of a block group to
> group descriptors and other metadata, enable the meta_bg feature.
> This enables us to create >500T filesystems with default options.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> lib/ext2fs/initialize.c |    5 +++++
> 1 file changed, 5 insertions(+)
> 
> 
> diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c
> index f672a27..b5ca928 100644
> --- a/lib/ext2fs/initialize.c
> +++ b/lib/ext2fs/initialize.c
> @@ -381,6 +381,11 @@ ipg_retry:
>    overhead = (int) (3 + fs->inode_blocks_per_group +
>              super->s_reserved_gdt_blocks);
> 
> +    /* Enable meta_bg if we'd lose more than 3/4 of a BG to GDT blocks. */
> +    if (super->s_reserved_gdt_blocks + fs->desc_blocks >
> +        super->s_blocks_per_group * 3 / 4)
> +        fs->super->s_feature_incompat |= EXT2_FEATURE_INCOMPAT_META_BG;
> +
>    if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
>        overhead++;
>    else
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Darrick Wong Oct. 13, 2015, 7:08 a.m. UTC | #2
On Mon, Oct 12, 2015 at 08:34:36PM -0600, Andreas Dilger wrote:
> The commit comment says enable meta_bg if 1/2 of the block group
> is full, but the code checks for 3/4 of the block group is full.  Which one
> Should it be?

Oops.  It should be 3/4 since it's generally advantageous to leave meta_bg off
as long as possible so as to keep the group descriptors nearby.

That said, I also toyed with the idea of making the switch if total overhead
(gdt + inodes) uses more than 3/4 of a BG.  But the inode size/ratio is
configurable, so I went with just checking gdt for now.

--D

> 
> Cheers, Andreas
> 
> > On Oct 12, 2015, at 15:56, Darrick J. Wong <darrick.wong@oracle.com> wrote:
> > 
> > If during formatting we'd lose more than half of a block group to
> > group descriptors and other metadata, enable the meta_bg feature.
> > This enables us to create >500T filesystems with default options.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> > lib/ext2fs/initialize.c |    5 +++++
> > 1 file changed, 5 insertions(+)
> > 
> > 
> > diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c
> > index f672a27..b5ca928 100644
> > --- a/lib/ext2fs/initialize.c
> > +++ b/lib/ext2fs/initialize.c
> > @@ -381,6 +381,11 @@ ipg_retry:
> >    overhead = (int) (3 + fs->inode_blocks_per_group +
> >              super->s_reserved_gdt_blocks);
> > 
> > +    /* Enable meta_bg if we'd lose more than 3/4 of a BG to GDT blocks. */
> > +    if (super->s_reserved_gdt_blocks + fs->desc_blocks >
> > +        super->s_blocks_per_group * 3 / 4)
> > +        fs->super->s_feature_incompat |= EXT2_FEATURE_INCOMPAT_META_BG;
> > +
> >    if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
> >        overhead++;
> >    else
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Theodore Ts'o Oct. 24, 2015, 4:38 a.m. UTC | #3
On Mon, Oct 12, 2015 at 02:56:42PM -0700, Darrick J. Wong wrote:
> If during formatting we'd lose more than half of a block group to
> group descriptors and other metadata, enable the meta_bg feature.
> This enables us to create >500T filesystems with default options.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Applied, with the commit description fixed up.

	      	  	 	     	   - Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c
index f672a27..b5ca928 100644
--- a/lib/ext2fs/initialize.c
+++ b/lib/ext2fs/initialize.c
@@ -381,6 +381,11 @@  ipg_retry:
 	overhead = (int) (3 + fs->inode_blocks_per_group +
 			  super->s_reserved_gdt_blocks);
 
+	/* Enable meta_bg if we'd lose more than 3/4 of a BG to GDT blocks. */
+	if (super->s_reserved_gdt_blocks + fs->desc_blocks >
+	    super->s_blocks_per_group * 3 / 4)
+		fs->super->s_feature_incompat |= EXT2_FEATURE_INCOMPAT_META_BG;
+
 	if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
 		overhead++;
 	else