X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Futils%2Fllverdev.c;h=e05f41b7da23aab88d11b6c9fc6a7776e41ee480;hp=67babe49e5d56f49429f7fc36ac0671781dc55da;hb=61743b88672687f789f9c609c85a351e1595118b;hpb=f95393b0d0a59cf3dc2f29cffc35dcc4cc9d7728 diff --git a/lustre/utils/llverdev.c b/lustre/utils/llverdev.c index 67babe4..e05f41b 100644 --- a/lustre/utils/llverdev.c +++ b/lustre/utils/llverdev.c @@ -1,6 +1,4 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=8:tabstop=8: - * +/* * GPL HEADER START * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -17,17 +15,16 @@ * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ /* * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2011, Intel Corporation. + * */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -40,14 +37,14 @@ * handling IO beyond 2TB boundary. * This tool have two working modes * 1. full mode - * 2. fast mode + * 2. partial mode * * In full mode, the program writes a test pattern on the entire disk. * The test pattern (device offset and timestamp) is written at the * beginning of each 4kB block. When the whole device is full the read * operation is performed to verify that the test pattern is correct. * - * In fast mode, the program writes data at the critical locations + * In partial mode, the program writes data at the critical locations * of the device such as start of the device, before and after multiple of 1GB * offset and at the end. * @@ -113,22 +110,20 @@ static unsigned full = 1; /* flag to full check */ static int error_count; /* number of IO errors hit during run */ static int isatty_flag; -static struct option const longopts[] = -{ - { "chunksize", required_argument, 0, 'c' }, - { "force", no_argument, 0, 'f' }, - { "help", no_argument, 0, 'h' }, - { "offset", required_argument, 0, 'o' }, - { "partial", required_argument, 0, 'p' }, - { "quiet", required_argument, 0, 'q' }, - { "read", no_argument, 0, 'r' }, - { "timestamp", required_argument, 0, 't' }, - { "verbose", no_argument, 0, 'v' }, - { "write", no_argument, 0, 'w' }, - { "long", no_argument, 0, 'l' }, - { "full", no_argument, 0, 'l' }, - { 0, 0, 0, 0} -}; +static struct option const long_opts[] = { + { .val = 'c', .name = "chunksize", .has_arg = required_argument }, + { .val = 'f', .name = "force", .has_arg = no_argument }, + { .val = 'h', .name = "help", .has_arg = no_argument }, + { .val = 'l', .name = "long", .has_arg = no_argument }, + { .val = 'l', .name = "full", .has_arg = no_argument }, + { .val = 'o', .name = "offset", .has_arg = required_argument }, + { .val = 'p', .name = "partial", .has_arg = required_argument }, + { .val = 'q', .name = "quiet", .has_arg = required_argument }, + { .val = 'r', .name = "read", .has_arg = no_argument }, + { .val = 't', .name = "timestamp", .has_arg = required_argument }, + { .val = 'v', .name = "verbose", .has_arg = no_argument }, + { .val = 'w', .name = "write", .has_arg = no_argument }, + { .name = NULL } }; /* * Usage: displays help information, whenever user supply --help option in @@ -273,7 +268,7 @@ int verify_chunk(char *chunk_buf, const size_t chunksize, /* * fill_chunk: Fills the chunk with current or user specified timestamp - * and offset. The test patters is filled at the beginning of + * and offset. The test pattern is filled at the beginning of * each 4kB(BLOCKSIZE) blocks in chunk_buf. */ void fill_chunk(char *chunk_buf, size_t chunksize, loff_t chunk_off, @@ -353,6 +348,7 @@ retry: fprintf(stderr, "\n%s: write %s@%llu+%zi short: %ld written\n", progname, file, offset, nrequested, nwritten); offset += nwritten; + chunk_buf += nwritten; nrequested -= nwritten; goto retry; } @@ -522,7 +518,7 @@ int main(int argc, char **argv) progname = strrchr(argv[0], '/') == NULL ? argv[0] : strrchr(argv[0], '/') + 1; - while ((c = getopt_long(argc, argv, "c:fhlo:pqrt:vw", longopts, + while ((c = getopt_long(argc, argv, "c:fhlo:pqrt:vw", long_opts, NULL)) != -1) { switch (c) { case 'c':