diff mbox series

btrfs-progs: tests: add convert test case for block number overflow

Message ID 20240606103228.3697282-1-srivathsa.d.dara@oracle.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: tests: add convert test case for block number overflow | expand

Commit Message

Srivathsa Dara June 6, 2024, 10:32 a.m. UTC
This test cases will test whether btrfs-convert can handle ext4
filesystems that are largerthan 16TiB.

At 16TiB block numbers overflow 32 bits, btrfs-convert either fails or
corrupts fs if 64 bit block numbers are not supported.

Signed-off-by: Srivathsa Dara <srivathsa.d.dara@oracle.com>
---
 .../025-64-bit-block-numbers/test.sh          | 21 +++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100755 tests/convert-tests/025-64-bit-block-numbers/test.sh

Comments

Qu Wenruo June 6, 2024, 10:32 p.m. UTC | #1
在 2024/6/6 20:02, Srivathsa Dara 写道:
> This test cases will test whether btrfs-convert can handle ext4
> filesystems that are largerthan 16TiB.
> 
> At 16TiB block numbers overflow 32 bits, btrfs-convert either fails or
> corrupts fs if 64 bit block numbers are not supported.

You may want to merge this one into the existing overflow tests, check 
convert-tests/018-fs-size-overflow, which is doing the 64g overflow test 
already.

Otherwise it looks good.

Thanks,
Qu
> 
> Signed-off-by: Srivathsa Dara <srivathsa.d.dara@oracle.com>
> ---
>   .../025-64-bit-block-numbers/test.sh          | 21 +++++++++++++++++++
>   1 file changed, 21 insertions(+)
>   create mode 100755 tests/convert-tests/025-64-bit-block-numbers/test.sh
> 
> diff --git a/tests/convert-tests/025-64-bit-block-numbers/test.sh b/tests/convert-tests/025-64-bit-block-numbers/test.sh
> new file mode 100755
> index 00000000..0eb6bb49
> --- /dev/null
> +++ b/tests/convert-tests/025-64-bit-block-numbers/test.sh
> @@ -0,0 +1,21 @@
> +#!/bin/bash
> +# Check if btrfs-convert can handle 64 bit block numbers in an ext4 fs.
> +# At 16TiB block numbers overflow 32 bits and screw up total size and used
> +# space calculation
> +
> +
> +source "$TEST_TOP/common" || exit
> +source "$TEST_TOP/common.convert" || exit
> +
> +check_prereq btrfs-convert
> +check_global_prereq mke2fs
> +
> +setup_root_helper
> +prepare_test_dev 16t
> +
> +convert_test_prep_fs ext4 mke2fs -t ext4 -b 4096
> +run_check_umount_test_dev
> +
> +convert_test_do_convert
> +run_check_mount_test_dev
> +run_check_umount_test_dev
Srivathsa Dara June 11, 2024, 6:04 a.m. UTC | #2
> 在 2024/6/6 20:02, Srivathsa Dara 写道:
> > This test cases will test whether btrfs-convert can handle ext4 
> > filesystems that are largerthan 16TiB.
> > 
> > At 16TiB block numbers overflow 32 bits, btrfs-convert either fails or 
> > corrupts fs if 64 bit block numbers are not supported.
> 
> You may want to merge this one into the existing overflow tests, check convert-tests/018-fs-size-overflow, which is doing the 64g overflow test already.

Sure, I will send a V2.

> 
> Otherwise it looks good.
> 
> Thanks,
> Qu
> > 
> > Signed-off-by: Srivathsa Dara <srivathsa.d.dara@oracle.com>
> > ---
> >   .../025-64-bit-block-numbers/test.sh          | 21 +++++++++++++++++++
> >   1 file changed, 21 insertions(+)
> >   create mode 100755 
> > tests/convert-tests/025-64-bit-block-numbers/test.sh
> > 
> > diff --git a/tests/convert-tests/025-64-bit-block-numbers/test.sh 
> > b/tests/convert-tests/025-64-bit-block-numbers/test.sh
> > new file mode 100755
> > index 00000000..0eb6bb49
> > --- /dev/null
> > +++ b/tests/convert-tests/025-64-bit-block-numbers/test.sh
> > @@ -0,0 +1,21 @@
> > +#!/bin/bash
> > +# Check if btrfs-convert can handle 64 bit block numbers in an ext4 fs.
> > +# At 16TiB block numbers overflow 32 bits and screw up total size and 
> > +used # space calculation
> > +
> > +
> > +source "$TEST_TOP/common" || exit
> > +source "$TEST_TOP/common.convert" || exit
> > +
> > +check_prereq btrfs-convert
> > +check_global_prereq mke2fs
> > +
> > +setup_root_helper
> > +prepare_test_dev 16t
> > +
> > +convert_test_prep_fs ext4 mke2fs -t ext4 -b 4096 
> > +run_check_umount_test_dev
> > +
> > +convert_test_do_convert
> > +run_check_mount_test_dev
> > +run_check_umount_test_dev
>
diff mbox series

Patch

diff --git a/tests/convert-tests/025-64-bit-block-numbers/test.sh b/tests/convert-tests/025-64-bit-block-numbers/test.sh
new file mode 100755
index 00000000..0eb6bb49
--- /dev/null
+++ b/tests/convert-tests/025-64-bit-block-numbers/test.sh
@@ -0,0 +1,21 @@ 
+#!/bin/bash
+# Check if btrfs-convert can handle 64 bit block numbers in an ext4 fs.
+# At 16TiB block numbers overflow 32 bits and screw up total size and used
+# space calculation
+
+
+source "$TEST_TOP/common" || exit
+source "$TEST_TOP/common.convert" || exit
+
+check_prereq btrfs-convert
+check_global_prereq mke2fs
+
+setup_root_helper
+prepare_test_dev 16t
+
+convert_test_prep_fs ext4 mke2fs -t ext4 -b 4096
+run_check_umount_test_dev
+
+convert_test_do_convert
+run_check_mount_test_dev
+run_check_umount_test_dev