From patchwork Tue May 7 16:56:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10933383 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 97514112C for ; Tue, 7 May 2019 16:57:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 841C7288E8 for ; Tue, 7 May 2019 16:57:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 74205288F8; Tue, 7 May 2019 16:57:10 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 D8CF828702 for ; Tue, 7 May 2019 16:57:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727227AbfEGQ5J (ORCPT ); Tue, 7 May 2019 12:57:09 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:59220 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726575AbfEGQ5I (ORCPT ); Tue, 7 May 2019 12:57:08 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x47Ghc7f183681; Tue, 7 May 2019 16:56:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=tEpd8zINojBtDfNgOw8DY2ZnXQwJRr4H9E6erK341x0=; b=h3Yayy9KlGddAF3AMAJ2WpOGE8xk+wFz7qiUzlRVMMFfSPxqUpol5tRmAZYekmpIUQDC PHgT/5RGOVnP8hAE7mWKhhuxSN9gI/VAwUvMAYhuHWNn0epXuMlI3eoBNO12oXczYFpT VWuRpqQ3jSvTFLGMhd6YyMYgvaD9YiV1Iam5fFeKaiKkwU6HbvnyKvnmJ+FGBOsCQxNJ 6QS7RNumREMSVTCzciF4/DKF9ZVgPlO6m1RMSnI2RXg9PsYp9saoCItyLDy1YIcOrPKO 6IBidd8/opY/c9lMJz+vjQiWG34VcQ5QvkYHo9XYV6y93Ll1+7S4/50oS6WRnzOROMEW 9Q== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 2s94b0prtv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 May 2019 16:56:59 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x47GtLSj159114; Tue, 7 May 2019 16:56:59 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3020.oracle.com with ESMTP id 2s94afkk59-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 May 2019 16:56:58 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x47GuwuG028313; Tue, 7 May 2019 16:56:58 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 07 May 2019 09:56:57 -0700 Subject: [PATCH 1/3] xfs: refactor minimum log size formatting code From: "Darrick J. Wong" To: guaneryu@gmail.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, xuyang2018.jy@cn.fujitsu.com, fstests@vger.kernel.org Date: Tue, 07 May 2019 09:56:56 -0700 Message-ID: <155724821672.2624631.8817002340394524781.stgit@magnolia> In-Reply-To: <155724821034.2624631.4172554705843296757.stgit@magnolia> References: <155724821034.2624631.4172554705843296757.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9250 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905070109 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9250 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905070109 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong Create a new helper function to discover the minimum log size that will work with the mkfs options provided, then remove all the hardcoded block sizes from various xfs tests. This will be necessary when we turn on reflink or rmap by default and the minimum log size increases. Signed-off-by: Darrick J. Wong --- common/xfs | 36 ++++++++++++++++++++++++++++++++++++ tests/xfs/104 | 3 ++- tests/xfs/119 | 3 ++- tests/xfs/291 | 3 ++- tests/xfs/295 | 5 +++-- tests/xfs/297 | 3 ++- 6 files changed, 47 insertions(+), 6 deletions(-) diff --git a/common/xfs b/common/xfs index af2b62ba..42f02ff7 100644 --- a/common/xfs +++ b/common/xfs @@ -77,6 +77,42 @@ _scratch_mkfs_xfs_supported() return $mkfs_status } +# Returns the minimum XFS log size, in units of log blocks. +_scratch_find_xfs_min_logblocks() +{ + local mkfs_cmd="`_scratch_mkfs_xfs_opts`" + + # The smallest log size we can specify is 2M (XFS_MIN_LOG_BYTES) so + # pass that in and see if mkfs succeeds or tells us what is the + # minimum log size. + local XFS_MIN_LOG_BYTES=2097152 + + _scratch_do_mkfs "$mkfs_cmd" "cat" $* -N -l size=$XFS_MIN_LOG_BYTES \ + 2>$tmp.mkfserr 1>$tmp.mkfsstd + local mkfs_status=$? + + # mkfs suceeded, so we must pick out the log block size to do the + # unit conversion + if [ $mkfs_status -eq 0 ]; then + local blksz="$(grep '^log.*bsize' $tmp.mkfsstd | \ + sed -e 's/log.*bsize=\([0-9]*\).*$/\1/g')" + echo $((XFS_MIN_LOG_BYTES / blksz)) + return + fi + + # Usually mkfs will tell us the minimum log size... + if grep -q 'minimum size is' $tmp.mkfserr; then + grep 'minimum size is' $tmp.mkfserr | \ + sed -e 's/^.*minimum size is \([0-9]*\) blocks/\1/g' + return + fi + + # Don't know what to do, so fail + echo "Cannot determine minimum log size" >&2 + cat $tmp.mkfsstd >> $seqres.full + cat $tmp.mkfserr >> $seqres.full +} + _scratch_mkfs_xfs() { local mkfs_cmd="`_scratch_mkfs_xfs_opts`" diff --git a/tests/xfs/104 b/tests/xfs/104 index bc38f969..679aced4 100755 --- a/tests/xfs/104 +++ b/tests/xfs/104 @@ -71,7 +71,8 @@ nags=4 size=`expr 125 \* 1048576` # 120 megabytes initially sizeb=`expr $size / $dbsize` # in data blocks echo "*** creating scratch filesystem" -_create_scratch -lsize=10m -dsize=${size} -dagcount=${nags} +logblks=$(_scratch_find_xfs_min_logblocks -dsize=${size} -dagcount=${nags}) +_create_scratch -lsize=${logblks}b -dsize=${size} -dagcount=${nags} echo "*** using some initial space on scratch filesystem" for i in `seq 125 -1 90`; do diff --git a/tests/xfs/119 b/tests/xfs/119 index bf7f1ca8..8825a5c3 100755 --- a/tests/xfs/119 +++ b/tests/xfs/119 @@ -38,7 +38,8 @@ _require_scratch # this may hang sync -export MKFS_OPTIONS="-l version=2,size=2560b,su=64k" +logblks=$(_scratch_find_xfs_min_logblocks -l version=2,su=64k) +export MKFS_OPTIONS="-l version=2,size=${logblks}b,su=64k" export MOUNT_OPTIONS="-o logbsize=64k" _scratch_mkfs_xfs >/dev/null diff --git a/tests/xfs/291 b/tests/xfs/291 index 349d0cd0..8a4b1354 100755 --- a/tests/xfs/291 +++ b/tests/xfs/291 @@ -31,7 +31,8 @@ _supported_os Linux # real QA test starts here rm -f $seqres.full _require_scratch -_scratch_mkfs_xfs -n size=16k -l size=10m -d size=133m >> $seqres.full 2>&1 +logblks=$(_scratch_find_xfs_min_logblocks -n size=16k -d size=133m) +_scratch_mkfs_xfs -n size=16k -l size=${logblks}b -d size=133m >> $seqres.full 2>&1 _scratch_mount # First we cause very badly fragmented freespace, then diff --git a/tests/xfs/295 b/tests/xfs/295 index 7d1c8faf..65da7d65 100755 --- a/tests/xfs/295 +++ b/tests/xfs/295 @@ -36,7 +36,8 @@ _require_attrs rm -f $seqres.full -_scratch_mkfs -l size=2560b >/dev/null 2>&1 +logblks=$(_scratch_find_xfs_min_logblocks) +_scratch_mkfs -l size=${logblks}b >/dev/null 2>&1 # Should yield a multiply-logged inode, thanks to xattr # Old logprint says this, then coredumps: @@ -53,7 +54,7 @@ _scratch_xfs_logprint 2>&1 >> $seqres.full # match, not as a continued transaction. If that happens we'll see: # xfs_logprint: unknown log operation type (494e) -_scratch_mkfs -l size=2560b >/dev/null 2>&1 +_scratch_mkfs -l size=${logblks}b >/dev/null 2>&1 _scratch_mount for I in `seq 0 8192`; do echo a >> $SCRATCH_MNT/cat diff --git a/tests/xfs/297 b/tests/xfs/297 index 1a048b4b..4f564add 100755 --- a/tests/xfs/297 +++ b/tests/xfs/297 @@ -36,7 +36,8 @@ _require_freeze _require_command "$KILLALL_PROG" killall rm -f $seqres.full -_scratch_mkfs_xfs -d agcount=16,su=256k,sw=12 -l su=256k,size=5120b >/dev/null 2>&1 +logblks=$(_scratch_find_xfs_min_logblocks -d agcount=16,su=256k,sw=12 -l su=256k) +_scratch_mkfs_xfs -d agcount=16,su=256k,sw=12 -l su=256k,size=${logblks}b >/dev/null 2>&1 _scratch_mount STRESS_DIR="$SCRATCH_MNT/testdir" From patchwork Tue May 7 16:57:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10933389 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8E501112C for ; Tue, 7 May 2019 16:57:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EF6F28702 for ; Tue, 7 May 2019 16:57:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73043288E8; Tue, 7 May 2019 16:57:14 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 29EC6288E0 for ; Tue, 7 May 2019 16:57:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727166AbfEGQ5N (ORCPT ); Tue, 7 May 2019 12:57:13 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:59296 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726575AbfEGQ5N (ORCPT ); Tue, 7 May 2019 12:57:13 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x47Ghck6183690; Tue, 7 May 2019 16:57:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=RM8799B0CEK6QOlagumfjozdrzMqZX7QpuAhC0GxiIQ=; b=vYEhGUy5nN4bt8rp+jZzEI7CAwUccq5VOLtCR5+KZsCVgkKyaAezq87UUv05JgaQWyZf IllvOdfOU1SBQj/QfOo55k1yaB/YX04DMIpU3+OZyVG9HFtcVLE6ma62j+4zA80ElWkt BR+G9BfOW5uIlP83qsYa1jljeukhHvm8hji5BeBCOxYX8EfFEWkJIEauHbOPr4rnKzsr vA5ASYS46dYp2XQ2htTn1HMvqtuRqV1doaISRnNNEkTRg3cnfgT/8u2T3Kq1KfjThe4v ZB3FMRqRjI0iVgMDJm/5KG4EKYtB24neSsf6oN1VlER3PbypYIYuBQ19eTKHD74+G5g1 XQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 2s94b0prur-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 May 2019 16:57:06 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x47Gv09A193856; Tue, 7 May 2019 16:57:05 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 2s94b9kmbr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 May 2019 16:57:05 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x47Gv47k028398; Tue, 7 May 2019 16:57:04 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 07 May 2019 09:57:04 -0700 Subject: [PATCH 2/3] xfs/216: always disable rmap and reflink when creating log size test fs From: "Darrick J. Wong" To: guaneryu@gmail.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, xuyang2018.jy@cn.fujitsu.com, fstests@vger.kernel.org Date: Tue, 07 May 2019 09:57:03 -0700 Message-ID: <155724822301.2624631.12786681370099485635.stgit@magnolia> In-Reply-To: <155724821034.2624631.4172554705843296757.stgit@magnolia> References: <155724821034.2624631.4172554705843296757.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9250 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=983 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905070109 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9250 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905070109 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong This test seems to check that log sizes scale up properly with the size of the filesystem, given a carefully controlled set of mkfs parameters. Since turning on reflink or rmap will change the minimum log size, change the test to detect their presence and ensure they're disabled. Signed-off-by: Darrick J. Wong --- tests/xfs/216 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/xfs/216 b/tests/xfs/216 index b1fd8ecc..15ff9ae1 100755 --- a/tests/xfs/216 +++ b/tests/xfs/216 @@ -37,12 +37,18 @@ _require_loop LOOP_DEV=$SCRATCH_MNT/test_fs LOOP_MNT=$SCRATCH_MNT/test_fs_dir +loop_mkfs_opts= +$MKFS_XFS_PROG 2>&1 | grep -q rmapbt && \ + loop_mkfs_opts="$loop_mkfs_opts -m rmapbt=0" +$MKFS_XFS_PROG 2>&1 | grep -q reflink && \ + loop_mkfs_opts="$loop_mkfs_opts -m reflink=0" + _do_mkfs() { for i in $*; do echo -n "fssize=${i}g " $MKFS_XFS_PROG -f -b size=4096 -l version=2 \ - -d name=$LOOP_DEV,size=${i}g |grep log + -d name=$LOOP_DEV,size=${i}g $loop_mkfs_opts |grep log mount -o loop -t xfs $LOOP_DEV $LOOP_MNT echo "test write" > $LOOP_MNT/test umount $LOOP_MNT > /dev/null 2>&1 From patchwork Tue May 7 16:57:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10933393 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 07CBF1575 for ; Tue, 7 May 2019 16:57:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB5CA288E0 for ; Tue, 7 May 2019 16:57:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF1F028702; Tue, 7 May 2019 16:57:18 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,LOTS_OF_MONEY,MAILING_LIST_MULTI,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 971C8288E0 for ; Tue, 7 May 2019 16:57:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727226AbfEGQ5S (ORCPT ); Tue, 7 May 2019 12:57:18 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:60018 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727192AbfEGQ5S (ORCPT ); Tue, 7 May 2019 12:57:18 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x47GhpIT178078; Tue, 7 May 2019 16:57:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=ex6EY1rjgH/SYnmAoJp7fkPANLKzJdi+4DciAFX6N2s=; b=E6DiFqQgkNxQwtOIJau4Q5ufQ6ADnxL51Zq/KkqO9FY8F7sFa9QC+f9HLsakOLxDSwpP HtlaS/s6BNl0AmykcNQR4T3u5eaZTKYroRj2Onh7SUoMvJia+oXpJ72bXqVX0WTR++BM yZBD6dZC5PVzlVNBnqWjlr0R6sGjnTa+E82mcXwVGkdth3lMjyRmDqCYpU+3zxpUCLTp GRMTFQZEXYR+3Ho+hi4s+vqqpE2g1nSd8YerujGrXa8gVeS9CSr01YDwQ8+1fnC0qorO E/sslsHbE7XgP6cvDuRRDTRnc7ueKDteCzMfUESxbrpJ8gZgM276TIbbNeQDFST4jMWV LQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 2s94b5xtbw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 May 2019 16:57:12 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x47Gv24d042554; Tue, 7 May 2019 16:57:12 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 2s9ayf0gd2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 May 2019 16:57:12 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x47GvA1s015267; Tue, 7 May 2019 16:57:11 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 07 May 2019 09:57:10 -0700 Subject: [PATCH 3/3] xfs/294: calculate space to reserve for fragmentation test From: "Darrick J. Wong" To: guaneryu@gmail.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, xuyang2018.jy@cn.fujitsu.com, fstests@vger.kernel.org Date: Tue, 07 May 2019 09:57:09 -0700 Message-ID: <155724822935.2624631.18285317888168151966.stgit@magnolia> In-Reply-To: <155724821034.2624631.4172554705843296757.stgit@magnolia> References: <155724821034.2624631.4172554705843296757.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9250 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905070109 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9250 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905070109 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong This test requires us to fragment free space, and in part accomplishes this by fallocating 400M of a 512M filesystem, then fallocating another 70M, and then using dd to eat remaining space. However, it's risky to assume the 400M figure because new features such as reflink and rmap have per-ag metadata reservations which add to overhead. Therefore, reserve the 70M fragment file first, then try to fallocate 95% of the remaining free space. Signed-off-by: Darrick J. Wong --- tests/xfs/294 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/xfs/294 b/tests/xfs/294 index bce4d07b..af0fc124 100755 --- a/tests/xfs/294 +++ b/tests/xfs/294 @@ -70,15 +70,16 @@ for I in `seq 1 100`; do touch $SCRATCH_MNT/testdir/12345678901234567890$I; done -# Now completely fragment freespace. -# Consume most of it: -$XFS_IO_PROG -f -c "falloc 0 400m" $SCRATCH_MNT/fillfile || - _fail "Could not allocate space" - # File to fragment: $XFS_IO_PROG -f -c "falloc 0 70m" $SCRATCH_MNT/fragfile || _fail "Could not allocate space" +# Now completely fragment freespace. +# Consume most of it: +space=$(stat -f -c '%f * %S * 95 / 100' $SCRATCH_MNT | $BC_PROG) +$XFS_IO_PROG -f -c "falloc 0 $space" $SCRATCH_MNT/fillfile || + _fail "Could not allocate space" + df -h $SCRATCH_MNT >> $seqres.full 2>&1 # Fill remaining space; let this run to failure