From patchwork Tue Jul 28 14:25:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eryu Guan X-Patchwork-Id: 6886441 Return-Path: X-Original-To: patchwork-fstests@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AB9F79F380 for ; Tue, 28 Jul 2015 14:25:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DE95F20272 for ; Tue, 28 Jul 2015 14:25:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 029D52017D for ; Tue, 28 Jul 2015 14:25:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752496AbbG1OZZ (ORCPT ); Tue, 28 Jul 2015 10:25:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53080 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751873AbbG1OZY (ORCPT ); Tue, 28 Jul 2015 10:25:24 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 0D8108C1B2 for ; Tue, 28 Jul 2015 14:25:24 +0000 (UTC) Received: from localhost (dhcp12-142.nay.redhat.com [10.66.12.142] (may be forged)) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6SEPMbB014457; Tue, 28 Jul 2015 10:25:23 -0400 From: Eryu Guan To: fstests@vger.kernel.org Cc: zlang@redhat.com, Eryu Guan Subject: [PATCH] common: fix _count_extents and _count_holes Date: Tue, 28 Jul 2015 22:25:04 +0800 Message-Id: <1438093504-25230-1-git-send-email-eguan@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 In _count_extents and _count_holes, the output of 'xfs_io -c "fiemap"' is saved in var res, but the following "echo $res" will merge the original output into one line. e.g. 0: [0..63]: 96..159 1: [64..127]: hole will be 0: [0..63]: 96..159 1: [64..127]: hole so the extent count is always 0 if there's a hole. This makes generic/046 fail occasionally. (Seems it's easier to reproduce when the system is under some presure, e.g. with fsstress running.) Tested the new _count_extents and _count_holes with generic/04[3-9] and tests all passed as expect. Reported-by: Zorro Lang Signed-off-by: Eryu Guan --- common/rc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/common/rc b/common/rc index 15e7795..0d3570f 100644 --- a/common/rc +++ b/common/rc @@ -2434,14 +2434,12 @@ _require_fiemap() _count_extents() { - res=`$XFS_IO_PROG -c "fiemap" $1 | tail -n +2` - echo $res | grep -v hole | wc -l | $AWK_PROG '{print $1}' + $XFS_IO_PROG -c "fiemap" $1 | tail -n +2 | grep -v hole | wc -l } _count_holes() { - res=`$XFS_IO_PROG -c "fiemap" $1 | tail -n +2` - echo $res | grep hole | wc -l | $AWK_PROG '{print $1}' + $XFS_IO_PROG -c "fiemap" $1 | tail -n +2 | grep hole | wc -l } # arg 1 is dev to remove and is output of the below eg.