Re: [PATCH] xfs/157: mkfs does not need a specific fssize

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 07, 2024 at 04:40:34PM +1100, Dave Chinner wrote:
> On Tue, Nov 05, 2024 at 07:47:12AM -0800, Darrick J. Wong wrote:
> > On Tue, Nov 05, 2024 at 07:02:26AM -0800, Christoph Hellwig wrote:
> > > On Tue, Nov 05, 2024 at 05:58:03PM +1100, Dave Chinner wrote:
> > > > When the two conflict, _scratch_mkfs drops the global MKFS_OPTIONS
> > > > and uses only the local parameters so the filesystem is set up with
> > > > the configuration the test expects.
> > > > 
> > > > In this case, MKFS_OPTIONS="-m rmapbt=1" which conflicts with the
> > > > local RTDEV/USE_EXTERNAL test setup. Because the test icurrently
> > > > overloads the global MKFS_OPTIONS with local test options, the local
> > > > test parameters are dropped along with the global paramters when
> > > > there is a conflict. Hence the mkfs_scratch call fails to set the
> > > > filesystem up the way the test expects.
> > > 
> > > But the rmapbt can be default on, in which case it does not get
> > > removed.  And then without the _sized we'll run into the problem that
> > > Hans' patches fixed once again.
> > 
> > Well we /could/ make _scratch_mkfs_sized pass options through to the
> > underlying _scratch_mkfs.
> 
> That seems like the right thing to do to me.

OK, thanks for all of these suggestions, how about below (draft) change[1].
If it's good to all of you, I'll send another patch.

Thanks,
Zorro

diff --git a/common/rc b/common/rc
index 2af26f23f..673f056fb 100644
--- a/common/rc
+++ b/common/rc
@@ -1027,7 +1027,9 @@ _small_fs_size_mb()
 _try_scratch_mkfs_sized()
 {
        local fssize=$1
-       local blocksize=$2
+       shift
+       local blocksize=$1
+       shift
        local def_blksz
        local blocksize_opt
        local rt_ops
@@ -1091,10 +1093,10 @@ _try_scratch_mkfs_sized()
                # don't override MKFS_OPTIONS that set a block size.
                echo $MKFS_OPTIONS |grep -E -q "b\s*size="
                if [ $? -eq 0 ]; then
-                       _try_scratch_mkfs_xfs -d size=$fssize $rt_ops
+                       _try_scratch_mkfs_xfs -d size=$fssize $rt_ops $@
                else
                        _try_scratch_mkfs_xfs -d size=$fssize $rt_ops \
-                               -b size=$blocksize
+                               -b size=$blocksize $@
                fi
                ;;
        ext2|ext3|ext4)
@@ -1105,7 +1107,7 @@ _try_scratch_mkfs_sized()
                                _notrun "Could not make scratch logdev"
                        MKFS_OPTIONS="$MKFS_OPTIONS -J device=$SCRATCH_LOGDEV"
                fi
-               ${MKFS_PROG} -t $FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks
+               ${MKFS_PROG} -t $FSTYP -F $MKFS_OPTIONS -b $blocksize $@ $SCRATCH_DEV $blocks
                ;;
        gfs2)
                # mkfs.gfs2 doesn't automatically shrink journal files on small
@@ -1120,13 +1122,13 @@ _try_scratch_mkfs_sized()
                        (( journal_size >= min_journal_size )) || journal_size=$min_journal_size
                        MKFS_OPTIONS="-J $journal_size $MKFS_OPTIONS"
                fi
-               ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS -O -b $blocksize $SCRATCH_DEV $blocks
+               ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS -O -b $blocksize $@ $SCRATCH_DEV $blocks
                ;;
        ocfs2)
-               yes | ${MKFS_PROG} -t $FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks
+               yes | ${MKFS_PROG} -t $FSTYP -F $MKFS_OPTIONS -b $blocksize $@ $SCRATCH_DEV $blocks
                ;;
        udf)
-               $MKFS_UDF_PROG $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks
+               $MKFS_UDF_PROG $MKFS_OPTIONS -b $blocksize $@ $SCRATCH_DEV $blocks
                ;;
        btrfs)
                local mixed_opt=
@@ -1134,33 +1136,33 @@ _try_scratch_mkfs_sized()
                # the device is not zoned. Ref: btrfs-progs: btrfs_min_dev_size()
                (( fssize < $((256 * 1024 * 1024)) )) &&
                        ! _scratch_btrfs_is_zoned && mixed_opt='--mixed'
-               $MKFS_BTRFS_PROG $MKFS_OPTIONS $mixed_opt -b $fssize $SCRATCH_DEV
+               $MKFS_BTRFS_PROG $MKFS_OPTIONS $mixed_opt -b $fssize $@ $SCRATCH_DEV
                ;;
        jfs)
-               ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS $SCRATCH_DEV $blocks
+               ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS $@ $SCRATCH_DEV $blocks
                ;;
        reiserfs)
-               ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks
+               ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS -b $blocksize $@ $SCRATCH_DEV $blocks
                ;;
        reiser4)
                # mkfs.resier4 requires size in KB as input for creating filesystem
-               $MKFS_REISER4_PROG $MKFS_OPTIONS -y -b $blocksize $SCRATCH_DEV \
+               $MKFS_REISER4_PROG $MKFS_OPTIONS -y -b $blocksize $@ $SCRATCH_DEV \
                                   `expr $fssize / 1024`
                ;;
        f2fs)
                # mkfs.f2fs requires # of sectors as an input for the size
                local sector_size=`blockdev --getss $SCRATCH_DEV`
-               $MKFS_F2FS_PROG $MKFS_OPTIONS $SCRATCH_DEV `expr $fssize / $sector_size`
+               $MKFS_F2FS_PROG $MKFS_OPTIONS $@ $SCRATCH_DEV `expr $fssize / $sector_size`
                ;;
        tmpfs)
                local free_mem=`_free_memory_bytes`
                if [ "$free_mem" -lt "$fssize" ] ; then
                   _notrun "Not enough memory ($free_mem) for tmpfs with $fssize bytes"
                fi
-               export MOUNT_OPTIONS="-o size=$fssize $TMPFS_MOUNT_OPTIONS"
+               export MOUNT_OPTIONS="-o size=$fssize $@ $TMPFS_MOUNT_OPTIONS"
                ;;
        bcachefs)
-               $MKFS_BCACHEFS_PROG $MKFS_OPTIONS --fs_size=$fssize $blocksize_opt $SCRATCH_DEV
+               $MKFS_BCACHEFS_PROG $MKFS_OPTIONS --fs_size=$fssize $blocksize_opt $@ $SCRATCH_DEV
                ;;
        *)
                _notrun "Filesystem $FSTYP not supported in _scratch_mkfs_sized"
@@ -1170,7 +1172,7 @@ _try_scratch_mkfs_sized()
 
 _scratch_mkfs_sized()
 {
-       _try_scratch_mkfs_sized $* || _notrun "_scratch_mkfs_sized failed with ($*)"
+       _try_scratch_mkfs_sized "$@" || _notrun "_scratch_mkfs_sized failed with ($@)"
 }
 
 # Emulate an N-data-disk stripe w/ various stripe units
diff --git a/tests/xfs/157 b/tests/xfs/157
index 9b5badbae..f8f102d78 100755
--- a/tests/xfs/157
+++ b/tests/xfs/157
@@ -66,8 +66,7 @@ scenario() {
 }
 
 check_label() {
-       MKFS_OPTIONS="-L oldlabel $MKFS_OPTIONS" _scratch_mkfs_sized $fs_size \
-               >> $seqres.full
+       _scratch_mkfs_sized "$fs_size" "" "-L oldlabel" >> $seqres.full 2>&1
        _scratch_xfs_db -c label
        _scratch_xfs_admin -L newlabel "$@" >> $seqres.full
        _scratch_xfs_db -c label




> 
> -Dave.
> -- 
> Dave Chinner
> david@xxxxxxxxxxxxx
> 





[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux