From patchwork Mon Aug 10 17:38:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Whitney X-Patchwork-Id: 6985701 Return-Path: X-Original-To: patchwork-fstests@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 14D51C05AC for ; Mon, 10 Aug 2015 17:37:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1B6282061C for ; Mon, 10 Aug 2015 17:37:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 16F7F205D1 for ; Mon, 10 Aug 2015 17:37:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753931AbbHJRhN (ORCPT ); Mon, 10 Aug 2015 13:37:13 -0400 Received: from mail-qk0-f182.google.com ([209.85.220.182]:35190 "EHLO mail-qk0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753472AbbHJRhM (ORCPT ); Mon, 10 Aug 2015 13:37:12 -0400 Received: by qkbm65 with SMTP id m65so60659492qkb.2; Mon, 10 Aug 2015 10:37:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=WwB3wLQlrN9BP5dgVW325FFhqFRr28/1lcBVbM6ziZI=; b=jphE4omK54p5LwG+x6Y4FWS7TYZO+tG7sadVfnw+mMuMH00y4yMdCvgp3VO4ZYGII4 vR17+jARuiED150rHWOu8bZ70ZfWugfWiCigSRXF77lch0tYZCdl7J7rxOUrA/cIaibT p2wwxjuFHsm6mTreLj7GXvrxztepYvUK7IwexehSua/IcBFDIyzg8lYw2hhfXp5+/d1E Grdz7c901ARkb5eceish8+8S2bUz92sfmKts4urUe5Rz85lO84N7HD3rmtW6UJB53xAt UekMU/1M+KBT5E/BR5SvvUP3/E3Y72jqvjPJ6t9b5b7mMqDuWpY9vRaBC62BdXEoKGVa 7lsA== X-Received: by 10.55.43.231 with SMTP id r100mr40467165qkr.54.1439228231400; Mon, 10 Aug 2015 10:37:11 -0700 (PDT) Received: from localhost.localdomain (c-50-187-53-200.hsd1.nh.comcast.net. [50.187.53.200]) by smtp.gmail.com with ESMTPSA id l5sm10165194qhl.3.2015.08.10.10.37.09 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Aug 2015 10:37:10 -0700 (PDT) Date: Mon, 10 Aug 2015 13:38:38 -0400 From: Eric Whitney To: fstests@vger.kernel.org Cc: namjae.jeon@samsung.com, linux-ext4@vger.kernel.org Subject: [PATCH] generic/064: allow room for unexpected allocation behavior Message-ID: <20150810173838.GA1845@localhost.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Per Dave Chinner's suggestion, modify generic/064 so that it won't fail if it finds a few more extents than it expects in its test file after inserting ranges. When 064's test file is first created, some file systems may use more than the ideal minimum single extent to represent it, and this can lead to a mismatch between the actual and expected extent count after the ranges have been inserted. Ext4 file systems mounted with delayed allocation disabled can exhibit this behavior if a test file's blocks happen to be allocated across regions of file system metadata. Also, replace the open coded counting of extents and holes with a simpler call to _count_extents(), and clarify some comments. Signed-off-by: Eric Whitney Reviewed-by: Namjae Jeon --- tests/generic/064 | 16 +++++++++------- tests/generic/064.out | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) mode change 100644 => 100755 tests/generic/064 diff --git a/tests/generic/064 b/tests/generic/064 old mode 100644 new mode 100755 index 760539a..d384a9a --- a/tests/generic/064 +++ b/tests/generic/064 @@ -2,9 +2,9 @@ # FS QA Test No. generic/064 # # Test multiple fallocate insert/collapse range calls on same file. -# Call insert range a single alternate block multiple times until the file -# is left with 100 extents and as much number of extents. And Call collapse -# range about the previously inserted ranges to test merge code of collapse +# Call insert range on alternate blocks multiple times until the file +# is left with 50 extents and as many holes. Then call collapse range +# on the previously inserted ranges to test merge code of collapse # range. Also check for data integrity and file system consistency. #----------------------------------------------------------------------- # Copyright (c) 2015 Samsung Electronics. All Rights Reserved. @@ -59,7 +59,7 @@ length=$(($BLOCKS * $BSIZE)) # Write file _do "$XFS_IO_PROG -f -c \"pwrite 0 $length\" -c fsync $src" cp $src $dest -extent_before=`$XFS_IO_PROG -c "fiemap -v" $dest | grep "^ *[0-9]*:" |wc -l` +extent_before=`_count_extents $dest` # Insert alternate blocks for (( j=0; j < $(($BLOCKS/2)); j++ )); do @@ -67,8 +67,10 @@ for (( j=0; j < $(($BLOCKS/2)); j++ )); do _do "$XFS_IO_PROG -c \"finsert $offset $BSIZE\" $dest" done -# Check if 100 extents are present -$XFS_IO_PROG -c "fiemap -v" $dest | grep "^ *[0-9]*:" |wc -l +# Check if 50 extents are present, allowing some slop for file systems +# that don't have ideal allocation behavior +num_extents=`_count_extents $dest` +_within_tolerance "Extent count after inserts" $num_extents 50 0 6% -v _check_scratch_fs if [ $? -ne 0 ]; then @@ -82,7 +84,7 @@ for (( j=0; j < $(($BLOCKS/2)); j++ )); do _do "$XFS_IO_PROG -c \"fcollapse $offset $BSIZE\" $dest" done -extent_after=`$XFS_IO_PROG -c "fiemap -v" $dest | grep "^ *[0-9]*:" |wc -l` +extent_after=`_count_extents $dest` if [ $extent_before -ne $extent_after ]; then echo "extents mismatched before = $extent_before after = $extent_after" fi diff --git a/tests/generic/064.out b/tests/generic/064.out index b217df5..329e447 100644 --- a/tests/generic/064.out +++ b/tests/generic/064.out @@ -1,2 +1,2 @@ QA output created by 064 -100 +Extent count after inserts is in range