From: Eryu Guan <eguan@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org
Subject: Re: [PATCH 4/5] common/populate: enable xfs quota accounting
Date: Fri, 4 Aug 2017 10:22:00 +0800 [thread overview]
Message-ID: <20170804022200.GC1991@eguan.usersys.redhat.com> (raw)
In-Reply-To: <150067469221.30639.16711306489951233808.stgit@magnolia>
On Fri, Jul 21, 2017 at 03:04:52PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> When we're creating a populated xfs image, turn on quotas so that we can
> fuzz those fields too.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> common/populate | 50 +++++++++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 49 insertions(+), 1 deletion(-)
>
>
> diff --git a/common/populate b/common/populate
> index 498151f..b77c508 100644
> --- a/common/populate
> +++ b/common/populate
> @@ -21,6 +21,7 @@
> # Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
> # Mountain View, CA 94043, USA, or: http://www.sgi.com
> #-----------------------------------------------------------------------
> +. ./common/quota
>
> _require_populate_commands() {
> _require_xfs_io_command "falloc"
> @@ -94,6 +95,47 @@ __populate_fill_fs() {
> done
> }
>
> +# For XFS, force on all the quota options if quota is enabled
> +# and the user didn't feed us noquota.
> +_populate_xfs_qmount_option()
> +{
> + # User explicitly told us not to quota
> + if echo "${MOUNT_OPTIONS}" | grep -q 'noquota'; then
> + return
> + fi
> +
> + # Don't bother if we can't turn on quotas
> + if [ ! -f /proc/fs/xfs/xqmstat ]; then
> + # No quota support
> + return
> + elif [ "${USE_EXTERNAL}" = "yes" ] && [ ! -z "${SCRATCH_RTDEV}" ]; then
> + # Quotas not supported on rt filesystems
> + return
> + elif [ -z "${XFS_QUOTA_PROG}" ]; then
> + # xfs quota tools not installed
> + return
> + fi
> +
> + # Turn on all the quotas
> + if xfs_info "${TEST_DIR}" | grep -q 'crc=1'; then
> + # v5 filesystems can have group & project quotas
> + quota="usrquota,grpquota,prjquota"
> + else
> + # v4 filesystems cannot mix group & project quotas
> + quota="usrquota,grpquota"
> + fi
> +
> + # Inject our quota mount options
> + if echo "${MOUNT_OPTIONS}" | grep -q "${quota}"; then
> + return
> + elif echo "${MOUNT_OPTIONS}" | egrep -q '(quota|noenforce)'; then
> + _qmount_option "${quota}"
> + else
> + export MOUNT_OPTIONS="$MOUNT_OPTIONS -o ${quota}"
> + echo "MOUNT_OPTIONS = $MOUNT_OPTIONS" >>$seqres.full
> + fi
> +}
> +
> # Populate an XFS on the scratch device with (we hope) all known
> # types of metadata block
> _scratch_xfs_populate() {
> @@ -106,6 +148,7 @@ _scratch_xfs_populate() {
> esac
> done
>
> + _populate_xfs_qmount_option
Sorry, another question just poped up..
This enables quota and modifies MOUNT_OPTIONS unconditionally and
implicitly, I suspect users of _scratch_populate_cached() or
_scratch_xfs_populate() may be bitten by this implicit change.
Would it be better if there's a argument to control this quota
enablement and default to disable quota? Just like the "nofill"
argument, introduce a new "quota" argument? So existing callers of
_scratch_populate_cached() are not affected by this change, and tests
want quota can enable it explicitly.
Thanks,
Eryu
> _scratch_mount
> blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")"
> dblksz="$(xfs_info "${SCRATCH_MNT}" | grep naming.*bsize | sed -e 's/^.*bsize=//g' -e 's/\([0-9]*\).*$/\1/g')"
> @@ -720,7 +763,12 @@ _scratch_populate_cached() {
> test -n "${SCRATCH_LOGDEV}" && rm -f "${POPULATE_METADUMP}"
> ;;
> "xfs")
> - extra_descr="LOGDEV ${SCRATCH_LOGDEV} USE_EXTERNAL ${USE_EXTERNAL} RTDEV ${SCRATCH_RTDEV}";;
> + extra_descr="LOGDEV ${SCRATCH_LOGDEV} USE_EXTERNAL ${USE_EXTERNAL} RTDEV ${SCRATCH_RTDEV}"
> + _populate_xfs_qmount_option
> + if echo "${MOUNT_OPTIONS}" | grep -q 'usrquota'; then
> + extra_descr="${extra_descr} QUOTAS"
> + fi
> + ;;
> *)
> extra_descr="";;
> esac
>
next prev parent reply other threads:[~2017-08-04 2:22 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-21 22:04 [PATCH 0/5] miscellaneous tests Darrick J. Wong
2017-07-21 22:04 ` [PATCH 1/5] xfs: only run scrub in dry run mode Darrick J. Wong
2017-07-21 22:04 ` [PATCH 2/5] ext4: fsmap tests Darrick J. Wong
2017-07-21 22:04 ` [PATCH 3/5] common/inject: refactor helpers to use new errortag interface Darrick J. Wong
2017-08-02 8:37 ` Eryu Guan
2017-08-02 14:30 ` Brian Foster
2017-08-02 15:52 ` Darrick J. Wong
2017-08-02 16:29 ` Brian Foster
2017-08-03 0:56 ` Eryu Guan
2017-08-03 15:49 ` [PATCH v2 " Darrick J. Wong
2017-08-04 0:45 ` Eryu Guan
2017-08-04 15:32 ` Darrick J. Wong
2017-08-04 15:37 ` [PATCH v3 " Darrick J. Wong
2017-07-21 22:04 ` [PATCH 4/5] common/populate: enable xfs quota accounting Darrick J. Wong
2017-08-04 1:54 ` Eryu Guan
2017-08-08 21:24 ` Darrick J. Wong
2017-08-04 2:22 ` Eryu Guan [this message]
2017-08-08 21:22 ` Darrick J. Wong
2017-08-23 22:03 ` Darrick J. Wong
2017-08-24 3:23 ` Eryu Guan
2017-07-21 22:04 ` [PATCH 5/5] xfs: test fuzzing every field of a dquot Darrick J. Wong
2017-08-24 9:03 ` Eryu Guan
2017-08-24 17:37 ` Darrick J. Wong
2017-08-04 7:00 ` [PATCH 0/5] miscellaneous tests 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=20170804022200.GC1991@eguan.usersys.redhat.com \
--to=eguan@redhat.com \
--cc=darrick.wong@oracle.com \
--cc=fstests@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
/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).