From patchwork Tue Aug 18 17:52:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zorro Lang X-Patchwork-Id: 7032761 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 64EDDC05AC for ; Tue, 18 Aug 2015 17:52:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 934652063D for ; Tue, 18 Aug 2015 17:52:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A1CE72062E for ; Tue, 18 Aug 2015 17:52:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752430AbbHRRwJ (ORCPT ); Tue, 18 Aug 2015 13:52:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52589 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751157AbbHRRwI (ORCPT ); Tue, 18 Aug 2015 13:52:08 -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 7BAD835419F; Tue, 18 Aug 2015 17:52:08 +0000 (UTC) Received: from localhost (vpn1-7-100.pek2.redhat.com [10.72.7.100]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t7IHq6RP027265; Tue, 18 Aug 2015 13:52:07 -0400 From: Zorro Lang To: fstests@vger.kernel.org Cc: hch@lst.de, Zorro Lang Subject: [PATCH] xfs/201: use min_dio_alignment size to replace 512b Date: Wed, 19 Aug 2015 01:52:05 +0800 Message-Id: <1439920325-9723-1-git-send-email-zlang@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=-7.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 This case use hard-code 512, but in 4k sector size device, it will fail. So I call _min_dio_alignment() to get the sector size, then replace `512`. Signed-off-by: Zorro Lang --- tests/xfs/201 | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/xfs/201 b/tests/xfs/201 index 88829d3..921d2a3 100755 --- a/tests/xfs/201 +++ b/tests/xfs/201 @@ -32,15 +32,6 @@ here=`pwd` tmp=/tmp/$$ status=1 # failure is the default! -do_pwrite() -{ - offset=`expr $1 \* 512` - end=`expr $2 \* 512` - length=`expr $end - $offset` - - xfs_io -d -f $file -c "pwrite $offset $length" >/dev/null -} - _cleanup() { umount $SCRATCH_MNT @@ -57,6 +48,17 @@ _supported_os Linux file=$SCRATCH_MNT/f +min_align=`_min_dio_alignment $SCRATCH_DEV` + +do_pwrite() +{ + offset=`expr $1 \* $min_align` + end=`expr $2 \* $min_align` + length=`expr $end - $offset` + + xfs_io -d -f $file -c "pwrite $offset $length" >/dev/null +} + _require_scratch _scratch_mkfs_xfs >/dev/null 2>&1