From patchwork Wed Sep 12 06:26:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandan Rajendra X-Patchwork-Id: 10596765 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 11BBF14F9 for ; Wed, 12 Sep 2018 06:24:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0125F2984C for ; Wed, 12 Sep 2018 06:24:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E9EFB2985B; Wed, 12 Sep 2018 06:24:20 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 4FF642984C for ; Wed, 12 Sep 2018 06:24:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726418AbeILL1S (ORCPT ); Wed, 12 Sep 2018 07:27:18 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:34856 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726502AbeILL1S (ORCPT ); Wed, 12 Sep 2018 07:27:18 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w8C6JeVf143449 for ; Wed, 12 Sep 2018 02:24:18 -0400 Received: from e13.ny.us.ibm.com (e13.ny.us.ibm.com [129.33.205.203]) by mx0a-001b2d01.pphosted.com with ESMTP id 2meqxvb9y3-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 12 Sep 2018 02:24:18 -0400 Received: from localhost by e13.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 12 Sep 2018 02:24:17 -0400 Received: from b01cxnp22036.gho.pok.ibm.com (9.57.198.26) by e13.ny.us.ibm.com (146.89.104.200) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 12 Sep 2018 02:24:14 -0400 Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w8C6ODuE25952418 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 12 Sep 2018 06:24:13 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EEE802805A; Wed, 12 Sep 2018 02:22:17 -0400 (EDT) Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8BCD72805E; Wed, 12 Sep 2018 02:22:16 -0400 (EDT) Received: from localhost.in.ibm.com (unknown [9.124.35.206]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 12 Sep 2018 02:22:16 -0400 (EDT) From: Chandan Rajendra To: fstests@vger.kernel.org Cc: Chandan Rajendra , guaneryu@gmail.com, darrick.wong@oracle.com, linux-xfs@vger.kernel.org Subject: [PATCH V3 01/19] Fix xfs/009 to work with 64k block size Date: Wed, 12 Sep 2018 11:56:08 +0530 X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180912062626.14349-1-chandan@linux.vnet.ibm.com> References: <20180912062626.14349-1-chandan@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18091206-0064-0000-0000-0000034BCACC X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009706; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000266; SDB=6.01087104; UDB=6.00561328; IPR=6.00867116; MB=3.00023245; MTD=3.00000008; XFM=3.00000015; UTC=2018-09-12 06:24:16 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18091206-0065-0000-0000-00003A9D4C42 Message-Id: <20180912062626.14349-2-chandan@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-09-12_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 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-1807170000 definitions=main-1809120068 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 xfs_alloc_file_space() rounds up allocation requests by the filesystem block size. Hence this commit changes the test to work with block size units rather than with a multiple of 4096 bytes. Signed-off-by: Chandan Rajendra --- tests/xfs/009 | 92 ++++++++++++++++++++++++++++++++++++++++++++++--------- tests/xfs/009.out | 66 +++++++++++++++++++-------------------- 2 files changed, 110 insertions(+), 48 deletions(-) diff --git a/tests/xfs/009 b/tests/xfs/009 index 68f6379..70717eb 100755 --- a/tests/xfs/009 +++ b/tests/xfs/009 @@ -14,9 +14,6 @@ here=`pwd` tmp=/tmp/$$ status=1 # failure is the default! trap "_cleanup; exit \$status" 0 1 2 3 15 -# This isn't really related to fs block size, it's just what -# alloc uses for the "block" unit in it's input parameters... -bsize=4096 _cleanup() { @@ -24,13 +21,6 @@ _cleanup() _scratch_unmount } -_block_filter() -{ - sed \ - -e 's/[0-9][0-9]*\.\.[0-9][0-9]*/BLOCKRANGE/g' \ - -e "s/blocksize $bsize/blocksize BSIZE/g" -} - _init() { echo "*** mkfs" @@ -49,11 +39,6 @@ _init() fi } -_filesize() -{ - ls -l $1 | $AWK_PROG '{print "filesize = " $5}' -} - # get standard environment, filters and checks . ./common/rc . ./common/filter @@ -64,9 +49,86 @@ _supported_os Linux _require_scratch +_filesize() +{ + ls -l $1 | $AWK_PROG -v bsize="$bsize" '{print "filesize = " $5 / bsize}' +} + +_block_filter() +{ + $AWK_PROG -v bsize="$bsize" ' + /blocksize/ { + printf(" blocksize BSIZE\n") + + next + } + + /CMD/ { + split($3, off, "=") + offset = strtonum(off[2]) + if (offset != -1) + offset = offset / bsize + + split($4, len, "=") + nr_blocks = strtonum(len[2]) + if (nr_blocks != -1) + nr_blocks = nr_blocks / bsize + + printf(" %s %s off=%s, len=%d\n", $1, $2, offset, nr_blocks) + + next + } + + /MAP/ { + split($2, off, "=") + offset = strtonum(off[2]) + if (offset != -1) + offset = offset / bsize + + split($3, len, "=") + + nr_blocks = strtonum(len[2]) + + if (nr_blocks != -1) + nr_blocks = nr_blocks / bsize + + printf(" %s off=%s, len=%d %s\n", $1, offset, nr_blocks, $4) + + next + } + + /TRUNCATE/ { + split($2, off, "=") + offset = strtonum(off[2]) / bsize + + printf(" %s off=%s\n", $1, offset) + + next + } + + /\[[0-9]+,[0-9]+\]:/ { + printf(" %s BLOCKRANGE\n", $1) + + next + } + + { + print + + next + } + ' +} + _init out=$SCRATCH_MNT/$$.tmp +# This isn't really related to fs block size, it's just what +# alloc uses for the "block" unit in it's input parameters... +# However, xfs_alloc_file_space() rounds up allocation +# request by the filesystem's block size. +bsize=$(_get_block_size $SCRATCH_MNT) + # since we're using a clean FS here, we make some assumptions # about availability of contiguous blocks diff --git a/tests/xfs/009.out b/tests/xfs/009.out index 7132aca..02b5d82 100644 --- a/tests/xfs/009.out +++ b/tests/xfs/009.out @@ -3,8 +3,8 @@ QA output created by 009 *** mount *** test 1 - reservations cleared on O_TRUNC blocksize BSIZE - CMD resvsp, off=0, len=4096000 - MAP off=0, len=4096000 [0,1000] + CMD resvsp, off=0, len=1000 + MAP off=0, len=1000 [0,1000] [ofs,count]: start..end [0,1000]: BLOCKRANGE MAP off=0, len=-1 [0-] @@ -17,53 +17,53 @@ filesize = 0 filesize = 0 *** test 2 - reserve & filesize blocksize BSIZE - CMD resvsp, off=0, len=4096000 - MAP off=0, len=4096000 [0,1000] + CMD resvsp, off=0, len=1000 + MAP off=0, len=1000 [0,1000] [ofs,count]: start..end [0,1000]: BLOCKRANGE filesize = 0 *** test 3 - alloc & filesize blocksize BSIZE - CMD allocsp, off=4096000, len=-1 - MAP off=4096000, len=-1 [1000-] + CMD allocsp, off=1000, len=-1 + MAP off=1000, len=-1 [1000-] [ofs,count]: start..end -filesize = 4096000 +filesize = 1000 *** test 4 - allocations cleared on O_TRUNC blocksize BSIZE - CMD allocsp, off=4096000, len=-1 - MAP off=4096000, len=-1 [1000-] + CMD allocsp, off=1000, len=-1 + MAP off=1000, len=-1 [1000-] [ofs,count]: start..end -filesize = 4096000 +filesize = 1000 blocksize BSIZE MAP off=0, len=-1 [0-] [ofs,count]: start..end filesize = 0 *** test 5 - reserve / unreserve blocksize BSIZE - CMD resvsp, off=0, len=409600 - MAP off=0, len=409600 [0,100] + CMD resvsp, off=0, len=100 + MAP off=0, len=100 [0,100] [ofs,count]: start..end [0,100]: BLOCKRANGE - CMD unresvsp, off=409600, len=2048000 - MAP off=409600, len=2048000 [100,500] + CMD unresvsp, off=100, len=500 + MAP off=100, len=500 [100,500] [ofs,count]: start..end MAP off=0, len=-1 [0-] [ofs,count]: start..end [0,100]: BLOCKRANGE - CMD unresvsp, off=3686400, len=819200 - MAP off=3686400, len=819200 [900,200] + CMD unresvsp, off=900, len=200 + MAP off=900, len=200 [900,200] [ofs,count]: start..end MAP off=0, len=-1 [0-] [ofs,count]: start..end [0,100]: BLOCKRANGE *** test 6 - reserve adjacent blocksize BSIZE - CMD resvsp, off=0, len=409600 - MAP off=0, len=409600 [0,100] + CMD resvsp, off=0, len=100 + MAP off=0, len=100 [0,100] [ofs,count]: start..end [0,100]: BLOCKRANGE - CMD resvsp, off=409600, len=409600 - MAP off=409600, len=409600 [100,100] + CMD resvsp, off=100, len=100 + MAP off=100, len=100 [100,100] [ofs,count]: start..end [100,100]: BLOCKRANGE MAP off=0, len=-1 [0-] @@ -71,44 +71,44 @@ filesize = 0 [0,200]: BLOCKRANGE *** test 7 - alloc blocksize BSIZE - CMD allocsp, off=4096000, len=-1 - MAP off=4096000, len=-1 [1000-] + CMD allocsp, off=1000, len=-1 + MAP off=1000, len=-1 [1000-] [ofs,count]: start..end MAP off=0, len=-1 [0-] [ofs,count]: start..end [0,1000]: BLOCKRANGE - CMD allocsp, off=8192000, len=-1 - MAP off=8192000, len=-1 [2000-] + CMD allocsp, off=2000, len=-1 + MAP off=2000, len=-1 [2000-] [ofs,count]: start..end MAP off=0, len=-1 [0-] [ofs,count]: start..end [0,2000]: BLOCKRANGE -filesize = 8192000 +filesize = 2000 *** test 8 - alloc & truncate blocksize BSIZE - CMD allocsp, off=4096000, len=-1 - MAP off=4096000, len=-1 [1000-] + CMD allocsp, off=1000, len=-1 + MAP off=1000, len=-1 [1000-] [ofs,count]: start..end MAP off=0, len=-1 [0-] [ofs,count]: start..end [0,1000]: BLOCKRANGE - TRUNCATE off=2048000 + TRUNCATE off=500 MAP off=0, len=-1 [0-] [ofs,count]: start..end [0,500]: BLOCKRANGE -filesize = 2048000 +filesize = 500 *** test 9 - reserve & truncate blocksize BSIZE - CMD resvsp, off=0, len=4096000 - MAP off=0, len=4096000 [0,1000] + CMD resvsp, off=0, len=1000 + MAP off=0, len=1000 [0,1000] [ofs,count]: start..end [0,1000]: BLOCKRANGE MAP off=0, len=-1 [0-] [ofs,count]: start..end [0,1000]: BLOCKRANGE - TRUNCATE off=2048000 + TRUNCATE off=500 MAP off=0, len=-1 [0-] [ofs,count]: start..end [0,1000]: BLOCKRANGE -filesize = 2048000 +filesize = 500 *** unmount