From: "Darrick J. Wong" <djwong@kernel.org>
To: djwong@kernel.org, guaneryu@gmail.com, zlang@redhat.com
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me,
tytso@mit.edu, linux-ext4@vger.kernel.org
Subject: [PATCH 2/3] common/rc: move XFS-specific parts of _scratch_options into common/xfs
Date: Tue, 02 Aug 2022 21:21:51 -0700 [thread overview]
Message-ID: <165950051183.198922.10544333892197894472.stgit@magnolia> (raw)
In-Reply-To: <165950050051.198922.13423077997881086438.stgit@magnolia>
From: Darrick J. Wong <djwong@kernel.org>
Move all the non-XFS code in _scratch_options into a
_scratch_xfs_options helper in common/xfs, in preparation to add ext4
bits.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
common/rc | 23 +++--------------------
common/xfs | 23 +++++++++++++++++++++++
2 files changed, 26 insertions(+), 20 deletions(-)
diff --git a/common/rc b/common/rc
index 52dd3b41..dc1d65c3 100644
--- a/common/rc
+++ b/common/rc
@@ -172,30 +172,13 @@ _clear_mount_stack()
_scratch_options()
{
- local type=$1
- local rt_opt=""
- local log_opt=""
SCRATCH_OPTIONS=""
- if [ "$FSTYP" != "xfs" ]; then
- return
- fi
-
- case $type in
- mkfs)
- SCRATCH_OPTIONS="$SCRATCH_OPTIONS -f"
- rt_opt="-r"
- log_opt="-l"
- ;;
- mount)
- rt_opt="-o"
- log_opt="-o"
+ case "$FSTYP" in
+ "xfs")
+ _scratch_xfs_options "$@"
;;
esac
- [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \
- SCRATCH_OPTIONS="$SCRATCH_OPTIONS ${rt_opt}rtdev=$SCRATCH_RTDEV"
- [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
- SCRATCH_OPTIONS="$SCRATCH_OPTIONS ${log_opt}logdev=$SCRATCH_LOGDEV"
}
_test_options()
diff --git a/common/xfs b/common/xfs
index 9f84dffb..f6f4cdd2 100644
--- a/common/xfs
+++ b/common/xfs
@@ -265,6 +265,29 @@ _xfs_check()
return $status
}
+_scratch_xfs_options()
+{
+ local type=$1
+ local rt_opt=""
+ local log_opt=""
+
+ case $type in
+ mkfs)
+ SCRATCH_OPTIONS="$SCRATCH_OPTIONS -f"
+ rt_opt="-r"
+ log_opt="-l"
+ ;;
+ mount)
+ rt_opt="-o"
+ log_opt="-o"
+ ;;
+ esac
+ [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \
+ SCRATCH_OPTIONS="$SCRATCH_OPTIONS ${rt_opt}rtdev=$SCRATCH_RTDEV"
+ [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
+ SCRATCH_OPTIONS="$SCRATCH_OPTIONS ${log_opt}logdev=$SCRATCH_LOGDEV"
+}
+
_scratch_xfs_db_options()
{
SCRATCH_OPTIONS=""
next prev parent reply other threads:[~2022-08-03 4:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-03 4:21 [PATCHSET 0/3] fstests: refactor ext4-specific code Darrick J. Wong
2022-08-03 4:21 ` [PATCH 1/3] common/rc: move ext4-specific helpers into a separate common/ext4 file Darrick J. Wong
2022-08-03 4:21 ` Darrick J. Wong [this message]
2022-08-03 4:21 ` [PATCH 3/3] common/ext4: provide custom ext4 scratch fs options Darrick J. Wong
2022-08-03 18:28 ` Zorro Lang
2022-08-03 18:52 ` Darrick J. Wong
2022-08-04 0:25 ` [PATCH v1.2 " Darrick J. Wong
2022-08-04 5:03 ` Darrick J. Wong
2022-08-04 16:29 ` [PATCH v1.3 " Darrick J. Wong
2022-08-05 17:08 ` Zorro Lang
2022-08-06 14:36 ` [PATCHSET 0/3] fstests: refactor ext4-specific code Zorro Lang
2022-08-07 16:30 ` Darrick J. Wong
2022-08-08 15:13 ` Zorro Lang
-- strict thread matches above, loose matches on Subject: below --
2022-08-09 21:00 [PATCHSET v2 " Darrick J. Wong
2022-08-09 21:00 ` [PATCH 2/3] common/rc: move XFS-specific parts of _scratch_options into common/xfs Darrick J. Wong
2022-08-11 12:32 ` Christoph Hellwig
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=165950051183.198922.10544333892197894472.stgit@magnolia \
--to=djwong@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=guan@eryu.me \
--cc=guaneryu@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=zlang@redhat.com \
/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