From patchwork Sat Nov 5 00:17:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 9413533 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 9ADA06022E for ; Sat, 5 Nov 2016 00:17:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D23E2B299 for ; Sat, 5 Nov 2016 00:17:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81A4F2B2CD; Sat, 5 Nov 2016 00:17:37 +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=ham 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 D0B412B299 for ; Sat, 5 Nov 2016 00:17:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751199AbcKEARg (ORCPT ); Fri, 4 Nov 2016 20:17:36 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:38121 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750935AbcKEARf (ORCPT ); Fri, 4 Nov 2016 20:17:35 -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 uA50HWDg013311 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 5 Nov 2016 00:17:32 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id uA50HWNk029347 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 5 Nov 2016 00:17:32 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id uA50HUqR000488; Sat, 5 Nov 2016 00:17:31 GMT Received: from localhost (/10.145.178.207) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 04 Nov 2016 17:17:30 -0700 Subject: [PATCH 3/9] populate: optionally fill the filesystem when populating fs From: "Darrick J. Wong" To: david@fromorbit.com, eguan@redhat.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Fri, 04 Nov 2016 17:17:29 -0700 Message-ID: <147830504936.1919.13567740350388016487.stgit@birch.djwong.org> In-Reply-To: <147830503054.1919.4998804611100937975.stgit@birch.djwong.org> References: <147830503054.1919.4998804611100937975.stgit@birch.djwong.org> 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 Be a little more flexible in how much we fill up a pre-populated filesystem. For the field fuzzing tests, we don't need the extra space/inode usage and therefore won't want much at all. Signed-off-by: Darrick J. Wong --- common/populate | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) -- 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 2ac2c22..5d451e3 100644 --- a/common/populate +++ b/common/populate @@ -73,26 +73,39 @@ __populate_create_attr() { done } -# Fill up 60% of the remaining free space +# Fill up some percentage of the remaining free space __populate_fill_fs() { dir="$1" pct="$2" test -z "${pct}" && pct=60 - SRC_SZ="$(du -ks "${SRCDIR}" | cut -f 1)" + mkdir -p "${dir}/test/1" + cp -pRdu "${dir}"/S_IFREG* "${dir}/test/1/" + + SRC_SZ="$(du -ks "${dir}/test/1" | cut -f 1)" FS_SZ="$(( $(stat -f "${dir}" -c '%a * %S') / 1024 ))" NR="$(( (FS_SZ * ${pct} / 100) / SRC_SZ ))" - test "${NR}" -lt 1 && NR=1 - seq 1 "${NR}" | while read nr; do - cp -pRdu "${SRCDIR}" "${dir}/test.${nr}" >> $seqres.full 2>&1 + echo "FILL FS" + echo "src_sz $SRC_SZ fs_sz $FS_SZ nr $NR" + seq 2 "${NR}" | while read nr; do + cp -pRdu "${dir}/test/1" "${dir}/test/${nr}" done } # Populate an XFS on the scratch device with (we hope) all known # types of metadata block _scratch_xfs_populate() { + fill=1 + + for arg in $@; do + case "${arg}" in + "nofill") + fill=0;; + esac + done + _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')" @@ -227,6 +240,15 @@ _scratch_xfs_populate() { # Populate an ext4 on the scratch device with (we hope) all known # types of metadata block _scratch_ext4_populate() { + fill=1 + + for arg in $@; do + case "${arg}" in + "nofill") + fill=0;; + esac + done + _scratch_mount blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")" dblksz="${blksz}" @@ -294,8 +316,7 @@ _scratch_ext4_populate() { # Copy some real files (xfs tests, I guess...) echo "+ real files" - __populate_fill_fs "${SCRATCH_MNT}" - cp -pRdu --reflink=always "${SCRATCH_MNT}/S_IFREG.FMT_ETREE" "${SCRATCH_MNT}/S_IREG.FMT_ETREE.REFLINK" 2> /dev/null + test $fill -ne 0 && __populate_fill_fs "${SCRATCH_MNT}" 5 umount "${SCRATCH_MNT}" }