From patchwork Tue Sep 5 19:11:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9939519 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9986D60350 for ; Tue, 5 Sep 2017 19:11:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B075289EB for ; Tue, 5 Sep 2017 19:11:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80413289FE; Tue, 5 Sep 2017 19:11:04 +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=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable 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 33FEF289EB for ; Tue, 5 Sep 2017 19:11:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752374AbdIETLB (ORCPT ); Tue, 5 Sep 2017 15:11:01 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36688 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752052AbdIETK5 (ORCPT ); Tue, 5 Sep 2017 15:10:57 -0400 Received: by mail-wm0-f68.google.com with SMTP id p17so3676405wmd.3; Tue, 05 Sep 2017 12:10:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DXEWz3V2LFJCejweWlLGlFySPfBIZbdeOAp0aagahD8=; b=rFW3Aoozkuvzkw3/Onqpu7pqz9wGCUQky5Ftz5/wfRXvRkRh4o3h2pUnb3Unqhqd1e WTz0K8iI5Fbb8HHMH0vS8RMsr+kG9tbmFOg54z4+cVmX/x1RoYtCTZOhiISpguKmYDPk hZ5IATtPRUSeb8vY7QbwmIn8LhigFWfA3AUOqhfcr7XaYx6L1onWPHnRl/BQ3u4yPW65 u25aPT2iMRt2Y1L9+a1qwmCsaKtRStF3RYBw54sw124ffFcLFejN4MhROnbG13LPRwzE GMaLta5j9ohQ43IHLIUQWpWdluIZWdXZ4bfOfQl1MLQa4AGDtLj1396UHa5PBOJpIfLf qtAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DXEWz3V2LFJCejweWlLGlFySPfBIZbdeOAp0aagahD8=; b=BShBFwMGivD5iJRwzNnYmyOAdosc2OJxtolBpjkIWe0m+IZJdwqZ74z3on9dFegoNd +TeTP58NPpSEyFczbH52pSf94JTaQqec1B1/3j0QV4Uh/0lSh+M8f1lMjIFy8zi9vC5N w+apqeckkGBLhzHWne8O82kndzGCM9/Dh1L+qpKbCmC2jiyTqO8yC81HS/xFarUhbvE9 bizHNR+5DpaWCVzcNp9m3rwXjWVWcBeqjQ+jHmrZoOh3GfoU+C5X7QzIee7KJ3qyhJ3S BrfQbTlmgVuJ1NNgIZrKMnfViGmduzeg41ODiimAwW+M/YYyvFY2KXWAdk1S9U9X0j6n Uuxg== X-Gm-Message-State: AHPjjUgJhHf+O0afOzi6GlSHMTIT0V65PUYeQjaaygRGjmrzgU7DnJ9D mRzD13t7pjhk3g== X-Google-Smtp-Source: ADKCNb7d/2aU6u4n/7gBKPqjOjTroB8f+9jboPTlEk5v13va5MBtD4add4mDir4MdHPkgn9Qad5LxA== X-Received: by 10.28.149.6 with SMTP id x6mr8408wmd.23.1504638655732; Tue, 05 Sep 2017 12:10:55 -0700 (PDT) Received: from localhost.localdomain (bzq-79-182-137-119.red.bezeqint.net. [79.182.137.119]) by smtp.gmail.com with ESMTPSA id 30sm1829015wry.34.2017.09.05.12.10.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 Sep 2017 12:10:55 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Josef Bacik , fstests@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v3 04/13] fsx: add support for writing constant instead of random data Date: Tue, 5 Sep 2017 22:11:11 +0300 Message-Id: <1504638680-25682-5-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504638680-25682-1-git-send-email-amir73il@gmail.com> References: <1504638680-25682-1-git-send-email-amir73il@gmail.com> Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP -g X: write character X instead of random generated data This is useful to compare holes between good and bad files because hexdump of good and bad files compacts the contigious ranges of X and zeroes. Signed-off-by: Amir Goldstein --- ltp/fsx.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/ltp/fsx.c b/ltp/fsx.c index 85fd50a..3510ace 100644 --- a/ltp/fsx.c +++ b/ltp/fsx.c @@ -132,6 +132,7 @@ unsigned long simulatedopcount = 0; /* -b flag */ int closeprob = 0; /* -c flag */ int debug = 0; /* -d flag */ unsigned long debugstart = 0; /* -D flag */ +char filldata = 0; /* -g flag */ int logid = 0; /* -j flag */ int flush = 0; /* -f flag */ int do_fsync = 0; /* -y flag */ @@ -814,9 +815,13 @@ void gendata(char *original_buf, char *good_buf, unsigned offset, unsigned size) { while (size--) { - good_buf[offset] = testcalls % 256; - if (offset % 2) - good_buf[offset] += original_buf[offset]; + if (filldata) { + good_buf[offset] = filldata; + } else { + good_buf[offset] = testcalls % 256; + if (offset % 2) + good_buf[offset] += original_buf[offset]; + } offset++; } } @@ -1631,11 +1636,12 @@ void usage(void) { fprintf(stdout, "usage: %s", - "fsx [-dnqxAFLOWZ] [-b opnum] [-c Prob] [-i logdev] [-j logid] [-l flen] [-m start:end] [-o oplen] [-p progressinterval] [-r readbdy] [-s style] [-t truncbdy] [-w writebdy] [-D startingop] [-N numops] [-P dirpath] [-S seed] fname\n\ + "fsx [-dnqxAFLOWZ] [-b opnum] [-c Prob] [-g filldata] [-i logdev] [-j logid] [-l flen] [-m start:end] [-o oplen] [-p progressinterval] [-r readbdy] [-s style] [-t truncbdy] [-w writebdy] [-D startingop] [-N numops] [-P dirpath] [-S seed] fname\n\ -b opnum: beginning operation number (default 1)\n\ -c P: 1 in P chance of file close+open at each op (default infinity)\n\ -d: debug output for all operations\n\ -f flush and invalidate cache after I/O\n\ + -g X: write character X instead of random generated data\n\ -i logdev: do integrity testing, logdev is the dm log writes device\n\ -j logid: prefix logs with this id\n\ -l flen: the upper bound on file size (default 262144)\n\ @@ -1873,7 +1879,7 @@ main(int argc, char **argv) setvbuf(stdout, (char *)0, _IOLBF, 0); /* line buffered stdout */ while ((ch = getopt_long(argc, argv, - "b:c:dfi:j:l:m:no:p:qr:s:t:w:xyAD:FKHzCILN:OP:RS:WZ", + "b:c:dfg:i:j:l:m:no:p:qr:s:t:w:xyAD:FKHzCILN:OP:RS:WZ", longopts, NULL)) != EOF) switch (ch) { case 'b': @@ -1900,6 +1906,9 @@ main(int argc, char **argv) case 'f': flush = 1; break; + case 'g': + filldata = *optarg; + break; case 'i': integrity = 1; logdev = strdup(optarg);