common/dmthin: make this work with external log devices
authorDarrick J. Wong <djwong@kernel.org>
Wed, 21 Apr 2021 00:22:31 +0000 (17:22 -0700)
committerEryu Guan <guaneryu@gmail.com>
Sun, 25 Apr 2021 05:17:01 +0000 (13:17 +0800)
Provide a mkfs helper to format the dm thin device when external devices
are in use, and fix the dmthin mount helper to support them.  This fixes
regressions in generic/347 and generic/500 when external logs are in
use.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/dmthin
tests/generic/347
tests/generic/500

index c58c3948e9cb73dabefd1915a3feaf02999ee077..3b1c7d457d3922c605f4eca6ae90f2734f6bf80a 100644 (file)
@@ -218,10 +218,17 @@ _dmthin_set_fail()
 
 _dmthin_mount_options()
 {
-       echo `_common_dev_mount_options $*` $DMTHIN_VOL_DEV $SCRATCH_MNT
+       _scratch_options mount
+       echo `_common_dev_mount_options $*` $SCRATCH_OPTIONS $DMTHIN_VOL_DEV $SCRATCH_MNT
 }
 
 _dmthin_mount()
 {
        _mount -t $FSTYP `_dmthin_mount_options $*`
 }
+
+_dmthin_mkfs()
+{
+       _scratch_options mkfs
+       _mkfs_dev $SCRATCH_OPTIONS $@ $DMTHIN_VOL_DEV
+}
index cbc5150a3e54008fb2c02290104f71cd5d2eb402..e970ac10e480feba867fe54ba5ecabe1fa81d28f 100755 (executable)
@@ -31,7 +31,7 @@ _setup_thin()
 {
        _dmthin_init $BACKING_SIZE $VIRTUAL_SIZE
        _dmthin_set_queue
-       _mkfs_dev $DMTHIN_VOL_DEV
+       _dmthin_mkfs
        _dmthin_mount
 }
 
index 085ddbf3d90645ade7945fbd4bd57c2c75eba724..5ab2f78c6a831b8d8e9d0ef64d2bfe57e9cc42f3 100755 (executable)
@@ -68,7 +68,7 @@ CLUSTER_SIZE=$((64 * 1024 / 512))             # 64K
 
 _dmthin_init $BACKING_SIZE $VIRTUAL_SIZE $CLUSTER_SIZE 0
 _dmthin_set_fail
-_mkfs_dev $DMTHIN_VOL_DEV
+_dmthin_mkfs
 _dmthin_mount
 
 # There're two bugs at here, one is dm-thin bug, the other is filesystem