From patchwork Tue Feb 3 21:09:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Schumaker, Anna" X-Patchwork-Id: 5771911 Return-Path: X-Original-To: patchwork-linux-nfs@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 2D995BF440 for ; Tue, 3 Feb 2015 21:09:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5E43420259 for ; Tue, 3 Feb 2015 21:09:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F099420256 for ; Tue, 3 Feb 2015 21:09:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966659AbbBCVJu (ORCPT ); Tue, 3 Feb 2015 16:09:50 -0500 Received: from mx143.netapp.com ([216.240.21.24]:27293 "EHLO mx143.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966485AbbBCVJu (ORCPT ); Tue, 3 Feb 2015 16:09:50 -0500 X-IronPort-AV: E=Sophos;i="5.09,515,1418112000"; d="scan'208";a="20483664" Received: from vmwexchts03-prd.hq.netapp.com ([10.122.105.31]) by mx143-out.netapp.com with ESMTP; 03 Feb 2015 13:09:50 -0800 Received: from smtp2.corp.netapp.com (10.57.159.114) by VMWEXCHTS03-PRD.hq.netapp.com (10.122.105.31) with Microsoft SMTP Server id 15.0.995.29; Tue, 3 Feb 2015 13:09:48 -0800 Received: from davros.com ([10.63.235.10]) by smtp2.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id t13L9kf3009722; Tue, 3 Feb 2015 13:09:47 -0800 (PST) From: Anna Schumaker To: , , Subject: [PATCH] fsx: check for filesystem support of FALLOCATE_FL_KEEP_SIZE Date: Tue, 3 Feb 2015 16:09:43 -0500 Message-ID: <1422997783-22484-1-git-send-email-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.2.2 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 The NFS implementation of fallocate() does not support passing the KEEP_SIZE flag by itself, causing tests to randomly fail. Signed-off-by: Anna Schumaker Reviewed-by: Christoph Hellwig --- ltp/fsx.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/ltp/fsx.c b/ltp/fsx.c index 3709419..0bb8ae8 100644 --- a/ltp/fsx.c +++ b/ltp/fsx.c @@ -142,6 +142,7 @@ int randomoplen = 1; /* -O flag disables it */ int seed = 1; /* -S flag */ int mapped_writes = 1; /* -W flag disables */ int fallocate_calls = 1; /* -F flag disables */ +int keep_size_calls = 1; /* -K flag disables */ int punch_hole_calls = 1; /* -H flag disables */ int zero_range_calls = 1; /* -z flag disables */ int collapse_range_calls = 1; /* -C flag disables */ @@ -907,7 +908,7 @@ do_zero_range(unsigned offset, unsigned length) { unsigned end_offset; int mode = FALLOC_FL_ZERO_RANGE; - int keep_size; + int keep_size = 0; if (length == 0) { if (!quiet && testcalls > simulatedopcount) @@ -916,7 +917,8 @@ do_zero_range(unsigned offset, unsigned length) return; } - keep_size = random() % 2; + if (keep_size_calls) + keep_size = random() % 2; end_offset = keep_size ? 0 : offset + length; @@ -1018,7 +1020,7 @@ void do_preallocate(unsigned offset, unsigned length) { unsigned end_offset; - int keep_size; + int keep_size = 0; if (length == 0) { if (!quiet && testcalls > simulatedopcount) @@ -1027,7 +1029,8 @@ do_preallocate(unsigned offset, unsigned length) return; } - keep_size = random() % 2; + if (keep_size_calls) + keep_size = random() % 2; end_offset = keep_size ? 0 : offset + length; @@ -1493,7 +1496,7 @@ main(int argc, char **argv) setvbuf(stdout, (char *)0, _IOLBF, 0); /* line buffered stdout */ - while ((ch = getopt(argc, argv, "b:c:dfl:m:no:p:qr:s:t:w:xyAD:FHzCLN:OP:RS:WZ")) + while ((ch = getopt(argc, argv, "b:c:dfl:m:no:p:qr:s:t:w:xyAD:FKHzCLN:OP:RS:WZ")) != EOF) switch (ch) { case 'b': @@ -1590,6 +1593,9 @@ main(int argc, char **argv) case 'F': fallocate_calls = 0; break; + case 'K': + keep_size_calls = 0; + break; case 'H': punch_hole_calls = 0; break; @@ -1751,6 +1757,8 @@ main(int argc, char **argv) if (fallocate_calls) fallocate_calls = test_fallocate(0); + if (keep_size_calls) + keep_size_calls = test_fallocate(FALLOC_FL_KEEP_SIZE); if (punch_hole_calls) punch_hole_calls = test_fallocate(FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE);