From patchwork Fri Oct 20 17:05:58 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: 10020679 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 570E4602CB for ; Fri, 20 Oct 2017 17:06:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4655428372 for ; Fri, 20 Oct 2017 17:06:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B2A828F23; Fri, 20 Oct 2017 17:06:05 +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 CB78D28372 for ; Fri, 20 Oct 2017 17:06:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753378AbdJTRGD (ORCPT ); Fri, 20 Oct 2017 13:06:03 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:30939 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752977AbdJTRGB (ORCPT ); Fri, 20 Oct 2017 13:06:01 -0400 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v9KH5xZL020945 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 20 Oct 2017 17:06:00 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v9KH5xub019361 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 20 Oct 2017 17:05:59 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v9KH5xOw013340; Fri, 20 Oct 2017 17:05:59 GMT Received: from localhost (/73.25.142.12) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 20 Oct 2017 10:05:59 -0700 Date: Fri, 20 Oct 2017 10:05:58 -0700 From: "Darrick J. Wong" To: Anatoly Pugachev Cc: fstests , linux-xfs@vger.kernel.org Subject: Re: [fstests] hardcoded values in common/rc for xfs (and probably others) Message-ID: <20171020170558.GY4755@magnolia> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Source-IP: userv0022.oracle.com [156.151.31.74] 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 On Fri, Oct 20, 2017 at 07:52:31PM +0300, Anatoly Pugachev wrote: > Hello! > > While running generic/012 on xfs filesystem created on sparc64 linux > (pagesize 8k) with "mkfs.xfs -b size=8192 /dev/vdiskb1" (but not with > the default mkfs.xfs which will use 4k block size) , I'm getting the > following output: > > root@ttip:xfstests-dev# cat local.config > export TEST_DIR=/testvol > export TEST_DEV=/dev/vdiskb1 > export SCRATCH_DEV_POOL="/dev/loop0 /dev/loop1 /dev/loop2" > export SCRATCH_MNT=/1/scratch > export MKFS_OPTIONS="-m reflink=1" > > root@ttip:xfstests-dev# mkfs.xfs -b size=8192 -m reflink=1 -f /dev/vdiskb1 > meta-data=/dev/vdiskb1 isize=512 agcount=4, agsize=983008 blks > = sectsz=8192 attr=2, projid32bit=1 > = crc=1 finobt=1, sparse=0, > rmapbt=0, reflink=1 > data = bsize=8192 blocks=3932032, imaxpct=25 > = sunit=0 swidth=0 blks > naming =version 2 bsize=8192 ascii-ci=0 ftype=1 > log =internal log bsize=8192 blocks=2160, version=2 > = sectsz=8192 sunit=1 blks, lazy-count=1 > realtime =none extsz=8192 blocks=0, rtextents=0 > > root@ttip:xfstests-dev# ./check generic/012 > FSTYP -- xfs (debug) > PLATFORM -- Linux/sparc64 ttip 4.14.0-rc5 > MKFS_OPTIONS -- -f -m reflink=1 /dev/loop0 > MOUNT_OPTIONS -- /dev/loop0 /1/scratch > > generic/012 2s ... [not run] xfs_io fcollapse failed (old kernel/wrong > fs/bad args?) > Not run: generic/012 > Passed all 0 tests > > root@ttip:xfstests-dev# xfs_io -V > xfs_io version 4.13.1 > > > debugging it, comes from the following xfs_io command: > > root@ttip:xfstests-dev# mount /dev/vdiskb1 /testvol/ > root@ttip:xfstests-dev# /opt/xfsprogs/sbin/xfs_io -i -F -f -c "pwrite > 0 20k" -c fsync -c "fcollapse 4k 8k" /testvol/248329.xfs_io 2>&1 > wrote 20480/20480 bytes at offset 0 > 20 KiB, 3 ops; 0.0000 sec (95.741 MiB/sec and 14705.8824 ops/sec) > fallocate: Invalid argument > > > While chatting in #xfs irc channel, Darrick told that there is should > not be hardcoded values (like 4k for fcollapse) in generic/012, but it > comes from _require_xfs_io_command() from common/rc, quote: > > 19:19 < djwong> anyway... fcollapse (and finsert) both requires that > the offset/length arguments are block-aligned > 19:19 < djwong> hence you can't fcollapse starting at 4k on an fs with 8k blocks > > And it's not only generic/012, it fails generic/0{16,17,21,22} (and > probably more) as well. > > Can someone look into this issue? Does the following xfstests patch help? --D --- To unsubscribe from this list: send the line "unsubscribe linux-xfs" 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/punch b/common/punch index c4ed261..5648bd8 100644 --- a/common/punch +++ b/common/punch @@ -341,13 +341,26 @@ _test_generic_punch() testfile=$6 multiple=1 + # This routine was originally written for fallocate modes that + # don't have alignment requirements so the (sort of) hardcoded + # 4k offsets didn't matter. fcollapse and finsert require + # block-aligned arguments, so increase $multiple until we get + # to the file's minimum data block size. + case "$zero_cmd" in + "fcollapse"|"finsert") + touch $testfile + bs=$(_get_file_block_size $testfile) + test "$bs" -gt 4096 && multiple=$((bs / 4096)) + ;; + esac + # # If we are testing collapse range, we increare all the offsets of this # test by a factor of 4. We do this because unlike punch, collapse # range also decreases the size of file hence require bigger offsets. # if [ "$zero_cmd" == "fcollapse" ]; then - multiple=4 + multiple=$((multiple * 4)) fi _4k="$((multiple * 4))k" diff --git a/common/rc b/common/rc index fe68d67..b585016 100644 --- a/common/rc +++ b/common/rc @@ -2063,8 +2063,8 @@ _require_xfs_io_command() param_checked=1 ;; "fpunch" | "fcollapse" | "zero" | "fzero" | "finsert" | "funshare") - testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \ - -c "$command 4k 8k" $testfile 2>&1` + testio=`$XFS_IO_PROG -F -f -c "pwrite 0 256k" -c "fsync" \ + -c "$command 64k 128k" $testfile 2>&1` ;; "fiemap") testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \