diff mbox series

[v3,3/3] common: Improve blocksize support for udf

Message ID 20230131124005.14207-3-jack@suse.cz (mailing list archive)
State New, archived
Headers show
Series fstests: Fix checking of UDF filesystems | expand

Commit Message

Jan Kara Jan. 31, 2023, 12:39 p.m. UTC
Add better support for blocksize selection in _scratch_mkfs_sized
(accept another variant of mkfs options, select correct default block
size if not specified). Also add blocksize selection support to
_scratch_mkfs_blocksized.

For _check_udf_filesystem to keep working when blocksize is not
specified in MKFS_OPTIONS, add detection of blocksize from a mounted
filesystem.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 common/rc | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

Comments

Zorro Lang Feb. 6, 2023, 11:12 a.m. UTC | #1
On Tue, Jan 31, 2023 at 01:39:59PM +0100, Jan Kara wrote:
> Add better support for blocksize selection in _scratch_mkfs_sized
> (accept another variant of mkfs options, select correct default block
> size if not specified). Also add blocksize selection support to
> _scratch_mkfs_blocksized.
> 
> For _check_udf_filesystem to keep working when blocksize is not
> specified in MKFS_OPTIONS, add detection of blocksize from a mounted
> filesystem.
> 
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---

This patch looks good to me, thanks for doing this for udf filesystem :)

It's been long time, no patches from udf list to fstests list. For exmaple,
The udf/102 missed the _setup_udf_scratchdir() helper (be removed) for long
time, if you're working on udf testing, you might be interested in it.
Anyway, I'll merge this patchset this week.

Reviewed-by: Zorro Lang <zlang@redhat.com>

Thanks,
Zorro

>  common/rc | 22 ++++++++++++++++------
>  1 file changed, 16 insertions(+), 6 deletions(-)
> 
> diff --git a/common/rc b/common/rc
> index 7f80afe7aeec..e49918c9deab 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -922,9 +922,15 @@ _scratch_mkfs_sized()
>  	btrfs)
>  		def_blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*-s ?+([0-9]+).*/\1/p'`
>  		;;
> -	ext2|ext3|ext4|ext4dev|udf|reiser4|ocfs2|reiserfs)
> +	ext2|ext3|ext4|ext4dev|reiser4|ocfs2|reiserfs)
>  		def_blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*-b ?+([0-9]+).*/\1/p'`
>  		;;
> +	udf)
> +		def_blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*(-b|--blocksize)[ =]?+([0-9]+).*/\2/p'`
> +		if [ -z "$def_blksz" ]; then
> +			def_blksz=512
> +		fi
> +		;;
>  	jfs)
>  		def_blksz=4096
>  		;;
> @@ -1116,6 +1122,9 @@ _scratch_mkfs_blocksized()
>  		${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS --block_size=$blocksize \
>  								$SCRATCH_DEV
>  		;;
> +	udf)
> +		_scratch_mkfs -b $blocksize
> +		;;
>  	*)
>  		_notrun "Filesystem $FSTYP not supported in _scratch_mkfs_blocksized"
>  		;;
> @@ -3074,17 +3083,18 @@ _check_udf_filesystem()
>  	return
>      fi
>  
> +    local device=$1
> +    local blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*(-b|--blocksize)[ =]?+([0-9]+).*/\2/p'`
> +    if [ -z "$blksz" ]; then
> +	blksz=512
> +    fi
>      # Is the filesystem mounted?
>      local type=`_fs_type $device`
>      if [ "$type" = "$FSTYP" ]; then
> +	blksz=`blockdev --getbsz $device`
>  	local mountpoint=`_umount_or_remount_ro $device`
>      fi
>  
> -    local device=$1
> -    local blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*(-b|--blocksize)[ =]?+([0-9]+).*/\2/p'`
> -    if [ -z "$blksz" ]; then
> -	blksz=512
> -    fi
>      local opt_arg="-ecclength 1 -blocksize $blksz"
>      if [ $# -eq 2 ]; then
>  	opt_arg+=" -lastvalidblock $(( $2 - 1 ))"
> -- 
> 2.35.3
>
Jan Kara Feb. 7, 2023, 12:28 p.m. UTC | #2
On Mon 06-02-23 19:12:35, Zorro Lang wrote:
> On Tue, Jan 31, 2023 at 01:39:59PM +0100, Jan Kara wrote:
> > Add better support for blocksize selection in _scratch_mkfs_sized
> > (accept another variant of mkfs options, select correct default block
> > size if not specified). Also add blocksize selection support to
> > _scratch_mkfs_blocksized.
> > 
> > For _check_udf_filesystem to keep working when blocksize is not
> > specified in MKFS_OPTIONS, add detection of blocksize from a mounted
> > filesystem.
> > 
> > Signed-off-by: Jan Kara <jack@suse.cz>
> > ---
> 
> This patch looks good to me, thanks for doing this for udf filesystem :)
> 
> It's been long time, no patches from udf list to fstests list. For exmaple,
> The udf/102 missed the _setup_udf_scratchdir() helper (be removed) for long
> time, if you're working on udf testing, you might be interested in it.

So I did some larger UDF kernel changes in this cycle so I also found some
time to do more testing which has shown all the problems. My plan is to run
fstests for UDF more often and slowly reduce the amount of failing tests
(so far I was more or less happy that the basic functionality looked solid
and the kernel didn't crash during whole fstests run ;).

> Anyway, I'll merge this patchset this week.
> 
> Reviewed-by: Zorro Lang <zlang@redhat.com>

Thanks!

								Honza
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index 7f80afe7aeec..e49918c9deab 100644
--- a/common/rc
+++ b/common/rc
@@ -922,9 +922,15 @@  _scratch_mkfs_sized()
 	btrfs)
 		def_blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*-s ?+([0-9]+).*/\1/p'`
 		;;
-	ext2|ext3|ext4|ext4dev|udf|reiser4|ocfs2|reiserfs)
+	ext2|ext3|ext4|ext4dev|reiser4|ocfs2|reiserfs)
 		def_blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*-b ?+([0-9]+).*/\1/p'`
 		;;
+	udf)
+		def_blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*(-b|--blocksize)[ =]?+([0-9]+).*/\2/p'`
+		if [ -z "$def_blksz" ]; then
+			def_blksz=512
+		fi
+		;;
 	jfs)
 		def_blksz=4096
 		;;
@@ -1116,6 +1122,9 @@  _scratch_mkfs_blocksized()
 		${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS --block_size=$blocksize \
 								$SCRATCH_DEV
 		;;
+	udf)
+		_scratch_mkfs -b $blocksize
+		;;
 	*)
 		_notrun "Filesystem $FSTYP not supported in _scratch_mkfs_blocksized"
 		;;
@@ -3074,17 +3083,18 @@  _check_udf_filesystem()
 	return
     fi
 
+    local device=$1
+    local blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*(-b|--blocksize)[ =]?+([0-9]+).*/\2/p'`
+    if [ -z "$blksz" ]; then
+	blksz=512
+    fi
     # Is the filesystem mounted?
     local type=`_fs_type $device`
     if [ "$type" = "$FSTYP" ]; then
+	blksz=`blockdev --getbsz $device`
 	local mountpoint=`_umount_or_remount_ro $device`
     fi
 
-    local device=$1
-    local blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*(-b|--blocksize)[ =]?+([0-9]+).*/\2/p'`
-    if [ -z "$blksz" ]; then
-	blksz=512
-    fi
     local opt_arg="-ecclength 1 -blocksize $blksz"
     if [ $# -eq 2 ]; then
 	opt_arg+=" -lastvalidblock $(( $2 - 1 ))"