From patchwork Fri Jul 21 22:04:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 9857749 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 293EC60393 for ; Fri, 21 Jul 2017 22:05:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1AF4B285B6 for ; Fri, 21 Jul 2017 22:05:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0FE3C285D8; Fri, 21 Jul 2017 22:05:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3F03285D4 for ; Fri, 21 Jul 2017 22:05:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754995AbdGUWE7 (ORCPT ); Fri, 21 Jul 2017 18:04:59 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:20409 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754991AbdGUWE6 (ORCPT ); Fri, 21 Jul 2017 18:04:58 -0400 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v6LM4sov017502 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 21 Jul 2017 22:04:54 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.13.8/8.14.4) with ESMTP id v6LM4s4l012816 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 21 Jul 2017 22:04:54 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v6LM4rma027317; Fri, 21 Jul 2017 22:04:53 GMT Received: from localhost (/10.159.239.81) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 21 Jul 2017 15:04:53 -0700 Subject: [PATCH 4/5] common/populate: enable xfs quota accounting From: "Darrick J. Wong" To: eguan@redhat.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Fri, 21 Jul 2017 15:04:52 -0700 Message-ID: <150067469221.30639.16711306489951233808.stgit@magnolia> In-Reply-To: <150067465981.30639.14801416171688538711.stgit@magnolia> References: <150067465981.30639.14801416171688538711.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong 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 --- common/populate | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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 _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