fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ritesh Harjani <riteshh@linux.ibm.com>
To: fstests@vger.kernel.org
Cc: linux-ext4@vger.kernel.org, "Theodore Ts'o" <tytso@mit.edu>,
	"Darrick J . Wong" <djwong@kernel.org>,
	Ritesh Harjani <riteshh@linux.ibm.com>
Subject: [PATCHv2 6/9] common/rc: Add _mkfs_dev_blocksized functionality
Date: Wed, 21 Jul 2021 10:57:59 +0530	[thread overview]
Message-ID: <0cc5f31ca1e4ef56367d041b86e7dcb78e1e033e.1626844259.git.riteshh@linux.ibm.com> (raw)
In-Reply-To: <cover.1626844259.git.riteshh@linux.ibm.com>

This adds _mkfs_dev_blocksized functionality.

Signed-off-by: Ritesh Harjani <riteshh@linux.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


  parent reply	other threads:[~2021-07-21  5:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-21  5:27 [PATCHv2 0/9] xfstests: 64K blocksize related fixes Ritesh Harjani
2021-07-21  5:27 ` [PATCHv2 1/9] ext4/003: Fix this test on 64K platform for dax config Ritesh Harjani
2021-07-21  5:27 ` [PATCHv2 2/9] ext4/027: Correct the right code of block and inode bitmap Ritesh Harjani
2021-07-21  5:27 ` [PATCHv2 3/9] ext4/306: Add -b blocksize parameter too to avoid failure with DAX config Ritesh Harjani
2021-07-21  5:27 ` [PATCHv2 4/9] ext4/022: exclude this test for dax config on 64KB pagesize platform Ritesh Harjani
2021-07-21  5:27 ` [PATCHv2 5/9] generic/031: Fix the test case for 64k blocksize config Ritesh Harjani
2021-08-01 16:00   ` Eryu Guan
2021-08-03  5:00     ` Ritesh Harjani
2021-08-08 12:36       ` Eryu Guan
2021-07-21  5:27 ` Ritesh Harjani [this message]
2021-07-21  5:28 ` [PATCHv2 7/9] generic/620: Use _mkfs_dev_blocksized to use 4k bs Ritesh Harjani
2021-08-01 16:03   ` Eryu Guan
2021-08-03  5:06     ` Ritesh Harjani
2021-08-08 13:32       ` Eryu Guan
2021-07-21  5:28 ` [PATCHv2 8/9] common/attr: Cleanup end of line whitespaces issues Ritesh Harjani
2021-07-21  5:28 ` [PATCHv2 9/9] common/attr: Reduce MAX_ATTRS to leave some overhead for 64K blocksize Ritesh Harjani
2021-08-01 16:05 ` [PATCHv2 0/9] xfstests: 64K blocksize related fixes Eryu Guan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0cc5f31ca1e4ef56367d041b86e7dcb78e1e033e.1626844259.git.riteshh@linux.ibm.com \
    --to=riteshh@linux.ibm.com \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).