lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 21 Jul 2021 10:57:59 +0530
From:   Ritesh Harjani <riteshh@...ux.ibm.com>
To:     fstests@...r.kernel.org
Cc:     linux-ext4@...r.kernel.org, "Theodore Ts'o" <tytso@....edu>,
        "Darrick J . Wong" <djwong@...nel.org>,
        Ritesh Harjani <riteshh@...ux.ibm.com>
Subject: [PATCHv2 6/9] common/rc: Add _mkfs_dev_blocksized functionality

This adds _mkfs_dev_blocksized functionality.

Signed-off-by: Ritesh Harjani <riteshh@...ux.ibm.com>
---
 common/rc | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/common/rc b/common/rc
index d4b1f21f..b5fe5c71 100644
--- a/common/rc
+++ b/common/rc
@@ -722,6 +722,53 @@ _mkfs_dev()
     rm -f $tmp.mkfserr $tmp.mkfsstd
 }
 
+_set_mkfs_options_blocksized()
+{
+	local blocksize=$1
+	local re='^[0-9]+$'
+
+	if ! [[ $blocksize =~ $re ]]; then
+		_notrun "error _set_mkfs_options_blocksized: blocksize \"$blocksize\" not an integer"
+	fi
+
+	case $FSTYP in
+	btrfs)
+		test -f /sys/fs/btrfs/features/supported_sectorsizes || \
+		_notrun "Subpage sectorsize support is not found in $FSTYP"
+
+		grep -wq $blocksize /sys/fs/btrfs/features/supported_sectorsizes || \
+		_notrun "$FSTYP does not support sectorsize=$blocksize yet"
+
+		MKFS_OPTIONS=" --sectorsize=$blocksize"
+		;;
+	xfs)
+		MKFS_OPTIONS=" -b size=$blocksize"
+		;;
+	ext2|ext3|ext4)
+		MKFS_OPTIONS=" -b $blocksize"
+		;;
+	gfs2)
+		MKFS_OPTIONS=" -O -b $blocksize"
+		;;
+	ocfs2)
+		MKFS_OPTIONS=" -b $blocksize -C $blocksize"
+		;;
+	bcachefs)
+		MKFS_OPTIONS=" --block_size=$blocksize"
+		;;
+	*)
+		# do nothing for other FS.
+		;;
+	esac
+}
+
+_mkfs_dev_blocksized()
+{
+	_set_mkfs_options_blocksized $1
+	shift
+	_mkfs_dev $*
+}
+
 # remove all files in $SCRATCH_MNT, useful when testing on NFS/CIFS
 _scratch_cleanup_files()
 {
-- 
2.31.1

Powered by blists - more mailing lists