From patchwork Thu Sep 7 07:26:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9941673 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 3244C6038C for ; Thu, 7 Sep 2017 07:26:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 24BBB2847D for ; Thu, 7 Sep 2017 07:26:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1999D28534; Thu, 7 Sep 2017 07:26:18 +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=ham 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 E788D2847D for ; Thu, 7 Sep 2017 07:26:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752276AbdIGH0Q (ORCPT ); Thu, 7 Sep 2017 03:26:16 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:36931 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753130AbdIGH0Q (ORCPT ); Thu, 7 Sep 2017 03:26:16 -0400 Received: by mail-wm0-f66.google.com with SMTP id f4so756042wmh.4 for ; Thu, 07 Sep 2017 00:26:15 -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=AVMCcUjn/LsMYWq5XZ0u4vUb+CPa8Q7vlMRKaP98CpM=; b=tTWwRClY5dFLMNyfsFovLxynIbgs0x3NFN+fNDeEmDM0wR1+CqdNPyzuMLkf6N3aH0 23kLfjmxzqgQpIew2KF+jwmaoDMzdvBNu0p854YW0HnA3e3YL3I/w/wImMxEgbluuBSd H+o5bqnzoLsuIXf22lEGC0T9CDq+GNynXgEE1GkBXkuCtdmMrLWlg3Zp4o2FPwLR6DXG E/7vS0xyI9ZTjl4B1qIiYvQ6c2Y0lVAgqTMsVhoG0tdZ41xmT4h0OeXv/SCc3C3omHoD VZLZqNbBsD1/uc0L/Mrza0I7Ri3HNr90DHZX7C90/BhLkQ8b2kRr9WPDA4538BrdBnwu 7KmQ== 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=AVMCcUjn/LsMYWq5XZ0u4vUb+CPa8Q7vlMRKaP98CpM=; b=etqdwp2UKSyqUlyY83kb5TedOUMzHqV52AkPerssjaPvnFzPUgtLZ6rbnvH/cLMddo tsCapaz9rM0HFTkEMxrQgCkXwyFe6t8IoLjUzo2S06aWVq5KfjRl9Er2IuFtSjeY8lpu eGIjx+JhpEaB/Z7N/quCHG4awUZP1FZF8VVGW1okJuHt1L2ZkFZldFdxTqQJIoTB9jN1 eHMnoGa6/fXUTa8RTscZ5DroNDxBptWh7s51ZPmiC6NIz0hC1hQBeqTIgYc/+A17/ulz ETghjjVaIHPh3iNVGxnXzgnc5JoEI2chetNU9/nxRITDL7FknYzQH+UuRIFB4C+JxR5D QwSA== X-Gm-Message-State: AHPjjUhCb4Be9JdxR8R2Nd+KsMs4Hwo1bFAet//WdHG9RPcYUhAlExEP JjQNrK/uSu82b8gC X-Google-Smtp-Source: ADKCNb4ZR4gmqCOUNC6TqdRTCT+CcsSJ6ZzzMX2JtmI1qCdt0CUK9cK8YRfQzhRIZbW1ui3Uzm9Z3g== X-Received: by 10.28.98.195 with SMTP id w186mr1482358wmb.143.1504769174916; Thu, 07 Sep 2017 00:26:14 -0700 (PDT) Received: from localhost.localdomain (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id 61sm1394452wre.44.2017.09.07.00.26.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Sep 2017 00:26:14 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: fstests@vger.kernel.org Subject: [PATCH v4 4/5] fsx: add support for writing constant instead of random data Date: Thu, 7 Sep 2017 10:26:37 +0300 Message-Id: <1504769198-4921-5-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504769198-4921-1-git-send-email-amir73il@gmail.com> References: <1504769198-4921-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 67d76dc..fd00962 100644 --- a/ltp/fsx.c +++ b/ltp/fsx.c @@ -133,6 +133,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 flush = 0; /* -f flag */ int do_fsync = 0; /* -y flag */ unsigned long maxfilelen = 256 * 1024; /* -l flag */ @@ -813,9 +814,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++; } } @@ -1630,11 +1635,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 debug log messsages with this id\n\ -l flen: the upper bound on file size (default 262144)\n\ @@ -1872,7 +1878,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': @@ -1896,6 +1902,9 @@ main(int argc, char **argv) case 'f': flush = 1; break; + case 'g': + filldata = *optarg; + break; case 'i': integrity = 1; logdev = strdup(optarg);