X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;ds=sidebyside;f=lustre%2Futils%2Floadgen.c;h=9670ad6d30dc1ce71f387d8e38e43a40daa8ba16;hb=eea0b5248b5c08acb1a20f47f40bc5672db62dd4;hp=88c8b0241746bd3aaecf5e6f4792abb04aae6863;hpb=d2d56f38da01001c92a09afc6b52b5acbd9bc13c;p=fs%2Flustre-release.git diff --git a/lustre/utils/loadgen.c b/lustre/utils/loadgen.c index 88c8b02..9670ad6 100644 --- a/lustre/utils/loadgen.c +++ b/lustre/utils/loadgen.c @@ -1,30 +1,46 @@ /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- * vim:expandtab:shiftwidth=8:tabstop=8: * - * Copyright (C) 2006 Cluster File Systems, Inc. - * Author: Nathan Rutman + * GPL HEADER START * - * This file is part of Lustre, http://www.lustre.org. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Lustre is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 only, + * as published by the Free Software Foundation. * - * Lustre is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License version 2 for more details (a copy is included + * in the LICENSE file that accompanied this code). * - * You should have received a copy of the GNU General Public License - * along with Lustre; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * 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. + * + * GPL HEADER END + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved + * Use is subject to license terms. + */ +/* + * This file is part of Lustre, http://www.lustre.org/ + * Lustre is a trademark of Sun Microsystems, Inc. + * + * lustre/utils/loadgen.c * - * loadgen.c * See how many local OSCs we can start whaling on a OST * We're doing direct ioctls instead of going though a system() call to lctl * to avoid the bash overhead. * Adds an osc / echo client pair in each thread and starts echo transactions. * + * Author: Nathan Rutman */ #include @@ -42,7 +58,7 @@ #include #include -#include "parser.h" +#include #include "obdctl.h" static char cmdname[512]; @@ -62,7 +78,7 @@ static int jt_quit(int argc, char **argv) { static int loadgen_usage(int argc, char **argv) { if (argc == 1) { - fprintf(stderr, + fprintf(stderr, "This is a test program used to simulate large numbers of\n" "clients. The echo obds are used, so the obdecho module must\n" "be loaded.\n" @@ -651,7 +667,7 @@ static void *run_one_child(void *threadvp) { struct kid_t *kid; char oname[10], ename[10]; - int thread = (long)threadvp, dev; + int thread = (long)threadvp, dev = 0; int rc = 0, err; if (o_verbose > 2) @@ -852,7 +868,7 @@ static int loadgen_write(int argc, char **argv) threads, live_threads); return -EOVERFLOW; } - trigger(C_WRITE, threads, atoi(argv[2]), + trigger(C_WRITE, threads, atoi(argv[2]), (argc == 4) ? atoi(argv[3]) : 0); return 0; } @@ -901,7 +917,7 @@ static int loadgen_start_echosrv(int argc, char **argv) cmdname, rc); goto clean; } - + /* Create an OSS to handle the communications */ /* attach ost OSS OSS_UUID */ args[1] = "ost"; @@ -940,7 +956,7 @@ clean: static int loadgen_wait(int argc, char **argv) { - /* Give scripts a chance to start some threads */ + /* Give scripts a chance to start some threads */ sleep(1); while (!all_done) { sleep(1); @@ -950,7 +966,7 @@ static int loadgen_wait(int argc, char **argv) static int loadgen_init(int argc, char **argv) { - char *args[3]; + char *args[4]; int rc; sprintf(cmdname, "%s", argv[0]); @@ -980,7 +996,7 @@ static int loadgen_init(int argc, char **argv) static int loadgen_exit() { int rc; - + printf("stopping %d children\n", live_threads); kill_kids(); rc = wait_for_threads(); @@ -1022,7 +1038,7 @@ static int loadgen_main(int argc, char **argv) out: obd_finalize(argc, argv); - return rc; + return rc < 0 ? -rc : rc; } #ifndef LIBLUSTRE_TEST @@ -1035,4 +1051,3 @@ int main (int argc, char **argv) return rc; } #endif -