From 8981cbdf0c02122ab47195c8992e5388727dede6 Mon Sep 17 00:00:00 2001 From: eeb Date: Sun, 27 Jul 2003 02:39:59 +0000 Subject: [PATCH] * Merged b_devel updates --- lnet/.cvsignore | 1 + lnet/Kernelenv.in | 7 ++++- lnet/Kernelenv.mk | 5 +++- lnet/Makefile.mk | 12 ++++++-- lnet/archdep.m4 | 34 +++++++++++++++++---- lnet/include/config.h.in | 9 ++++-- lnet/include/linux/kp30.h | 47 +++++++++++++++-------------- lnet/include/lnet/internal.h | 2 -- lnet/include/lnet/list.h | 7 +++-- lnet/include/lnet/lltrace.h | 48 +++++++++++++++--------------- lnet/include/lnet/myrnal.h | 3 -- lnet/include/lnet/nal.h | 2 -- lnet/include/lnet/ppid.h | 3 -- lnet/include/lnet/stringtab.h | 2 -- lnet/include/lnet/types.h | 22 +++++++------- lnet/klnds/.cvsignore | 1 + lnet/klnds/Makefile.mk | 4 +-- lnet/klnds/gmlnd/gmnal.c | 2 +- lnet/klnds/qswlnd/qswlnd.h | 2 +- lnet/klnds/qswlnd/qswlnd_cb.c | 1 + lnet/klnds/scimaclnd/scimacnal.c | 2 +- lnet/klnds/socklnd/socklnd_cb.c | 18 +++++------ lnet/klnds/toelnd/toenal.c | 2 +- lnet/klnds/toelnd/toenal_cb.c | 6 ++-- lnet/libcfs/.cvsignore | 1 + lnet/libcfs/Makefile.mk | 2 +- lnet/libcfs/debug.c | 16 +++++----- lnet/libcfs/module.c | 7 +++-- lnet/lnet/.cvsignore | 1 + lnet/lnet/Makefile.mk | 7 +++-- lnet/lnet/lib-move.c | 2 +- lnet/router/.cvsignore | 1 + lnet/router/Makefile.mk | 2 +- lnet/router/router.c | 22 ++++++-------- lnet/tests/.cvsignore | 1 + lnet/tests/ping_cli.c | 4 +-- lnet/tests/ping_srv.c | 6 ++-- lnet/tests/sping_cli.c | 4 +-- lnet/tests/sping_srv.c | 2 +- lnet/ulnds/debug.c | 4 +-- lnet/ulnds/socklnd/debug.c | 4 +-- lnet/utils/debug.c | 2 ++ lnet/utils/portals.c | 45 ++++++++++++++++++---------- lnet/utils/routerstat.c | 43 +++++++++++++++++++------- lustre/Makefile.mk | 20 ++++++++++++- lustre/mds/Makefile.mk | 7 +++-- lustre/portals/.cvsignore | 1 + lustre/portals/Kernelenv.in | 7 ++++- lustre/portals/Kernelenv.mk | 5 +++- lustre/portals/Makefile.mk | 12 ++++++-- lustre/portals/archdep.m4 | 34 +++++++++++++++++---- lustre/portals/include/config.h.in | 9 ++++-- lustre/portals/include/linux/kp30.h | 47 +++++++++++++++-------------- lustre/portals/include/portals/list.h | 7 +++-- lustre/portals/include/portals/lltrace.h | 48 +++++++++++++++--------------- lustre/portals/include/portals/myrnal.h | 3 -- lustre/portals/include/portals/nal.h | 2 -- lustre/portals/include/portals/ppid.h | 3 -- lustre/portals/include/portals/stringtab.h | 2 -- lustre/portals/include/portals/types.h | 22 +++++++------- lustre/portals/knals/.cvsignore | 1 + lustre/portals/knals/Makefile.mk | 4 +-- lustre/portals/knals/gmnal/gmnal.c | 2 +- lustre/portals/knals/qswnal/qswnal.h | 2 +- lustre/portals/knals/qswnal/qswnal_cb.c | 1 + lustre/portals/knals/scimacnal/scimacnal.c | 2 +- lustre/portals/knals/socknal/socknal_cb.c | 18 +++++------ lustre/portals/knals/toenal/toenal.c | 2 +- lustre/portals/knals/toenal/toenal_cb.c | 6 ++-- lustre/portals/libcfs/.cvsignore | 1 + lustre/portals/libcfs/Makefile.mk | 2 +- lustre/portals/libcfs/debug.c | 16 +++++----- lustre/portals/libcfs/module.c | 7 +++-- lustre/portals/portals/.cvsignore | 1 + lustre/portals/portals/Makefile.mk | 7 +++-- lustre/portals/portals/lib-move.c | 2 +- lustre/portals/router/.cvsignore | 1 + lustre/portals/router/Makefile.mk | 2 +- lustre/portals/router/router.c | 22 ++++++-------- lustre/portals/tests/.cvsignore | 1 + lustre/portals/tests/ping_cli.c | 4 +-- lustre/portals/tests/ping_srv.c | 6 ++-- lustre/portals/tests/sping_cli.c | 4 +-- lustre/portals/tests/sping_srv.c | 2 +- lustre/portals/unals/debug.c | 4 +-- lustre/portals/utils/debug.c | 2 ++ lustre/portals/utils/portals.c | 45 ++++++++++++++++++---------- lustre/portals/utils/routerstat.c | 43 +++++++++++++++++++------- lustre/utils/llobdstat.pl | 1 + 89 files changed, 518 insertions(+), 340 deletions(-) diff --git a/lnet/.cvsignore b/lnet/.cvsignore index 99ac885..c1a9bdf 100644 --- a/lnet/.cvsignore +++ b/lnet/.cvsignore @@ -6,3 +6,4 @@ autom4te.cache config.log config.status configure +.*.o.cmd diff --git a/lnet/Kernelenv.in b/lnet/Kernelenv.in index 29a713f..7a48c58 100644 --- a/lnet/Kernelenv.in +++ b/lnet/Kernelenv.in @@ -1 +1,6 @@ -EXTRA_CFLAGS= -Ifs/lustre/include -Ifs/lustre/portals/include +EXTRA_CFLAGS := -Ifs/lustre/include -Ifs/lustre/portals/include +# portals/utils/debug.c wants from userspace. sigh. +HOSTCFLAGS := -I@LINUX@/include $(EXTRA_CFLAGS) +LIBREADLINE := @LIBREADLINE@ +# 2.5's makefiles aren't nice to cross dir libraries in host programs +PTLCTLOBJS := debug.o l_ioctl.o parser.o portals.o diff --git a/lnet/Kernelenv.mk b/lnet/Kernelenv.mk index 29a713f..7c66dfa 100644 --- a/lnet/Kernelenv.mk +++ b/lnet/Kernelenv.mk @@ -1 +1,4 @@ -EXTRA_CFLAGS= -Ifs/lustre/include -Ifs/lustre/portals/include +EXTRA_CFLAGS := -Ifs/lustre/include -Ifs/lustre/portals/include +HOSTCFLAGS := $(EXTRA_CFLAGS) +# the kernel doesn't want us to build archives for host binaries :/ +PTLCTLOBJS := debug.o l_ioctl.o parser.o portals.o diff --git a/lnet/Makefile.mk b/lnet/Makefile.mk index be0e51a..73a19df 100644 --- a/lnet/Makefile.mk +++ b/lnet/Makefile.mk @@ -1,6 +1,12 @@ -include fs/lustre/portals/Kernelenv +include $(src)/Kernelenv -obj-y += portals/ +# The ordering of these determines the order that each subsystem's +# module_init() functions are called in. if these are changed make sure +# they reflect the dependencies between each subsystem's _init functions. obj-y += libcfs/ -obj-y += knals/ +obj-y += portals/ obj-y += router/ +obj-y += knals/ +obj-y += tests/ + +obj-m += utils/ diff --git a/lnet/archdep.m4 b/lnet/archdep.m4 index ba7c699..c1455c3 100644 --- a/lnet/archdep.m4 +++ b/lnet/archdep.m4 @@ -11,8 +11,13 @@ AC_ARG_WITH(lib, [ --with-lib compile lustre library], host_cpu="lib") AC_ARG_WITH(linux, [ --with-linux=[path] set path to Linux source (default=/usr/src/linux)],LINUX=$with_linux,LINUX=/usr/src/linux) AC_SUBST(LINUX) +if test x$enable_inkernel = xyes ; then + echo ln -s `pwd` $LINUX/fs/lustre + rm $LINUX/fs/lustre + ln -s `pwd` $LINUX/fs/lustre +fi -# --------- UML? -------------------- +# -------------------- AC_MSG_CHECKING(if you are running user mode linux for $host_cpu ...) if test $host_cpu = "lib" ; then host_cpu="lib" @@ -111,6 +116,13 @@ case ${host_cpu} in MOD_LINK=elf64_ia64 ;; + x86_64 ) + AC_MSG_RESULT($host_cpu) + KCFLAGS='-g -O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fomit-frame-pointer -mno-red-zone -mcmodel=kernel -pipe -fno-reorder-blocks -finline-limit=2000 -fno-strength-reduce -fno-asynchronous-unwind-tables' + KCPPFLAGS='-D__KERNEL__ -DMODULE' + MOD_LINK=elf_x86_64 +;; + sparc64 ) AC_MSG_RESULT($host_cpu) KCFLAGS='-O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fomit-frame-pointer -fno-strict-aliasing -fno-common -Wno-unused -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow -ffixed-g4 -fcall-used-g5 -fcall-used-g7 -Wno-sign-compare -Wa,--undeclared-regs' @@ -160,21 +172,33 @@ if test $host_cpu != "lib" ; then AC_MSG_ERROR(** cannot find $LINUX/include/linux/autoconf.h. Run make config in $LINUX.) fi -# ------------ RELEASE and moduledir ------------------ +# ------------ LINUXRELEASE and moduledir ------------------ AC_MSG_CHECKING(for Linux release) dnl We need to rid ourselves of the nasty [ ] quotes. changequote(, ) dnl Get release from version.h - RELEASE="`sed -ne 's/.*UTS_RELEASE[ \"]*\([0-9.a-zA-Z_-]*\).*/\1/p' $LINUX/include/linux/version.h`" + LINUXRELEASE="`sed -ne 's/.*UTS_RELEASE[ \"]*\([0-9.a-zA-Z_-]*\).*/\1/p' $LINUX/include/linux/version.h`" changequote([, ]) - moduledir='$(libdir)/modules/'$RELEASE/kernel + moduledir='$(libdir)/modules/'$LINUXRELEASE/kernel AC_SUBST(moduledir) modulefsdir='$(moduledir)/fs/$(PACKAGE)' AC_SUBST(modulefsdir) + AC_MSG_RESULT($LINUXRELEASE) + AC_SUBST(LINUXRELEASE) + +# ------------ RELEASE -------------------------------- + AC_MSG_CHECKING(lustre release) + + dnl We need to rid ourselves of the nasty [ ] quotes. + changequote(, ) + dnl Get release from version.h + RELEASE="`sed -ne 's/-/_/g' -e 's/.*UTS_RELEASE[ \"]*\([0-9.a-zA-Z_]*\).*/\1/p' $LINUX/include/linux/version.h`_`date +%Y%m%d%H%M`" + changequote([, ]) + AC_MSG_RESULT($RELEASE) AC_SUBST(RELEASE) @@ -303,7 +327,7 @@ AM_CONDITIONAL(LIBLUSTRE, test x$host_cpu = xlib) # This needs to run after we've defined the KCPPFLAGS AC_MSG_CHECKING(for kernel version) -AC_TRY_LINK([#define __KERNEL__ +AC_TRY_COMPILE([#define __KERNEL__ #include ], [struct task_struct p; p.sighand = NULL;], diff --git a/lnet/include/config.h.in b/lnet/include/config.h.in index b05d0c4..a4b1e1e 100644 --- a/lnet/include/config.h.in +++ b/lnet/include/config.h.in @@ -1,7 +1,7 @@ -/* ../include/config.h.in. Generated automatically from configure.in by autoheader. */ +/* portals/include/config.h.in. Generated automatically from configure.in by autoheader. */ -/* Define if you have the readline library (-lreadline). */ -#undef HAVE_LIBREADLINE +/* The number of bytes in a unsigned long long. */ +#undef SIZEOF_UNSIGNED_LONG_LONG /* Name of package */ #undef PACKAGE @@ -9,3 +9,6 @@ /* Version number of package */ #undef VERSION +/* IOCTL Buffer Size */ +#undef OBD_MAX_IOCTL_BUFFER + diff --git a/lnet/include/linux/kp30.h b/lnet/include/linux/kp30.h index bd963d7..6088b7f 100644 --- a/lnet/include/linux/kp30.h +++ b/lnet/include/linux/kp30.h @@ -16,10 +16,6 @@ #define LOWEST_BIT_SET(x) ((x) & ~((x) - 1)) -#ifndef CONFIG_SMP -# define smp_processor_id() 0 -#endif - /* * Debugging */ @@ -55,6 +51,7 @@ extern unsigned int portal_printk; #define S_COBD (21 << 24) #define S_PTLBD (22 << 24) #define S_LOG (23 << 24) +#define S_MGMT (24 << 24) /* If you change these values, please keep portals/linux/utils/debug.c * up to date! */ @@ -83,20 +80,23 @@ extern unsigned int portal_printk; #define D_RPCTRACE (1 << 20) /* for distributed debugging */ #define D_VFSTRACE (1 << 21) -#ifndef __KERNEL__ -#define THREAD_SIZE 8192 +#ifdef __KERNEL__ +# include /* THREAD_SIZE */ +#else +# define THREAD_SIZE 8192 #endif -#ifdef __ia64__ -#define CDEBUG_STACK() (THREAD_SIZE - \ + +#ifdef __KERNEL__ +# ifdef __ia64__ +# define CDEBUG_STACK (THREAD_SIZE - \ ((unsigned long)__builtin_dwarf_cfa() & \ (THREAD_SIZE - 1))) -#else -#define CDEBUG_STACK() (THREAD_SIZE - \ +# else +# define CDEBUG_STACK (THREAD_SIZE - \ ((unsigned long)__builtin_frame_address(0) & \ (THREAD_SIZE - 1))) -#endif +# endif -#ifdef __KERNEL__ #define CHECK_STACK(stack) \ do { \ if ((stack) > 3*THREAD_SIZE/4 && (stack) > portal_stack) { \ @@ -108,20 +108,21 @@ extern unsigned int portal_printk; /*panic("LBUG");*/ \ } \ } while (0) -#else +#else /* __KERNEL __ */ #define CHECK_STACK(stack) do { } while(0) -#endif +#define CDEBUG_STACK (0L) +#endif /* __KERNEL__ */ #if 1 #define CDEBUG(mask, format, a...) \ do { \ - CHECK_STACK(CDEBUG_STACK()); \ + CHECK_STACK(CDEBUG_STACK); \ if (!(mask) || ((mask) & (D_ERROR | D_EMERG)) || \ (portal_debug & (mask) && \ portal_subsystem_debug & (1 << (DEBUG_SUBSYSTEM >> 24)))) \ portals_debug_msg(DEBUG_SUBSYSTEM, mask, \ __FILE__, __FUNCTION__, __LINE__, \ - CDEBUG_STACK(), format , ## a); \ + CDEBUG_STACK, format, ## a); \ } while (0) #define CWARN(format, a...) CDEBUG(D_WARNING, format, ## a) @@ -213,7 +214,8 @@ static inline void our_cond_resched(void) #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) */ #ifdef PORTAL_DEBUG -extern void kportal_assertion_failed(char *expr,char *file,char *func,int line); +extern void kportal_assertion_failed(char *expr, char *file, const char *func, + const int line); #define LASSERT(e) ((e) ? 0 : kportal_assertion_failed( #e , __FILE__, \ __FUNCTION__, __LINE__)) #else @@ -563,7 +565,7 @@ extern struct prof_ent prof_ents[MAX_PROFS]; #endif /* PORTALS_PROFILING */ /* debug.c */ -void portals_run_lbug_upcall(char * file, char *fn, int line); +void portals_run_lbug_upcall(char * file, const char *fn, const int line); void portals_debug_dumplog(void); int portals_debug_init(unsigned long bufsize); int portals_debug_cleanup(void); @@ -581,12 +583,13 @@ __s32 portals_debug_copy_to_user(char *buf, unsigned long len); # warning printf has been defined as a macro... # undef printf #endif -void portals_debug_msg (int subsys, int mask, char *file, char *fn, int line, - unsigned long stack, const char *format, ...) +void portals_debug_msg(int subsys, int mask, char *file, const char *fn, + const int line, unsigned long stack, + const char *format, ...) __attribute__ ((format (printf, 7, 8))); #else -void portals_debug_msg (int subsys, int mask, char *file, char *fn, - int line, unsigned long stack, +void portals_debug_msg (int subsys, int mask, char *file, const char *fn, + const int line, unsigned long stack, const char *format, ...); #endif /* __GNUC__ */ void portals_debug_set_level(unsigned int debug_level); diff --git a/lnet/include/lnet/internal.h b/lnet/include/lnet/internal.h index d78cad4..a70b465 100644 --- a/lnet/include/lnet/internal.h +++ b/lnet/include/lnet/internal.h @@ -1,5 +1,3 @@ -/* -*/ #ifndef _P30_INTERNAL_H_ #define _P30_INTERNAL_H_ diff --git a/lnet/include/lnet/list.h b/lnet/include/lnet/list.h index 2b63312..78a1e2d 100644 --- a/lnet/include/lnet/list.h +++ b/lnet/include/lnet/list.h @@ -1,6 +1,4 @@ #ifndef _LINUX_LIST_H -#define _LINUX_LIST_H - /* * Simple doubly linked list implementation. @@ -101,7 +99,9 @@ static inline void list_del_init(struct list_head *entry) __list_del(entry->prev, entry->next); INIT_LIST_HEAD(entry); } +#endif +#ifndef list_for_each_entry /** * list_move - delete from one list and add as another's head * @list: the entry to move @@ -124,7 +124,10 @@ static inline void list_move_tail(struct list_head *list, __list_del(list->prev, list->next); list_add_tail(list, head); } +#endif +#ifndef _LINUX_LIST_H +#define _LINUX_LIST_H /** * list_empty - tests whether a list is empty * @head: the list to test. diff --git a/lnet/include/lnet/lltrace.h b/lnet/include/lnet/lltrace.h index 7d1b304..d389aab 100644 --- a/lnet/include/lnet/lltrace.h +++ b/lnet/include/lnet/lltrace.h @@ -2,7 +2,7 @@ * vim:expandtab:shiftwidth=8:tabstop=8: * * Compile with: - * cc -I../../portals/include -o fio fio.c -L../../portals/linux/utils -lptlctl + * cc -I../../portals/include -o fio fio.c -L../../portals/linux/utils -lptlctl */ #ifndef __LTRACE_H_ #define __LTRACE_H_ @@ -31,20 +31,20 @@ static inline int ltrace_write_file(char* fname) argv[0] = "debug_kernel"; argv[1] = fname; argv[2] = "1"; - + fprintf(stderr, "[ptlctl] %s %s %s\n", argv[0], argv[1], argv[2]); - + return jt_dbg_debug_kernel(3, argv); } static inline int ltrace_clear() { char* argv[1]; - + argv[0] = "clear"; - + fprintf(stderr, "[ptlctl] %s\n", argv[0]); - + return jt_dbg_clear_debug_buf(1, argv); } @@ -52,9 +52,9 @@ static inline int ltrace_mark(int indent_level, char* text) { char* argv[2]; char mark_buf[PATH_MAX]; - + snprintf(mark_buf, PATH_MAX, "====%d=%s", indent_level, text); - + argv[0] = "mark"; argv[1] = mark_buf; return jt_dbg_mark_debug_buf(2, argv); @@ -65,9 +65,9 @@ static inline int ltrace_applymasks() char* argv[2]; argv[0] = "list"; argv[1] = "applymasks"; - + fprintf(stderr, "[ptlctl] %s %s\n", argv[0], argv[1]); - + return jt_dbg_list(2, argv); } @@ -95,19 +95,19 @@ static inline int ltrace_start() #ifdef PORTALS_DEV_ID rc = register_ioc_dev(PORTALS_DEV_ID, PORTALS_DEV_PATH); #endif - ltrace_filter("class"); + ltrace_filter("class"); ltrace_filter("socknal"); - ltrace_filter("qswnal"); - ltrace_filter("gmnal"); - ltrace_filter("portals"); - - ltrace_show("all_types"); - ltrace_filter("trace"); - ltrace_filter("malloc"); - ltrace_filter("net"); - ltrace_filter("page"); - ltrace_filter("other"); - ltrace_filter("info"); + ltrace_filter("qswnal"); + ltrace_filter("gmnal"); + ltrace_filter("portals"); + + ltrace_show("all_types"); + ltrace_filter("trace"); + ltrace_filter("malloc"); + ltrace_filter("net"); + ltrace_filter("page"); + ltrace_filter("other"); + ltrace_filter("info"); ltrace_applymasks(); return rc; @@ -146,7 +146,7 @@ static inline void ltrace_add_processnames(char* fname) struct timezone tz; int nob; int underuml = !not_uml(); - + gettimeofday(&tv, &tz); nob = snprintf(cmdbuf, LTRACE_MAX_NOB, "ps --no-headers -eo \""); @@ -167,7 +167,7 @@ static inline void ltrace_add_processnames(char* fname) "(%s:%d:%s() %d+%lu): ", "lltrace.h", __LINE__, __FUNCTION__, 0, 0L); } - + nob += snprintf(cmdbuf+nob, LTRACE_MAX_NOB, " %%p %%c\" >> %s", fname); system(cmdbuf); } diff --git a/lnet/include/lnet/myrnal.h b/lnet/include/lnet/myrnal.h index 12b1925..13790f7 100644 --- a/lnet/include/lnet/myrnal.h +++ b/lnet/include/lnet/myrnal.h @@ -1,6 +1,3 @@ -/* -*/ - #ifndef MYRNAL_H #define MYRNAL_H diff --git a/lnet/include/lnet/nal.h b/lnet/include/lnet/nal.h index 88be63c..7cb3ab7 100644 --- a/lnet/include/lnet/nal.h +++ b/lnet/include/lnet/nal.h @@ -1,5 +1,3 @@ -/* -*/ #ifndef _NAL_H_ #define _NAL_H_ diff --git a/lnet/include/lnet/ppid.h b/lnet/include/lnet/ppid.h index 4727599..760f465 100644 --- a/lnet/include/lnet/ppid.h +++ b/lnet/include/lnet/ppid.h @@ -1,6 +1,3 @@ -/* - */ - #ifndef _INCppidh_ #define _INCppidh_ diff --git a/lnet/include/lnet/stringtab.h b/lnet/include/lnet/stringtab.h index c9683f7..33e4375 100644 --- a/lnet/include/lnet/stringtab.h +++ b/lnet/include/lnet/stringtab.h @@ -1,5 +1,3 @@ /* -*/ -/* * stringtab.h */ diff --git a/lnet/include/lnet/types.h b/lnet/include/lnet/types.h index d4038b6..0269290 100644 --- a/lnet/include/lnet/types.h +++ b/lnet/include/lnet/types.h @@ -2,14 +2,19 @@ #define _P30_TYPES_H_ #ifdef __linux__ -#include -#include +# include +# include #else -#include +# include typedef u_int32_t __u32; typedef u_int64_t __u64; -typedef unsigned long long cycles_t; -static inline cycles_t get_cycles(void) { return 0; } +#endif + +#ifdef __KERNEL__ +# include +#else +# include +# define do_gettimeofday(tv) gettimeofday(tv, NULL) #endif typedef __u64 ptl_nid_t; @@ -31,7 +36,7 @@ typedef ptl_handle_any_t ptl_handle_md_t; typedef ptl_handle_any_t ptl_handle_me_t; #define PTL_HANDLE_NONE \ -((const ptl_handle_any_t){.nal_idx = -1, .cookie = -1}) + ((const ptl_handle_any_t){.nal_idx = -1, .cookie = -1}) #define PTL_EQ_NONE PTL_HANDLE_NONE static inline int PtlHandleEqual (ptl_handle_any_t h1, ptl_handle_any_t h2) @@ -108,17 +113,15 @@ typedef struct { ptl_handle_me_t unlinked_me; ptl_md_t mem_desc; ptl_hdr_data_t hdr_data; - cycles_t arrival_time; + struct timeval arrival_time; volatile ptl_seq_t sequence; } ptl_event_t; - typedef enum { PTL_ACK_REQ, PTL_NOACK_REQ } ptl_ack_req_t; - typedef struct { volatile ptl_seq_t sequence; ptl_size_t size; @@ -130,7 +133,6 @@ typedef struct { ptl_eq_t *eq; } ptl_ni_t; - typedef struct { int max_match_entries; /* max number of match entries */ int max_mem_descriptors; /* max number of memory descriptors */ diff --git a/lnet/klnds/.cvsignore b/lnet/klnds/.cvsignore index 282522d..89a4aa6 100644 --- a/lnet/klnds/.cvsignore +++ b/lnet/klnds/.cvsignore @@ -1,2 +1,3 @@ Makefile Makefile.in +.*.o.cmd diff --git a/lnet/klnds/Makefile.mk b/lnet/klnds/Makefile.mk index ce40a60..cd5d9d6 100644 --- a/lnet/klnds/Makefile.mk +++ b/lnet/klnds/Makefile.mk @@ -1,4 +1,4 @@ -include ../Kernelenv +include $(obj)/../Kernelenv obj-y = socknal/ -# more coming... \ No newline at end of file +# more coming... diff --git a/lnet/klnds/gmlnd/gmnal.c b/lnet/klnds/gmlnd/gmnal.c index ceeea2a..0cffc158 100644 --- a/lnet/klnds/gmlnd/gmnal.c +++ b/lnet/klnds/gmlnd/gmnal.c @@ -124,7 +124,7 @@ static nal_t *kgmnal_init(int interface, ptl_pt_index_t ptl_size, return &kgmnal_api; } -static void __exit +static void /*__exit*/ kgmnal_finalize(void) { struct list_head *tmp; diff --git a/lnet/klnds/qswlnd/qswlnd.h b/lnet/klnds/qswlnd/qswlnd.h index ceb7c8c..0eb4959 100644 --- a/lnet/klnds/qswlnd/qswlnd.h +++ b/lnet/klnds/qswlnd/qswlnd.h @@ -106,7 +106,7 @@ typedef unsigned long kqsw_csum_t; #define KQSW_TX_MAXCONTIG (1<<10) /* largest payload that gets made contiguous on transmit */ #define KQSW_NTXMSGS 8 /* # normal transmit messages */ -#define KQSW_NNBLK_TXMSGS 128 /* # reserved transmit messages if can't block */ +#define KQSW_NNBLK_TXMSGS 256 /* # reserved transmit messages if can't block */ #define KQSW_NRXMSGS_LARGE 64 /* # large receive buffers */ #define KQSW_EP_ENVELOPES_LARGE 128 /* # large ep envelopes */ diff --git a/lnet/klnds/qswlnd/qswlnd_cb.c b/lnet/klnds/qswlnd/qswlnd_cb.c index 3b47a25..c03d592 100644 --- a/lnet/klnds/qswlnd/qswlnd_cb.c +++ b/lnet/klnds/qswlnd/qswlnd_cb.c @@ -617,6 +617,7 @@ kqswnal_sendmsg (nal_cb_t *nal, if (ktx == NULL) { kqswnal_cerror_hdr (hdr); lib_finalize (&kqswnal_lib, private, cookie); + return (-1); } memcpy (ktx->ktx_buffer, hdr, sizeof (*hdr)); /* copy hdr from caller's stack */ diff --git a/lnet/klnds/scimaclnd/scimacnal.c b/lnet/klnds/scimaclnd/scimacnal.c index 1066d69..479cc2c 100644 --- a/lnet/klnds/scimaclnd/scimacnal.c +++ b/lnet/klnds/scimaclnd/scimacnal.c @@ -112,7 +112,7 @@ static nal_t *kscimacnal_init(int interface, ptl_pt_index_t ptl_size, /* Called by kernel at module unload time */ -static void __exit +static void /*__exit*/ kscimacnal_finalize(void) { /* FIXME: How should the shutdown procedure really look? */ diff --git a/lnet/klnds/socklnd/socklnd_cb.c b/lnet/klnds/socklnd/socklnd_cb.c index 3e7d206..bc770c8 100644 --- a/lnet/klnds/socklnd/socklnd_cb.c +++ b/lnet/klnds/socklnd/socklnd_cb.c @@ -1372,21 +1372,17 @@ int ksocknal_scheduler (void *arg) int nloops = 0; int id = sched - ksocknal_data.ksnd_schedulers; char name[16]; -#if (CONFIG_SMP && CPU_AFFINITY) -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) - int cpu = cpu_logical_map(id % num_online_cpus()); -#else -#warning "Take care of architecure specific logical APIC map" - int cpu = 1; /* Have to change later. */ -#endif /* LINUX_VERSION_CODE */ - - set_cpus_allowed (current, 1 << cpu); - id = cpu; -#endif /* CONFIG_SMP && CPU_AFFINITY */ snprintf (name, sizeof (name),"ksocknald[%d]", id); kportal_daemonize (name); kportal_blockallsigs (); + +#if (CONFIG_SMP && CPU_AFFINITY) + if ((cpu_online_map & (1 << id)) != 0) + current->cpus_allowed = (1 << id); + else + CERROR ("Can't set CPU affinity for %s\n", name); +#endif /* CONFIG_SMP && CPU_AFFINITY */ spin_lock_irqsave (&sched->kss_lock, flags); diff --git a/lnet/klnds/toelnd/toenal.c b/lnet/klnds/toelnd/toenal.c index 1f5dc38..77ee473 100644 --- a/lnet/klnds/toelnd/toenal.c +++ b/lnet/klnds/toelnd/toenal.c @@ -379,7 +379,7 @@ ktoenal_cmd(struct portal_ioctl_data * data, void * private) } -void __exit +void /*__exit*/ ktoenal_module_fini (void) { CDEBUG(D_MALLOC, "before NAL cleanup: kmem %d\n", diff --git a/lnet/klnds/toelnd/toenal_cb.c b/lnet/klnds/toelnd/toenal_cb.c index 5388f4b..2800788 100644 --- a/lnet/klnds/toelnd/toenal_cb.c +++ b/lnet/klnds/toelnd/toenal_cb.c @@ -893,9 +893,10 @@ ktoenal_process_receive (ksock_conn_t *conn, long *irq_flags) spin_lock_irqsave (&ktoenal_data.ksnd_sched_lock, *irq_flags); goto get_fmb; /* => go get a fwd msg buffer */ default: - LBUG (); + break; } /* Not Reached */ + LBUG (); } PROF_START(lib_parse); @@ -934,10 +935,11 @@ ktoenal_process_receive (ksock_conn_t *conn, long *irq_flags) goto out; /* (later) */ default: - LBUG (); + break; } /* Not Reached */ + LBUG (); out: spin_lock_irqsave (&ktoenal_data.ksnd_sched_lock, *irq_flags); diff --git a/lnet/libcfs/.cvsignore b/lnet/libcfs/.cvsignore index 67d1a3d..7fa686f 100644 --- a/lnet/libcfs/.cvsignore +++ b/lnet/libcfs/.cvsignore @@ -2,3 +2,4 @@ Makefile Makefile.in link-stamp +.*.o.cmd diff --git a/lnet/libcfs/Makefile.mk b/lnet/libcfs/Makefile.mk index 3196ea2..9aa838f 100644 --- a/lnet/libcfs/Makefile.mk +++ b/lnet/libcfs/Makefile.mk @@ -6,4 +6,4 @@ include fs/lustre/portals/Kernelenv obj-y += libcfs.o -licfs-objs := module.o proc.o debug.o \ No newline at end of file +libcfs-objs := module.o proc.o debug.o diff --git a/lnet/libcfs/debug.c b/lnet/libcfs/debug.c index 491c954..07c0bed 100644 --- a/lnet/libcfs/debug.c +++ b/lnet/libcfs/debug.c @@ -573,8 +573,8 @@ int portals_debug_init(unsigned long bufsize) memset(debug_buf, 0, debug_size); debug_wrapped = 0; - printk(KERN_INFO "Portals: allocated %lu byte debug buffer at %p.\n", - bufsize, debug_buf); + //printk(KERN_INFO "Portals: allocated %lu byte debug buffer at %p.\n", + //bufsize, debug_buf); atomic_set(&debug_off_a, debug_off); notifier_chain_register(&panic_notifier_list, &lustre_panic_notifier); debug_size = bufsize; @@ -634,9 +634,9 @@ int portals_debug_mark_buffer(char *text) if (debug_buf == NULL) return -EINVAL; - CDEBUG(0, "*******************************************************************************\n"); + CDEBUG(0, "********************************************************\n"); CDEBUG(0, "DEBUG MARKER: %s\n", text); - CDEBUG(0, "*******************************************************************************\n"); + CDEBUG(0, "********************************************************\n"); return 0; } @@ -674,8 +674,8 @@ __s32 portals_debug_copy_to_user(char *buf, unsigned long len) /* FIXME: I'm not very smart; someone smarter should make this better. */ void -portals_debug_msg (int subsys, int mask, char *file, char *fn, int line, - unsigned long stack, const char *format, ...) +portals_debug_msg(int subsys, int mask, char *file, const char *fn, + const int line, unsigned long stack, const char *format, ...) { va_list ap; unsigned long flags; @@ -792,7 +792,7 @@ void portals_debug_set_level(unsigned int debug_level) portal_debug = debug_level; } -void portals_run_lbug_upcall(char * file, char *fn, int line) +void portals_run_lbug_upcall(char *file, const char *fn, const int line) { char *argv[6]; char *envp[3]; @@ -805,7 +805,7 @@ void portals_run_lbug_upcall(char * file, char *fn, int line) argv[0] = portals_upcall; argv[1] = "LBUG"; argv[2] = file; - argv[3] = fn; + argv[3] = (char *)fn; argv[4] = buf; argv[5] = NULL; diff --git a/lnet/libcfs/module.c b/lnet/libcfs/module.c index 5e3fcb5..e8eb290 100644 --- a/lnet/libcfs/module.c +++ b/lnet/libcfs/module.c @@ -62,10 +62,10 @@ static struct nal_cmd_handler nal_cmd[NAL_MAX_NR + 1]; struct semaphore nal_cmd_sem; #ifdef PORTAL_DEBUG -void -kportal_assertion_failed (char *expr, char *file, char *func, int line) +void kportal_assertion_failed(char *expr, char *file, const char *func, + const int line) { - portals_debug_msg(0, D_EMERG, file, func, line, CDEBUG_STACK(), + portals_debug_msg(0, D_EMERG, file, func, line, CDEBUG_STACK, "ASSERTION(%s) failed\n", expr); LBUG_WITH_LOC(file, func, line); } @@ -429,6 +429,7 @@ static int kportal_ioctl(struct inode *inode, struct file *file, return (-EINVAL); err = PtlFailNid (*nip, data->ioc_nid, data->ioc_count); + kportal_put_ni (data->ioc_nal); break; } diff --git a/lnet/lnet/.cvsignore b/lnet/lnet/.cvsignore index e995588..95973d6 100644 --- a/lnet/lnet/.cvsignore +++ b/lnet/lnet/.cvsignore @@ -1,3 +1,4 @@ .deps Makefile Makefile.in +.*.o.cmd diff --git a/lnet/lnet/Makefile.mk b/lnet/lnet/Makefile.mk index 5627ef7..7822846 100644 --- a/lnet/lnet/Makefile.mk +++ b/lnet/lnet/Makefile.mk @@ -3,7 +3,10 @@ # This code is issued under the GNU General Public License. # See the file COPYING in this distribution -include ../Kernelenv +include $(src)/../Kernelenv obj-y += portals.o -portals-objs := lib-dispatch.o lib-eq.o lib-init.o lib-md.o lib-me.o lib-move.o lib-msg.o lib-ni.o lib-not-impl.o lib-pid.o api-eq.o api-errno.o api-init.o api-md.o api-me.o api-ni.o api-wrap.o +portals-objs := lib-dispatch.o lib-eq.o lib-init.o lib-md.o lib-me.o \ + lib-move.o lib-msg.o lib-ni.o lib-pid.o \ + api-eq.o api-errno.o api-init.o api-me.o api-ni.o \ + api-wrap.o diff --git a/lnet/lnet/lib-move.c b/lnet/lnet/lib-move.c index fde4f16..02f8b60 100644 --- a/lnet/lnet/lib-move.c +++ b/lnet/lnet/lib-move.c @@ -544,7 +544,7 @@ get_new_msg (nal_cb_t *nal, lib_md_t *md) msg->send_ack = 0; msg->md = md; - msg->ev.arrival_time = get_cycles(); + do_gettimeofday(&msg->ev.arrival_time); md->pending++; if (md->threshold != PTL_MD_THRESH_INF) { LASSERT (md->threshold > 0); diff --git a/lnet/router/.cvsignore b/lnet/router/.cvsignore index e995588..95973d6 100644 --- a/lnet/router/.cvsignore +++ b/lnet/router/.cvsignore @@ -1,3 +1,4 @@ .deps Makefile Makefile.in +.*.o.cmd diff --git a/lnet/router/Makefile.mk b/lnet/router/Makefile.mk index 64bd09b..9b02c03 100644 --- a/lnet/router/Makefile.mk +++ b/lnet/router/Makefile.mk @@ -3,7 +3,7 @@ # This code is issued under the GNU General Public License. # See the file COPYING in this distribution -include ../Kernelenv +include $(src)/../Kernelenv obj-y += kptlrouter.o kptlrouter-objs := router.o proc.o diff --git a/lnet/router/router.c b/lnet/router/router.c index 6074c3c..27a7fba 100644 --- a/lnet/router/router.c +++ b/lnet/router/router.c @@ -23,8 +23,8 @@ #include "router.h" -struct list_head kpr_routes; -struct list_head kpr_nals; +LIST_HEAD(kpr_routes); +LIST_HEAD(kpr_nals); unsigned long long kpr_fwd_bytes; unsigned long kpr_fwd_packets; @@ -35,7 +35,7 @@ atomic_t kpr_queue_depth; * * Once in a blue moon we register/deregister NALs and add/remove routing * entries (thread context only)... */ -rwlock_t kpr_rwlock; +rwlock_t kpr_rwlock = RW_LOCK_UNLOCKED; kpr_router_interface_t kpr_router_interface = { kprri_register: kpr_register_nal, @@ -55,7 +55,7 @@ kpr_control_interface_t kpr_control_interface = { int kpr_register_nal (kpr_nal_interface_t *nalif, void **argp) { - long flags; + unsigned long flags; struct list_head *e; kpr_nal_entry_t *ne; @@ -98,7 +98,7 @@ kpr_register_nal (kpr_nal_interface_t *nalif, void **argp) void kpr_shutdown_nal (void *arg) { - long flags; + unsigned long flags; kpr_nal_entry_t *ne = (kpr_nal_entry_t *)arg; CDEBUG (D_OTHER, "Shutting down NAL %d\n", ne->kpne_interface.kprni_nalid); @@ -123,7 +123,7 @@ kpr_shutdown_nal (void *arg) void kpr_deregister_nal (void *arg) { - long flags; + unsigned long flags; kpr_nal_entry_t *ne = (kpr_nal_entry_t *)arg; CDEBUG (D_OTHER, "Deregister NAL %d\n", ne->kpne_interface.kprni_nalid); @@ -296,7 +296,7 @@ int kpr_add_route (int gateway_nalid, ptl_nid_t gateway_nid, ptl_nid_t lo_nid, ptl_nid_t hi_nid) { - long flags; + unsigned long flags; struct list_head *e; kpr_route_entry_t *re; @@ -345,7 +345,7 @@ kpr_add_route (int gateway_nalid, ptl_nid_t gateway_nid, ptl_nid_t lo_nid, int kpr_del_route (ptl_nid_t nid) { - long flags; + unsigned long flags; struct list_head *e; CDEBUG(D_OTHER, "Del route "LPX64"\n", nid); @@ -398,7 +398,7 @@ kpr_get_route(int idx, int *gateway_nalid, ptl_nid_t *gateway_nid, return (-ENOENT); } -static void __exit +static void /*__exit*/ kpr_finalise (void) { LASSERT (list_empty (&kpr_nals)); @@ -427,10 +427,6 @@ kpr_initialise (void) CDEBUG(D_MALLOC, "kpr_initialise: kmem %d\n", atomic_read(&portal_kmemory)); - rwlock_init(&kpr_rwlock); - INIT_LIST_HEAD(&kpr_routes); - INIT_LIST_HEAD(&kpr_nals); - kpr_proc_init(); PORTAL_SYMBOL_REGISTER(kpr_router_interface); diff --git a/lnet/tests/.cvsignore b/lnet/tests/.cvsignore index 051d1bd..d0c4c88 100644 --- a/lnet/tests/.cvsignore +++ b/lnet/tests/.cvsignore @@ -1,3 +1,4 @@ Makefile Makefile.in .deps +.*.o.cmd diff --git a/lnet/tests/ping_cli.c b/lnet/tests/ping_cli.c index 389ffbb..4d04ffb 100644 --- a/lnet/tests/ping_cli.c +++ b/lnet/tests/ping_cli.c @@ -260,7 +260,7 @@ pingcli_start(struct portal_ioctl_data *args) /* called by the portals_ioctl for ping requests */ -static int kping_client(struct portal_ioctl_data *args) +int kping_client(struct portal_ioctl_data *args) { PORTAL_ALLOC (client, sizeof(struct pingcli_data)); if (client == NULL) @@ -282,7 +282,7 @@ static int __init pingcli_init(void) } /* pingcli_init() */ -static void __exit pingcli_cleanup(void) +static void /*__exit*/ pingcli_cleanup(void) { PORTAL_SYMBOL_UNREGISTER (kping_client); } /* pingcli_cleanup() */ diff --git a/lnet/tests/ping_srv.c b/lnet/tests/ping_srv.c index 1037d09..873e11c 100644 --- a/lnet/tests/ping_srv.c +++ b/lnet/tests/ping_srv.c @@ -47,11 +47,11 @@ #include #define STDSIZE (sizeof(int) + sizeof(int) + sizeof(struct timeval)) -#define MAXSIZE (16*1024*1024) +#define MAXSIZE (16*1024) static unsigned ping_head_magic; static unsigned ping_bulk_magic; -static int nal = 0; // Your NAL, +static int nal = SOCKNAL; // Your NAL, static unsigned long packets_valid = 0; // Valid packets static int running = 1; atomic_t pkt; @@ -282,7 +282,7 @@ static int __init pingsrv_init(void) } /* pingsrv_init() */ -static void __exit pingsrv_cleanup(void) +static void /*__exit*/ pingsrv_cleanup(void) { remove_proc_entry ("net/pingsrv", NULL); diff --git a/lnet/tests/sping_cli.c b/lnet/tests/sping_cli.c index 4cef08b..35e114b 100644 --- a/lnet/tests/sping_cli.c +++ b/lnet/tests/sping_cli.c @@ -235,7 +235,7 @@ pingcli_start(struct portal_ioctl_data *args) /* called by the portals_ioctl for ping requests */ -static int kping_client(struct portal_ioctl_data *args) +int kping_client(struct portal_ioctl_data *args) { PORTAL_ALLOC (client, sizeof(struct pingcli_data)); @@ -258,7 +258,7 @@ static int __init pingcli_init(void) } /* pingcli_init() */ -static void __exit pingcli_cleanup(void) +static void /*__exit*/ pingcli_cleanup(void) { PORTAL_SYMBOL_UNREGISTER (kping_client); } /* pingcli_cleanup() */ diff --git a/lnet/tests/sping_srv.c b/lnet/tests/sping_srv.c index a18ea35..2b45a46 100644 --- a/lnet/tests/sping_srv.c +++ b/lnet/tests/sping_srv.c @@ -269,7 +269,7 @@ static int __init pingsrv_init(void) } /* pingsrv_init() */ -static void __exit pingsrv_cleanup(void) +static void /*__exit*/ pingsrv_cleanup(void) { remove_proc_entry ("net/pingsrv", NULL); diff --git a/lnet/ulnds/debug.c b/lnet/ulnds/debug.c index 529bb2d..b73f042 100644 --- a/lnet/ulnds/debug.c +++ b/lnet/ulnds/debug.c @@ -84,8 +84,8 @@ int portals_debug_copy_to_user(char *buf, unsigned long len) /* FIXME: I'm not very smart; someone smarter should make this better. */ void -portals_debug_msg (int subsys, int mask, char *file, char *fn, int line, - const char *format, ...) +portals_debug_msg (int subsys, int mask, char *file, const char *fn, + const int line, const char *format, ...) { va_list ap; unsigned long flags; diff --git a/lnet/ulnds/socklnd/debug.c b/lnet/ulnds/socklnd/debug.c index 529bb2d..b73f042 100644 --- a/lnet/ulnds/socklnd/debug.c +++ b/lnet/ulnds/socklnd/debug.c @@ -84,8 +84,8 @@ int portals_debug_copy_to_user(char *buf, unsigned long len) /* FIXME: I'm not very smart; someone smarter should make this better. */ void -portals_debug_msg (int subsys, int mask, char *file, char *fn, int line, - const char *format, ...) +portals_debug_msg (int subsys, int mask, char *file, const char *fn, + const int line, const char *format, ...) { va_list ap; unsigned long flags; diff --git a/lnet/utils/debug.c b/lnet/utils/debug.c index 9ab1c73d..78271d5 100644 --- a/lnet/utils/debug.c +++ b/lnet/utils/debug.c @@ -551,6 +551,8 @@ int jt_dbg_modules(int argc, char **argv) {"mds_ext3", "lustre/mds"}, {"mds_extN", "lustre/mds"}, {"ptlbd", "lustre/ptlbd"}, + {"mgmt_svc", "lustre/mgmt"}, + {"mgmt_cli", "lustre/mgmt"}, {NULL, NULL} }; char *path = ".."; diff --git a/lnet/utils/portals.c b/lnet/utils/portals.c index 90d66f5..a89f4f7 100644 --- a/lnet/utils/portals.c +++ b/lnet/utils/portals.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -106,6 +107,27 @@ nal2name (int nal) return ((e == NULL) ? "???" : e->name); } +static struct hostent * +ptl_gethostbyname(char * hname) { + struct hostent *he; + he = gethostbyname(hname); + if (!he) { + switch(h_errno) { + case HOST_NOT_FOUND: + case NO_ADDRESS: + fprintf(stderr, "Unable to resolve hostname: %s\n", + hname); + break; + default: + fprintf(stderr, "gethostbyname error: %s\n", + strerror(errno)); + break; + } + return NULL; + } + return he; +} + int ptl_parse_nid (ptl_nid_t *nidp, char *str) { @@ -127,7 +149,7 @@ ptl_parse_nid (ptl_nid_t *nidp, char *str) if ((('a' <= str[0] && str[0] <= 'z') || ('A' <= str[0] && str[0] <= 'Z')) && - (he = gethostbyname (str)) != NULL) + (he = ptl_gethostbyname (str)) != NULL) { __u32 addr = *(__u32 *)he->h_addr; @@ -351,12 +373,9 @@ int jt_ptl_connect(int argc, char **argv) goto usage; } - he = gethostbyname(argv[1]); - if (!he) { - fprintf(stderr, "gethostbyname error: %s\n", - strerror(errno)); + he = ptl_gethostbyname(argv[1]); + if (!he) return -1; - } g_port = atol(argv[2]); @@ -525,12 +544,9 @@ int jt_ptl_disconnect(int argc, char **argv) PORTAL_IOC_INIT(data); if (argc == 2) { - he = gethostbyname(argv[1]); - if (!he) { - fprintf(stderr, "gethostbyname error: %s\n", - strerror(errno)); + he = ptl_gethostbyname(argv[1]); + if (!he) return -1; - } data.ioc_nid = ntohl (*(__u32 *)he->h_addr); /* HOST byte order */ @@ -582,12 +598,9 @@ int jt_ptl_push_connection (int argc, char **argv) PORTAL_IOC_INIT(data); if (argc == 2) { - he = gethostbyname(argv[1]); - if (!he) { - fprintf(stderr, "gethostbyname error: %s\n", - strerror(errno)); + he = ptl_gethostbyname(argv[1]); + if (!he) return -1; - } data.ioc_nid = ntohl (*(__u32 *)he->h_addr); /* HOST byte order */ diff --git a/lnet/utils/routerstat.c b/lnet/utils/routerstat.c index 37da12c..99bc59b 100644 --- a/lnet/utils/routerstat.c +++ b/lnet/utils/routerstat.c @@ -21,12 +21,15 @@ do_stat (int fd) { static char buffer[1024]; static double last = 0.0; + static unsigned long long old_bytes; + static unsigned long old_packets; + static unsigned long old_errors; double now; double t; - long long bytes; - long packets; - long errors; - long depth; + unsigned long long new_bytes, bytes; + unsigned long new_packets, packets; + unsigned long new_errors, errors; + unsigned long depth; int n; lseek (fd, 0, SEEK_SET); @@ -39,7 +42,8 @@ do_stat (int fd) } buffer[n] = 0; - n = sscanf (buffer, "%Ld %ld %ld %ld", &bytes, &packets, &errors, &depth); + n = sscanf (buffer, "%Lu %lu %lu %lu", + &new_bytes, &new_packets, &new_errors, &depth); if (n < 3) { @@ -48,27 +52,44 @@ do_stat (int fd) } if (last == 0.0) - printf ("%Ld bytes, %ld packets (sz %Ld) %ld errors", - bytes, packets, (long long)((packets == 0) ? 0LL : bytes/packets), errors); + printf ("%llu bytes, %lu packets (sz %lld), %lu errors", + new_bytes, new_packets, + (long long)((new_packets == 0) ? 0LL : new_bytes/new_packets), + new_errors); else { t = now - last; - printf ("%9Ld (%7.2fMb/s), %7ld packets (sz %5Ld, %5ld/s) %ld errors (%ld/s)", + if (new_bytes < old_bytes) + bytes = -1ULL - old_bytes + new_bytes + 1; + else + bytes = new_bytes - old_bytes; + if (new_packets < old_packets) + packets = -1UL - old_packets + new_packets + 1; + else + packets = new_packets - old_packets; + if (new_errors < old_errors) + errors = -1UL - old_errors + new_errors + 1; + else + errors = new_errors - old_errors; + + printf ("%9llu bytes (%7.2fMb/s), %7lu packets (sz %5lld, %5ld/s), %lu errors (%ld/s)", bytes, ((double)bytes)/((1<<20) * t), packets, (long long)((packets == 0) ? 0LL : bytes/packets), (long)(packets/t), errors, (long)(errors/t)); } + old_bytes = new_bytes; + old_packets = new_packets; + old_errors = new_errors; if (n == 4) - printf (" (%ld)\n", depth); + printf (", depth (%ld)\n", depth); else printf ("\n"); fflush (stdout); lseek (fd, 0, SEEK_SET); - write (fd, "\n", 1); last = timenow(); } @@ -80,7 +101,7 @@ int main (int argc, char **argv) if (argc > 1) interval = atoi (argv[1]); - fd = open ("/proc/sys/portals/router", O_RDWR); + fd = open ("/proc/sys/portals/router", O_RDONLY); if (fd < 0) { fprintf (stderr, "Can't open stat: %s\n", strerror (errno)); diff --git a/lustre/Makefile.mk b/lustre/Makefile.mk index e540148..59178a4 100644 --- a/lustre/Makefile.mk +++ b/lustre/Makefile.mk @@ -1,4 +1,22 @@ -include fs/lustre/portals/Kernelenv +include $(src)/portals/Kernelenv + +# for scripts/version_tag.pl +LINUX = @LINUX@ obj-y += portals/ +# obdclass has to come before anything that does class_register.. +obj-y += obdclass/ +obj-y += ptlrpc/ +obj-y += ldlm/ +obj-y += obdfilter/ +obj-y += mdc/ obj-y += mds/ +obj-y += obdecho/ +obj-y += osc/ +obj-y += ost/ +obj-y += lov/ +obj-y += llite/ + +# portals needs to be before utils/, which pulls in ptlctl objects +obj-m += utils/ +obj-m += tests/ diff --git a/lustre/mds/Makefile.mk b/lustre/mds/Makefile.mk index 6b712fb..0696bd7 100644 --- a/lustre/mds/Makefile.mk +++ b/lustre/mds/Makefile.mk @@ -3,8 +3,9 @@ # This code is issued under the GNU General Public License. # See the file COPYING in this distribution -include fs/lustre/portals/Kernelenv +include $(src)/../portals/Kernelenv obj-y += mds.o - -mds-objs := mds_lov.o handler.o mds_reint.o mds_fs.o lproc_mds.o mds_internal.h mds_updates.o mds_open.o simple.o target.o +mds-objs := mds_lov.o handler.o mds_reint.o mds_fs.o lproc_mds.o mds_open.o \ + mds_lib.o + diff --git a/lustre/portals/.cvsignore b/lustre/portals/.cvsignore index 99ac885..c1a9bdf 100644 --- a/lustre/portals/.cvsignore +++ b/lustre/portals/.cvsignore @@ -6,3 +6,4 @@ autom4te.cache config.log config.status configure +.*.o.cmd diff --git a/lustre/portals/Kernelenv.in b/lustre/portals/Kernelenv.in index 29a713f..7a48c58 100644 --- a/lustre/portals/Kernelenv.in +++ b/lustre/portals/Kernelenv.in @@ -1 +1,6 @@ -EXTRA_CFLAGS= -Ifs/lustre/include -Ifs/lustre/portals/include +EXTRA_CFLAGS := -Ifs/lustre/include -Ifs/lustre/portals/include +# portals/utils/debug.c wants from userspace. sigh. +HOSTCFLAGS := -I@LINUX@/include $(EXTRA_CFLAGS) +LIBREADLINE := @LIBREADLINE@ +# 2.5's makefiles aren't nice to cross dir libraries in host programs +PTLCTLOBJS := debug.o l_ioctl.o parser.o portals.o diff --git a/lustre/portals/Kernelenv.mk b/lustre/portals/Kernelenv.mk index 29a713f..7c66dfa 100644 --- a/lustre/portals/Kernelenv.mk +++ b/lustre/portals/Kernelenv.mk @@ -1 +1,4 @@ -EXTRA_CFLAGS= -Ifs/lustre/include -Ifs/lustre/portals/include +EXTRA_CFLAGS := -Ifs/lustre/include -Ifs/lustre/portals/include +HOSTCFLAGS := $(EXTRA_CFLAGS) +# the kernel doesn't want us to build archives for host binaries :/ +PTLCTLOBJS := debug.o l_ioctl.o parser.o portals.o diff --git a/lustre/portals/Makefile.mk b/lustre/portals/Makefile.mk index be0e51a..73a19df 100644 --- a/lustre/portals/Makefile.mk +++ b/lustre/portals/Makefile.mk @@ -1,6 +1,12 @@ -include fs/lustre/portals/Kernelenv +include $(src)/Kernelenv -obj-y += portals/ +# The ordering of these determines the order that each subsystem's +# module_init() functions are called in. if these are changed make sure +# they reflect the dependencies between each subsystem's _init functions. obj-y += libcfs/ -obj-y += knals/ +obj-y += portals/ obj-y += router/ +obj-y += knals/ +obj-y += tests/ + +obj-m += utils/ diff --git a/lustre/portals/archdep.m4 b/lustre/portals/archdep.m4 index ba7c699..c1455c3 100644 --- a/lustre/portals/archdep.m4 +++ b/lustre/portals/archdep.m4 @@ -11,8 +11,13 @@ AC_ARG_WITH(lib, [ --with-lib compile lustre library], host_cpu="lib") AC_ARG_WITH(linux, [ --with-linux=[path] set path to Linux source (default=/usr/src/linux)],LINUX=$with_linux,LINUX=/usr/src/linux) AC_SUBST(LINUX) +if test x$enable_inkernel = xyes ; then + echo ln -s `pwd` $LINUX/fs/lustre + rm $LINUX/fs/lustre + ln -s `pwd` $LINUX/fs/lustre +fi -# --------- UML? -------------------- +# -------------------- AC_MSG_CHECKING(if you are running user mode linux for $host_cpu ...) if test $host_cpu = "lib" ; then host_cpu="lib" @@ -111,6 +116,13 @@ case ${host_cpu} in MOD_LINK=elf64_ia64 ;; + x86_64 ) + AC_MSG_RESULT($host_cpu) + KCFLAGS='-g -O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fomit-frame-pointer -mno-red-zone -mcmodel=kernel -pipe -fno-reorder-blocks -finline-limit=2000 -fno-strength-reduce -fno-asynchronous-unwind-tables' + KCPPFLAGS='-D__KERNEL__ -DMODULE' + MOD_LINK=elf_x86_64 +;; + sparc64 ) AC_MSG_RESULT($host_cpu) KCFLAGS='-O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fomit-frame-pointer -fno-strict-aliasing -fno-common -Wno-unused -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow -ffixed-g4 -fcall-used-g5 -fcall-used-g7 -Wno-sign-compare -Wa,--undeclared-regs' @@ -160,21 +172,33 @@ if test $host_cpu != "lib" ; then AC_MSG_ERROR(** cannot find $LINUX/include/linux/autoconf.h. Run make config in $LINUX.) fi -# ------------ RELEASE and moduledir ------------------ +# ------------ LINUXRELEASE and moduledir ------------------ AC_MSG_CHECKING(for Linux release) dnl We need to rid ourselves of the nasty [ ] quotes. changequote(, ) dnl Get release from version.h - RELEASE="`sed -ne 's/.*UTS_RELEASE[ \"]*\([0-9.a-zA-Z_-]*\).*/\1/p' $LINUX/include/linux/version.h`" + LINUXRELEASE="`sed -ne 's/.*UTS_RELEASE[ \"]*\([0-9.a-zA-Z_-]*\).*/\1/p' $LINUX/include/linux/version.h`" changequote([, ]) - moduledir='$(libdir)/modules/'$RELEASE/kernel + moduledir='$(libdir)/modules/'$LINUXRELEASE/kernel AC_SUBST(moduledir) modulefsdir='$(moduledir)/fs/$(PACKAGE)' AC_SUBST(modulefsdir) + AC_MSG_RESULT($LINUXRELEASE) + AC_SUBST(LINUXRELEASE) + +# ------------ RELEASE -------------------------------- + AC_MSG_CHECKING(lustre release) + + dnl We need to rid ourselves of the nasty [ ] quotes. + changequote(, ) + dnl Get release from version.h + RELEASE="`sed -ne 's/-/_/g' -e 's/.*UTS_RELEASE[ \"]*\([0-9.a-zA-Z_]*\).*/\1/p' $LINUX/include/linux/version.h`_`date +%Y%m%d%H%M`" + changequote([, ]) + AC_MSG_RESULT($RELEASE) AC_SUBST(RELEASE) @@ -303,7 +327,7 @@ AM_CONDITIONAL(LIBLUSTRE, test x$host_cpu = xlib) # This needs to run after we've defined the KCPPFLAGS AC_MSG_CHECKING(for kernel version) -AC_TRY_LINK([#define __KERNEL__ +AC_TRY_COMPILE([#define __KERNEL__ #include ], [struct task_struct p; p.sighand = NULL;], diff --git a/lustre/portals/include/config.h.in b/lustre/portals/include/config.h.in index b05d0c4..a4b1e1e 100644 --- a/lustre/portals/include/config.h.in +++ b/lustre/portals/include/config.h.in @@ -1,7 +1,7 @@ -/* ../include/config.h.in. Generated automatically from configure.in by autoheader. */ +/* portals/include/config.h.in. Generated automatically from configure.in by autoheader. */ -/* Define if you have the readline library (-lreadline). */ -#undef HAVE_LIBREADLINE +/* The number of bytes in a unsigned long long. */ +#undef SIZEOF_UNSIGNED_LONG_LONG /* Name of package */ #undef PACKAGE @@ -9,3 +9,6 @@ /* Version number of package */ #undef VERSION +/* IOCTL Buffer Size */ +#undef OBD_MAX_IOCTL_BUFFER + diff --git a/lustre/portals/include/linux/kp30.h b/lustre/portals/include/linux/kp30.h index bd963d7..6088b7f 100644 --- a/lustre/portals/include/linux/kp30.h +++ b/lustre/portals/include/linux/kp30.h @@ -16,10 +16,6 @@ #define LOWEST_BIT_SET(x) ((x) & ~((x) - 1)) -#ifndef CONFIG_SMP -# define smp_processor_id() 0 -#endif - /* * Debugging */ @@ -55,6 +51,7 @@ extern unsigned int portal_printk; #define S_COBD (21 << 24) #define S_PTLBD (22 << 24) #define S_LOG (23 << 24) +#define S_MGMT (24 << 24) /* If you change these values, please keep portals/linux/utils/debug.c * up to date! */ @@ -83,20 +80,23 @@ extern unsigned int portal_printk; #define D_RPCTRACE (1 << 20) /* for distributed debugging */ #define D_VFSTRACE (1 << 21) -#ifndef __KERNEL__ -#define THREAD_SIZE 8192 +#ifdef __KERNEL__ +# include /* THREAD_SIZE */ +#else +# define THREAD_SIZE 8192 #endif -#ifdef __ia64__ -#define CDEBUG_STACK() (THREAD_SIZE - \ + +#ifdef __KERNEL__ +# ifdef __ia64__ +# define CDEBUG_STACK (THREAD_SIZE - \ ((unsigned long)__builtin_dwarf_cfa() & \ (THREAD_SIZE - 1))) -#else -#define CDEBUG_STACK() (THREAD_SIZE - \ +# else +# define CDEBUG_STACK (THREAD_SIZE - \ ((unsigned long)__builtin_frame_address(0) & \ (THREAD_SIZE - 1))) -#endif +# endif -#ifdef __KERNEL__ #define CHECK_STACK(stack) \ do { \ if ((stack) > 3*THREAD_SIZE/4 && (stack) > portal_stack) { \ @@ -108,20 +108,21 @@ extern unsigned int portal_printk; /*panic("LBUG");*/ \ } \ } while (0) -#else +#else /* __KERNEL __ */ #define CHECK_STACK(stack) do { } while(0) -#endif +#define CDEBUG_STACK (0L) +#endif /* __KERNEL__ */ #if 1 #define CDEBUG(mask, format, a...) \ do { \ - CHECK_STACK(CDEBUG_STACK()); \ + CHECK_STACK(CDEBUG_STACK); \ if (!(mask) || ((mask) & (D_ERROR | D_EMERG)) || \ (portal_debug & (mask) && \ portal_subsystem_debug & (1 << (DEBUG_SUBSYSTEM >> 24)))) \ portals_debug_msg(DEBUG_SUBSYSTEM, mask, \ __FILE__, __FUNCTION__, __LINE__, \ - CDEBUG_STACK(), format , ## a); \ + CDEBUG_STACK, format, ## a); \ } while (0) #define CWARN(format, a...) CDEBUG(D_WARNING, format, ## a) @@ -213,7 +214,8 @@ static inline void our_cond_resched(void) #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) */ #ifdef PORTAL_DEBUG -extern void kportal_assertion_failed(char *expr,char *file,char *func,int line); +extern void kportal_assertion_failed(char *expr, char *file, const char *func, + const int line); #define LASSERT(e) ((e) ? 0 : kportal_assertion_failed( #e , __FILE__, \ __FUNCTION__, __LINE__)) #else @@ -563,7 +565,7 @@ extern struct prof_ent prof_ents[MAX_PROFS]; #endif /* PORTALS_PROFILING */ /* debug.c */ -void portals_run_lbug_upcall(char * file, char *fn, int line); +void portals_run_lbug_upcall(char * file, const char *fn, const int line); void portals_debug_dumplog(void); int portals_debug_init(unsigned long bufsize); int portals_debug_cleanup(void); @@ -581,12 +583,13 @@ __s32 portals_debug_copy_to_user(char *buf, unsigned long len); # warning printf has been defined as a macro... # undef printf #endif -void portals_debug_msg (int subsys, int mask, char *file, char *fn, int line, - unsigned long stack, const char *format, ...) +void portals_debug_msg(int subsys, int mask, char *file, const char *fn, + const int line, unsigned long stack, + const char *format, ...) __attribute__ ((format (printf, 7, 8))); #else -void portals_debug_msg (int subsys, int mask, char *file, char *fn, - int line, unsigned long stack, +void portals_debug_msg (int subsys, int mask, char *file, const char *fn, + const int line, unsigned long stack, const char *format, ...); #endif /* __GNUC__ */ void portals_debug_set_level(unsigned int debug_level); diff --git a/lustre/portals/include/portals/list.h b/lustre/portals/include/portals/list.h index 2b63312..78a1e2d 100644 --- a/lustre/portals/include/portals/list.h +++ b/lustre/portals/include/portals/list.h @@ -1,6 +1,4 @@ #ifndef _LINUX_LIST_H -#define _LINUX_LIST_H - /* * Simple doubly linked list implementation. @@ -101,7 +99,9 @@ static inline void list_del_init(struct list_head *entry) __list_del(entry->prev, entry->next); INIT_LIST_HEAD(entry); } +#endif +#ifndef list_for_each_entry /** * list_move - delete from one list and add as another's head * @list: the entry to move @@ -124,7 +124,10 @@ static inline void list_move_tail(struct list_head *list, __list_del(list->prev, list->next); list_add_tail(list, head); } +#endif +#ifndef _LINUX_LIST_H +#define _LINUX_LIST_H /** * list_empty - tests whether a list is empty * @head: the list to test. diff --git a/lustre/portals/include/portals/lltrace.h b/lustre/portals/include/portals/lltrace.h index 7d1b304..d389aab 100644 --- a/lustre/portals/include/portals/lltrace.h +++ b/lustre/portals/include/portals/lltrace.h @@ -2,7 +2,7 @@ * vim:expandtab:shiftwidth=8:tabstop=8: * * Compile with: - * cc -I../../portals/include -o fio fio.c -L../../portals/linux/utils -lptlctl + * cc -I../../portals/include -o fio fio.c -L../../portals/linux/utils -lptlctl */ #ifndef __LTRACE_H_ #define __LTRACE_H_ @@ -31,20 +31,20 @@ static inline int ltrace_write_file(char* fname) argv[0] = "debug_kernel"; argv[1] = fname; argv[2] = "1"; - + fprintf(stderr, "[ptlctl] %s %s %s\n", argv[0], argv[1], argv[2]); - + return jt_dbg_debug_kernel(3, argv); } static inline int ltrace_clear() { char* argv[1]; - + argv[0] = "clear"; - + fprintf(stderr, "[ptlctl] %s\n", argv[0]); - + return jt_dbg_clear_debug_buf(1, argv); } @@ -52,9 +52,9 @@ static inline int ltrace_mark(int indent_level, char* text) { char* argv[2]; char mark_buf[PATH_MAX]; - + snprintf(mark_buf, PATH_MAX, "====%d=%s", indent_level, text); - + argv[0] = "mark"; argv[1] = mark_buf; return jt_dbg_mark_debug_buf(2, argv); @@ -65,9 +65,9 @@ static inline int ltrace_applymasks() char* argv[2]; argv[0] = "list"; argv[1] = "applymasks"; - + fprintf(stderr, "[ptlctl] %s %s\n", argv[0], argv[1]); - + return jt_dbg_list(2, argv); } @@ -95,19 +95,19 @@ static inline int ltrace_start() #ifdef PORTALS_DEV_ID rc = register_ioc_dev(PORTALS_DEV_ID, PORTALS_DEV_PATH); #endif - ltrace_filter("class"); + ltrace_filter("class"); ltrace_filter("socknal"); - ltrace_filter("qswnal"); - ltrace_filter("gmnal"); - ltrace_filter("portals"); - - ltrace_show("all_types"); - ltrace_filter("trace"); - ltrace_filter("malloc"); - ltrace_filter("net"); - ltrace_filter("page"); - ltrace_filter("other"); - ltrace_filter("info"); + ltrace_filter("qswnal"); + ltrace_filter("gmnal"); + ltrace_filter("portals"); + + ltrace_show("all_types"); + ltrace_filter("trace"); + ltrace_filter("malloc"); + ltrace_filter("net"); + ltrace_filter("page"); + ltrace_filter("other"); + ltrace_filter("info"); ltrace_applymasks(); return rc; @@ -146,7 +146,7 @@ static inline void ltrace_add_processnames(char* fname) struct timezone tz; int nob; int underuml = !not_uml(); - + gettimeofday(&tv, &tz); nob = snprintf(cmdbuf, LTRACE_MAX_NOB, "ps --no-headers -eo \""); @@ -167,7 +167,7 @@ static inline void ltrace_add_processnames(char* fname) "(%s:%d:%s() %d+%lu): ", "lltrace.h", __LINE__, __FUNCTION__, 0, 0L); } - + nob += snprintf(cmdbuf+nob, LTRACE_MAX_NOB, " %%p %%c\" >> %s", fname); system(cmdbuf); } diff --git a/lustre/portals/include/portals/myrnal.h b/lustre/portals/include/portals/myrnal.h index 12b1925..13790f7 100644 --- a/lustre/portals/include/portals/myrnal.h +++ b/lustre/portals/include/portals/myrnal.h @@ -1,6 +1,3 @@ -/* -*/ - #ifndef MYRNAL_H #define MYRNAL_H diff --git a/lustre/portals/include/portals/nal.h b/lustre/portals/include/portals/nal.h index 88be63c..7cb3ab7 100644 --- a/lustre/portals/include/portals/nal.h +++ b/lustre/portals/include/portals/nal.h @@ -1,5 +1,3 @@ -/* -*/ #ifndef _NAL_H_ #define _NAL_H_ diff --git a/lustre/portals/include/portals/ppid.h b/lustre/portals/include/portals/ppid.h index 4727599..760f465 100644 --- a/lustre/portals/include/portals/ppid.h +++ b/lustre/portals/include/portals/ppid.h @@ -1,6 +1,3 @@ -/* - */ - #ifndef _INCppidh_ #define _INCppidh_ diff --git a/lustre/portals/include/portals/stringtab.h b/lustre/portals/include/portals/stringtab.h index c9683f7..33e4375 100644 --- a/lustre/portals/include/portals/stringtab.h +++ b/lustre/portals/include/portals/stringtab.h @@ -1,5 +1,3 @@ /* -*/ -/* * stringtab.h */ diff --git a/lustre/portals/include/portals/types.h b/lustre/portals/include/portals/types.h index d4038b6..0269290 100644 --- a/lustre/portals/include/portals/types.h +++ b/lustre/portals/include/portals/types.h @@ -2,14 +2,19 @@ #define _P30_TYPES_H_ #ifdef __linux__ -#include -#include +# include +# include #else -#include +# include typedef u_int32_t __u32; typedef u_int64_t __u64; -typedef unsigned long long cycles_t; -static inline cycles_t get_cycles(void) { return 0; } +#endif + +#ifdef __KERNEL__ +# include +#else +# include +# define do_gettimeofday(tv) gettimeofday(tv, NULL) #endif typedef __u64 ptl_nid_t; @@ -31,7 +36,7 @@ typedef ptl_handle_any_t ptl_handle_md_t; typedef ptl_handle_any_t ptl_handle_me_t; #define PTL_HANDLE_NONE \ -((const ptl_handle_any_t){.nal_idx = -1, .cookie = -1}) + ((const ptl_handle_any_t){.nal_idx = -1, .cookie = -1}) #define PTL_EQ_NONE PTL_HANDLE_NONE static inline int PtlHandleEqual (ptl_handle_any_t h1, ptl_handle_any_t h2) @@ -108,17 +113,15 @@ typedef struct { ptl_handle_me_t unlinked_me; ptl_md_t mem_desc; ptl_hdr_data_t hdr_data; - cycles_t arrival_time; + struct timeval arrival_time; volatile ptl_seq_t sequence; } ptl_event_t; - typedef enum { PTL_ACK_REQ, PTL_NOACK_REQ } ptl_ack_req_t; - typedef struct { volatile ptl_seq_t sequence; ptl_size_t size; @@ -130,7 +133,6 @@ typedef struct { ptl_eq_t *eq; } ptl_ni_t; - typedef struct { int max_match_entries; /* max number of match entries */ int max_mem_descriptors; /* max number of memory descriptors */ diff --git a/lustre/portals/knals/.cvsignore b/lustre/portals/knals/.cvsignore index 282522d..89a4aa6 100644 --- a/lustre/portals/knals/.cvsignore +++ b/lustre/portals/knals/.cvsignore @@ -1,2 +1,3 @@ Makefile Makefile.in +.*.o.cmd diff --git a/lustre/portals/knals/Makefile.mk b/lustre/portals/knals/Makefile.mk index ce40a60..cd5d9d6 100644 --- a/lustre/portals/knals/Makefile.mk +++ b/lustre/portals/knals/Makefile.mk @@ -1,4 +1,4 @@ -include ../Kernelenv +include $(obj)/../Kernelenv obj-y = socknal/ -# more coming... \ No newline at end of file +# more coming... diff --git a/lustre/portals/knals/gmnal/gmnal.c b/lustre/portals/knals/gmnal/gmnal.c index ceeea2a..0cffc158 100644 --- a/lustre/portals/knals/gmnal/gmnal.c +++ b/lustre/portals/knals/gmnal/gmnal.c @@ -124,7 +124,7 @@ static nal_t *kgmnal_init(int interface, ptl_pt_index_t ptl_size, return &kgmnal_api; } -static void __exit +static void /*__exit*/ kgmnal_finalize(void) { struct list_head *tmp; diff --git a/lustre/portals/knals/qswnal/qswnal.h b/lustre/portals/knals/qswnal/qswnal.h index ceb7c8c..0eb4959 100644 --- a/lustre/portals/knals/qswnal/qswnal.h +++ b/lustre/portals/knals/qswnal/qswnal.h @@ -106,7 +106,7 @@ typedef unsigned long kqsw_csum_t; #define KQSW_TX_MAXCONTIG (1<<10) /* largest payload that gets made contiguous on transmit */ #define KQSW_NTXMSGS 8 /* # normal transmit messages */ -#define KQSW_NNBLK_TXMSGS 128 /* # reserved transmit messages if can't block */ +#define KQSW_NNBLK_TXMSGS 256 /* # reserved transmit messages if can't block */ #define KQSW_NRXMSGS_LARGE 64 /* # large receive buffers */ #define KQSW_EP_ENVELOPES_LARGE 128 /* # large ep envelopes */ diff --git a/lustre/portals/knals/qswnal/qswnal_cb.c b/lustre/portals/knals/qswnal/qswnal_cb.c index 3b47a25..c03d592 100644 --- a/lustre/portals/knals/qswnal/qswnal_cb.c +++ b/lustre/portals/knals/qswnal/qswnal_cb.c @@ -617,6 +617,7 @@ kqswnal_sendmsg (nal_cb_t *nal, if (ktx == NULL) { kqswnal_cerror_hdr (hdr); lib_finalize (&kqswnal_lib, private, cookie); + return (-1); } memcpy (ktx->ktx_buffer, hdr, sizeof (*hdr)); /* copy hdr from caller's stack */ diff --git a/lustre/portals/knals/scimacnal/scimacnal.c b/lustre/portals/knals/scimacnal/scimacnal.c index 1066d69..479cc2c 100644 --- a/lustre/portals/knals/scimacnal/scimacnal.c +++ b/lustre/portals/knals/scimacnal/scimacnal.c @@ -112,7 +112,7 @@ static nal_t *kscimacnal_init(int interface, ptl_pt_index_t ptl_size, /* Called by kernel at module unload time */ -static void __exit +static void /*__exit*/ kscimacnal_finalize(void) { /* FIXME: How should the shutdown procedure really look? */ diff --git a/lustre/portals/knals/socknal/socknal_cb.c b/lustre/portals/knals/socknal/socknal_cb.c index 3e7d206..bc770c8 100644 --- a/lustre/portals/knals/socknal/socknal_cb.c +++ b/lustre/portals/knals/socknal/socknal_cb.c @@ -1372,21 +1372,17 @@ int ksocknal_scheduler (void *arg) int nloops = 0; int id = sched - ksocknal_data.ksnd_schedulers; char name[16]; -#if (CONFIG_SMP && CPU_AFFINITY) -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) - int cpu = cpu_logical_map(id % num_online_cpus()); -#else -#warning "Take care of architecure specific logical APIC map" - int cpu = 1; /* Have to change later. */ -#endif /* LINUX_VERSION_CODE */ - - set_cpus_allowed (current, 1 << cpu); - id = cpu; -#endif /* CONFIG_SMP && CPU_AFFINITY */ snprintf (name, sizeof (name),"ksocknald[%d]", id); kportal_daemonize (name); kportal_blockallsigs (); + +#if (CONFIG_SMP && CPU_AFFINITY) + if ((cpu_online_map & (1 << id)) != 0) + current->cpus_allowed = (1 << id); + else + CERROR ("Can't set CPU affinity for %s\n", name); +#endif /* CONFIG_SMP && CPU_AFFINITY */ spin_lock_irqsave (&sched->kss_lock, flags); diff --git a/lustre/portals/knals/toenal/toenal.c b/lustre/portals/knals/toenal/toenal.c index 1f5dc38..77ee473 100644 --- a/lustre/portals/knals/toenal/toenal.c +++ b/lustre/portals/knals/toenal/toenal.c @@ -379,7 +379,7 @@ ktoenal_cmd(struct portal_ioctl_data * data, void * private) } -void __exit +void /*__exit*/ ktoenal_module_fini (void) { CDEBUG(D_MALLOC, "before NAL cleanup: kmem %d\n", diff --git a/lustre/portals/knals/toenal/toenal_cb.c b/lustre/portals/knals/toenal/toenal_cb.c index 5388f4b..2800788 100644 --- a/lustre/portals/knals/toenal/toenal_cb.c +++ b/lustre/portals/knals/toenal/toenal_cb.c @@ -893,9 +893,10 @@ ktoenal_process_receive (ksock_conn_t *conn, long *irq_flags) spin_lock_irqsave (&ktoenal_data.ksnd_sched_lock, *irq_flags); goto get_fmb; /* => go get a fwd msg buffer */ default: - LBUG (); + break; } /* Not Reached */ + LBUG (); } PROF_START(lib_parse); @@ -934,10 +935,11 @@ ktoenal_process_receive (ksock_conn_t *conn, long *irq_flags) goto out; /* (later) */ default: - LBUG (); + break; } /* Not Reached */ + LBUG (); out: spin_lock_irqsave (&ktoenal_data.ksnd_sched_lock, *irq_flags); diff --git a/lustre/portals/libcfs/.cvsignore b/lustre/portals/libcfs/.cvsignore index 67d1a3d..7fa686f 100644 --- a/lustre/portals/libcfs/.cvsignore +++ b/lustre/portals/libcfs/.cvsignore @@ -2,3 +2,4 @@ Makefile Makefile.in link-stamp +.*.o.cmd diff --git a/lustre/portals/libcfs/Makefile.mk b/lustre/portals/libcfs/Makefile.mk index 3196ea2..9aa838f 100644 --- a/lustre/portals/libcfs/Makefile.mk +++ b/lustre/portals/libcfs/Makefile.mk @@ -6,4 +6,4 @@ include fs/lustre/portals/Kernelenv obj-y += libcfs.o -licfs-objs := module.o proc.o debug.o \ No newline at end of file +libcfs-objs := module.o proc.o debug.o diff --git a/lustre/portals/libcfs/debug.c b/lustre/portals/libcfs/debug.c index 491c954..07c0bed 100644 --- a/lustre/portals/libcfs/debug.c +++ b/lustre/portals/libcfs/debug.c @@ -573,8 +573,8 @@ int portals_debug_init(unsigned long bufsize) memset(debug_buf, 0, debug_size); debug_wrapped = 0; - printk(KERN_INFO "Portals: allocated %lu byte debug buffer at %p.\n", - bufsize, debug_buf); + //printk(KERN_INFO "Portals: allocated %lu byte debug buffer at %p.\n", + //bufsize, debug_buf); atomic_set(&debug_off_a, debug_off); notifier_chain_register(&panic_notifier_list, &lustre_panic_notifier); debug_size = bufsize; @@ -634,9 +634,9 @@ int portals_debug_mark_buffer(char *text) if (debug_buf == NULL) return -EINVAL; - CDEBUG(0, "*******************************************************************************\n"); + CDEBUG(0, "********************************************************\n"); CDEBUG(0, "DEBUG MARKER: %s\n", text); - CDEBUG(0, "*******************************************************************************\n"); + CDEBUG(0, "********************************************************\n"); return 0; } @@ -674,8 +674,8 @@ __s32 portals_debug_copy_to_user(char *buf, unsigned long len) /* FIXME: I'm not very smart; someone smarter should make this better. */ void -portals_debug_msg (int subsys, int mask, char *file, char *fn, int line, - unsigned long stack, const char *format, ...) +portals_debug_msg(int subsys, int mask, char *file, const char *fn, + const int line, unsigned long stack, const char *format, ...) { va_list ap; unsigned long flags; @@ -792,7 +792,7 @@ void portals_debug_set_level(unsigned int debug_level) portal_debug = debug_level; } -void portals_run_lbug_upcall(char * file, char *fn, int line) +void portals_run_lbug_upcall(char *file, const char *fn, const int line) { char *argv[6]; char *envp[3]; @@ -805,7 +805,7 @@ void portals_run_lbug_upcall(char * file, char *fn, int line) argv[0] = portals_upcall; argv[1] = "LBUG"; argv[2] = file; - argv[3] = fn; + argv[3] = (char *)fn; argv[4] = buf; argv[5] = NULL; diff --git a/lustre/portals/libcfs/module.c b/lustre/portals/libcfs/module.c index 5e3fcb5..e8eb290 100644 --- a/lustre/portals/libcfs/module.c +++ b/lustre/portals/libcfs/module.c @@ -62,10 +62,10 @@ static struct nal_cmd_handler nal_cmd[NAL_MAX_NR + 1]; struct semaphore nal_cmd_sem; #ifdef PORTAL_DEBUG -void -kportal_assertion_failed (char *expr, char *file, char *func, int line) +void kportal_assertion_failed(char *expr, char *file, const char *func, + const int line) { - portals_debug_msg(0, D_EMERG, file, func, line, CDEBUG_STACK(), + portals_debug_msg(0, D_EMERG, file, func, line, CDEBUG_STACK, "ASSERTION(%s) failed\n", expr); LBUG_WITH_LOC(file, func, line); } @@ -429,6 +429,7 @@ static int kportal_ioctl(struct inode *inode, struct file *file, return (-EINVAL); err = PtlFailNid (*nip, data->ioc_nid, data->ioc_count); + kportal_put_ni (data->ioc_nal); break; } diff --git a/lustre/portals/portals/.cvsignore b/lustre/portals/portals/.cvsignore index e995588..95973d6 100644 --- a/lustre/portals/portals/.cvsignore +++ b/lustre/portals/portals/.cvsignore @@ -1,3 +1,4 @@ .deps Makefile Makefile.in +.*.o.cmd diff --git a/lustre/portals/portals/Makefile.mk b/lustre/portals/portals/Makefile.mk index 5627ef7..7822846 100644 --- a/lustre/portals/portals/Makefile.mk +++ b/lustre/portals/portals/Makefile.mk @@ -3,7 +3,10 @@ # This code is issued under the GNU General Public License. # See the file COPYING in this distribution -include ../Kernelenv +include $(src)/../Kernelenv obj-y += portals.o -portals-objs := lib-dispatch.o lib-eq.o lib-init.o lib-md.o lib-me.o lib-move.o lib-msg.o lib-ni.o lib-not-impl.o lib-pid.o api-eq.o api-errno.o api-init.o api-md.o api-me.o api-ni.o api-wrap.o +portals-objs := lib-dispatch.o lib-eq.o lib-init.o lib-md.o lib-me.o \ + lib-move.o lib-msg.o lib-ni.o lib-pid.o \ + api-eq.o api-errno.o api-init.o api-me.o api-ni.o \ + api-wrap.o diff --git a/lustre/portals/portals/lib-move.c b/lustre/portals/portals/lib-move.c index fde4f16..02f8b60 100644 --- a/lustre/portals/portals/lib-move.c +++ b/lustre/portals/portals/lib-move.c @@ -544,7 +544,7 @@ get_new_msg (nal_cb_t *nal, lib_md_t *md) msg->send_ack = 0; msg->md = md; - msg->ev.arrival_time = get_cycles(); + do_gettimeofday(&msg->ev.arrival_time); md->pending++; if (md->threshold != PTL_MD_THRESH_INF) { LASSERT (md->threshold > 0); diff --git a/lustre/portals/router/.cvsignore b/lustre/portals/router/.cvsignore index e995588..95973d6 100644 --- a/lustre/portals/router/.cvsignore +++ b/lustre/portals/router/.cvsignore @@ -1,3 +1,4 @@ .deps Makefile Makefile.in +.*.o.cmd diff --git a/lustre/portals/router/Makefile.mk b/lustre/portals/router/Makefile.mk index 64bd09b..9b02c03 100644 --- a/lustre/portals/router/Makefile.mk +++ b/lustre/portals/router/Makefile.mk @@ -3,7 +3,7 @@ # This code is issued under the GNU General Public License. # See the file COPYING in this distribution -include ../Kernelenv +include $(src)/../Kernelenv obj-y += kptlrouter.o kptlrouter-objs := router.o proc.o diff --git a/lustre/portals/router/router.c b/lustre/portals/router/router.c index 6074c3c..27a7fba 100644 --- a/lustre/portals/router/router.c +++ b/lustre/portals/router/router.c @@ -23,8 +23,8 @@ #include "router.h" -struct list_head kpr_routes; -struct list_head kpr_nals; +LIST_HEAD(kpr_routes); +LIST_HEAD(kpr_nals); unsigned long long kpr_fwd_bytes; unsigned long kpr_fwd_packets; @@ -35,7 +35,7 @@ atomic_t kpr_queue_depth; * * Once in a blue moon we register/deregister NALs and add/remove routing * entries (thread context only)... */ -rwlock_t kpr_rwlock; +rwlock_t kpr_rwlock = RW_LOCK_UNLOCKED; kpr_router_interface_t kpr_router_interface = { kprri_register: kpr_register_nal, @@ -55,7 +55,7 @@ kpr_control_interface_t kpr_control_interface = { int kpr_register_nal (kpr_nal_interface_t *nalif, void **argp) { - long flags; + unsigned long flags; struct list_head *e; kpr_nal_entry_t *ne; @@ -98,7 +98,7 @@ kpr_register_nal (kpr_nal_interface_t *nalif, void **argp) void kpr_shutdown_nal (void *arg) { - long flags; + unsigned long flags; kpr_nal_entry_t *ne = (kpr_nal_entry_t *)arg; CDEBUG (D_OTHER, "Shutting down NAL %d\n", ne->kpne_interface.kprni_nalid); @@ -123,7 +123,7 @@ kpr_shutdown_nal (void *arg) void kpr_deregister_nal (void *arg) { - long flags; + unsigned long flags; kpr_nal_entry_t *ne = (kpr_nal_entry_t *)arg; CDEBUG (D_OTHER, "Deregister NAL %d\n", ne->kpne_interface.kprni_nalid); @@ -296,7 +296,7 @@ int kpr_add_route (int gateway_nalid, ptl_nid_t gateway_nid, ptl_nid_t lo_nid, ptl_nid_t hi_nid) { - long flags; + unsigned long flags; struct list_head *e; kpr_route_entry_t *re; @@ -345,7 +345,7 @@ kpr_add_route (int gateway_nalid, ptl_nid_t gateway_nid, ptl_nid_t lo_nid, int kpr_del_route (ptl_nid_t nid) { - long flags; + unsigned long flags; struct list_head *e; CDEBUG(D_OTHER, "Del route "LPX64"\n", nid); @@ -398,7 +398,7 @@ kpr_get_route(int idx, int *gateway_nalid, ptl_nid_t *gateway_nid, return (-ENOENT); } -static void __exit +static void /*__exit*/ kpr_finalise (void) { LASSERT (list_empty (&kpr_nals)); @@ -427,10 +427,6 @@ kpr_initialise (void) CDEBUG(D_MALLOC, "kpr_initialise: kmem %d\n", atomic_read(&portal_kmemory)); - rwlock_init(&kpr_rwlock); - INIT_LIST_HEAD(&kpr_routes); - INIT_LIST_HEAD(&kpr_nals); - kpr_proc_init(); PORTAL_SYMBOL_REGISTER(kpr_router_interface); diff --git a/lustre/portals/tests/.cvsignore b/lustre/portals/tests/.cvsignore index 051d1bd..d0c4c88 100644 --- a/lustre/portals/tests/.cvsignore +++ b/lustre/portals/tests/.cvsignore @@ -1,3 +1,4 @@ Makefile Makefile.in .deps +.*.o.cmd diff --git a/lustre/portals/tests/ping_cli.c b/lustre/portals/tests/ping_cli.c index 389ffbb..4d04ffb 100644 --- a/lustre/portals/tests/ping_cli.c +++ b/lustre/portals/tests/ping_cli.c @@ -260,7 +260,7 @@ pingcli_start(struct portal_ioctl_data *args) /* called by the portals_ioctl for ping requests */ -static int kping_client(struct portal_ioctl_data *args) +int kping_client(struct portal_ioctl_data *args) { PORTAL_ALLOC (client, sizeof(struct pingcli_data)); if (client == NULL) @@ -282,7 +282,7 @@ static int __init pingcli_init(void) } /* pingcli_init() */ -static void __exit pingcli_cleanup(void) +static void /*__exit*/ pingcli_cleanup(void) { PORTAL_SYMBOL_UNREGISTER (kping_client); } /* pingcli_cleanup() */ diff --git a/lustre/portals/tests/ping_srv.c b/lustre/portals/tests/ping_srv.c index 1037d09..873e11c 100644 --- a/lustre/portals/tests/ping_srv.c +++ b/lustre/portals/tests/ping_srv.c @@ -47,11 +47,11 @@ #include #define STDSIZE (sizeof(int) + sizeof(int) + sizeof(struct timeval)) -#define MAXSIZE (16*1024*1024) +#define MAXSIZE (16*1024) static unsigned ping_head_magic; static unsigned ping_bulk_magic; -static int nal = 0; // Your NAL, +static int nal = SOCKNAL; // Your NAL, static unsigned long packets_valid = 0; // Valid packets static int running = 1; atomic_t pkt; @@ -282,7 +282,7 @@ static int __init pingsrv_init(void) } /* pingsrv_init() */ -static void __exit pingsrv_cleanup(void) +static void /*__exit*/ pingsrv_cleanup(void) { remove_proc_entry ("net/pingsrv", NULL); diff --git a/lustre/portals/tests/sping_cli.c b/lustre/portals/tests/sping_cli.c index 4cef08b..35e114b 100644 --- a/lustre/portals/tests/sping_cli.c +++ b/lustre/portals/tests/sping_cli.c @@ -235,7 +235,7 @@ pingcli_start(struct portal_ioctl_data *args) /* called by the portals_ioctl for ping requests */ -static int kping_client(struct portal_ioctl_data *args) +int kping_client(struct portal_ioctl_data *args) { PORTAL_ALLOC (client, sizeof(struct pingcli_data)); @@ -258,7 +258,7 @@ static int __init pingcli_init(void) } /* pingcli_init() */ -static void __exit pingcli_cleanup(void) +static void /*__exit*/ pingcli_cleanup(void) { PORTAL_SYMBOL_UNREGISTER (kping_client); } /* pingcli_cleanup() */ diff --git a/lustre/portals/tests/sping_srv.c b/lustre/portals/tests/sping_srv.c index a18ea35..2b45a46 100644 --- a/lustre/portals/tests/sping_srv.c +++ b/lustre/portals/tests/sping_srv.c @@ -269,7 +269,7 @@ static int __init pingsrv_init(void) } /* pingsrv_init() */ -static void __exit pingsrv_cleanup(void) +static void /*__exit*/ pingsrv_cleanup(void) { remove_proc_entry ("net/pingsrv", NULL); diff --git a/lustre/portals/unals/debug.c b/lustre/portals/unals/debug.c index 529bb2d..b73f042 100644 --- a/lustre/portals/unals/debug.c +++ b/lustre/portals/unals/debug.c @@ -84,8 +84,8 @@ int portals_debug_copy_to_user(char *buf, unsigned long len) /* FIXME: I'm not very smart; someone smarter should make this better. */ void -portals_debug_msg (int subsys, int mask, char *file, char *fn, int line, - const char *format, ...) +portals_debug_msg (int subsys, int mask, char *file, const char *fn, + const int line, const char *format, ...) { va_list ap; unsigned long flags; diff --git a/lustre/portals/utils/debug.c b/lustre/portals/utils/debug.c index 9ab1c73d..78271d5 100644 --- a/lustre/portals/utils/debug.c +++ b/lustre/portals/utils/debug.c @@ -551,6 +551,8 @@ int jt_dbg_modules(int argc, char **argv) {"mds_ext3", "lustre/mds"}, {"mds_extN", "lustre/mds"}, {"ptlbd", "lustre/ptlbd"}, + {"mgmt_svc", "lustre/mgmt"}, + {"mgmt_cli", "lustre/mgmt"}, {NULL, NULL} }; char *path = ".."; diff --git a/lustre/portals/utils/portals.c b/lustre/portals/utils/portals.c index 90d66f5..a89f4f7 100644 --- a/lustre/portals/utils/portals.c +++ b/lustre/portals/utils/portals.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -106,6 +107,27 @@ nal2name (int nal) return ((e == NULL) ? "???" : e->name); } +static struct hostent * +ptl_gethostbyname(char * hname) { + struct hostent *he; + he = gethostbyname(hname); + if (!he) { + switch(h_errno) { + case HOST_NOT_FOUND: + case NO_ADDRESS: + fprintf(stderr, "Unable to resolve hostname: %s\n", + hname); + break; + default: + fprintf(stderr, "gethostbyname error: %s\n", + strerror(errno)); + break; + } + return NULL; + } + return he; +} + int ptl_parse_nid (ptl_nid_t *nidp, char *str) { @@ -127,7 +149,7 @@ ptl_parse_nid (ptl_nid_t *nidp, char *str) if ((('a' <= str[0] && str[0] <= 'z') || ('A' <= str[0] && str[0] <= 'Z')) && - (he = gethostbyname (str)) != NULL) + (he = ptl_gethostbyname (str)) != NULL) { __u32 addr = *(__u32 *)he->h_addr; @@ -351,12 +373,9 @@ int jt_ptl_connect(int argc, char **argv) goto usage; } - he = gethostbyname(argv[1]); - if (!he) { - fprintf(stderr, "gethostbyname error: %s\n", - strerror(errno)); + he = ptl_gethostbyname(argv[1]); + if (!he) return -1; - } g_port = atol(argv[2]); @@ -525,12 +544,9 @@ int jt_ptl_disconnect(int argc, char **argv) PORTAL_IOC_INIT(data); if (argc == 2) { - he = gethostbyname(argv[1]); - if (!he) { - fprintf(stderr, "gethostbyname error: %s\n", - strerror(errno)); + he = ptl_gethostbyname(argv[1]); + if (!he) return -1; - } data.ioc_nid = ntohl (*(__u32 *)he->h_addr); /* HOST byte order */ @@ -582,12 +598,9 @@ int jt_ptl_push_connection (int argc, char **argv) PORTAL_IOC_INIT(data); if (argc == 2) { - he = gethostbyname(argv[1]); - if (!he) { - fprintf(stderr, "gethostbyname error: %s\n", - strerror(errno)); + he = ptl_gethostbyname(argv[1]); + if (!he) return -1; - } data.ioc_nid = ntohl (*(__u32 *)he->h_addr); /* HOST byte order */ diff --git a/lustre/portals/utils/routerstat.c b/lustre/portals/utils/routerstat.c index 37da12c..99bc59b 100644 --- a/lustre/portals/utils/routerstat.c +++ b/lustre/portals/utils/routerstat.c @@ -21,12 +21,15 @@ do_stat (int fd) { static char buffer[1024]; static double last = 0.0; + static unsigned long long old_bytes; + static unsigned long old_packets; + static unsigned long old_errors; double now; double t; - long long bytes; - long packets; - long errors; - long depth; + unsigned long long new_bytes, bytes; + unsigned long new_packets, packets; + unsigned long new_errors, errors; + unsigned long depth; int n; lseek (fd, 0, SEEK_SET); @@ -39,7 +42,8 @@ do_stat (int fd) } buffer[n] = 0; - n = sscanf (buffer, "%Ld %ld %ld %ld", &bytes, &packets, &errors, &depth); + n = sscanf (buffer, "%Lu %lu %lu %lu", + &new_bytes, &new_packets, &new_errors, &depth); if (n < 3) { @@ -48,27 +52,44 @@ do_stat (int fd) } if (last == 0.0) - printf ("%Ld bytes, %ld packets (sz %Ld) %ld errors", - bytes, packets, (long long)((packets == 0) ? 0LL : bytes/packets), errors); + printf ("%llu bytes, %lu packets (sz %lld), %lu errors", + new_bytes, new_packets, + (long long)((new_packets == 0) ? 0LL : new_bytes/new_packets), + new_errors); else { t = now - last; - printf ("%9Ld (%7.2fMb/s), %7ld packets (sz %5Ld, %5ld/s) %ld errors (%ld/s)", + if (new_bytes < old_bytes) + bytes = -1ULL - old_bytes + new_bytes + 1; + else + bytes = new_bytes - old_bytes; + if (new_packets < old_packets) + packets = -1UL - old_packets + new_packets + 1; + else + packets = new_packets - old_packets; + if (new_errors < old_errors) + errors = -1UL - old_errors + new_errors + 1; + else + errors = new_errors - old_errors; + + printf ("%9llu bytes (%7.2fMb/s), %7lu packets (sz %5lld, %5ld/s), %lu errors (%ld/s)", bytes, ((double)bytes)/((1<<20) * t), packets, (long long)((packets == 0) ? 0LL : bytes/packets), (long)(packets/t), errors, (long)(errors/t)); } + old_bytes = new_bytes; + old_packets = new_packets; + old_errors = new_errors; if (n == 4) - printf (" (%ld)\n", depth); + printf (", depth (%ld)\n", depth); else printf ("\n"); fflush (stdout); lseek (fd, 0, SEEK_SET); - write (fd, "\n", 1); last = timenow(); } @@ -80,7 +101,7 @@ int main (int argc, char **argv) if (argc > 1) interval = atoi (argv[1]); - fd = open ("/proc/sys/portals/router", O_RDWR); + fd = open ("/proc/sys/portals/router", O_RDONLY); if (fd < 0) { fprintf (stderr, "Can't open stat: %s\n", strerror (errno)); diff --git a/lustre/utils/llobdstat.pl b/lustre/utils/llobdstat.pl index ec95f89..cb39d30 100755 --- a/lustre/utils/llobdstat.pl +++ b/lustre/utils/llobdstat.pl @@ -143,6 +143,7 @@ sub process_stats() } } print "\n"; + $| = 1; } } -- 1.8.3.1