diff mbox series

mkfs: force block size to 1024 for ext3 and ext4

Message ID 20210510134739.37512-1-cascardo@canonical.com
State Accepted
Headers show
Series mkfs: force block size to 1024 for ext3 and ext4 | expand

Commit Message

Thadeu Lima de Souza Cascardo May 10, 2021, 1:47 p.m. UTC
ext3 and ext4 filesystems will reserve at least 1024 blocks for the
journal.  With a blocksize of 4096, this will be 25% of the filesystem size
without accounting for any other overhead.

/etc/mke2fs.conf will use 1024 block size for small filesystems, which are
between 3M and 512M. However, on recent versions of Ubuntu, this
configuration has changed and thet default blocksize is 4096 even for small
filesystems.

Force the blocksize to 1024 on ext3 and ext4 filesystems, which will lead
to the expected results, as journals will take only 1M.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
---
 testcases/commands/mkfs/mkfs01.sh | 3 +++
 1 file changed, 3 insertions(+)

Comments

Petr Vorel May 11, 2021, 6:19 a.m. UTC | #1
Hi,

> ext3 and ext4 filesystems will reserve at least 1024 blocks for the
> journal.  With a blocksize of 4096, this will be 25% of the filesystem size
> without accounting for any other overhead.
Is that any actual problem?

> /etc/mke2fs.conf will use 1024 block size for small filesystems, which are
> between 3M and 512M. However, on recent versions of Ubuntu, this
> configuration has changed and thet default blocksize is 4096 even for small
> filesystems.

> Force the blocksize to 1024 on ext3 and ext4 filesystems, which will lead
> to the expected results, as journals will take only 1M.

IMHO it'd be better to keep the default, because that covers what end users
actually use.

Kind regards,
Petr
Thadeu Lima de Souza Cascardo May 11, 2021, 10:36 a.m. UTC | #2
On Tue, May 11, 2021 at 08:19:01AM +0200, Petr Vorel wrote:
> Hi,
> 
> > ext3 and ext4 filesystems will reserve at least 1024 blocks for the
> > journal.  With a blocksize of 4096, this will be 25% of the filesystem size
> > without accounting for any other overhead.
> Is that any actual problem?

It causes the test to fail.
     mkfs01 2 TFAIL: 'mkfs -t ext4  /dev/loop0 16000' failed, unexpected size.

The filesystem size is very small, 16K 1k blocks, and we test that there are at
least 80% of that available. As I said, the journal takes at least 1024 blocks,
and with 4k blocks, that is too much overhead.

> 
> > /etc/mke2fs.conf will use 1024 block size for small filesystems, which are
> > between 3M and 512M. However, on recent versions of Ubuntu, this
> > configuration has changed and thet default blocksize is 4096 even for small
> > filesystems.
> 
> > Force the blocksize to 1024 on ext3 and ext4 filesystems, which will lead
> > to the expected results, as journals will take only 1M.
> 
> IMHO it'd be better to keep the default, because that covers what end users
> actually use.

One alternative to forcing the block size is accouting for the journal blocks,
but, then, that needs to consider the block size. I think my approach is more
simple. We could restrict it to the smaller 16M filesystem, though.

What do you think?

Thanks.
Cascardo.

> 
> Kind regards,
> Petr
Petr Vorel May 11, 2021, 2:19 p.m. UTC | #3
Hi,

> On Tue, May 11, 2021 at 08:19:01AM +0200, Petr Vorel wrote:
> > Hi,

> > > ext3 and ext4 filesystems will reserve at least 1024 blocks for the
> > > journal.  With a blocksize of 4096, this will be 25% of the filesystem size
> > > without accounting for any other overhead.
> > Is that any actual problem?

> It causes the test to fail.
>      mkfs01 2 TFAIL: 'mkfs -t ext4  /dev/loop0 16000' failed, unexpected size.

> The filesystem size is very small, 16K 1k blocks, and we test that there are at
> least 80% of that available. As I said, the journal takes at least 1024 blocks,
> and with 4k blocks, that is too much overhead.

Have you checked if d44387457 ("mkfs: relax size check") fixes the issue?

https://github.com/linux-test-project/ltp/commit/d4438745751dc4b0faa50063f9a0d9542f0ceaac

Kind regards,
Petr

> > > /etc/mke2fs.conf will use 1024 block size for small filesystems, which are
> > > between 3M and 512M. However, on recent versions of Ubuntu, this
> > > configuration has changed and thet default blocksize is 4096 even for small
> > > filesystems.

> > > Force the blocksize to 1024 on ext3 and ext4 filesystems, which will lead
> > > to the expected results, as journals will take only 1M.

> > IMHO it'd be better to keep the default, because that covers what end users
> > actually use.

> One alternative to forcing the block size is accouting for the journal blocks,
> but, then, that needs to consider the block size. I think my approach is more
> simple. We could restrict it to the smaller 16M filesystem, though.

> What do you think?

> Thanks.
> Cascardo.
Thadeu Lima de Souza Cascardo May 11, 2021, 3:28 p.m. UTC | #4
On Tue, May 11, 2021 at 04:19:19PM +0200, Petr Vorel wrote:
> Hi,
> 
> > On Tue, May 11, 2021 at 08:19:01AM +0200, Petr Vorel wrote:
> > > Hi,
> 
> > > > ext3 and ext4 filesystems will reserve at least 1024 blocks for the
> > > > journal.  With a blocksize of 4096, this will be 25% of the filesystem size
> > > > without accounting for any other overhead.
> > > Is that any actual problem?
> 
> > It causes the test to fail.
> >      mkfs01 2 TFAIL: 'mkfs -t ext4  /dev/loop0 16000' failed, unexpected size.
> 
> > The filesystem size is very small, 16K 1k blocks, and we test that there are at
> > least 80% of that available. As I said, the journal takes at least 1024 blocks,
> > and with 4k blocks, that is too much overhead.
> 
> Have you checked if d44387457 ("mkfs: relax size check") fixes the issue?
> 
> https://github.com/linux-test-project/ltp/commit/d4438745751dc4b0faa50063f9a0d9542f0ceaac
> 
> Kind regards,
> Petr
> 

It does not. That would have to move to something below 80%.

Cascardo.

> > > > /etc/mke2fs.conf will use 1024 block size for small filesystems, which are
> > > > between 3M and 512M. However, on recent versions of Ubuntu, this
> > > > configuration has changed and thet default blocksize is 4096 even for small
> > > > filesystems.
> 
> > > > Force the blocksize to 1024 on ext3 and ext4 filesystems, which will lead
> > > > to the expected results, as journals will take only 1M.
> 
> > > IMHO it'd be better to keep the default, because that covers what end users
> > > actually use.
> 
> > One alternative to forcing the block size is accouting for the journal blocks,
> > but, then, that needs to consider the block size. I think my approach is more
> > simple. We could restrict it to the smaller 16M filesystem, though.
> 
> > What do you think?
> 
> > Thanks.
> > Cascardo.
Cyril Hrubis May 12, 2021, 1:17 p.m. UTC | #5
Hi!
> > > /etc/mke2fs.conf will use 1024 block size for small filesystems, which are
> > > between 3M and 512M. However, on recent versions of Ubuntu, this
> > > configuration has changed and thet default blocksize is 4096 even for small
> > > filesystems.
> > 
> > > Force the blocksize to 1024 on ext3 and ext4 filesystems, which will lead
> > > to the expected results, as journals will take only 1M.
> > 
> > IMHO it'd be better to keep the default, because that covers what end users
> > actually use.
> 
> One alternative to forcing the block size is accouting for the journal blocks,
> but, then, that needs to consider the block size. I think my approach is more
> simple. We could restrict it to the smaller 16M filesystem, though.
> 
> What do you think?

I guess that we should merge your fix in order to have the test working
for the upcomming release. Then we can discuss if this should be fixed
differently or not.
Petr Vorel May 12, 2021, 1:55 p.m. UTC | #6
Hi,

[Cc Jan]

> Hi!
> > > > /etc/mke2fs.conf will use 1024 block size for small filesystems, which are
> > > > between 3M and 512M. However, on recent versions of Ubuntu, this
> > > > configuration has changed and thet default blocksize is 4096 even for small
> > > > filesystems.

> > > > Force the blocksize to 1024 on ext3 and ext4 filesystems, which will lead
> > > > to the expected results, as journals will take only 1M.

> > > IMHO it'd be better to keep the default, because that covers what end users
> > > actually use.

> > One alternative to forcing the block size is accouting for the journal blocks,
> > but, then, that needs to consider the block size. I think my approach is more
> > simple. We could restrict it to the smaller 16M filesystem, though.

> > What do you think?

> I guess that we should merge your fix in order to have the test working
> for the upcomming release. Then we can discuss if this should be fixed
> differently or not.
Acked-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr
Jan Stancek May 12, 2021, 1:59 p.m. UTC | #7
On Wed, May 12, 2021 at 3:55 PM Petr Vorel <pvorel@suse.cz> wrote:
>
> Hi,
>
> [Cc Jan]
>
> > Hi!
> > > > > /etc/mke2fs.conf will use 1024 block size for small filesystems, which are
> > > > > between 3M and 512M. However, on recent versions of Ubuntu, this
> > > > > configuration has changed and thet default blocksize is 4096 even for small
> > > > > filesystems.
>
> > > > > Force the blocksize to 1024 on ext3 and ext4 filesystems, which will lead
> > > > > to the expected results, as journals will take only 1M.
>
> > > > IMHO it'd be better to keep the default, because that covers what end users
> > > > actually use.
>
> > > One alternative to forcing the block size is accouting for the journal blocks,
> > > but, then, that needs to consider the block size. I think my approach is more
> > > simple. We could restrict it to the smaller 16M filesystem, though.
>
> > > What do you think?
>
> > I guess that we should merge your fix in order to have the test working
> > for the upcomming release. Then we can discuss if this should be fixed
> > differently or not.
> Acked-by: Petr Vorel <pvorel@suse.cz>

Fine by me (I don't have a better idea atm.)

>
> Kind regards,
> Petr
>
Cyril Hrubis May 12, 2021, 2:18 p.m. UTC | #8
Hi!
Pushed with the acks.
diff mbox series

Patch

diff --git a/testcases/commands/mkfs/mkfs01.sh b/testcases/commands/mkfs/mkfs01.sh
index 3e3e56719cf3..17c7fb9e4a1a 100755
--- a/testcases/commands/mkfs/mkfs01.sh
+++ b/testcases/commands/mkfs/mkfs01.sh
@@ -96,6 +96,9 @@  mkfs_test()
 	if [ "$fs_type" = "xfs" ] || [ "$fs_type" = "btrfs" ]; then
 		fs_op="$fs_op -f"
 	fi
+	if [ "$fs_type" = "ext3" ] || [ "$fs_type" = "ext4" ]; then
+		fs_op="$fs_op -b 1024"
+	fi
 
 	local mkfs_cmd="mkfs $mkfs_op $fs_op $device $size"