All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] common: Improve blocksize support for udf
@ 2023-01-23  9:38 Jan Kara
  2023-01-30 16:54 ` Zorro Lang
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2023-01-23  9:38 UTC (permalink / raw)
  To: fstests; +Cc: Jan Kara

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(-)

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] common: Improve blocksize support for udf
  2023-01-23  9:38 [PATCH] common: Improve blocksize support for udf Jan Kara
@ 2023-01-30 16:54 ` Zorro Lang
  2023-01-31 12:33   ` Jan Kara
  0 siblings, 1 reply; 3+ messages in thread
From: Zorro Lang @ 2023-01-30 16:54 UTC (permalink / raw)
  To: Jan Kara; +Cc: fstests

On Mon, Jan 23, 2023 at 10:38:00AM +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>
> ---

Is this patch a replacement of below patch ?
  [PATCH 1/2] common: Provide blocksize and ecclength to udf fsck

Due to you've sent a patchset, and that 2nd patch has been reviewed but
not merged:
  [PATCH 2/2] common: Unmount udf filesystem prior checking

I'm not sure if you write this one singly to replace the 1st patch, or be a
supplement. Can you send these 2 or 3 patches in one patchset :)

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
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] common: Improve blocksize support for udf
  2023-01-30 16:54 ` Zorro Lang
@ 2023-01-31 12:33   ` Jan Kara
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Kara @ 2023-01-31 12:33 UTC (permalink / raw)
  To: Zorro Lang; +Cc: Jan Kara, fstests

On Tue 31-01-23 00:54:23, Zorro Lang wrote:
> On Mon, Jan 23, 2023 at 10:38:00AM +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>
> > ---
> 
> Is this patch a replacement of below patch ?
>   [PATCH 1/2] common: Provide blocksize and ecclength to udf fsck

No, it is an addition on top of this - a reaction to your comment that
besides _check_udf_filesystem there are other places that could use better
handling of blocksize in UDF.

> Due to you've sent a patchset, and that 2nd patch has been reviewed but
> not merged:
>   [PATCH 2/2] common: Unmount udf filesystem prior checking
> 
> I'm not sure if you write this one singly to replace the 1st patch, or be a
> supplement. Can you send these 2 or 3 patches in one patchset :)

So all three patches are needed. I can resend them all in one series if it
helps you.

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-31 12:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-23  9:38 [PATCH] common: Improve blocksize support for udf Jan Kara
2023-01-30 16:54 ` Zorro Lang
2023-01-31 12:33   ` Jan Kara

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.