Skip to contentSkip to conversation

mkfs: force block size to 1024 for ext3 and ext4

PATCH New Thadeu Lima de Souza Cascardo 4 participants 9 messages May 10, 2021 – May 12, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mkfs: force block size to 1024 for ext3 and ext4

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.

---
 testcases/commands/mkfs/mkfs01.sh | 3 +++
 1 file changed, 3 insertions(+)
testcases/commands/mkfs/mkfs01.sh +3 -0
index 3e3e56719cf3..17c7fb9e4a1a 100755
@@ -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"
 
Signature · 1 line
2.27.0
#1 lore raw

PATCH 1/1 mkfs: force block size to 1024 for ext3 and ext4

Hi,

Quoted 3 lines

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?

Quoted 7 lines

/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

#2 lore raw

PATCH 1/1 mkfs: force block size to 1024 for ext3 and ext4

Quoted 6 lines · Petr Vorel

Hi,

Quoted 3 lines

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.

Quoted 11 lines
Quoted 8 lines

/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.

Quoted 3 lines

Kind regards,
Petr

#3 lore raw

PATCH 1/1 mkfs: force block size to 1024 for ext3 and ext4

Hi,

Quoted 6 lines · Petr Vorel
Quoted 5 lines

Hi,

Quoted 3 lines

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.

Quoted 8 lines
Quoted 1 line

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

Quoted 19 lines
Quoted 10 lines
Quoted 7 lines

/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.

#4 lore raw

PATCH 1/1 mkfs: force block size to 1024 for ext3 and ext4

Quoted 17 lines · Petr Vorel

Hi,

Quoted 6 lines · Petr Vorel
Quoted 5 lines

Hi,

Quoted 3 lines

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.

Quoted 8 lines
Quoted 1 line

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.

Quoted 7 lines

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.

Quoted 19 lines
Quoted 19 lines
Quoted 10 lines
Quoted 7 lines

/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.

#5 lore raw

PATCH 1/1 mkfs: force block size to 1024 for ext3 and ext4

In reply to Thadeu Lima de Souza Cascardo

Hi!

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

/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.

Quoted 8 lines
Quoted 2 lines

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.

Signature · 2 lines
Cyril Hrubis
[email protected]
#6 lore raw

PATCH 1/1 mkfs: force block size to 1024 for ext3 and ext4

Hi,

[Cc Jan]

Quoted 16 lines

Hi!

Quoted 14 lines
Quoted 10 lines
Quoted 7 lines

/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.

Quoted 5 lines
Quoted 1 line

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.

Kind regards,
Petr

#7 lore raw

PATCH 1/1 mkfs: force block size to 1024 for ext3 and ext4

Quoted 21 lines · Petr Vorel

Hi,

[Cc Jan]

Quoted 15 lines

Hi!

Quoted 14 lines
Quoted 10 lines
Quoted 7 lines

/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.

Quoted 6 lines
Quoted 5 lines
Quoted 1 line

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.

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

Quoted 4 lines

Kind regards,
Petr