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 c58c394..3b1c7d4 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 cbc5150..e970ac1 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 085ddbf..5ab2f78 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