Whamcloud - gitweb
Land b_smallfix onto HEAD (20040414_1359)
authoradilger <adilger>
Wed, 14 Apr 2004 20:39:45 +0000 (20:39 +0000)
committeradilger <adilger>
Wed, 14 Apr 2004 20:39:45 +0000 (20:39 +0000)
b=3116, b=3064, b=3107, b=3122, b=1519, 2.6 kernel fixes, group lock fixes

82 files changed:
ldiskfs/kernel_patches/series/ldiskfs-2.6-suse.series
lnet/include/linux/kp30.h
lnet/klnds/socklnd/socklnd_cb.c
lnet/libcfs/debug.c
lnet/utils/acceptor.c
lnet/utils/gmlndnid.c
lnet/utils/portals.c
lustre/ChangeLog
lustre/cobd/cache_obd.c
lustre/configure.in
lustre/include/liblustre.h
lustre/include/linux/lprocfs_status.h
lustre/include/linux/lustre_idl.h
lustre/include/linux/obd.h
lustre/include/lustre/liblustreapi.h
lustre/include/lustre/lustre_user.h
lustre/kernel_patches/patches/bproc-patch-2.4.20
lustre/kernel_patches/patches/ext3-xattr-header-move-2.6.suse.patch [new file with mode: 0644]
lustre/kernel_patches/patches/revalide-special-oops-2.6.4.suse.patch [new file with mode: 0644]
lustre/kernel_patches/patches/vfs_intent-2.6-suse.patch
lustre/kernel_patches/series/ldiskfs-2.6-suse.series
lustre/ldlm/ldlm_extent.c
lustre/ldlm/ldlm_resource.c
lustre/liblustre/rw.c
lustre/liblustre/super.c
lustre/llite/file.c
lustre/llite/llite_internal.h
lustre/llite/llite_lib.c
lustre/llite/lproc_llite.c
lustre/llite/namei.c
lustre/llite/rw.c
lustre/llite/special.c
lustre/llite/super.c
lustre/llite/super25.c
lustre/lov/lov_obd.c
lustre/lov/lov_pack.c
lustre/lov/lproc_lov.c
lustre/lvfs/fsfilt_ext3.c
lustre/mdc/mdc_request.c
lustre/mds/handler.c
lustre/mds/lproc_mds.c
lustre/mds/mds_fs.c
lustre/mds/mds_reint.c
lustre/obdclass/class_obd.c
lustre/obdclass/llog_test.c
lustre/obdclass/lprocfs_status.c
lustre/obdecho/echo.c
lustre/obdfilter/filter.c
lustre/obdfilter/filter_io_26.c
lustre/obdfilter/filter_lvb.c
lustre/obdfilter/lproc_obdfilter.c
lustre/osc/lproc_osc.c
lustre/osc/osc_request.c
lustre/ost/ost_handler.c
lustre/portals/include/linux/kp30.h
lustre/portals/knals/socknal/socknal_cb.c
lustre/portals/libcfs/debug.c
lustre/portals/utils/acceptor.c
lustre/portals/utils/gmnalnid.c
lustre/portals/utils/portals.c
lustre/ptlbd/client.c
lustre/ptlbd/server.c
lustre/ptlrpc/client.c
lustre/ptlrpc/connection.c
lustre/ptlrpc/events.c
lustre/ptlrpc/pinger.c
lustre/ptlrpc/recover.c
lustre/ptlrpc/service.c
lustre/tests/createdestroy.c
lustre/tests/fsx.c
lustre/tests/multiop.c
lustre/tests/oos.sh
lustre/tests/oos2.sh
lustre/tests/recovery-small-upcall.sh
lustre/tests/recovery-small.sh
lustre/tests/sanityN.sh
lustre/tests/test-framework.sh
lustre/tests/write_append_truncate.c
lustre/tests/write_disjoint.c
lustre/utils/lfs.c
lustre/utils/liblustreapi.c
lustre/utils/llmount.c

index cff99dd..65e8dcd 100644 (file)
@@ -1,3 +1,4 @@
+header-guards-2.6-suse.patch
 ext3-wantedi-2.6-suse.patch
 ext3-san-jdike-2.6-suse.patch
 iopen-2.6-suse.patch 
@@ -7,3 +8,4 @@ ext3-init-generation-2.6-suse.patch
 ext3-ea-in-inode-2.6-suse.patch
 export-ext3-2.6-suse.patch
 ext3-include-fixes-2.6-suse.patch
+ext3-xattr-header-move-2.6.suse.patch
index 3bbda8d..4ca4047 100644 (file)
@@ -318,6 +318,7 @@ extern void kportal_blockallsigs (void);
 # define printk(format, args...) printf (format, ## args)
 # define PORTAL_ALLOC(ptr, size) do { (ptr) = malloc(size); } while (0);
 # define PORTAL_FREE(a, b) do { free(a); } while (0);
+void portals_debug_dumplog(void);
 # define portals_debug_msg(subsys, mask, file, fn, line, stack, format, a...) \
     printf("%02x:%06x (@%lu %s:%s,l. %d %d %lu): " format,                    \
            (subsys), (mask), (long)time(0), file, fn, line,                   \
index 861c07d..21e0abe 100644 (file)
@@ -24,6 +24,9 @@
  */
 
 #include "socknal.h"
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
+# include <linux/syscalls.h>
+#endif
 
 /*
  *  LIB functions follow
index 4e43aa5..a444e9e 100644 (file)
@@ -79,7 +79,7 @@ static char *debug_buf = NULL;
 static unsigned long debug_size = 0;
 static atomic_t debug_off_a = ATOMIC_INIT(0);
 static int debug_wrapped;
-wait_queue_head_t debug_ctlwq;
+static DECLARE_WAIT_QUEUE_HEAD(debug_ctlwq);
 #define DAEMON_SND_SIZE      (64 << 10)
 
 /*
@@ -266,7 +266,7 @@ int portals_do_debug_dumplog(void *arg)
                        PTR_ERR(file));
                 GOTO(out, PTR_ERR(file));
         } else {
-                printk(KERN_ALERT "LustreError: dumping log to %s ... writing ...\n",
+                printk(KERN_ALERT "LustreError: dumping log to %s ...\n",
                        debug_file_name);
         }
 
@@ -439,18 +439,26 @@ void portals_debug_print(void)
 void portals_debug_dumplog(void)
 {
         int rc;
+        DECLARE_WAITQUEUE(wait, current);
         ENTRY;
 
-        init_waitqueue_head(&debug_ctlwq);
+        /* we're being careful to ensure that the kernel thread is
+         * able to set our state to running as it exits before we
+         * get to schedule() */
+        set_current_state(TASK_INTERRUPTIBLE);
+        add_wait_queue(&debug_ctlwq, &wait);
 
         rc = kernel_thread(portals_do_debug_dumplog,
                            NULL, CLONE_VM | CLONE_FS | CLONE_FILES);
-        if (rc < 0) {
+        if (rc < 0)
                 printk(KERN_ERR "LustreError: cannot start log dump thread: "
                        "%d\n", rc);
-                return;
-        }
-        sleep_on(&debug_ctlwq);
+        else
+                schedule();
+
+        /* be sure to teardown if kernel_thread() failed */
+        remove_wait_queue(&debug_ctlwq, &wait);
+        set_current_state(TASK_RUNNING);
 }
 
 int portals_debug_daemon_start(char *file, unsigned int size)
index 29b8d1e..f6367d4 100644 (file)
@@ -11,9 +11,7 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <unistd.h>
-#include <asm/byteorder.h>
 #include <syslog.h>
-
 #include <errno.h>
 
 #include <portals/api-support.h>
index ff6631c..e45fae4 100644 (file)
@@ -29,9 +29,7 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <unistd.h>
-#include <asm/byteorder.h>
 #include <syslog.h>
-
 #include <errno.h>
 
 #include <portals/api-support.h>
index e42fda6..f078099 100644 (file)
@@ -34,7 +34,7 @@
 #include <unistd.h>
 #include <time.h>
 #include <stdarg.h>
-#include <asm/byteorder.h>
+#include <endian.h>
 
 #ifdef __CYGWIN__
 
index 2d5138f..1555716 100644 (file)
@@ -1,8 +1,10 @@
 tbd  Cluster File Systems, Inc. <info@clusterfs.com>
        * version 1.2.x
        * bug fixes
-       - clear page cache after eviction (2766)
+       - clear page cache after eviction (2766)
        - zero nameidata in detach_mnt (3118)
+       - verify d_inode after revalidate_special is valid (3116)
+       - use lustre_put_super() to handle zconf unmounts in 2.6 (3064)
 
 tbd  Cluster File Systems, Inc. <info@clusterfs.com>
        * version 1.2.2
@@ -17,6 +19,9 @@ tbd  Cluster File Systems, Inc. <info@clusterfs.com>
        - initialize lock handle to avoid ASSERT on error cleanup (3057)
        - don't use cancelling-locks' kms values (2947)
        - use highest lock extent for kms, not last one (2925)
+       - don't dereference ERR_PTR() dentry in error handling path (3107)
+       - fix thread race in portals_debug_dumplog() (3122)
+       - create lprocfs device entries at setup instead of at attach (1519)
        * miscellania
        - allow default OST striping configuration per directory (1414)
 
index e725ecf..9bcd1c2 100644 (file)
 #include <linux/obd_class.h>
 #include <linux/obd_cache.h>
 
-static int cobd_attach(struct obd_device *dev, obd_count len, void *data)
-{
-        struct lprocfs_static_vars lvars;
-
-        lprocfs_init_vars(cobd, &lvars);
-        return lprocfs_obd_attach(dev, lvars.obd_vars);
-}
-
-static int cobd_detach(struct obd_device *dev)
-{
-        return lprocfs_obd_detach(dev);
-}
-
-static int
-cobd_setup (struct obd_device *dev, obd_count len, void *buf)
+static int cobd_setup (struct obd_device *obd, obd_count len, void *buf)
 {
         struct lustre_cfg *lcfg = (struct lustre_cfg *)buf;
-        struct cache_obd  *cobd = &dev->u.cobd;
+        struct cache_obd  *cobd = &obd->u.cobd;
         struct obd_device *target;
         struct obd_device *cache;
         struct obd_uuid target_uuid;
         struct obd_uuid cache_uuid;
         struct lustre_handle target_conn = {0,}, cache_conn = {0,};
+        struct lprocfs_static_vars lvars;
         int                rc;
 
-        if (lcfg->lcfg_inlbuf1 == NULL ||
-            lcfg->lcfg_inlbuf2 == NULL)
+        if (lcfg->lcfg_inlbuf1 == NULL || lcfg->lcfg_inlbuf2 == NULL)
                 return (-EINVAL);
 
         obd_str2uuid(&target_uuid, lcfg->lcfg_inlbuf1);
@@ -82,24 +68,29 @@ cobd_setup (struct obd_device *dev, obd_count len, void *buf)
         }
         cobd->cobd_cache_exp = class_conn2export(&cache_conn);
 
-        return rc;
+        lprocfs_init_vars(cobd, &lvars);
+        lprocfs_obd_setup(obd, lvars.obd_vars);
+
+        return 0;
 }
 
-static int cobd_cleanup(struct obd_device *dev, int flags)
+static int cobd_cleanup(struct obd_device *obd, int flags)
 {
-        struct cache_obd  *cobd = &dev->u.cobd;
+        struct cache_obd  *cobd = &obd->u.cobd;
         int                rc;
 
-        if (!list_empty(&dev->obd_exports))
+        if (!list_empty(&obd->obd_exports))
                 return (-EBUSY);
 
+        lprocfs_obd_cleanup(obd);
+
         rc = obd_disconnect(cobd->cobd_cache_exp, flags);
         if (rc != 0)
-                CERROR ("error %d disconnecting cache\n", rc);
+                CERROR("error %d disconnecting cache\n", rc);
 
         rc = obd_disconnect(cobd->cobd_target_exp, flags);
         if (rc != 0)
-                CERROR ("error %d disconnecting target\n", rc);
+                CERROR("error %d disconnecting target\n", rc);
 
         return (0);
 }
@@ -244,8 +235,6 @@ static int cobd_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 
 static struct obd_ops cobd_ops = {
         o_owner:                THIS_MODULE,
-        o_attach:               cobd_attach,
-        o_detach:               cobd_detach,
 
         o_setup:                cobd_setup,
         o_cleanup:              cobd_cleanup,
index 88b11e9..47977cc 100644 (file)
@@ -31,14 +31,6 @@ AC_ARG_ENABLE([tests],
        [],[enable_tests='yes'])
 AC_MSG_RESULT([$enable_tests])
 
-AC_MSG_CHECKING([whether to build Lustre library])
-AC_ARG_ENABLE([liblustre],
-       AC_HELP_STRING([--disable-liblustre],
-                       [disable building of Lustre library]),
-       [],[enable_liblustre='yes'])
-AC_MSG_RESULT([$enable_liblustre])
-AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
-
 # specify wether to build doc or not
 AC_MSG_CHECKING([whether to build docs])
 AC_ARG_ENABLE(doc,
@@ -113,11 +105,43 @@ AC_ARG_WITH([sysio],
                        [set path to libsysio source (default=../libsysio)]),
        [
                SYSIO=$with_sysio
+               SYSIO_PATH=$SYSIO
        ],[
                SYSIO='$(top_srcdir)/../libsysio'
+               SYSIO_PATH='../libsysio'
        ])
-AC_MSG_RESULT([$SYSIO])
-AC_SUBST(SYSIO)
+AC_MSG_RESULT([$SYSIO_PATH])
+
+AC_MSG_CHECKING([libsysio exists and ready for use])
+
+if test -r $SYSIO_PATH/src/libsysio.a; then
+       valid_libsysio=yes
+       AC_MSG_RESULT([yes])
+       AC_SUBST(SYSIO)
+else
+       valid_libsysio=no
+       AC_MSG_RESULT([no])
+fi
+
+AC_MSG_CHECKING([whether to build Lustre library])
+AC_ARG_ENABLE([liblustre],
+       AC_HELP_STRING([--disable-liblustre],
+                       [disable building of Lustre library]),
+       [],[enable_liblustre='yes'])
+
+if test x$valid_libsysio != xyes; then
+       enable_liblustre=no
+       AC_MSG_RESULT([$enable_liblustre])
+       
+       echo "Nevertheless liblustre was enabled for build, \
+no valid libsysio is found and liblustre building will be \
+disabled. Make sure that valid libsysio exists and built \
+at $SYSIO_PATH."
+else
+       AC_MSG_RESULT([$enable_liblustre])
+fi
+
+AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
 
 #build mpi-tests 
 AC_MSG_CHECKING([whether to build mpitests])
index ef010dc..842a5da 100644 (file)
@@ -24,8 +24,8 @@
 #ifndef LIBLUSTRE_H__
 #define LIBLUSTRE_H__
 
-#include <asm/byteorder.h>
 #include <sys/mman.h>
+#include <asm/byteorder.h>
 #ifndef  __CYGWIN__
 #include <stdint.h>
 #include <asm/page.h>
@@ -240,8 +240,18 @@ static inline int request_module(char *name)
 #define __MOD_DEC_USE_COUNT(m)  do {} while (0)
 #define MOD_INC_USE_COUNT       do {} while (0)
 #define MOD_DEC_USE_COUNT       do {} while (0)
-#define try_module_get          __MOD_INC_USE_COUNT
-#define module_put              __MOD_DEC_USE_COUNT
+static inline void __module_get(struct module *module)
+{
+}
+
+static inline int try_module_get(struct module *module)
+{
+        return 1;
+}
+
+static inline void module_put(struct module *module)
+{
+}
 
 /* module initialization */
 extern int init_obdclass(void);
@@ -255,7 +265,6 @@ extern int echo_client_init(void);
 
 
 /* general stuff */
-#define jiffies 0
 
 #define EXPORT_SYMBOL(S)
 
@@ -527,14 +536,15 @@ struct semaphore {
         int count;
 };
 
-#define down(a) do {} while (0)
-#define up(a) do {} while (0)
-#define down_read(a) do {} while (0)
-#define up_read(a) do {} while (0)
-#define down_write(a) do {} while (0)
-#define up_write(a) do {} while (0)
-#define sema_init(a,b) do {} while (0)
-#define init_rwsem(a) do {} while (0)
+/* use the macro's argument to avoid unused warnings */
+#define down(a) do { (void)a; } while (0)
+#define up(a) do { (void)a; } while (0)
+#define down_read(a) do { (void)a; } while (0)
+#define up_read(a) do { (void)a; } while (0)
+#define down_write(a) do { (void)a; } while (0)
+#define up_write(a) do { (void)a; } while (0)
+#define sema_init(a,b) do { (void)a; } while (0)
+#define init_rwsem(a) do { (void)a; } while (0)
 #define DECLARE_MUTEX(name)     \
         struct semaphore name = { 1 }
 static inline void init_MUTEX (struct semaphore *sem)
@@ -622,6 +632,20 @@ static inline int schedule_timeout(signed long t)
 #define SIGNAL_MASK_ASSERT()
 #define KERN_INFO
 
+#include <sys/time.h>
+#if HZ != 1
+#error "liblustre's jiffies currently expects HZ to be 1"
+#endif
+#define jiffies                                 \
+({                                              \
+        unsigned long _ret = 0;                 \
+        struct timeval tv;                      \
+        if (gettimeofday(&tv, NULL) == 0)       \
+                _ret = tv.tv_sec;               \
+        _ret;                                   \
+})
+#define time_after(a, b) ((long)(b) - (long)(a) > 0)
+#define time_before(a, b) time_after(b,a)
 
 struct timer_list {
         struct list_head tl_list;
@@ -654,11 +678,6 @@ static inline void del_timer(struct timer_list *l)
         free(l);
 }
 
-#define time_after(a, b)                                        \
-({                                                              \
-        1;                                                      \
-})
-
 typedef struct { volatile int counter; } atomic_t;
 
 #define atomic_read(a) ((a)->counter)
index 3a7ac42..b79b574 100644 (file)
@@ -182,17 +182,6 @@ extern void lprocfs_free_obd_stats(struct obd_device *obddev);
 extern int lprocfs_register_stats(struct proc_dir_entry *root, const char *name,
                                   struct lprocfs_stats *stats);
 
-#define LPROCFS_INIT_MULTI_VARS(array, size)                              \
-void lprocfs_init_multi_vars(unsigned int idx,                            \
-                             struct lprocfs_static_vars *x)               \
-{                                                                         \
-   struct lprocfs_static_vars *glob = (struct lprocfs_static_vars*)array; \
-   LASSERT(glob != 0);                                                    \
-   LASSERT(idx < (unsigned int)(size));                                   \
-   x->module_vars = glob[idx].module_vars;                                \
-   x->obd_vars = glob[idx].obd_vars;                                      \
-}                                                                         \
-
 #define LPROCFS_INIT_VARS(name, vclass, vinstance)           \
 void lprocfs_##name##_init_vars(struct lprocfs_static_vars *x)  \
 {                                                      \
@@ -205,8 +194,6 @@ do {      \
         extern void lprocfs_##NAME##_init_vars(struct lprocfs_static_vars *);  \
         lprocfs_##NAME##_init_vars(VAR);                                       \
 } while (0)
-extern void lprocfs_init_multi_vars(unsigned int idx,
-                                    struct lprocfs_static_vars *var);
 /* lprocfs_status.c */
 extern int lprocfs_add_vars(struct proc_dir_entry *root,
                             struct lprocfs_vars *var,
@@ -222,8 +209,8 @@ extern void lprocfs_remove(struct proc_dir_entry *root);
 extern struct proc_dir_entry *lprocfs_srch(struct proc_dir_entry *root,
                                            const char *name);
 
-extern int lprocfs_obd_attach(struct obd_device *dev, struct lprocfs_vars *list);
-extern int lprocfs_obd_detach(struct obd_device *dev);
+extern int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list);
+extern int lprocfs_obd_cleanup(struct obd_device *obd);
 
 /* Generic callbacks */
 
@@ -239,6 +226,8 @@ extern int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
                                   int count, int *eof, void *data);
 extern int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
                                 int count, int *eof, void *data);
+extern int lprocfs_rd_num_exports(char *page, char **start, off_t off,
+                                  int count, int *eof, void *data);
 extern int lprocfs_rd_numrefs(char *page, char **start, off_t off,
                               int count, int *eof, void *data);
 
@@ -304,9 +293,6 @@ static inline void lprocfs_free_obd_stats(struct obd_device *obddev)
 static inline struct proc_dir_entry *
 lprocfs_register(const char *name, struct proc_dir_entry *parent,
                  struct lprocfs_vars *list, void *data) { return NULL; }
-#define LPROCFS_INIT_MULTI_VARS(array, size) do {} while (0)
-static inline void lprocfs_init_multi_vars(unsigned int idx,
-                                           struct lprocfs_static_vars *x) { return; }
 #define LPROCFS_INIT_VARS(name, vclass, vinstance) do {} while (0)
 #define lprocfs_init_vars(...) do {} while (0)
 static inline int lprocfs_add_vars(struct proc_dir_entry *root,
@@ -315,9 +301,9 @@ static inline int lprocfs_add_vars(struct proc_dir_entry *root,
 static inline void lprocfs_remove(struct proc_dir_entry *root) {};
 static inline struct proc_dir_entry *lprocfs_srch(struct proc_dir_entry *head,
                                     const char *name) {return 0;}
-static inline int lprocfs_obd_attach(struct obd_device *dev,
-                                     struct lprocfs_vars *list) { return 0; }
-static inline int lprocfs_obd_detach(struct obd_device *dev)  { return 0; }
+static inline int lprocfs_obd_setup(struct obd_device *dev,
+                                    struct lprocfs_vars *list) { return 0; }
+static inline int lprocfs_obd_cleanup(struct obd_device *dev)  { return 0; }
 static inline int lprocfs_rd_u64(char *page, char **start, off_t off,
                                  int count, int *eof, void *data) { return 0; }
 static inline int lprocfs_rd_uuid(char *page, char **start, off_t off,
@@ -325,9 +311,14 @@ static inline int lprocfs_rd_uuid(char *page, char **start, off_t off,
 static inline int lprocfs_rd_name(char *page, char **start, off_t off,
                                   int count, int *eof, void *data) { return 0; }
 static inline int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
-                                         int count, int *eof, void *data) { return 0; }
+                                         int count, int *eof, void *data)
+{ return 0; }
 static inline int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
-                                       int count, int *eof, void *data) { return 0; }
+                                       int count, int *eof, void *data)
+{ return 0; }
+static inline int lprocfs_rd_num_exports(char *page, char **start, off_t off,
+                                         int count, int *eof, void *data)
+{ return 0; }
 static inline int lprocfs_rd_numrefs(char *page, char **start, off_t off,
                                      int count, int *eof, void *data) { return 0; }
 
index 202198c..ef2ad2d 100644 (file)
@@ -54,7 +54,6 @@
 # include <linux/types.h>
 # include <linux/list.h>
 # include <linux/string.h> /* for strncpy, below */
-# include <asm/byteorder.h>
 # include <linux/fs.h> /* to check for FMODE_EXEC, lest we redefine */
 #else
 #ifdef __CYGWIN__
index 354ce2f..b3ccd51 100644 (file)
@@ -18,7 +18,8 @@
 #define IOC_MDC_TYPE         'i'
 #define IOC_MDC_MIN_NR       20
 #define IOC_MDC_LOOKUP       _IOWR(IOC_MDC_TYPE, 20, struct obd_device *)
-#define IOC_MDC_GETSTRIPE    _IOWR(IOC_MDC_TYPE, 21, struct lov_mds_md *)
+/* Moved to lustre_user.h
+#define IOC_MDC_GETSTRIPE    _IOWR(IOC_MDC_TYPE, 21, struct lov_mds_md *) */
 #define IOC_MDC_MAX_NR       50
 
 #ifdef __KERNEL__
@@ -466,9 +467,9 @@ struct obd_device {
         struct obd_uuid obd_uuid;
 
         int obd_minor;
-        int obd_attached:1, obd_set_up:1, obd_recovering:1,
-            obd_abort_recovery:1, obd_replayable:1, obd_no_transno:1,
-            obd_no_recov:1, obd_stopping:1;
+        unsigned int obd_attached:1, obd_set_up:1, obd_recovering:1,
+                obd_abort_recovery:1, obd_replayable:1, obd_no_transno:1,
+                obd_no_recov:1, obd_stopping:1;
         atomic_t obd_refcount;
         wait_queue_head_t obd_refcount_waitq;
         struct proc_dir_entry *obd_proc_entry;
index 9f890a7..5aa2de2 100644 (file)
 #ifndef _LIBLUSTREAPI_H_
 #define _LIBLUSTREAPI_H_
 
-/* liblustreapi.c */
-int op_create_file(char *name, long stripe_size, int stripe_offset,
-         int stripe_count);
-int op_find(char *path, struct obd_uuid *obduuid, int recursive,
-         int verbose, int quiet);
-int op_check(int type_num, char **obd_type_p, char *dir);
-int op_catinfo(char *dir, char *keyword, char *node_name);
-
+#include <lustre/lustre_user.h>
 
+/* liblustreapi.c */
+extern int op_create_file(char *name, long stripe_size, int stripe_offset,
+                          int stripe_count);
+extern int op_find(char *path, struct obd_uuid *obduuid, int recursive,
+                   int verbose, int quiet);
+extern int op_check(int type_num, char **obd_type_p, char *dir);
+extern int op_catinfo(char *dir, char *keyword, char *node_name);
+extern int get_file_stripe(char *path, struct lov_user_md *lum);
+extern int llapi_is_lustre_mnttype(char *type);
 
 #endif
index ad55e05..e98b204 100644 (file)
@@ -35,6 +35,9 @@
 #define LL_IOC_GROUP_LOCK               _IOW ('f', 158, long)
 #define LL_IOC_GROUP_UNLOCK             _IOW ('f', 159, long)
 
+#define IOC_MDC_TYPE            'i'
+#define IOC_MDC_GETSTRIPE       _IOWR(IOC_MDC_TYPE, 21, struct lov_mds_md *)
+
 #define O_LOV_DELAY_CREATE 0100000000  /* hopefully this does not conflict */
 
 #define LL_FILE_IGNORE_LOCK             0x00000001
index e3cf679..0144b9f 100644 (file)
@@ -1,5 +1,3 @@
-$Id: bproc-patch-2.4.20,v 1.9 2004/04/13 01:57:22 eeb Exp $
-
 Index: linux/fs/exec.c
 ===================================================================
 --- linux.orig/fs/exec.c       2003-09-03 17:52:00.000000000 -0400
@@ -764,7 +762,7 @@ Index: linux/kernel/bproc_hook.c
 + *  along with this program; if not, write to the Free Software
 + *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 + *
-+ * $Id: bproc-patch-2.4.20,v 1.9 2004/04/13 01:57:22 eeb Exp $
++ * Id: bproc-patch-2.4.20,v 1.8 2004/04/12 21:44:45 nic Exp $
 + *-----------------------------------------------------------------------*/
 +#include <linux/kernel.h>
 +#include <linux/sched.h>
@@ -832,7 +830,7 @@ Index: linux/include/linux/bproc.h
 + *  along with this program; if not, write to the Free Software
 + *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 + *
-+ * $Id: bproc-patch-2.4.20,v 1.9 2004/04/13 01:57:22 eeb Exp $
++ * Id: bproc-patch-2.4.20,v 1.8 2004/04/12 21:44:45 nic Exp $
 + *-----------------------------------------------------------------------*/
 +#ifndef _LINUX_BPROC_H
 +#define _LINUX_BPROC_H
diff --git a/lustre/kernel_patches/patches/ext3-xattr-header-move-2.6.suse.patch b/lustre/kernel_patches/patches/ext3-xattr-header-move-2.6.suse.patch
new file mode 100644 (file)
index 0000000..7c2d97d
--- /dev/null
@@ -0,0 +1,506 @@
+diff -rupN linux-2.6.4-51.0.orig/fs/ext3/acl.c linux-2.6.4-51.0/fs/ext3/acl.c
+--- linux-2.6.4-51.0.orig/fs/ext3/acl.c        2004-04-05 19:41:59.000000000 +0300
++++ linux-2.6.4-51.0/fs/ext3/acl.c     2004-04-07 11:06:33.000000000 +0300
+@@ -10,7 +10,7 @@
+ #include <linux/fs.h>
+ #include <linux/ext3_jbd.h>
+ #include <linux/ext3_fs.h>
+-#include "xattr.h"
++#include <linux/ext3_xattr.h>
+ #include "acl.h"
+ /*
+diff -rupN linux-2.6.4-51.0.orig/fs/ext3/file.c linux-2.6.4-51.0/fs/ext3/file.c
+--- linux-2.6.4-51.0.orig/fs/ext3/file.c       2004-04-05 19:41:59.000000000 +0300
++++ linux-2.6.4-51.0/fs/ext3/file.c    2004-04-07 11:06:39.000000000 +0300
+@@ -23,7 +23,7 @@
+ #include <linux/jbd.h>
+ #include <linux/ext3_fs.h>
+ #include <linux/ext3_jbd.h>
+-#include "xattr.h"
++#include <linux/ext3_xattr.h>
+ #include "acl.h"
+ /*
+diff -rupN linux-2.6.4-51.0.orig/fs/ext3/ialloc.c linux-2.6.4-51.0/fs/ext3/ialloc.c
+--- linux-2.6.4-51.0.orig/fs/ext3/ialloc.c     2004-04-06 22:17:15.000000000 +0300
++++ linux-2.6.4-51.0/fs/ext3/ialloc.c  2004-04-07 11:06:46.000000000 +0300
+@@ -26,7 +26,7 @@
+ #include <asm/bitops.h>
+ #include <asm/byteorder.h>
+-#include "xattr.h"
++#include <linux/ext3_xattr.h>
+ #include "acl.h"
+ /*
+diff -rupN linux-2.6.4-51.0.orig/fs/ext3/inode.c linux-2.6.4-51.0/fs/ext3/inode.c
+--- linux-2.6.4-51.0.orig/fs/ext3/inode.c      2004-04-06 22:17:15.000000000 +0300
++++ linux-2.6.4-51.0/fs/ext3/inode.c   2004-04-07 11:25:05.000000000 +0300
+@@ -36,7 +36,7 @@
+ #include <linux/writeback.h>
+ #include <linux/mpage.h>
+ #include <linux/uio.h>
+-#include "xattr.h"
++#include <linux/ext3_xattr.h>
+ #include "iopen.h"
+ #include "acl.h"
+@@ -2340,7 +2340,7 @@ static unsigned long ext3_get_inode_bloc
+  * performed.
+  */
+ int ext3_get_inode_loc(struct inode *inode,
+-                              struct ext3_iloc *iloc, int in_mem)
++                     struct ext3_iloc *iloc, int in_mem)
+ {
+       unsigned long block;
+       struct buffer_head *bh;
+diff -rupN linux-2.6.4-51.0.orig/fs/ext3/namei.c linux-2.6.4-51.0/fs/ext3/namei.c
+--- linux-2.6.4-51.0.orig/fs/ext3/namei.c      2004-04-06 22:17:15.000000000 +0300
++++ linux-2.6.4-51.0/fs/ext3/namei.c   2004-04-07 11:06:57.000000000 +0300
+@@ -36,7 +36,7 @@
+ #include <linux/quotaops.h>
+ #include <linux/buffer_head.h>
+ #include <linux/smp_lock.h>
+-#include "xattr.h"
++#include <linux/ext3_xattr.h>
+ #include "iopen.h"
+ #include "acl.h"
+diff -rupN linux-2.6.4-51.0.orig/fs/ext3/super.c linux-2.6.4-51.0/fs/ext3/super.c
+--- linux-2.6.4-51.0.orig/fs/ext3/super.c      2004-04-06 22:17:15.000000000 +0300
++++ linux-2.6.4-51.0/fs/ext3/super.c   2004-04-07 11:07:05.000000000 +0300
+@@ -33,7 +33,7 @@
+ #include <linux/vfs.h>
+ #include <linux/random.h>
+ #include <asm/uaccess.h>
+-#include "xattr.h"
++#include <linux/ext3_xattr.h>
+ #include "acl.h"
+ static int ext3_load_journal(struct super_block *, struct ext3_super_block *);
+diff -rupN linux-2.6.4-51.0.orig/fs/ext3/symlink.c linux-2.6.4-51.0/fs/ext3/symlink.c
+--- linux-2.6.4-51.0.orig/fs/ext3/symlink.c    2004-04-05 19:41:59.000000000 +0300
++++ linux-2.6.4-51.0/fs/ext3/symlink.c 2004-04-07 11:07:16.000000000 +0300
+@@ -20,7 +20,7 @@
+ #include <linux/fs.h>
+ #include <linux/jbd.h>
+ #include <linux/ext3_fs.h>
+-#include "xattr.h"
++#include <linux/ext3_xattr.h>
+ static int
+ ext3_readlink(struct dentry *dentry, char __user *buffer, int buflen)
+diff -rupN linux-2.6.4-51.0.orig/fs/ext3/xattr.c linux-2.6.4-51.0/fs/ext3/xattr.c
+--- linux-2.6.4-51.0.orig/fs/ext3/xattr.c      2004-04-06 22:17:15.000000000 +0300
++++ linux-2.6.4-51.0/fs/ext3/xattr.c   2004-04-07 11:22:34.000000000 +0300
+@@ -59,7 +59,7 @@
+ #include <linux/mbcache.h>
+ #include <linux/quotaops.h>
+ #include <linux/rwsem.h>
+-#include "xattr.h"
++#include <linux/ext3_xattr.h>
+ #include "acl.h"
+ #define HDR(bh) ((struct ext3_xattr_header *)((bh)->b_data))
+@@ -348,7 +348,7 @@ cleanup:
+  */
+ int
+ ext3_xattr_ibody_get(struct inode *inode, int name_index, const char *name,
+-             void *buffer, size_t buffer_size)
++                   void *buffer, size_t buffer_size)
+ {
+       int size, name_len = strlen(name), storage_size;
+       struct ext3_xattr_entry *last;
+@@ -360,7 +360,7 @@ ext3_xattr_ibody_get(struct inode *inode
+       if (EXT3_SB(inode->i_sb)->s_inode_size <= EXT3_GOOD_OLD_INODE_SIZE)
+               return -ENOENT;
+-      ret = ext3_get_inode_loc(inode, &iloc);
++      ret = ext3_get_inode_loc(inode, &iloc, 1);
+       if (ret)
+               return ret;
+       raw_inode = ext3_raw_inode(&iloc);
+@@ -542,7 +542,7 @@ ext3_xattr_ibody_list(struct inode *inod
+       if (EXT3_SB(inode->i_sb)->s_inode_size <= EXT3_GOOD_OLD_INODE_SIZE)
+               return 0;
+-      ret = ext3_get_inode_loc(inode, &iloc);
++      ret = ext3_get_inode_loc(inode, &iloc, 1);
+       if (ret)
+               return ret;
+       raw_inode = ext3_raw_inode(&iloc);
+@@ -693,7 +693,7 @@ ext3_xattr_ibody_find(struct inode *inod
+       if (EXT3_SB(inode->i_sb)->s_inode_size <= EXT3_GOOD_OLD_INODE_SIZE)
+               return ret;
+-      err = ext3_get_inode_loc(inode, &iloc);
++      err = ext3_get_inode_loc(inode, &iloc, 1);
+       if (err)
+               return -EIO;
+       raw_inode = ext3_raw_inode(&iloc);
+@@ -824,7 +824,7 @@ ext3_xattr_ibody_set(handle_t *handle, s
+       if (EXT3_SB(inode->i_sb)->s_inode_size <= EXT3_GOOD_OLD_INODE_SIZE)
+               return -ENOSPC;
+-      err = ext3_get_inode_loc(inode, &iloc);
++      err = ext3_get_inode_loc(inode, &iloc, 1);
+       if (err)
+               return err;
+       raw_inode = ext3_raw_inode(&iloc);
+diff -rupN linux-2.6.4-51.0.orig/fs/ext3/xattr.h linux-2.6.4-51.0/fs/ext3/xattr.h
+--- linux-2.6.4-51.0.orig/fs/ext3/xattr.h      2004-04-06 22:17:15.000000000 +0300
++++ linux-2.6.4-51.0/fs/ext3/xattr.h   1970-01-01 03:00:00.000000000 +0300
+@@ -1,147 +0,0 @@
+-/*
+-  File: fs/ext3/xattr.h
+-
+-  On-disk format of extended attributes for the ext3 filesystem.
+-
+-  (C) 2001 Andreas Gruenbacher, <a.gruenbacher@computer.org>
+-*/
+-
+-#include <linux/config.h>
+-#include <linux/xattr.h>
+-
+-/* Magic value in attribute blocks */
+-#define EXT3_XATTR_MAGIC              0xEA020000
+-
+-/* Maximum number of references to one attribute block */
+-#define EXT3_XATTR_REFCOUNT_MAX               1024
+-
+-/* Name indexes */
+-#define EXT3_XATTR_INDEX_MAX                  10
+-#define EXT3_XATTR_INDEX_USER                 1
+-#define EXT3_XATTR_INDEX_POSIX_ACL_ACCESS     2
+-#define EXT3_XATTR_INDEX_POSIX_ACL_DEFAULT    3
+-#define EXT3_XATTR_INDEX_TRUSTED              4
+-#define       EXT3_XATTR_INDEX_LUSTRE                 5
+-#define EXT3_XATTR_INDEX_SECURITY             6
+-
+-struct ext3_xattr_header {
+-      __u32   h_magic;        /* magic number for identification */
+-      __u32   h_refcount;     /* reference count */
+-      __u32   h_blocks;       /* number of disk blocks used */
+-      __u32   h_hash;         /* hash value of all attributes */
+-      __u32   h_reserved[4];  /* zero right now */
+-};
+-
+-struct ext3_xattr_entry {
+-      __u8    e_name_len;     /* length of name */
+-      __u8    e_name_index;   /* attribute name index */
+-      __u16   e_value_offs;   /* offset in disk block of value */
+-      __u32   e_value_block;  /* disk block attribute is stored on (n/i) */
+-      __u32   e_value_size;   /* size of attribute value */
+-      __u32   e_hash;         /* hash value of name and value */
+-      char    e_name[0];      /* attribute name */
+-};
+-
+-#define EXT3_XATTR_PAD_BITS           2
+-#define EXT3_XATTR_PAD                (1<<EXT3_XATTR_PAD_BITS)
+-#define EXT3_XATTR_ROUND              (EXT3_XATTR_PAD-1)
+-#define EXT3_XATTR_LEN(name_len) \
+-      (((name_len) + EXT3_XATTR_ROUND + \
+-      sizeof(struct ext3_xattr_entry)) & ~EXT3_XATTR_ROUND)
+-#define EXT3_XATTR_NEXT(entry) \
+-      ( (struct ext3_xattr_entry *)( \
+-        (char *)(entry) + EXT3_XATTR_LEN((entry)->e_name_len)) )
+-#define EXT3_XATTR_SIZE(size) \
+-      (((size) + EXT3_XATTR_ROUND) & ~EXT3_XATTR_ROUND)
+-
+-# ifdef CONFIG_EXT3_FS_XATTR
+-
+-struct ext3_xattr_handler {
+-      char *prefix;
+-      size_t (*list)(char *list, struct inode *inode, const char *name,
+-                     int name_len);
+-      int (*get)(struct inode *inode, const char *name, void *buffer,
+-                 size_t size);
+-      int (*set)(struct inode *inode, const char *name, const void *buffer,
+-                 size_t size, int flags);
+-};
+-
+-extern int ext3_xattr_register(int, struct ext3_xattr_handler *);
+-extern void ext3_xattr_unregister(int, struct ext3_xattr_handler *);
+-
+-extern int ext3_setxattr(struct dentry *, const char *, const void *, size_t, int);
+-extern ssize_t ext3_getxattr(struct dentry *, const char *, void *, size_t);
+-extern ssize_t ext3_listxattr(struct dentry *, char *, size_t);
+-extern int ext3_removexattr(struct dentry *, const char *);
+-
+-extern int ext3_xattr_get(struct inode *, int, const char *, void *, size_t);
+-extern int ext3_xattr_list(struct inode *, char *, size_t);
+-extern int ext3_xattr_set(struct inode *, int, const char *, const void *, size_t, int);
+-extern int ext3_xattr_set_handle(handle_t *, struct inode *, int, const char *,const void *,size_t,int);
+-extern int ext3_xattr_block_set(handle_t *, struct inode *, int, const char *,const void *,size_t,int);
+-
+-extern void ext3_xattr_delete_inode(handle_t *, struct inode *);
+-extern void ext3_xattr_put_super(struct super_block *);
+-
+-extern int init_ext3_xattr(void);
+-extern void exit_ext3_xattr(void);
+-
+-# else  /* CONFIG_EXT3_FS_XATTR */
+-#  define ext3_setxattr               NULL
+-#  define ext3_getxattr               NULL
+-#  define ext3_listxattr      NULL
+-#  define ext3_removexattr    NULL
+-
+-static inline int
+-ext3_xattr_get(struct inode *inode, int name_index, const char *name,
+-             void *buffer, size_t size, int flags)
+-{
+-      return -EOPNOTSUPP;
+-}
+-
+-static inline int
+-ext3_xattr_list(struct inode *inode, void *buffer, size_t size)
+-{
+-      return -EOPNOTSUPP;
+-}
+-
+-static inline int
+-ext3_xattr_set(struct inode *inode, int name_index, const char *name,
+-             const void *value, size_t size, int flags)
+-{
+-      return -EOPNOTSUPP;
+-}
+-
+-static inline int
+-ext3_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
+-             const char *name, const void *value, size_t size, int flags)
+-{
+-      return -EOPNOTSUPP;
+-}
+-
+-static inline void
+-ext3_xattr_delete_inode(handle_t *handle, struct inode *inode)
+-{
+-}
+-
+-static inline void
+-ext3_xattr_put_super(struct super_block *sb)
+-{
+-}
+-
+-static inline int
+-init_ext3_xattr(void)
+-{
+-      return 0;
+-}
+-
+-static inline void
+-exit_ext3_xattr(void)
+-{
+-}
+-
+-# endif  /* CONFIG_EXT3_FS_XATTR */
+-
+-extern struct ext3_xattr_handler ext3_xattr_user_handler;
+-extern struct ext3_xattr_handler ext3_xattr_trusted_handler;
+-extern struct ext3_xattr_handler ext3_xattr_security_handler;
+diff -rupN linux-2.6.4-51.0.orig/fs/ext3/xattr_security.c linux-2.6.4-51.0/fs/ext3/xattr_security.c
+--- linux-2.6.4-51.0.orig/fs/ext3/xattr_security.c     2004-04-05 19:41:59.000000000 +0300
++++ linux-2.6.4-51.0/fs/ext3/xattr_security.c  2004-04-07 11:06:22.000000000 +0300
+@@ -9,7 +9,7 @@
+ #include <linux/smp_lock.h>
+ #include <linux/ext3_jbd.h>
+ #include <linux/ext3_fs.h>
+-#include "xattr.h"
++#include <linux/ext3_xattr.h>
+ static size_t
+ ext3_xattr_security_list(char *list, struct inode *inode,
+diff -rupN linux-2.6.4-51.0.orig/fs/ext3/xattr_trusted.c linux-2.6.4-51.0/fs/ext3/xattr_trusted.c
+--- linux-2.6.4-51.0.orig/fs/ext3/xattr_trusted.c      2004-04-05 19:41:59.000000000 +0300
++++ linux-2.6.4-51.0/fs/ext3/xattr_trusted.c   2004-04-07 11:07:41.000000000 +0300
+@@ -11,7 +11,7 @@
+ #include <linux/smp_lock.h>
+ #include <linux/ext3_jbd.h>
+ #include <linux/ext3_fs.h>
+-#include "xattr.h"
++#include <linux/ext3_xattr.h>
+ #define XATTR_TRUSTED_PREFIX "trusted."
+diff -rupN linux-2.6.4-51.0.orig/fs/ext3/xattr_user.c linux-2.6.4-51.0/fs/ext3/xattr_user.c
+--- linux-2.6.4-51.0.orig/fs/ext3/xattr_user.c 2004-04-05 19:41:59.000000000 +0300
++++ linux-2.6.4-51.0/fs/ext3/xattr_user.c      2004-04-07 11:07:47.000000000 +0300
+@@ -11,7 +11,7 @@
+ #include <linux/smp_lock.h>
+ #include <linux/ext3_jbd.h>
+ #include <linux/ext3_fs.h>
+-#include "xattr.h"
++#include <linux/ext3_xattr.h>
+ #define XATTR_USER_PREFIX "user."
+diff -rupN linux-2.6.4-51.0.orig/include/linux/ext3_fs.h linux-2.6.4-51.0/include/linux/ext3_fs.h
+--- linux-2.6.4-51.0.orig/include/linux/ext3_fs.h      2004-04-06 22:17:15.000000000 +0300
++++ linux-2.6.4-51.0/include/linux/ext3_fs.h   2004-04-07 11:13:26.000000000 +0300
+@@ -741,6 +741,9 @@ extern void ext3_truncate (struct inode 
+ extern void ext3_set_inode_flags(struct inode *);
+ extern void ext3_set_aops(struct inode *inode);
++extern int ext3_get_inode_loc(struct inode *inode,
++                            struct ext3_iloc *iloc, int in_mem);
++
+ /* ioctl.c */
+ extern int ext3_ioctl (struct inode *, struct file *, unsigned int,
+                      unsigned long);
+diff -rupN linux-2.6.4-51.0.orig/include/linux/ext3_xattr.h linux-2.6.4-51.0/include/linux/ext3_xattr.h
+--- linux-2.6.4-51.0.orig/include/linux/ext3_xattr.h   1970-01-01 03:00:00.000000000 +0300
++++ linux-2.6.4-51.0/include/linux/ext3_xattr.h        2004-04-07 11:08:34.000000000 +0300
+@@ -0,0 +1,152 @@
++/*
++  File: linux/include/linux/ext3_xattr.h
++
++  On-disk format of extended attributes for the ext3 filesystem.
++
++  (C) 2001 Andreas Gruenbacher, <a.gruenbacher@computer.org>
++*/
++
++#ifndef _LINUX_EXT3_XATTR_H
++#define _LINUX_EXT3_XATTR_H
++
++#include <linux/config.h>
++#include <linux/xattr.h>
++
++/* Magic value in attribute blocks */
++#define EXT3_XATTR_MAGIC              0xEA020000
++
++/* Maximum number of references to one attribute block */
++#define EXT3_XATTR_REFCOUNT_MAX               1024
++
++/* Name indexes */
++#define EXT3_XATTR_INDEX_MAX                  10
++#define EXT3_XATTR_INDEX_USER                 1
++#define EXT3_XATTR_INDEX_POSIX_ACL_ACCESS     2
++#define EXT3_XATTR_INDEX_POSIX_ACL_DEFAULT    3
++#define EXT3_XATTR_INDEX_TRUSTED              4
++#define       EXT3_XATTR_INDEX_LUSTRE                 5
++#define EXT3_XATTR_INDEX_SECURITY             6
++
++struct ext3_xattr_header {
++      __u32   h_magic;        /* magic number for identification */
++      __u32   h_refcount;     /* reference count */
++      __u32   h_blocks;       /* number of disk blocks used */
++      __u32   h_hash;         /* hash value of all attributes */
++      __u32   h_reserved[4];  /* zero right now */
++};
++
++struct ext3_xattr_entry {
++      __u8    e_name_len;     /* length of name */
++      __u8    e_name_index;   /* attribute name index */
++      __u16   e_value_offs;   /* offset in disk block of value */
++      __u32   e_value_block;  /* disk block attribute is stored on (n/i) */
++      __u32   e_value_size;   /* size of attribute value */
++      __u32   e_hash;         /* hash value of name and value */
++      char    e_name[0];      /* attribute name */
++};
++
++#define EXT3_XATTR_PAD_BITS           2
++#define EXT3_XATTR_PAD                (1<<EXT3_XATTR_PAD_BITS)
++#define EXT3_XATTR_ROUND              (EXT3_XATTR_PAD-1)
++#define EXT3_XATTR_LEN(name_len) \
++      (((name_len) + EXT3_XATTR_ROUND + \
++      sizeof(struct ext3_xattr_entry)) & ~EXT3_XATTR_ROUND)
++#define EXT3_XATTR_NEXT(entry) \
++      ( (struct ext3_xattr_entry *)( \
++        (char *)(entry) + EXT3_XATTR_LEN((entry)->e_name_len)) )
++#define EXT3_XATTR_SIZE(size) \
++      (((size) + EXT3_XATTR_ROUND) & ~EXT3_XATTR_ROUND)
++
++# ifdef CONFIG_EXT3_FS_XATTR
++
++struct ext3_xattr_handler {
++      char *prefix;
++      size_t (*list)(char *list, struct inode *inode, const char *name,
++                     int name_len);
++      int (*get)(struct inode *inode, const char *name, void *buffer,
++                 size_t size);
++      int (*set)(struct inode *inode, const char *name, const void *buffer,
++                 size_t size, int flags);
++};
++
++extern int ext3_xattr_register(int, struct ext3_xattr_handler *);
++extern void ext3_xattr_unregister(int, struct ext3_xattr_handler *);
++
++extern int ext3_setxattr(struct dentry *, const char *, const void *, size_t, int);
++extern ssize_t ext3_getxattr(struct dentry *, const char *, void *, size_t);
++extern ssize_t ext3_listxattr(struct dentry *, char *, size_t);
++extern int ext3_removexattr(struct dentry *, const char *);
++
++extern int ext3_xattr_get(struct inode *, int, const char *, void *, size_t);
++extern int ext3_xattr_list(struct inode *, char *, size_t);
++extern int ext3_xattr_set(struct inode *, int, const char *, const void *, size_t, int);
++extern int ext3_xattr_set_handle(handle_t *, struct inode *, int, const char *,const void *,size_t,int);
++extern int ext3_xattr_block_set(handle_t *, struct inode *, int, const char *,const void *,size_t,int);
++
++extern void ext3_xattr_delete_inode(handle_t *, struct inode *);
++extern void ext3_xattr_put_super(struct super_block *);
++
++extern int init_ext3_xattr(void);
++extern void exit_ext3_xattr(void);
++
++# else  /* CONFIG_EXT3_FS_XATTR */
++#  define ext3_setxattr               NULL
++#  define ext3_getxattr               NULL
++#  define ext3_listxattr      NULL
++#  define ext3_removexattr    NULL
++
++static inline int
++ext3_xattr_get(struct inode *inode, int name_index, const char *name,
++             void *buffer, size_t size, int flags)
++{
++      return -EOPNOTSUPP;
++}
++
++static inline int
++ext3_xattr_list(struct inode *inode, void *buffer, size_t size)
++{
++      return -EOPNOTSUPP;
++}
++
++static inline int
++ext3_xattr_set(struct inode *inode, int name_index, const char *name,
++             const void *value, size_t size, int flags)
++{
++      return -EOPNOTSUPP;
++}
++
++static inline int
++ext3_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
++             const char *name, const void *value, size_t size, int flags)
++{
++      return -EOPNOTSUPP;
++}
++
++static inline void
++ext3_xattr_delete_inode(handle_t *handle, struct inode *inode)
++{
++}
++
++static inline void
++ext3_xattr_put_super(struct super_block *sb)
++{
++}
++
++static inline int
++init_ext3_xattr(void)
++{
++      return 0;
++}
++
++static inline void
++exit_ext3_xattr(void)
++{
++}
++
++# endif  /* CONFIG_EXT3_FS_XATTR */
++
++extern struct ext3_xattr_handler ext3_xattr_user_handler;
++extern struct ext3_xattr_handler ext3_xattr_trusted_handler;
++extern struct ext3_xattr_handler ext3_xattr_security_handler;
++
++#endif
diff --git a/lustre/kernel_patches/patches/revalide-special-oops-2.6.4.suse.patch b/lustre/kernel_patches/patches/revalide-special-oops-2.6.4.suse.patch
new file mode 100644 (file)
index 0000000..3c5ad67
--- /dev/null
@@ -0,0 +1,22 @@
+--- linux-2.6.4-51.0.orig/fs/namei.c   2004-04-06 22:16:14.000000000 +0300
++++ linux-2.6.4-51.0/fs/namei.c        2004-04-09 16:07:42.856930416 +0300
+@@ -749,10 +749,18 @@ last_component:
+                               nd->flags |= LOOKUP_LAST;
+                               err = revalidate_special(nd);
+                               nd->flags &= ~LOOKUP_LAST;
+-                              if (err)
++                              if (err)
+                                       break;
+                               goto return_reval;
+               }
++              
++              if (err) {
++                      if (!nd->dentry->d_inode)
++                              err = -ENOENT;
++                      
++                      goto return_err;                        
++              }
++              
+               if (nd->dentry->d_op && nd->dentry->d_op->d_hash) {
+                       err = nd->dentry->d_op->d_hash(nd->dentry, &this);
+                       if (err < 0)
index 43607fa..f40f808 100644 (file)
@@ -134,19 +134,27 @@ Index: linux-2.6.4-51.0/fs/namei.c
                        dput(next.dentry);
                        mntput(next.mnt);
                        if (err)
-@@ -702,6 +746,11 @@
+@@ -702,14 +746,29 @@
                                inode = nd->dentry->d_inode;
                                /* fallthrough */
                        case 1:
 +                              nd->flags |= LOOKUP_LAST;
 +                              err = revalidate_special(nd);
 +                              nd->flags &= ~LOOKUP_LAST;
-+                              if (err)
++                              if (err)
 +                                      break;
                                goto return_reval;
                }
++              
++              if (err) {
++                      if (!nd->dentry->d_inode)
++                              err = -ENOENT;
++                      
++                      goto return_err;                        
++              }
++              
                if (nd->dentry->d_op && nd->dentry->d_op->d_hash) {
-@@ -709,7 +758,9 @@
+                       err = nd->dentry->d_op->d_hash(nd->dentry, &this);
                        if (err < 0)
                                break;
                }
@@ -156,7 +164,7 @@ Index: linux-2.6.4-51.0/fs/namei.c
                if (err)
                        break;
                follow_mount(&next.mnt, &next.dentry);
-@@ -935,7 +986,7 @@
+@@ -935,7 +994,7 @@
  }
  
  /* SMP-safe */
@@ -165,7 +173,7 @@ Index: linux-2.6.4-51.0/fs/namei.c
  {
        unsigned long hash;
        struct qstr this;
-@@ -955,11 +1006,16 @@
+@@ -955,11 +1014,16 @@
        }
        this.hash = end_name_hash(hash);
  
@@ -183,7 +191,7 @@ Index: linux-2.6.4-51.0/fs/namei.c
  /*
   *    namei()
   *
-@@ -971,7 +1027,7 @@
+@@ -971,7 +1035,7 @@
   * that namei follows links, while lnamei does not.
   * SMP-safe
   */
@@ -192,7 +200,7 @@ Index: linux-2.6.4-51.0/fs/namei.c
  {
        char *tmp = getname(name);
        int err = PTR_ERR(tmp);
-@@ -983,6 +1039,12 @@
+@@ -983,6 +1047,12 @@
        return err;
  }
  
@@ -205,7 +213,7 @@ Index: linux-2.6.4-51.0/fs/namei.c
  /*
   * It's inline, so penalty for filesystems that don't use sticky bit is
   * minimal.
-@@ -1255,8 +1317,8 @@
+@@ -1255,8 +1325,8 @@
                acc_mode |= MAY_APPEND;
  
        /* Fill in the open() intent data */
@@ -216,7 +224,7 @@ Index: linux-2.6.4-51.0/fs/namei.c
  
        /*
         * The simplest case - just a plain lookup.
-@@ -1271,6 +1333,7 @@
+@@ -1271,6 +1341,7 @@
        /*
         * Create - we need to know the parent.
         */
@@ -224,7 +232,7 @@ Index: linux-2.6.4-51.0/fs/namei.c
        error = path_lookup(pathname, LOOKUP_PARENT|LOOKUP_OPEN|LOOKUP_CREATE, nd);
        if (error)
                return error;
-@@ -1287,7 +1350,9 @@
+@@ -1287,7 +1358,9 @@
        dir = nd->dentry;
        nd->flags &= ~LOOKUP_PARENT;
        down(&dir->d_inode->i_sem);
@@ -234,7 +242,7 @@ Index: linux-2.6.4-51.0/fs/namei.c
  
  do_last:
        error = PTR_ERR(dentry);
-@@ -1392,7 +1457,9 @@
+@@ -1392,7 +1465,9 @@
        }
        dir = nd->dentry;
        down(&dir->d_inode->i_sem);
@@ -244,7 +252,7 @@ Index: linux-2.6.4-51.0/fs/namei.c
        putname(nd->last.name);
        goto do_last;
  }
-@@ -2154,7 +2221,9 @@
+@@ -2154,7 +2229,9 @@
  __vfs_follow_link(struct nameidata *nd, const char *link)
  {
        int res = 0;
@@ -254,7 +262,7 @@ Index: linux-2.6.4-51.0/fs/namei.c
        if (IS_ERR(link))
                goto fail;
  
-@@ -2164,6 +2233,10 @@
+@@ -2164,6 +2241,10 @@
                        /* weird __emul_prefix() stuff did it */
                        goto out;
        }
index cff99dd..65e8dcd 100644 (file)
@@ -1,3 +1,4 @@
+header-guards-2.6-suse.patch
 ext3-wantedi-2.6-suse.patch
 ext3-san-jdike-2.6-suse.patch
 iopen-2.6-suse.patch 
@@ -7,3 +8,4 @@ ext3-init-generation-2.6-suse.patch
 ext3-ea-in-inode-2.6-suse.patch
 export-ext3-2.6-suse.patch
 ext3-include-fixes-2.6-suse.patch
+ext3-xattr-header-move-2.6.suse.patch
index 48c7b6a..ea93e13 100644 (file)
@@ -164,6 +164,7 @@ ldlm_extent_compat_queue(struct list_head *queue, struct ldlm_lock *req,
         __u64 req_start = req->l_req_extent.start;
         __u64 req_end = req->l_req_extent.end;
         int compat = 1;
+        int scan = 0;
         ENTRY;
 
         lockmode_verify(req_mode);
@@ -174,6 +175,32 @@ ldlm_extent_compat_queue(struct list_head *queue, struct ldlm_lock *req,
                 if (req == lock)
                         RETURN(compat);
 
+                if (scan) {
+                        /* We only get here if we are queuing GROUP lock
+                           and met some incompatible one. The main idea of this
+                           code is to insert GROUP lock past compatible GROUP
+                           lock in the waiting queue or if there is not any,
+                           then in front of first non-GROUP lock */
+                        if (lock->l_req_mode != LCK_GROUP) {
+                        /* Ok, we hit non-GROUP lock, there should be no
+                           more GROUP locks later on, queue in front of
+                           first non-GROUP lock */
+
+                                ldlm_resource_insert_lock_after(lock, req);
+                                list_del_init(&lock->l_res_link);
+                                ldlm_resource_insert_lock_after(req, lock);
+                                RETURN(0);
+                        }
+                        if (req->l_policy_data.l_extent.gid ==
+                             lock->l_policy_data.l_extent.gid) {
+                                /* found it */
+                                ldlm_resource_insert_lock_after(lock,
+                                                                req);
+                                RETURN(0);
+                        }
+                        continue;
+                }
+
                 /* locks are compatible, overlap doesn't matter */
                 if (lockmode_compat(lock->l_req_mode, req_mode)) {
                         /* non-group locks are compatible, overlap doesn't
@@ -209,6 +236,29 @@ ldlm_extent_compat_queue(struct list_head *queue, struct ldlm_lock *req,
                         }
                 }
 
+                if (req_mode == LCK_GROUP &&
+                    (lock->l_req_mode != lock->l_granted_mode)) {
+                        scan = 1;
+                        compat = 0;
+                        if (lock->l_req_mode != LCK_GROUP) {
+                        /* Ok, we hit non-GROUP lock, there should be no
+                           more GROUP locks later on, queue in front of
+                           first non-GROUP lock */
+
+                                ldlm_resource_insert_lock_after(lock, req);
+                                list_del_init(&lock->l_res_link);
+                                ldlm_resource_insert_lock_after(req, lock);
+                                RETURN(0);
+                        }
+                        if (req->l_policy_data.l_extent.gid ==
+                             lock->l_policy_data.l_extent.gid) {
+                                /* found it */
+                                ldlm_resource_insert_lock_after(lock, req);
+                                RETURN(0);
+                        }
+                        continue;
+                }
+
                 if (lock->l_req_mode == LCK_GROUP) {
                         /* If compared lock is GROUP, then requested is PR/PW/=>
                          * this is not compatible; extent range does not
@@ -290,13 +340,15 @@ int ldlm_process_extent_lock(struct ldlm_lock *lock, int *flags, int first_enq,
         res->lr_tmp = &rpc_list;
         rc = ldlm_extent_compat_queue(&res->lr_granted, lock, 1, flags, err);
         if (rc < 0)
-                RETURN(rc); /* lock was destroyed */
-        if (rc == 2)
+                GOTO(out, rc); /* lock was destroyed */
+        if (rc == 2) {
+                res->lr_tmp = NULL;
                 goto grant;
+        }
 
         rc2 = ldlm_extent_compat_queue(&res->lr_waiting, lock, 1, flags, err);
         if (rc2 < 0)
-                RETURN(rc2); /* lock was destroyed */
+                GOTO(out, rc = rc2); /* lock was destroyed */
         res->lr_tmp = NULL;
 
         if (rc + rc2 == 2) {
@@ -320,7 +372,10 @@ int ldlm_process_extent_lock(struct ldlm_lock *lock, int *flags, int first_enq,
                         GOTO(restart, -ERESTART);
                 *flags |= LDLM_FL_BLOCK_GRANTED;
         }
-        RETURN(0);
+        rc = 0;
+out:
+        res->lr_tmp = NULL;
+        RETURN(rc);
 }
 
 /* When a lock is cancelled by a client, the KMS may undergo change if this
index 8ed3de9..bc174d8 100644 (file)
@@ -50,15 +50,15 @@ static int ldlm_proc_dump_ns(struct file *file, const char *buffer,
 int ldlm_proc_setup(void)
 {
         int rc;
-        struct lprocfs_vars list[] = { 
+        struct lprocfs_vars list[] = {
                 { "dump_namespaces", NULL, ldlm_proc_dump_ns, NULL },
                 { NULL }};
         ENTRY;
         LASSERT(ldlm_ns_proc_dir == NULL);
 
         ldlm_type_proc_dir = lprocfs_register(OBD_LDLM_DEVICENAME,
-                                               proc_lustre_root,
-                                               NULL, NULL);
+                                              proc_lustre_root,
+                                              NULL, NULL);
         if (IS_ERR(ldlm_type_proc_dir)) {
                 CERROR("LProcFS failed in ldlm-init\n");
                 rc = PTR_ERR(ldlm_type_proc_dir);
@@ -87,9 +87,9 @@ int ldlm_proc_setup(void)
 
         RETURN(0);
 
-err_ns:        
+err_ns:
         lprocfs_remove(ldlm_ns_proc_dir);
-err_type:        
+err_type:
         lprocfs_remove(ldlm_type_proc_dir);
 err:
         ldlm_type_proc_dir = NULL;
index ae70a99..8ae6e45 100644 (file)
@@ -75,13 +75,12 @@ static int llu_extent_lock_callback(struct ldlm_lock *lock,
         struct lustre_handle lockh = { 0 };
         int rc;
         ENTRY;
-        
 
         if ((unsigned long)data > 0 && (unsigned long)data < 0x1000) {
                 LDLM_ERROR(lock, "cancelling lock with bad data %p", data);
                 LBUG();
         }
-        
+
         switch (flag) {
         case LDLM_CB_BLOCKING:
                 ldlm_lock2handle(lock, &lockh);
@@ -95,7 +94,7 @@ static int llu_extent_lock_callback(struct ldlm_lock *lock,
                 struct lov_stripe_md *lsm;
                 __u32 stripe;
                 __u64 kms;
-                
+
                 /* This lock wasn't granted, don't try to evict pages */
                 if (lock->l_req_mode != lock->l_granted_mode)
                         RETURN(0);
@@ -124,7 +123,7 @@ iput:
         default:
                 LBUG();
         }
-        
+
         RETURN(0);
 }
 
@@ -182,7 +181,7 @@ int llu_glimpse_size(struct inode *inode, struct ost_lvb *lvb)
         struct llu_inode_info *lli = llu_i2info(inode);
         struct llu_sb_info *sbi = llu_i2sbi(inode);
         ldlm_policy_data_t policy = { .l_extent = { 0, OBD_OBJECT_EOF } };
-        struct lustre_handle lockh;
+        struct lustre_handle lockh = { 0 };
         int rc, flags = LDLM_FL_HAS_INTENT;
         ENTRY;
 
index 6608922..86048e6 100644 (file)
@@ -1560,5 +1560,3 @@ static struct inode_ops llu_inode_ops = {
 #endif
         inop_gone:      llu_iop_gone,
 };
-
-#warning "time_after() defined in liblustre.h need to be rewrite in userspace"
index 3ce798b..080483e 100644 (file)
@@ -272,7 +272,7 @@ int ll_lsm_getattr(struct obd_export *exp, struct lov_stripe_md *lsm,
         if (rc)
                 RETURN(rc);
 
-        oa->o_valid &= (OBD_MD_FLBLOCKS | OBD_MD_FLBLKSZ | OBD_MD_FLMTIME | 
+        oa->o_valid &= (OBD_MD_FLBLOCKS | OBD_MD_FLBLKSZ | OBD_MD_FLMTIME |
                         OBD_MD_FLCTIME | OBD_MD_FLSIZE);
         RETURN(0);
 }
@@ -609,7 +609,7 @@ int ll_glimpse_size(struct inode *inode, struct ost_lvb *lvb)
         struct ll_inode_info *lli = ll_i2info(inode);
         struct ll_sb_info *sbi = ll_i2sbi(inode);
         ldlm_policy_data_t policy = { .l_extent = { 0, OBD_OBJECT_EOF } };
-        struct lustre_handle lockh = { .cookie = 0 };
+        struct lustre_handle lockh = { 0 };
         int rc, flags = LDLM_FL_HAS_INTENT;
         ENTRY;
 
@@ -726,7 +726,7 @@ static ssize_t ll_file_read(struct file *filp, char *buf, size_t count,
                 RETURN(err);
 
         kms = lov_merge_size(lsm, 1);
-        if (policy.l_extent.end > kms) {
+        if (*ppos + count - 1 > kms) {
                 /* A glimpse is necessary to determine whether we return a short
                  * read or some zeroes at the end of the buffer */
                 struct ost_lvb lvb;
index b0d2fa3..5ff6eb3 100644 (file)
@@ -188,7 +188,6 @@ void ll_lookup_finish_locks(struct lookup_intent *it, struct dentry *dentry);
 
 /* llite/llite_lib.c */
 
-extern struct super_operations ll_super_operations;
 extern struct super_operations lustre_super_operations;
 
 char *ll_read_opt(const char *opt, char *data);
@@ -198,7 +197,6 @@ void ll_lli_init(struct ll_inode_info *lli);
 int ll_fill_super(struct super_block *sb, void *data, int silent);
 int lustre_fill_super(struct super_block *sb, void *data, int silent);
 void lustre_put_super(struct super_block *sb);
-void ll_put_super(struct super_block *sb);
 struct inode *ll_inode_from_lock(struct ldlm_lock *lock);
 void ll_clear_inode(struct inode *inode);
 int ll_attr2inode(struct inode *inode, struct iattr *attr, int trunc);
index 09d7e71..00fa891 100644 (file)
@@ -38,7 +38,6 @@ kmem_cache_t *ll_file_data_slab;
 
 extern struct address_space_operations ll_aops;
 extern struct address_space_operations ll_dir_aops;
-extern struct super_operations ll_super_operations;
 
 #ifndef log2
 #define log2(n) ffz(~(n))
@@ -193,12 +192,14 @@ int lustre_common_fill_super(struct super_block *sb, char *mdc, char *osc)
                 GOTO(out_root, err);
         }
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
-#warning "Please fix this"
-#else
+       /* making vm readahead 0 for 2.4.x. In the case of 2.6.x, 
+          backing dev info assigned to inode mapping is used for
+          determining maximal readahead. */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
         /* bug 2805 - set VM readahead to zero */
         vm_max_readahead = vm_min_readahead = 0;
 #endif
+
         sb->s_root = d_alloc_root(root);
         RETURN(err);
 
@@ -362,19 +363,6 @@ out:
         RETURN(err);
 } /* ll_read_super */
 
-void ll_put_super(struct super_block *sb)
-{
-        ENTRY;
-
-        CDEBUG(D_VFSTRACE, "VFS Op: sb %p\n", sb);
-
-        lustre_common_put_super(sb);
-
-        lustre_free_sbi(sb);
-
-        EXIT;
-} /* ll_put_super */
-
 int lustre_process_log(struct lustre_mount_data *lmd, char * profile,
                        struct config_llog_instance *cfg, int allow_recov)
 {
@@ -883,10 +871,10 @@ int ll_setattr_raw(struct inode *inode, struct iattr *attr)
                                     (rc=ll_permission(inode,MAY_WRITE,NULL))!=0)
                                         RETURN(rc);
                         } else {
-                               /* from inode_change_ok() */
-                               if (current->fsuid != inode->i_uid &&
-                                   !capable(CAP_FOWNER))
-                                       RETURN(-EPERM);
+                                /* from inode_change_ok() */
+                                if (current->fsuid != inode->i_uid &&
+                                    !capable(CAP_FOWNER))
+                                        RETURN(-EPERM);
                         }
                 }
 
@@ -1116,6 +1104,13 @@ void ll_update_inode(struct inode *inode, struct mds_body *body,
                 set_bit(LLI_F_HAVE_MDS_SIZE_LOCK, &lli->lli_flags);
 }
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
+static struct backing_dev_info ll_backing_dev_info = {
+       .ra_pages       = 0,    /* No readahead */
+       .memory_backed  = 0,    /* Does contribute to dirty memory */
+};
+#endif
+
 void ll_read_inode2(struct inode *inode, void *opaque)
 {
         struct lustre_md *md = opaque;
@@ -1155,15 +1150,19 @@ void ll_read_inode2(struct inode *inode, void *opaque)
                 EXIT;
         } else {
                 inode->i_op = &ll_special_inode_operations;
+
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
-#warning "need to fix this for 2.6 also"
                 init_special_inode(inode, inode->i_mode,
                                    kdev_t_to_nr(inode->i_rdev));
+               
+               /* initializing backing dev info. */
+               inode->i_mapping->backing_dev_info = &ll_backing_dev_info;
 #else
                 init_special_inode(inode, inode->i_mode, inode->i_rdev);
-
+#endif
                 lli->ll_save_ifop = inode->i_fop;
-                if (S_ISCHR(inode->i_mode))
+                
+               if (S_ISCHR(inode->i_mode))
                         inode->i_fop = &ll_special_chr_inode_fops;
                 else if (S_ISBLK(inode->i_mode))
                         inode->i_fop = &ll_special_blk_inode_fops;
@@ -1171,12 +1170,14 @@ void ll_read_inode2(struct inode *inode, void *opaque)
                         inode->i_fop = &ll_special_fifo_inode_fops;
                 else if (S_ISSOCK(inode->i_mode))
                         inode->i_fop = &ll_special_sock_inode_fops;
-                CWARN("saved %p, replaced with %p\n", lli->ll_save_ifop,
+        
+               CWARN("saved %p, replaced with %p\n", lli->ll_save_ifop,
                       inode->i_fop);
-                if (lli->ll_save_ifop->owner)
+                     
+                if (lli->ll_save_ifop->owner) {
                         CWARN("%p has owner %p\n", lli->ll_save_ifop,
                               lli->ll_save_ifop->owner);
-#endif
+               }
                 EXIT;
         }
 }
index 162f568..9f1987c 100644 (file)
@@ -602,6 +602,7 @@ static int llite_dump_pgcache_seq_release(struct inode *inode,
 }
 
 struct file_operations llite_dump_pgcache_fops = {
+        .owner   = THIS_MODULE,
         .open    = llite_dump_pgcache_seq_open,
         .read    = seq_read,
         .release = llite_dump_pgcache_seq_release,
index 3508777..6c0f612 100644 (file)
@@ -184,7 +184,7 @@ int ll_mdc_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
                         CDEBUG(D_INODE, "invalidating inode %lu\n",
                                inode->i_ino);
 
-                        ll_invalidate_inode_pages(inode);
+                        truncate_inode_pages(inode->i_mapping, 0);
                 }
 
                 if (inode->i_sb->s_root &&
index 01ad4a1..2e71def 100644 (file)
@@ -848,15 +848,10 @@ int ll_readpage(struct file *filp, struct page *page)
                        inode->i_ino, page->index,
                        (long long)page->index << PAGE_CACHE_SHIFT);
                 if (time_after(jiffies, next_print)) {
-                        CERROR("ino %lu page %lu (%llu) not covered by "
+                        CWARN("ino %lu page %lu (%llu) not covered by "
                                "a lock (mmap?).  check debug logs.\n",
                                inode->i_ino, page->index,
                                (long long)page->index << PAGE_CACHE_SHIFT);
-                        ldlm_dump_all_namespaces();
-                        if (next_print == 0) {
-                                CERROR("%s\n", portals_debug_dumpstack());
-                                portals_debug_dumplog();
-                        }
                         next_print = jiffies + 30 * HZ;
                 }
         }
index 12e5b0f..e209697 100644 (file)
@@ -193,7 +193,7 @@ static int ll_special_ioctl(struct inode *inode, struct file *filp,
 
         if (pfop && *pfop && (*pfop)->ioctl) {
                 struct file_operations *sfops = filp->f_op;
-
+                       
                 rc = (*pfop)->ioctl(inode, filp, cmd, arg);
                 /* sometimes, file_operations will be changed in ioctl */
                 save_fops(filp, inode, sfops);
index e248be7..4d2befe 100644 (file)
@@ -60,19 +60,6 @@ static struct super_block *lustre_read_super(struct super_block *sb,
         RETURN(sb);
 }
 
-/* exported operations */
-struct super_operations ll_super_operations =
-{
-        read_inode2: ll_read_inode2,
-        clear_inode: ll_clear_inode,
-        //        delete_inode: ll_delete_inode,
-        put_super: ll_put_super,
-        statfs: ll_statfs,
-        umount_begin: ll_umount_begin,
-        fh_to_dentry: ll_fh_to_dentry,
-        dentry_to_fh: ll_dentry_to_fh
-};
-
 static struct file_system_type lustre_lite_fs_type = {
         name:           "lustre_lite",
         fs_flags:       FS_NFSEXP_FSID,
index 526776b..9e9c83e 100644 (file)
@@ -100,12 +100,12 @@ void ll_destroy_inodecache(void)
 /* exported operations */
 struct super_operations lustre_super_operations =
 {
-        alloc_inode: ll_alloc_inode,
-        destroy_inode: ll_destroy_inode,
-        clear_inode: ll_clear_inode,
-        put_super: ll_put_super,
-        statfs: ll_statfs,
-        umount_begin: ll_umount_begin
+        .alloc_inode = ll_alloc_inode,
+        .destroy_inode = ll_destroy_inode,
+        .clear_inode = ll_clear_inode,
+        .put_super = lustre_put_super,
+        .statfs = ll_statfs,
+        .umount_begin = ll_umount_begin
 };
 
 
index 9aa541a..1a8bcd4 100644 (file)
@@ -114,35 +114,6 @@ static void lov_llh_destroy(struct lov_lock_handles *llh)
 }
 
 /* obd methods */
-int lov_attach(struct obd_device *dev, obd_count len, void *data)
-{
-        struct lprocfs_static_vars lvars;
-        int rc;
-
-        lprocfs_init_vars(lov, &lvars);
-        rc = lprocfs_obd_attach(dev, lvars.obd_vars);
-        if (rc == 0) {
-#ifdef __KERNEL__
-                struct proc_dir_entry *entry;
-
-                entry = create_proc_entry("target_obd", 0444, 
-                                          dev->obd_proc_entry);
-                if (entry == NULL) {
-                        rc = -ENOMEM;
-                } else {
-                        entry->proc_fops = &lov_proc_target_fops;
-                        entry->data = dev;
-                }
-#endif
-        }
-        return rc;
-}
-
-int lov_detach(struct obd_device *dev)
-{
-        return lprocfs_obd_detach(dev);
-}
-
 static int lov_connect(struct lustre_handle *conn, struct obd_device *obd,
                        struct obd_uuid *cluuid)
 {
@@ -176,7 +147,7 @@ static int lov_connect(struct lustre_handle *conn, struct obd_device *obd,
 
                 LASSERT( tgt_uuid != NULL);
 
-                tgt_obd = class_find_client_obd(tgt_uuid, LUSTRE_OSC_NAME, 
+                tgt_obd = class_find_client_obd(tgt_uuid, LUSTRE_OSC_NAME,
                                                 &obd->obd_uuid);
 
                 if (!tgt_obd) {
@@ -390,6 +361,7 @@ static int lov_notify(struct obd_device *obd, struct obd_device *watched,
 
 static int lov_setup(struct obd_device *obd, obd_count len, void *buf)
 {
+        struct lprocfs_static_vars lvars;
         struct lustre_cfg *lcfg = buf;
         struct lov_desc *desc;
         struct lov_obd *lov = &obd->u.lov;
@@ -397,7 +369,6 @@ static int lov_setup(struct obd_device *obd, obd_count len, void *buf)
         struct lov_tgt_desc *tgts;
         int i;
         int count;
-        int rc = 0;
         ENTRY;
 
         if (lcfg->lcfg_inllen1 < 1) {
@@ -456,15 +427,31 @@ static int lov_setup(struct obd_device *obd, obd_count len, void *buf)
                 *uuid = uuids[i];
         }
 
+        lprocfs_init_vars(lov, &lvars);
+        lprocfs_obd_setup(obd, lvars.obd_vars);
+#ifdef __KERNEL__
+        {
+                struct proc_dir_entry *entry;
 
-        RETURN(rc);
+                entry = create_proc_entry("target_obd", 0444,
+                                          obd->obd_proc_entry);
+                if (entry != NULL) {
+                        entry->proc_fops = &lov_proc_target_fops;
+                        entry->data = obd;
+                }
+        }
+#endif
+
+        RETURN(0);
 }
 
-static int lov_cleanup(struct obd_device *obd, int flags) 
+static int lov_cleanup(struct obd_device *obd, int flags)
 {
         struct lov_obd *lov = &obd->u.lov;
 
+        lprocfs_obd_cleanup(obd);
         OBD_FREE(lov->tgts, lov->bufsize);
+
         RETURN(0);
 }
 
@@ -557,7 +544,7 @@ static int lov_clear_orphans(struct obd_export *export, struct obdo *src_oa,
                 struct lov_stripe_md *obj_mdp = &obj_md;
                 int err;
 
-                /* if called for a specific target, we don't 
+                /* if called for a specific target, we don't
                    care if it is not active. */
                 if (lov->tgts[i].active == 0 && ost_uuid == NULL) {
                         CDEBUG(D_HA, "lov idx %d inactive\n", i);
@@ -996,7 +983,7 @@ static int lov_getattr(struct obd_export *exp, struct obdo *oa,
         RETURN(rc);
 }
 
-static int lov_getattr_interpret(struct ptlrpc_request_set *rqset, void *data, 
+static int lov_getattr_interpret(struct ptlrpc_request_set *rqset, void *data,
                                  int rc)
 {
         struct lov_getattr_async_args *aa = data;
@@ -1584,8 +1571,8 @@ static int lov_brw(int cmd, struct obd_export *exp, struct obdo *src_oa,
                                 memcpy(tmp_oa, src_oa, sizeof(*tmp_oa));
 
                         tmp_oa->o_id = si->lsm.lsm_object_id;
-                        rc = obd_brw(cmd, lov->tgts[si->ost_idx].ltd_exp, 
-                                     tmp_oa, &si->lsm, si->bufct, 
+                        rc = obd_brw(cmd, lov->tgts[si->ost_idx].ltd_exp,
+                                     tmp_oa, &si->lsm, si->bufct,
                                      &ioarr[shift], oti);
                         if (rc)
                                 GOTO(out_ioarr, rc);
@@ -1794,7 +1781,7 @@ static int lov_ap_refresh_count(void *data, int cmd)
         if (IS_ERR(lap))
                 return -EINVAL;
 
-        return lap->lap_caller_ops->ap_refresh_count(lap->lap_caller_data, 
+        return lap->lap_caller_ops->ap_refresh_count(lap->lap_caller_data,
                                                      cmd);
 }
 static void lov_ap_fill_obdo(void *data, int cmd, struct obdo *oa)
@@ -1830,7 +1817,7 @@ static struct obd_async_page_ops lov_async_page_ops = {
 
 int lov_prep_async_page(struct obd_export *exp, struct lov_stripe_md *lsm,
                            struct lov_oinfo *loi, struct page *page,
-                           obd_off offset, struct obd_async_page_ops *ops, 
+                           obd_off offset, struct obd_async_page_ops *ops,
                            void *data, void **res)
 {
         struct lov_obd *lov = &exp->exp_obd->u.lov;
@@ -1855,7 +1842,7 @@ int lov_prep_async_page(struct obd_export *exp, struct lov_stripe_md *lsm,
         lov_stripe_offset(lsm, offset, lap->lap_stripe, &lap->lap_sub_offset);
         loi = &lsm->lsm_oinfo[lap->lap_stripe];
 
-        /* so the callback doesn't need the lsm */ 
+        /* so the callback doesn't need the lsm */
         lap->lap_loi_id = loi->loi_id;
 
         rc = obd_prep_async_page(lov->tgts[loi->loi_ost_idx].ltd_exp,
@@ -1967,7 +1954,7 @@ static int lov_trigger_group_io(struct obd_export *exp,
 
         for (i = 0, loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count;
              i++, loi++) {
-                err = obd_trigger_group_io(lov->tgts[loi->loi_ost_idx].ltd_exp, 
+                err = obd_trigger_group_io(lov->tgts[loi->loi_ost_idx].ltd_exp,
                                            lsm, loi, oig);
                 if (rc == 0 && err != 0)
                         rc = err;
@@ -1993,10 +1980,10 @@ static int lov_teardown_async_page(struct obd_export *exp,
                 RETURN(PTR_ERR(lap));
 
         loi = &lsm->lsm_oinfo[lap->lap_stripe];
-        rc = obd_teardown_async_page(lov->tgts[loi->loi_ost_idx].ltd_exp, 
+        rc = obd_teardown_async_page(lov->tgts[loi->loi_ost_idx].ltd_exp,
                                      lsm, loi, lap->lap_sub_cookie);
         if (rc) {
-                CERROR("unable to teardown sub cookie %p: %d\n", 
+                CERROR("unable to teardown sub cookie %p: %d\n",
                        lap->lap_sub_cookie, rc);
                 RETURN(rc);
         }
@@ -2571,7 +2558,7 @@ static int lov_get_info(struct obd_export *exp, __u32 keylen,
                 for (i = 0, loi = data->lsm->lsm_oinfo;
                      i < data->lsm->lsm_stripe_count;
                      i++, loi++) {
-                        if (lov->tgts[loi->loi_ost_idx].ltd_exp == 
+                        if (lov->tgts[loi->loi_ost_idx].ltd_exp ==
                             data->lock->l_conn_export) {
                                 *stripe = i;
                                 RETURN(0);
@@ -2607,7 +2594,7 @@ static int lov_get_info(struct obd_export *exp, __u32 keylen,
         } else if (keylen >= strlen("lovdesc") && strcmp(key, "lovdesc") == 0) {
                 struct lov_desc *desc_ret = val;
                 *desc_ret = lov->desc;
-                
+
                 RETURN(0);
         }
 
@@ -2654,7 +2641,7 @@ static int lov_set_info(struct obd_export *exp, obd_count keylen,
         for (i = 0; i < lov->desc.ld_tgt_count; i++) {
                 int er;
 
-                if (val && !obd_uuid_equals(val, &lov->tgts[i].uuid)) 
+                if (val && !obd_uuid_equals(val, &lov->tgts[i].uuid))
                         continue;
 
                 if (!val && !lov->tgts[i].active)
@@ -2839,8 +2826,6 @@ EXPORT_SYMBOL(lov_increase_kms);
 
 struct obd_ops lov_obd_ops = {
         o_owner:       THIS_MODULE,
-        o_attach:      lov_attach,
-        o_detach:      lov_detach,
         o_setup:       lov_setup,
         o_cleanup:     lov_cleanup,
         o_connect:     lov_connect,
index d941dda..164bcec 100644 (file)
@@ -186,7 +186,7 @@ static int lov_verify_lmm_v0(struct lov_mds_md_v0 *lmm, int lmm_bytes,
 
         if (lmm_bytes < lov_mds_md_v0_size(*stripe_count)) {
                 CERROR("LOV EA too small: %d, need %d\n",
-                       lmm_bytes, lov_mds_md_size(*stripe_count));
+                       lmm_bytes, lov_mds_md_v0_size(*stripe_count));
                 lov_dump_lmm_v0(D_WARNING, lmm);
                 return -EINVAL;
         }
@@ -238,9 +238,9 @@ static int lov_verify_lmm_v1(struct lov_mds_md_v1 *lmm, int lmm_bytes,
                 return -EINVAL;
         }
 
-        if (lmm_bytes < lov_mds_md_size(*stripe_count)) {
+        if (lmm_bytes < lov_mds_md_v1_size(*stripe_count)) {
                 CERROR("LOV EA too small: %d, need %d\n",
-                       lmm_bytes, lov_mds_md_size(*stripe_count));
+                       lmm_bytes, lov_mds_md_v1_size(*stripe_count));
                 lov_dump_lmm_v1(D_WARNING, lmm);
                 return -EINVAL;
         }
index c29644c..ee4883d 100644 (file)
@@ -198,9 +198,10 @@ static struct lprocfs_vars lprocfs_module_vars[] = {
 };
 
 struct file_operations lov_proc_target_fops = {
-        .open = lov_target_seq_open,
-        .read = seq_read,
-        .llseek = seq_lseek,
+        .owner   = THIS_MODULE,
+        .open    = lov_target_seq_open,
+        .read    = seq_read,
+        .llseek  = seq_lseek,
         .release = seq_release,
 };
 
index d1249f6..35f89e2 100644 (file)
 #include <linux/ext3_fs.h>
 #include <linux/ext3_jbd.h>
 #include <linux/version.h>
-/* XXX ugh */
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- #include <linux/ext3_xattr.h>
-#else
-/* 
- * our build flags set -I$LINUX/fs and -I$LUSTRE so that ext3 and
- * ldiskfs work correctly
- */
- #include <ext3/xattr.h>
-#endif
+#include <linux/ext3_xattr.h>
+
 #include <linux/kp30.h>
 #include <linux/lustre_fsfilt.h>
 #include <linux/obd.h>
@@ -312,8 +304,11 @@ static int fsfilt_ext3_commit(struct inode *inode, void *h, int force_sync)
 static int fsfilt_ext3_commit_async(struct inode *inode, void *h,
                                         void **wait_handle)
 {
+        unsigned long tid;
         transaction_t *transaction;
-        unsigned long tid, rtid;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+        unsigned long rtid;
+#endif
         handle_t *handle = h;
         journal_t *journal;
         int rc;
index 830c2cd..fe0144a 100644 (file)
@@ -497,6 +497,7 @@ int mdc_close(struct obd_export *exp, struct obdo *obdo,
         rc = l_wait_event(req->rq_reply_waitq, mdc_close_check_reply(req),
                           &lwi);
         if (rc == 0) {
+                LASSERTF(req->rq_repmsg != NULL, "req = %p", req);
                 rc = req->rq_repmsg->status;
                 if (req->rq_repmsg->type == PTL_RPC_MSG_ERR) {
                         DEBUG_REQ(D_ERROR, req, "type == PTL_RPC_MSG_ERR, err "
@@ -614,9 +615,15 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
         struct llog_ctxt *ctxt;
         int rc;
         ENTRY;
-        
-        MOD_INC_USE_COUNT;
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+        MOD_INC_USE_COUNT;
+#else
+       if (!try_module_get(THIS_MODULE)) {
+               CERROR("Can't get module. Is it alive?");
+               return -EINVAL;
+       }
+#endif
         switch (cmd) {
         case OBD_IOC_CLIENT_RECOVER:
                 rc = ptlrpc_recover_import(imp, data->ioc_inlbuf1);
@@ -641,11 +648,16 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
         }
 #endif
         default:
-                CERROR("osc_ioctl(): unrecognised ioctl %#x\n", cmd);
+                CERROR("mdc_ioctl(): unrecognised ioctl %#x\n", cmd);
                 GOTO(out, rc = -ENOTTY);
         }
 out:
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
         MOD_DEC_USE_COUNT;
+#else
+       module_put(THIS_MODULE);
+#endif
+
         return rc;
 }
 
@@ -819,19 +831,6 @@ int mdc_sync(struct obd_export *exp, struct ll_fid *fid,
         RETURN(rc);
 }
 
-static int mdc_attach(struct obd_device *dev, obd_count len, void *data)
-{
-        struct lprocfs_static_vars lvars;
-
-        lprocfs_init_vars(mdc, &lvars);
-        return lprocfs_obd_attach(dev, lvars.obd_vars);
-}
-
-static int mdc_detach(struct obd_device *dev)
-{
-        return lprocfs_obd_detach(dev);
-}
-
 static int mdc_import_event(struct obd_device *obd,
                             struct obd_import *imp, 
                             enum obd_import_event event)
@@ -851,7 +850,7 @@ static int mdc_import_event(struct obd_device *obd,
         }
         case IMP_EVENT_INVALIDATE: {
                 struct ldlm_namespace *ns = obd->obd_namespace;
-                
+
                 ldlm_namespace_cleanup(ns, LDLM_FL_LOCAL_ONLY);
 
                 break;
@@ -871,6 +870,7 @@ static int mdc_import_event(struct obd_device *obd,
 static int mdc_setup(struct obd_device *obd, obd_count len, void *buf)
 {
         struct client_obd *cli = &obd->u.cli;
+        struct lprocfs_static_vars lvars;
         int rc;
         ENTRY;
 
@@ -883,15 +883,14 @@ static int mdc_setup(struct obd_device *obd, obd_count len, void *buf)
 
         OBD_ALLOC(cli->cl_setattr_lock, sizeof (*cli->cl_setattr_lock));
         if (!cli->cl_setattr_lock)
-                GOTO(out_free_rpc, rc = -ENOMEM);
+                GOTO(err_rpc_lock, rc = -ENOMEM);
         mdc_init_rpc_lock(cli->cl_setattr_lock);
 
         rc = client_obd_setup(obd, len, buf);
-        if (rc) {
-                OBD_FREE(cli->cl_setattr_lock, sizeof (*cli->cl_setattr_lock));
- out_free_rpc:
-                OBD_FREE(cli->cl_rpc_lock, sizeof (*cli->cl_rpc_lock));
-        }
+        if (rc)
+                GOTO(err_setattr_lock, rc);
+        lprocfs_init_vars(mdc, &lvars);
+        lprocfs_obd_setup(obd, lvars.obd_vars);
 
         rc = obd_llog_init(obd, obd, 0, NULL);
         if (rc) {
@@ -900,6 +899,13 @@ static int mdc_setup(struct obd_device *obd, obd_count len, void *buf)
         }
 
         RETURN(rc);
+
+err_setattr_lock:
+        OBD_FREE(cli->cl_setattr_lock, sizeof (*cli->cl_setattr_lock));
+err_rpc_lock:
+        OBD_FREE(cli->cl_rpc_lock, sizeof (*cli->cl_rpc_lock));
+        ptlrpcd_decref();
+        RETURN(rc);
 }
 
 int mdc_init_ea_size(struct obd_device *obd, char *lov_name)
@@ -940,7 +946,7 @@ int mdc_init_ea_size(struct obd_device *obd, char *lov_name)
 static int mdc_precleanup(struct obd_device *obd, int flags)
 {
         int rc = 0;
-        
+
         rc = obd_llog_finish(obd, 0);
         if (rc != 0)
                 CERROR("failed to cleanup llogging subsystems\n");
@@ -951,10 +957,11 @@ static int mdc_precleanup(struct obd_device *obd, int flags)
 static int mdc_cleanup(struct obd_device *obd, int flags)
 {
         struct client_obd *cli = &obd->u.cli;
+
         OBD_FREE(cli->cl_rpc_lock, sizeof (*cli->cl_rpc_lock));
         OBD_FREE(cli->cl_setattr_lock, sizeof (*cli->cl_setattr_lock));
 
+        lprocfs_obd_cleanup(obd);
         ptlrpcd_decref();
 
         return client_obd_cleanup(obd, flags);
@@ -989,8 +996,6 @@ static int mdc_llog_finish(struct obd_device *obd, int count)
 
 struct obd_ops mdc_obd_ops = {
         o_owner:       THIS_MODULE,
-        o_attach:      mdc_attach,
-        o_detach:      mdc_detach,
         o_setup:       mdc_setup,
         o_precleanup:  mdc_precleanup,
         o_cleanup:     mdc_cleanup,
@@ -1014,12 +1019,12 @@ int __init mdc_init(void)
                                    LUSTRE_MDC_NAME);
 }
 
+#ifdef __KERNEL__
 static void /*__exit*/ mdc_exit(void)
 {
         class_unregister_type(LUSTRE_MDC_NAME);
 }
 
-#ifdef __KERNEL__
 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
 MODULE_DESCRIPTION("Lustre Metadata Client");
 MODULE_LICENSE("GPL");
index b34e184..84a3f0d 100644 (file)
@@ -1365,6 +1365,7 @@ int mds_update_server_data(struct obd_device *obd, int force_sync)
 /* mount the file system (secretly) */
 static int mds_setup(struct obd_device *obd, obd_count len, void *buf)
 {
+        struct lprocfs_static_vars lvars;
         struct lustre_cfg* lcfg = buf;
         struct mds_obd *mds = &obd->u.mds;
         struct vfsmount *mnt;
@@ -1422,7 +1423,6 @@ static int mds_setup(struct obd_device *obd, obd_count len, void *buf)
         rc = llog_start_commit_thread();
         if (rc < 0)
                 GOTO(err_fs, rc);
-        
 
         if (lcfg->lcfg_inllen3 > 0 && lcfg->lcfg_inlbuf3) {
                 class_uuid_t uuid;
@@ -1431,13 +1431,13 @@ static int mds_setup(struct obd_device *obd, obd_count len, void *buf)
                 class_uuid_unparse(uuid, &mds->mds_lov_uuid);
 
                 OBD_ALLOC(mds->mds_profile, lcfg->lcfg_inllen3);
-                if (mds->mds_profile == NULL) 
+                if (mds->mds_profile == NULL)
                         GOTO(err_fs, rc = -ENOMEM);
 
                 memcpy(mds->mds_profile, lcfg->lcfg_inlbuf3,
                        lcfg->lcfg_inllen3);
 
-        } 
+        }
 
         ptlrpc_init_client(LDLM_CB_REQUEST_PORTAL, LDLM_CB_REPLY_PORTAL,
                            "mds_ldlm_client", &obd->obd_ldlm_client);
@@ -1446,6 +1446,10 @@ static int mds_setup(struct obd_device *obd, obd_count len, void *buf)
         rc = mds_postsetup(obd);
         if (rc)
                 GOTO(err_fs, rc);
+
+        lprocfs_init_vars(mds, &lvars);
+        lprocfs_obd_setup(obd, lvars.obd_vars);
+
         RETURN(0);
 
 err_fs:
@@ -1579,6 +1583,8 @@ static int mds_cleanup(struct obd_device *obd, int flags)
         if (mds->mds_sb == NULL)
                 RETURN(0);
 
+        lprocfs_obd_cleanup(obd);
+
         mds_update_server_data(obd, 1);
         if (mds->mds_lov_objids != NULL) {
                 OBD_FREE(mds->mds_lov_objids,
@@ -1649,7 +1655,7 @@ static void fixup_handle_for_resent_req(struct ptlrpc_request *req,
          * be handled like any normal request now. */
 
         lustre_msg_clear_flags(req->rq_reqmsg, MSG_RESENT);
-        
+
         DEBUG_REQ(D_HA, req, "no existing lock with rhandle "LPX64,
                   remote_hdl.cookie);
 }
@@ -1814,50 +1820,28 @@ static int mds_intent_policy(struct ldlm_namespace *ns,
         RETURN(ELDLM_LOCK_REPLACED);
 }
 
-int mds_attach(struct obd_device *dev, obd_count len, void *data)
-{
-        struct lprocfs_static_vars lvars;
-
-        lprocfs_init_multi_vars(0, &lvars);
-        return lprocfs_obd_attach(dev, lvars.obd_vars);
-}
-
-int mds_detach(struct obd_device *dev)
-{
-        return lprocfs_obd_detach(dev);
-}
-
-int mdt_attach(struct obd_device *dev, obd_count len, void *data)
+static int mdt_setup(struct obd_device *obd, obd_count len, void *buf)
 {
+        struct mds_obd *mds = &obd->u.mds;
         struct lprocfs_static_vars lvars;
-
-        lprocfs_init_multi_vars(1, &lvars);
-        return lprocfs_obd_attach(dev, lvars.obd_vars);
-}
-
-int mdt_detach(struct obd_device *dev)
-{
-        return lprocfs_obd_detach(dev);
-}
-
-static int mdt_setup(struct obd_device *obddev, obd_count len, void *buf)
-{
-        struct mds_obd *mds = &obddev->u.mds;
         int rc = 0;
         ENTRY;
 
-        mds->mds_service = 
+        lprocfs_init_vars(mdt, &lvars);
+        lprocfs_obd_setup(obd, lvars.obd_vars);
+
+        mds->mds_service =
                 ptlrpc_init_svc(MDS_NBUFS, MDS_BUFSIZE, MDS_MAXREQSIZE,
                                 MDS_REQUEST_PORTAL, MDC_REPLY_PORTAL,
                                 mds_handle, "mds",
-                                obddev->obd_proc_entry);
+                                obd->obd_proc_entry);
 
         if (!mds->mds_service) {
                 CERROR("failed to start service\n");
-                RETURN(rc = -ENOMEM);
+                GOTO(err_lprocfs, rc = -ENOMEM);
         }
 
-        rc = ptlrpc_start_n_threads(obddev, mds->mds_service, MDT_NUM_THREADS,
+        rc = ptlrpc_start_n_threads(obd, mds->mds_service, MDT_NUM_THREADS,
                                     "ll_mdt");
         if (rc)
                 GOTO(err_thread, rc);
@@ -1865,32 +1849,32 @@ static int mdt_setup(struct obd_device *obddev, obd_count len, void *buf)
         mds->mds_setattr_service =
                 ptlrpc_init_svc(MDS_NBUFS, MDS_BUFSIZE, MDS_MAXREQSIZE,
                                 MDS_SETATTR_PORTAL, MDC_REPLY_PORTAL,
-                                mds_handle, "mds_setattr", 
-                                obddev->obd_proc_entry);
+                                mds_handle, "mds_setattr",
+                                obd->obd_proc_entry);
         if (!mds->mds_setattr_service) {
                 CERROR("failed to start getattr service\n");
                 GOTO(err_thread, rc = -ENOMEM);
         }
 
-        rc = ptlrpc_start_n_threads(obddev, mds->mds_setattr_service,
+        rc = ptlrpc_start_n_threads(obd, mds->mds_setattr_service,
                                  MDT_NUM_THREADS, "ll_mdt_attr");
         if (rc)
                 GOTO(err_thread2, rc);
-                        
+
         mds->mds_readpage_service =
                 ptlrpc_init_svc(MDS_NBUFS, MDS_BUFSIZE, MDS_MAXREQSIZE,
                                 MDS_READPAGE_PORTAL, MDC_REPLY_PORTAL,
-                                mds_handle, "mds_readpage", 
-                                obddev->obd_proc_entry);
+                                mds_handle, "mds_readpage",
+                                obd->obd_proc_entry);
         if (!mds->mds_readpage_service) {
                 CERROR("failed to start readpage service\n");
                 GOTO(err_thread2, rc = -ENOMEM);
         }
 
-        rc = ptlrpc_start_n_threads(obddev, mds->mds_readpage_service,
+        rc = ptlrpc_start_n_threads(obd, mds->mds_readpage_service,
                                     MDT_NUM_THREADS, "ll_mdt_rdpg");
 
-        if (rc) 
+        if (rc)
                 GOTO(err_thread3, rc);
 
         RETURN(0);
@@ -1901,13 +1885,14 @@ err_thread2:
         ptlrpc_unregister_service(mds->mds_setattr_service);
 err_thread:
         ptlrpc_unregister_service(mds->mds_service);
+err_lprocfs:
+        lprocfs_obd_cleanup(obd);
         return rc;
 }
 
-
-static int mdt_cleanup(struct obd_device *obddev, int flags)
+static int mdt_cleanup(struct obd_device *obd, int flags)
 {
-        struct mds_obd *mds = &obddev->u.mds;
+        struct mds_obd *mds = &obd->u.mds;
         ENTRY;
 
         ptlrpc_stop_all_threads(mds->mds_readpage_service);
@@ -1919,10 +1904,13 @@ static int mdt_cleanup(struct obd_device *obddev, int flags)
         ptlrpc_stop_all_threads(mds->mds_service);
         ptlrpc_unregister_service(mds->mds_service);
 
+        lprocfs_obd_cleanup(obd);
+
         RETURN(0);
 }
 
-static struct dentry *mds_lvfs_fid2dentry(__u64 id, __u32 gen, __u64 gr, void *data)
+static struct dentry *mds_lvfs_fid2dentry(__u64 id, __u32 gen, __u64 gr,
+                                          void *data)
 {
         struct obd_device *obd = data;
         struct ll_fid fid;
@@ -1938,8 +1926,6 @@ struct lvfs_callback_ops mds_lvfs_ops = {
 /* use obd ops to offer management infrastructure */
 static struct obd_ops mds_obd_ops = {
         o_owner:       THIS_MODULE,
-        o_attach:      mds_attach,
-        o_detach:      mds_detach,
         o_connect:     mds_connect,
         o_init_export:  mds_init_export,
         o_destroy_export:  mds_destroy_export,
@@ -1959,8 +1945,6 @@ static struct obd_ops mds_obd_ops = {
 
 static struct obd_ops mdt_obd_ops = {
         o_owner:       THIS_MODULE,
-        o_attach:      mdt_attach,
-        o_detach:      mdt_detach,
         o_setup:       mdt_setup,
         o_cleanup:     mdt_cleanup,
 };
@@ -1969,9 +1953,9 @@ static int __init mds_init(void)
 {
         struct lprocfs_static_vars lvars;
 
-        lprocfs_init_multi_vars(0, &lvars);
+        lprocfs_init_vars(mds, &lvars);
         class_register_type(&mds_obd_ops, lvars.module_vars, LUSTRE_MDS_NAME);
-        lprocfs_init_multi_vars(1, &lvars);
+        lprocfs_init_vars(mdt, &lvars);
         class_register_type(&mdt_obd_ops, lvars.module_vars, LUSTRE_MDT_NAME);
 
         return 0;
index 10365a6..52225be 100644 (file)
@@ -163,10 +163,10 @@ struct lprocfs_vars lprocfs_mds_obd_vars[] = {
         { "filestotal",   lprocfs_rd_filestotal,  0, 0 },
         { "filesfree",    lprocfs_rd_filesfree,   0, 0 },
         { "filesopen",    lprocfs_mds_rd_filesopen,   0, 0 },
-        //{ "filegroups",   lprocfs_rd_filegroups,  0, 0 },
         { "mntdev",       lprocfs_mds_rd_mntdev,  0, 0 },
         { "recovery_status", lprocfs_mds_rd_recovery_status, 0, 0 },
         { "evict_client", 0, lprocfs_mds_wr_evict_client, 0 },
+        { "num_exports",  lprocfs_rd_num_exports, 0, 0 },
         { 0 }
 };
 
@@ -186,11 +186,5 @@ struct lprocfs_vars lprocfs_mdt_module_vars[] = {
 };
 
 #endif
-struct lprocfs_static_vars lprocfs_array_vars[] = { {lprocfs_mds_module_vars,
-                                                     lprocfs_mds_obd_vars},
-                                                    {lprocfs_mdt_module_vars,
-                                                     lprocfs_mdt_obd_vars}};
-
-LPROCFS_INIT_MULTI_VARS(lprocfs_array_vars,
-                        (sizeof(lprocfs_array_vars) /
-                         sizeof(struct lprocfs_static_vars)))
+LPROCFS_INIT_VARS(mds, lprocfs_mds_module_vars, lprocfs_mds_obd_vars);
+LPROCFS_INIT_VARS(mdt, lprocfs_mdt_module_vars, lprocfs_mdt_obd_vars);
index ee9ed2d..0c74ec0 100644 (file)
@@ -95,7 +95,8 @@ int mds_client_add(struct obd_device *obd, struct mds_obd *mds,
                cl_idx, med->med_mcd->mcd_uuid);
 
         med->med_idx = cl_idx;
-        med->med_off = MDS_LR_CLIENT_START + (cl_idx * MDS_LR_CLIENT_SIZE);
+        med->med_off = le32_to_cpu(mds->mds_server_data->msd_client_start) +
+                (cl_idx * le16_to_cpu(mds->mds_server_data->msd_client_size));
 
         if (new_client) {
                 struct obd_run_ctxt saved;
@@ -193,10 +194,10 @@ static int mds_read_last_rcvd(struct obd_device *obd, struct file *file)
         ENTRY;
 
         /* ensure padding in the struct is the correct size */
-        LASSERT (offsetof(struct mds_server_data, msd_padding) +
-                 sizeof(msd->msd_padding) == MDS_LR_SERVER_SIZE);
-        LASSERT (offsetof(struct mds_client_data, mcd_padding) +
-                 sizeof(mcd->mcd_padding) == MDS_LR_CLIENT_SIZE);
+        LASSERT(offsetof(struct mds_server_data, msd_padding) +
+                sizeof(msd->msd_padding) == MDS_LR_SERVER_SIZE);
+        LASSERT(offsetof(struct mds_client_data, mcd_padding) +
+                sizeof(mcd->mcd_padding) == MDS_LR_CLIENT_SIZE);
 
         OBD_ALLOC_WAIT(msd, sizeof(*msd));
         if (!msd)
@@ -216,7 +217,7 @@ static int mds_read_last_rcvd(struct obd_device *obd, struct file *file)
 
                 memcpy(msd->msd_uuid, obd->obd_uuid.uuid,sizeof(msd->msd_uuid));
                 msd->msd_last_transno = 0;
-                mount_count = msd->msd_mount_count = 0; 
+                mount_count = msd->msd_mount_count = 0;
                 msd->msd_server_size = cpu_to_le32(MDS_LR_SERVER_SIZE);
                 msd->msd_client_start = cpu_to_le32(MDS_LR_CLIENT_START);
                 msd->msd_client_size = cpu_to_le16(MDS_LR_CLIENT_SIZE);
@@ -265,8 +266,9 @@ static int mds_read_last_rcvd(struct obd_device *obd, struct file *file)
         CDEBUG(D_INODE, "%s: last_rcvd size: %lu\n",
                obd->obd_name, last_rcvd_size);
         CDEBUG(D_INODE, "%s: last_rcvd clients: %lu\n", obd->obd_name,
-               last_rcvd_size <= MDS_LR_CLIENT_START ? 0 :
-               (last_rcvd_size - MDS_LR_CLIENT_START) / MDS_LR_CLIENT_SIZE);
+               last_rcvd_size <= le32_to_cpu(msd->msd_client_start) ? 0 :
+               (last_rcvd_size - le32_to_cpu(msd->msd_client_start)) /
+                le16_to_cpu(msd->msd_client_size));
 
         /* When we do a clean MDS shutdown, we save the last_transno into
          * the header.  If we find clients with higher last_transno values
index 7d18572..d4b13f7 100644 (file)
@@ -300,12 +300,12 @@ void mds_steal_ack_locks(struct ptlrpc_request *req)
 
                 CWARN("Stealing %d locks from rs %p x"LPD64".t"LPD64
                       " o%d NID"LPX64"\n",
-                      oldrep->rs_nlocks, oldrep, 
+                      oldrep->rs_nlocks, oldrep,
                       oldrep->rs_xid, oldrep->rs_transno, oldrep->rs_msg.opc,
                       exp->exp_connection->c_peer.peer_nid);
 
                 for (i = 0; i < oldrep->rs_nlocks; i++)
-                        ptlrpc_save_lock(req, 
+                        ptlrpc_save_lock(req,
                                          &oldrep->rs_locks[i],
                                          oldrep->rs_modes[i]);
                 oldrep->rs_nlocks = 0;
@@ -407,7 +407,7 @@ static int mds_reint_setattr(struct mds_update_record *rec, int offset,
 
         inode = de->d_inode;
         LASSERT(inode);
-        if ((S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)) && 
+        if ((S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)) &&
             rec->ur_eadata != NULL)
                 down(&inode->i_sem);
 
@@ -490,7 +490,7 @@ static int mds_reint_setattr(struct mds_update_record *rec, int offset,
         err = mds_finish_transno(mds, inode, handle, req, rc, 0);
         switch (cleanup_phase) {
         case 1:
-                if ((S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)) && 
+                if ((S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)) &&
                     rec->ur_eadata != NULL)
                         up(&inode->i_sem);
                 l_dput(de);
@@ -1061,9 +1061,11 @@ int mds_get_parent_child_locked(struct obd_device *obd, struct mds_obd *mds,
 
         /* Step 1: Lookup parent */
         *dparentp = mds_fid2dentry(mds, fid, NULL);
-        if (IS_ERR(*dparentp))
-                RETURN(rc = PTR_ERR(*dparentp));
-        LASSERT((*dparentp)->d_inode);
+        if (IS_ERR(*dparentp)) {
+                rc = PTR_ERR(*dparentp);
+                *dparentp = NULL;
+                RETURN(rc);
+        }
 
         CDEBUG(D_INODE, "parent ino %lu, name %s\n",
                (*dparentp)->d_inode->i_ino, name);
@@ -1387,8 +1389,11 @@ static int mds_reint_link(struct mds_update_record *rec, int offset,
         cleanup_phase = 1; /* source dentry */
 
         de_tgt_dir = mds_fid2dentry(mds, rec->ur_fid2, NULL);
-        if (IS_ERR(de_tgt_dir))
-                GOTO(cleanup, rc = PTR_ERR(de_tgt_dir));
+        if (IS_ERR(de_tgt_dir)) {
+                rc = PTR_ERR(de_tgt_dir);
+                de_tgt_dir = NULL;
+                GOTO(cleanup, rc);
+        }
 
         cleanup_phase = 2; /* target directory dentry */
 
@@ -1589,8 +1594,11 @@ static int mds_get_parents_children_locked(struct obd_device *obd,
                 *de_tgtdirp = dget(*de_srcdirp);
         } else {
                 *de_tgtdirp = mds_fid2dentry(mds, p2_fid, NULL);
-                if (IS_ERR(*de_tgtdirp))
-                        GOTO(cleanup, rc = PTR_ERR(*de_tgtdirp));
+                if (IS_ERR(*de_tgtdirp)) {
+                        rc = PTR_ERR(*de_tgtdirp);
+                        *de_tgtdirp = NULL;
+                        GOTO(cleanup, rc);
+                }
         }
 
         cleanup_phase = 2; /* target directory dentry */
index 7fa8003..3978cb8 100644 (file)
@@ -362,16 +362,17 @@ static int obd_class_ioctl(struct inode *inode, struct file *filp,
 
 /* declare character device */
 static struct file_operations obd_psdev_fops = {
-        ioctl:   obd_class_ioctl,       /* ioctl */
-        open:    obd_class_open,        /* open */
-        release: obd_class_release,     /* release */
+        .owner   = THIS_MODULE,
+        .ioctl   = obd_class_ioctl,     /* ioctl */
+        .open    = obd_class_open,      /* open */
+        .release = obd_class_release,   /* release */
 };
 
 /* modules setup */
 static struct miscdevice obd_psdev = {
-        OBD_MINOR,
-        "obd_psdev",
-        &obd_psdev_fops
+        .minor = OBD_MINOR,
+        .name  = "obd_psdev",
+        .fops  = &obd_psdev_fops,
 };
 #else
 void *obd_psdev = NULL;
@@ -533,9 +534,10 @@ static int obd_device_list_open(struct inode *inode, struct file *file)
 }
 
 struct file_operations obd_device_list_fops = {
-        .open = obd_device_list_open,
-        .read = seq_read,
-        .llseek = seq_lseek,
+        .owner   = THIS_MODULE,
+        .open    = obd_device_list_open,
+        .read    = seq_read,
+        .llseek  = seq_lseek,
         .release = seq_release,
 };
 #endif
@@ -602,12 +604,14 @@ int init_obdclass(void)
         return 0;
 }
 
+/* liblustre doesn't call cleanup_obdclass, apparently.  we carry on in this
+ * ifdef to the end of the file to cover module and versioning goo.*/
+#ifdef __KERNEL__
+
 static void cleanup_obdclass(void)
 {
         int i;
-#ifndef __KERNEL__
         int leaked;
-#endif
         ENTRY;
 
         misc_deregister(&obd_psdev);
@@ -621,9 +625,7 @@ static void cleanup_obdclass(void)
         }
 
         obd_cleanup_caches();
-#ifdef __KERNEL__
         obd_sysctl_clean();
-#endif
 #ifdef LPROCFS
         if (proc_lustre_root) {
                 lprocfs_remove(proc_lustre_root);
@@ -634,18 +636,15 @@ static void cleanup_obdclass(void)
         class_handle_cleanup();
         class_exit_uuidlist();
 
-#ifndef __KERNEL__
         leaked = atomic_read(&obd_memory);
         CDEBUG(leaked ? D_ERROR : D_INFO,
                "obd mem max: %d leaked: %d\n", obd_memmax, leaked);
-#endif
 
         EXIT;
 }
 
 /* Check that we're building against the appropriate version of the Lustre
  * kernel patch */
-#ifdef __KERNEL__
 #include <linux/lustre_version.h>
 #define LUSTRE_MIN_VERSION 28
 #define LUSTRE_MAX_VERSION 34
@@ -654,11 +653,7 @@ static void cleanup_obdclass(void)
 #elif (LUSTRE_KERNEL_VERSION > LUSTRE_MAX_VERSION)
 # error Cannot continue: Your Lustre sources are older than the kernel patch
 #endif
- #else
-# warning "Lib Lustre - no versioning information"
-#endif
 
-#ifdef __KERNEL__
 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
 MODULE_DESCRIPTION("Lustre Class Driver Build Version: " BUILD_VERSION);
 MODULE_LICENSE("GPL");
index e3edd02..a45e57d 100644 (file)
@@ -610,11 +610,14 @@ static int llog_test_cleanup(struct obd_device *obd, int flags)
         if (rc)
                 CERROR("failed to llog_test_llog_finish: %d\n", rc);
 
+        lprocfs_obd_cleanup(obd);
+
         return rc;
 }
 
 static int llog_test_setup(struct obd_device *obd, obd_count len, void *buf)
 {
+        struct lprocfs_static_vars lvars;
         struct lustre_cfg *lcfg = buf;
         struct obd_device *tgt;
         int rc;
@@ -641,30 +644,15 @@ static int llog_test_setup(struct obd_device *obd, obd_count len, void *buf)
         rc = llog_run_tests(obd);
         if (rc)
                 llog_test_cleanup(obd, 0);
-        RETURN(rc);
-}
-
-static struct lprocfs_vars lprocfs_ost_obd_vars[] = { {0} };
-static struct lprocfs_vars lprocfs_ost_module_vars[] = { {0} };
-LPROCFS_INIT_VARS(ost, lprocfs_ost_module_vars, lprocfs_ost_obd_vars)
-
-static int llog_test_attach(struct obd_device *dev, obd_count len, void *data)
-{
-        struct lprocfs_static_vars lvars;
 
-        lprocfs_init_vars(ost, &lvars);
-        return lprocfs_obd_attach(dev, lvars.obd_vars);
-}
+        lprocfs_init_vars(llog_test, &lvars);
+        lprocfs_obd_setup(obd, lvars.obd_vars);
 
-static int llog_test_detach(struct obd_device *dev)
-{
-        return lprocfs_obd_detach(dev);
+        RETURN(rc);
 }
 
 static struct obd_ops llog_obd_ops = {
         o_owner:       THIS_MODULE,
-        o_attach:      llog_test_attach,
-        o_detach:      llog_test_detach,
         o_setup:       llog_test_setup,
         o_cleanup:     llog_test_cleanup,
         o_llog_init:   llog_test_llog_init,
index a90a6e1..fcfb991 100644 (file)
@@ -315,20 +315,13 @@ int lprocfs_rd_filesfree(char *page, char **start, off_t off, int count,
         return rc;
 }
 
-int lprocfs_rd_filegroups(char *page, char **start, off_t off, int count,
-                          int *eof, void *data)
-{
-        *eof = 1;
-        return snprintf(page, count, "unimplemented\n");
-}
-
 int lprocfs_rd_server_uuid(char *page, char **start, off_t off, int count,
                            int *eof, void *data)
 {
         struct obd_device *obd = (struct obd_device *)data;
         struct obd_import *imp;
         char *imp_state_name = NULL;
-        
+
         LASSERT(obd != NULL);
         imp = obd->u.cli.cl_import;
         imp_state_name = ptlrpc_import_state_name(imp->imp_state);
@@ -350,6 +343,16 @@ int lprocfs_rd_conn_uuid(char *page, char **start, off_t off, int count,
         return snprintf(page, count, "%s\n", conn->c_remote_uuid.uuid);
 }
 
+int lprocfs_rd_num_exports(char *page, char **start, off_t off, int count,
+                           int *eof,  void *data)
+{
+        struct obd_device *obd = (struct obd_device*)data;
+
+        LASSERT(obd != NULL);
+        *eof = 1;
+        return snprintf(page, count, "%u\n", obd->obd_num_exports);
+}
+
 int lprocfs_rd_numrefs(char *page, char **start, off_t off, int count,
                        int *eof, void *data)
 {
@@ -360,29 +363,30 @@ int lprocfs_rd_numrefs(char *page, char **start, off_t off, int count,
         return snprintf(page, count, "%d\n", class->typ_refcnt);
 }
 
-int lprocfs_obd_attach(struct obd_device *dev, struct lprocfs_vars *list)
+int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list)
 {
         int rc = 0;
 
-        LASSERT(dev != NULL);
-        LASSERT(dev->obd_type != NULL);
-        LASSERT(dev->obd_type->typ_procroot != NULL);
-
-        dev->obd_proc_entry = lprocfs_register(dev->obd_name,
-                                               dev->obd_type->typ_procroot,
-                                               list, dev);
-        if (IS_ERR(dev->obd_proc_entry)) {
-                rc = PTR_ERR(dev->obd_proc_entry);
-                dev->obd_proc_entry = NULL;
+        LASSERT(obd != NULL);
+        LASSERT(obd->obd_type != NULL);
+        LASSERT(obd->obd_type->typ_procroot != NULL);
+
+        obd->obd_proc_entry = lprocfs_register(obd->obd_name,
+                                               obd->obd_type->typ_procroot,
+                                               list, obd);
+        if (IS_ERR(obd->obd_proc_entry)) {
+                rc = PTR_ERR(obd->obd_proc_entry);
+                CERROR("error %d setting up lprocfs for %s\n",rc,obd->obd_name);
+                obd->obd_proc_entry = NULL;
         }
         return rc;
 }
 
-int lprocfs_obd_detach(struct obd_device *dev)
+int lprocfs_obd_cleanup(struct obd_device *obd)
 {
-        if (dev && dev->obd_proc_entry) {
-                lprocfs_remove(dev->obd_proc_entry);
-                dev->obd_proc_entry = NULL;
+        if (obd && obd->obd_proc_entry) {
+                lprocfs_remove(obd->obd_proc_entry);
+                obd->obd_proc_entry = NULL;
         }
         return 0;
 }
@@ -538,6 +542,7 @@ static int lprocfs_stats_seq_open(struct inode *inode, struct file *file)
 }
 
 struct file_operations lprocfs_stats_seq_fops = {
+        owner:   THIS_MODULE,
         open:    lprocfs_stats_seq_open,
         read:    seq_read,
         llseek:  seq_lseek,
@@ -788,8 +793,8 @@ EXPORT_SYMBOL(lprocfs_register);
 EXPORT_SYMBOL(lprocfs_srch);
 EXPORT_SYMBOL(lprocfs_remove);
 EXPORT_SYMBOL(lprocfs_add_vars);
-EXPORT_SYMBOL(lprocfs_obd_attach);
-EXPORT_SYMBOL(lprocfs_obd_detach);
+EXPORT_SYMBOL(lprocfs_obd_setup);
+EXPORT_SYMBOL(lprocfs_obd_cleanup);
 EXPORT_SYMBOL(lprocfs_alloc_stats);
 EXPORT_SYMBOL(lprocfs_free_stats);
 EXPORT_SYMBOL(lprocfs_register_stats);
@@ -802,6 +807,7 @@ EXPORT_SYMBOL(lprocfs_rd_name);
 EXPORT_SYMBOL(lprocfs_rd_fstype);
 EXPORT_SYMBOL(lprocfs_rd_server_uuid);
 EXPORT_SYMBOL(lprocfs_rd_conn_uuid);
+EXPORT_SYMBOL(lprocfs_rd_num_exports);
 EXPORT_SYMBOL(lprocfs_rd_numrefs);
 
 EXPORT_SYMBOL(lprocfs_rd_blksize);
@@ -810,7 +816,6 @@ EXPORT_SYMBOL(lprocfs_rd_kbytesfree);
 EXPORT_SYMBOL(lprocfs_rd_kbytesavail);
 EXPORT_SYMBOL(lprocfs_rd_filestotal);
 EXPORT_SYMBOL(lprocfs_rd_filesfree);
-EXPORT_SYMBOL(lprocfs_rd_filegroups);
 
 EXPORT_SYMBOL(lprocfs_write_helper);
 EXPORT_SYMBOL(lprocfs_write_u64_helper);
index f6e094e..808bb41 100644 (file)
@@ -440,69 +440,56 @@ commitrw_cleanup:
         return rc;
 }
 
-static int echo_setup(struct obd_device *obddev, obd_count len, void *buf)
+static int echo_setup(struct obd_device *obd, obd_count len, void *buf)
 {
+        struct lprocfs_static_vars lvars;
         ENTRY;
 
-        spin_lock_init(&obddev->u.echo.eo_lock);
-        obddev->u.echo.eo_lastino = ECHO_INIT_OBJID;
+        spin_lock_init(&obd->u.echo.eo_lock);
+        obd->u.echo.eo_lastino = ECHO_INIT_OBJID;
 
-        obddev->obd_namespace =
-                ldlm_namespace_new("echo-tgt", LDLM_NAMESPACE_SERVER);
-        if (obddev->obd_namespace == NULL) {
+        obd->obd_namespace = ldlm_namespace_new("echo-tgt",
+                                                LDLM_NAMESPACE_SERVER);
+        if (obd->obd_namespace == NULL) {
                 LBUG();
                 RETURN(-ENOMEM);
         }
 
+        lprocfs_init_vars(echo, &lvars);
+        if (lprocfs_obd_setup(obd, lvars.obd_vars) == 0 &&
+            lprocfs_alloc_obd_stats(obd, LPROC_ECHO_LAST) == 0) {
+                lprocfs_counter_init(obd->obd_stats, LPROC_ECHO_READ_BYTES,
+                                     LPROCFS_CNTR_AVGMINMAX,
+                                     "read_bytes", "bytes");
+                lprocfs_counter_init(obd->obd_stats, LPROC_ECHO_WRITE_BYTES,
+                                     LPROCFS_CNTR_AVGMINMAX,
+                                     "write_bytes", "bytes");
+        }
+
         ptlrpc_init_client (LDLM_CB_REQUEST_PORTAL, LDLM_CB_REPLY_PORTAL,
-                            "echo_ldlm_cb_client", &obddev->obd_ldlm_client);
+                            "echo_ldlm_cb_client", &obd->obd_ldlm_client);
         RETURN(0);
 }
 
-static int echo_cleanup(struct obd_device *obddev, int flags)
+static int echo_cleanup(struct obd_device *obd, int flags)
 {
-        int     leaked;
+        int leaked;
         ENTRY;
 
-        ldlm_namespace_free(obddev->obd_namespace, flags & OBD_OPT_FORCE);
+        lprocfs_free_obd_stats(obd);
+        lprocfs_obd_cleanup(obd);
+
+        ldlm_namespace_free(obd->obd_namespace, flags & OBD_OPT_FORCE);
 
-        leaked = atomic_read(&obddev->u.echo.eo_prep);
+        leaked = atomic_read(&obd->u.echo.eo_prep);
         if (leaked != 0)
                 CERROR("%d prep/commitrw pages leaked\n", leaked);
 
         RETURN(0);
 }
 
-int echo_attach(struct obd_device *obd, obd_count len, void *data)
-{
-        struct lprocfs_static_vars lvars;
-        int rc;
-
-        lprocfs_init_vars(echo, &lvars);
-        rc = lprocfs_obd_attach(obd, lvars.obd_vars);
-        if (rc != 0)
-                return rc;
-        rc = lprocfs_alloc_obd_stats(obd, LPROC_ECHO_LAST);
-        if (rc != 0)
-                return rc;
-
-        lprocfs_counter_init(obd->obd_stats, LPROC_ECHO_READ_BYTES,
-                             LPROCFS_CNTR_AVGMINMAX, "read_bytes", "bytes");
-        lprocfs_counter_init(obd->obd_stats, LPROC_ECHO_WRITE_BYTES,
-                             LPROCFS_CNTR_AVGMINMAX, "write_bytes", "bytes");
-        return rc;
-}
-
-int echo_detach(struct obd_device *dev)
-{
-        lprocfs_free_obd_stats(dev);
-        return lprocfs_obd_detach(dev);
-}
-
 static struct obd_ops echo_obd_ops = {
         o_owner:           THIS_MODULE,
-        o_attach:          echo_attach,
-        o_detach:          echo_detach,
         o_connect:         echo_connect,
         o_disconnect:      echo_disconnect,
         o_destroy_export:  echo_destroy_export,
index 3aba19a..6673ddb 100644 (file)
@@ -520,48 +520,51 @@ err_fsd:
 static int filter_cleanup_groups(struct obd_device *obd)
 {
         struct filter_obd *filter = &obd->u.filter;
+        struct file *filp;
+        struct dentry *dentry;
         int i;
         ENTRY;
 
-        if (filter->fo_dentry_O_groups != NULL &&
-            filter->fo_last_objids != NULL &&
-            filter->fo_last_objid_files != NULL) {
+        if (filter->fo_dentry_O_groups != NULL) {
                 for (i = 0; i < FILTER_GROUPS; i++) {
-                        struct dentry *dentry = filter->fo_dentry_O_groups[i];
-                        struct file *filp = filter->fo_last_objid_files[i];
-                        if (dentry != NULL) {
+                        dentry = filter->fo_dentry_O_groups[i];
+                        if (dentry != NULL)
                                 f_dput(dentry);
-                                filter->fo_dentry_O_groups[i] = NULL;
-                        }
-                        if (filp != NULL) {
+                }
+                OBD_FREE(filter->fo_dentry_O_groups,
+                         FILTER_GROUPS * sizeof(*filter->fo_dentry_O_groups));
+                filter->fo_dentry_O_groups = NULL;
+        }
+        if (filter->fo_last_objid_files != NULL) {
+                for (i = 0; i < FILTER_GROUPS; i++) {
+                        filp = filter->fo_last_objid_files[i];
+                        if (filp != NULL)
                                 filp_close(filp, 0);
-                                filter->fo_last_objid_files[i] = NULL;
-                        }
                 }
+                OBD_FREE(filter->fo_last_objid_files,
+                         FILTER_GROUPS * sizeof(*filter->fo_last_objid_files));
+                filter->fo_last_objid_files = NULL;
         }
-        if (filter->fo_dentry_O_sub != NULL && filter->fo_subdir_count) {
+        if (filter->fo_dentry_O_sub != NULL) {
                 for (i = 0; i < filter->fo_subdir_count; i++) {
-                        struct dentry *dentry = filter->fo_dentry_O_sub[i];
-                        if (dentry != NULL) {
+                        dentry = filter->fo_dentry_O_sub[i];
+                        if (dentry != NULL)
                                 f_dput(dentry);
-                                filter->fo_dentry_O_sub[i] = NULL;
-                        }
                 }
                 OBD_FREE(filter->fo_dentry_O_sub,
                          filter->fo_subdir_count *
                          sizeof(*filter->fo_dentry_O_sub));
+                filter->fo_dentry_O_sub = NULL;
         }
-        if (filter->fo_dentry_O_groups != NULL)
-                OBD_FREE(filter->fo_dentry_O_groups,
-                         FILTER_GROUPS * sizeof(struct dentry *));
-        if (filter->fo_last_objids != NULL)
+        if (filter->fo_last_objids != NULL) {
                 OBD_FREE(filter->fo_last_objids,
-                         FILTER_GROUPS * sizeof(__u64));
-        if (filter->fo_last_objid_files != NULL)
-                OBD_FREE(filter->fo_last_objid_files,
-                         FILTER_GROUPS * sizeof(struct file *));
-        if (filter->fo_dentry_O != NULL)
+                         FILTER_GROUPS * sizeof(*filter->fo_last_objids));
+                filter->fo_last_objids = NULL;
+        }
+        if (filter->fo_dentry_O != NULL) {
                 f_dput(filter->fo_dentry_O);
+                filter->fo_dentry_O = NULL;
+        }
         RETURN(0);
 }
 
@@ -623,13 +626,13 @@ static int filter_prep_groups(struct obd_device *obd)
                 GOTO(cleanup_O0, rc);
 
         cleanup_O0:
-                dput(O0_dentry);
+                f_dput(O0_dentry);
         cleanup_R:
-                dput(dentry);
+                f_dput(dentry);
                 if (rc)
                         GOTO(cleanup, rc);
         } else {
-                dput(dentry);
+                f_dput(dentry);
         }
 
         OBD_ALLOC(filter->fo_last_objids, FILTER_GROUPS * sizeof(__u64));
@@ -1246,6 +1249,7 @@ err_ops:
 
 static int filter_setup(struct obd_device *obd, obd_count len, void *buf)
 {
+        struct lprocfs_static_vars lvars;
         struct lustre_cfg* lcfg = buf;
         const char *str = NULL;
         char *option = NULL;
@@ -1272,6 +1276,21 @@ static int filter_setup(struct obd_device *obd, obd_count len, void *buf)
         rc = filter_common_setup(obd, len, buf, option);
         if (option)
                 OBD_FREE(option, n);
+
+        lprocfs_init_vars(filter, &lvars);
+        if (rc == 0 && lprocfs_obd_setup(obd, lvars.obd_vars) == 0 &&
+            lprocfs_alloc_obd_stats(obd, LPROC_FILTER_LAST) == 0) {
+                /* Init obdfilter private stats here */
+                lprocfs_counter_init(obd->obd_stats, LPROC_FILTER_READ_BYTES,
+                                     LPROCFS_CNTR_AVGMINMAX,
+                                     "read_bytes", "bytes");
+                lprocfs_counter_init(obd->obd_stats, LPROC_FILTER_WRITE_BYTES,
+                                     LPROCFS_CNTR_AVGMINMAX,
+                                     "write_bytes", "bytes");
+
+                lproc_filter_attach_seqstat(obd);
+        }
+
         return rc;
 }
 
@@ -1298,6 +1317,9 @@ static int filter_cleanup(struct obd_device *obd, int flags)
         if (filter->fo_sb == NULL)
                 RETURN(0);
 
+        lprocfs_free_obd_stats(obd);
+        lprocfs_obd_cleanup(obd);
+
         filter_post(obd);
 
         shrink_dcache_parent(filter->fo_sb->s_root);
@@ -1320,35 +1342,6 @@ static int filter_cleanup(struct obd_device *obd, int flags)
         RETURN(0);
 }
 
-static int filter_attach(struct obd_device *obd, obd_count len, void *data)
-{
-        struct lprocfs_static_vars lvars;
-        int rc;
-
-        lprocfs_init_vars(filter, &lvars);
-        rc = lprocfs_obd_attach(obd, lvars.obd_vars);
-        if (rc != 0)
-                return rc;
-
-        rc = lprocfs_alloc_obd_stats(obd, LPROC_FILTER_LAST);
-        if (rc != 0)
-                return rc;
-
-        /* Init obdfilter private stats here */
-        lprocfs_counter_init(obd->obd_stats, LPROC_FILTER_READ_BYTES,
-                             LPROCFS_CNTR_AVGMINMAX, "read_bytes", "bytes");
-        lprocfs_counter_init(obd->obd_stats, LPROC_FILTER_WRITE_BYTES,
-                             LPROCFS_CNTR_AVGMINMAX, "write_bytes", "bytes");
-
-        return lproc_filter_attach_seqstat(obd);
-}
-
-static int filter_detach(struct obd_device *dev)
-{
-        lprocfs_free_obd_stats(dev);
-        return lprocfs_obd_detach(dev);
-}
-
 /* nearly identical to mds_connect */
 static int filter_connect(struct lustre_handle *conn, struct obd_device *obd,
                           struct obd_uuid *cluuid)
@@ -1413,7 +1406,7 @@ static int filter_precleanup(struct obd_device *obd, int flags)
 /* Do extra sanity checks for grant accounting.  We do this at connect,
  * disconnect, and statfs RPC time, so it shouldn't be too bad.  We can
  * always get rid of it or turn it off when we know accounting is good. */
-static void filter_grant_sanity_check(struct obd_device *obd, char *func)
+static void filter_grant_sanity_check(struct obd_device *obd, const char *func)
 {
         struct filter_export_data *fed;
         struct obd_export *exp;
@@ -2385,8 +2378,6 @@ static struct lvfs_callback_ops filter_lvfs_ops = {
 
 static struct obd_ops filter_obd_ops = {
         o_owner:          THIS_MODULE,
-        o_attach:         filter_attach,
-        o_detach:         filter_detach,
         o_get_info:       filter_get_info,
         o_set_info:       filter_set_info,
         o_setup:          filter_setup,
@@ -2413,8 +2404,6 @@ static struct obd_ops filter_obd_ops = {
 
 static struct obd_ops filter_sanobd_ops = {
         o_owner:          THIS_MODULE,
-        o_attach:         filter_attach,
-        o_detach:         filter_detach,
         o_get_info:       filter_get_info,
         o_set_info:       filter_set_info,
         o_setup:          filter_san_setup,
index 5ce65c7..3794bba 100644 (file)
@@ -109,7 +109,7 @@ int filter_commitrw_write(struct obd_export *exp, struct obdo *oa, int objcount,
         int i, k, cleanup_phase = 0, err;
         unsigned long now = jiffies; /* DEBUGGING OST TIMEOUTS */
         int blocks_per_page;
-        struct dio_request *dreq;
+        struct dio_request *dreq = NULL;
         struct bio *bio = NULL;
         ENTRY;
         LASSERT(oti != NULL);
index 23f672b..3ca1fad 100644 (file)
@@ -70,18 +70,19 @@ static int filter_lvbo_init(struct ldlm_resource *res)
                 GOTO(out, rc = PTR_ERR(dentry));
 
         if (dentry->d_inode == NULL)
-                GOTO(out, rc = -ENOENT);
+                GOTO(out_dentry, rc = -ENOENT);
 
         lvb->lvb_size = dentry->d_inode->i_size;
         lvb->lvb_mtime = LTIME_S(dentry->d_inode->i_mtime);
         lvb->lvb_blocks = dentry->d_inode->i_blocks;
-        f_dput(dentry);
 
         CDEBUG(D_DLMTRACE, "res: "LPU64" initial lvb size: "LPU64", "
                "mtime: "LPU64", blocks: "LPU64"\n",
                res->lr_name.name[0], lvb->lvb_size,
                lvb->lvb_mtime, lvb->lvb_blocks);
 
+ out_dentry:
+        f_dput(dentry);
  out:
         /* Don't free lvb data on lookup error */
         up(&res->lr_lvb_sem);
@@ -157,6 +158,9 @@ static int filter_lvbo_update(struct ldlm_resource *res, struct lustre_msg *m,
         if (IS_ERR(dentry))
                 GOTO(out, rc = PTR_ERR(dentry));
 
+        if (dentry->d_inode == NULL)
+                GOTO(out_dentry, rc = -ENOENT);
+
         if (dentry->d_inode->i_size > lvb->lvb_size || !increase) {
                 CDEBUG(D_DLMTRACE, "res: "LPU64" updating lvb size from disk: "
                        LPU64" -> %llu\n", res->lr_name.name[0],
@@ -175,15 +179,14 @@ static int filter_lvbo_update(struct ldlm_resource *res, struct lustre_msg *m,
                lvb->lvb_blocks, dentry->d_inode->i_blocks);
         lvb->lvb_blocks = dentry->d_inode->i_blocks;
 
+out_dentry:
         f_dput(dentry);
 
- out:
+out:
         up(&res->lr_lvb_sem);
         return rc;
 }
 
-
-
 struct ldlm_valblock_ops filter_lvbo = {
         lvbo_init: filter_lvbo_init,
         lvbo_update: filter_lvbo_update
index 6fae59d..8f64926 100644 (file)
@@ -34,10 +34,47 @@ static struct lprocfs_vars lprocfs_obd_vars[]  = { {0} };
 static struct lprocfs_vars lprocfs_module_vars[] = { {0} };
 #else
 
+static int lprocfs_filter_rd_groups(char *page, char **start, off_t off,
+                                    int count, int *eof, void *data)
+{
+        *eof = 1;
+        return snprintf(page, count, "%u\n", FILTER_GROUPS);
+}
+
+static int lprocfs_filter_rd_tot_dirty(char *page, char **start, off_t off,
+                                       int count, int *eof, void *data)
+{
+        struct obd_device *obd = (struct obd_device *)data;
+
+        LASSERT(obd != NULL);
+        *eof = 1;
+        return snprintf(page, count, LPU64"\n", obd->u.filter.fo_tot_dirty);
+}
+
+static int lprocfs_filter_rd_tot_granted(char *page, char **start, off_t off,
+                                         int count, int *eof, void *data)
+{
+        struct obd_device *obd = (struct obd_device *)data;
+
+        LASSERT(obd != NULL);
+        *eof = 1;
+        return snprintf(page, count, LPU64"\n", obd->u.filter.fo_tot_granted);
+}
+
+static int lprocfs_filter_rd_tot_pending(char *page, char **start, off_t off,
+                                         int count, int *eof, void *data)
+{
+        struct obd_device *obd = (struct obd_device *)data;
+
+        LASSERT(obd != NULL);
+        *eof = 1;
+        return snprintf(page, count, LPU64"\n", obd->u.filter.fo_tot_pending);
+}
+
 static int lprocfs_filter_rd_mntdev(char *page, char **start, off_t off,
                                     int count, int *eof, void *data)
 {
-        struct obd_deviceobd = (struct obd_device *)data;
+        struct obd_device *obd = (struct obd_device *)data;
 
         LASSERT(obd != NULL);
         LASSERT(obd->u.filter.fo_vfsmnt->mnt_devname);
@@ -92,10 +129,14 @@ static struct lprocfs_vars lprocfs_obd_vars[] = {
         { "kbytesavail",  lprocfs_rd_kbytesavail,   0, 0 },
         { "filestotal",   lprocfs_rd_filestotal,    0, 0 },
         { "filesfree",    lprocfs_rd_filesfree,     0, 0 },
-        //{ "filegroups",   lprocfs_rd_filegroups,    0, 0 },
+        { "filegroups",   lprocfs_filter_rd_groups, 0, 0 },
         { "fstype",       lprocfs_rd_fstype,        0, 0 },
         { "mntdev",       lprocfs_filter_rd_mntdev, 0, 0 },
         { "last_id",      lprocfs_filter_rd_last_id,0, 0 },
+        { "tot_dirty",    lprocfs_filter_rd_tot_dirty,   0, 0 },
+        { "tot_pending",  lprocfs_filter_rd_tot_pending, 0, 0 },
+        { "tot_granted",  lprocfs_filter_rd_tot_granted, 0, 0 },
+        { "num_exports",  lprocfs_rd_num_exports,   0, 0 },
         { "readcache_max_filesize",
                           lprocfs_filter_rd_readcache,
                           lprocfs_filter_wr_readcache, 0 },
@@ -137,7 +178,7 @@ void filter_tally_write(struct filter_obd *filter, struct page **pages,
         lprocfs_oh_tally(&filter->fo_w_discont_blocks, discont_blocks);
 }
 
-void filter_tally_read(struct filter_obd *filter, struct niobuf_local *lnb, 
+void filter_tally_read(struct filter_obd *filter, struct niobuf_local *lnb,
                        int niocount)
 {
         struct niobuf_local *end;
@@ -156,7 +197,7 @@ void filter_tally_read(struct filter_obd *filter, struct niobuf_local *lnb,
                         /* XXX not so smart for now */
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
                         if ((page->buffers && last_page->buffers) &&
-                            (page->buffers->b_blocknr != 
+                            (page->buffers->b_blocknr !=
                              (last_page->buffers->b_blocknr + 1)))
                                 discont_blocks++;
 #else
@@ -202,9 +243,9 @@ static int filter_brw_stats_seq_show(struct seq_file *seq, void *v)
                 unsigned long w = filter->fo_w_pages.oh_buckets[i];
                 read_cum += r;
                 write_cum += w;
-                seq_printf(seq, "%d:\t\t%10lu %3lu %3lu   | %10lu %3lu %3lu\n", 
-                                 1 << i, r, pct(r, read_tot), 
-                                 pct(read_cum, read_tot), w, 
+                seq_printf(seq, "%d:\t\t%10lu %3lu %3lu   | %10lu %3lu %3lu\n",
+                                 1 << i, r, pct(r, read_tot),
+                                 pct(read_cum, read_tot), w,
                                  pct(w, write_tot),
                                  pct(write_cum, write_tot));
                 if (read_cum == read_tot && write_cum == write_tot)
@@ -226,9 +267,9 @@ static int filter_brw_stats_seq_show(struct seq_file *seq, void *v)
                 unsigned long w = filter->fo_w_discont_pages.oh_buckets[i];
                 read_cum += r;
                 write_cum += w;
-                seq_printf(seq, "%d:\t\t%10lu %3lu %3lu   | %10lu %3lu %3lu\n", 
-                                 i, r, pct(r, read_tot), 
-                                 pct(read_cum, read_tot), w, 
+                seq_printf(seq, "%d:\t\t%10lu %3lu %3lu   | %10lu %3lu %3lu\n",
+                                 i, r, pct(r, read_tot),
+                                 pct(read_cum, read_tot), w,
                                  pct(w, write_tot),
                                  pct(write_cum, write_tot));
                 if (read_cum == read_tot && write_cum == write_tot)
@@ -249,9 +290,9 @@ static int filter_brw_stats_seq_show(struct seq_file *seq, void *v)
                 unsigned long w = filter->fo_w_discont_blocks.oh_buckets[i];
                 read_cum += r;
                 write_cum += w;
-                seq_printf(seq, "%d:\t\t%10lu %3lu %3lu   | %10lu %3lu %3lu\n", 
-                                 i, r, pct(r, read_tot), 
-                                 pct(read_cum, read_tot), w, 
+                seq_printf(seq, "%d:\t\t%10lu %3lu %3lu   | %10lu %3lu %3lu\n",
+                                 i, r, pct(r, read_tot),
+                                 pct(read_cum, read_tot), w,
                                  pct(w, write_tot),
                                  pct(write_cum, write_tot));
                 if (read_cum == read_tot && write_cum == write_tot)
@@ -288,7 +329,7 @@ static int filter_brw_stats_seq_open(struct inode *inode, struct file *file)
         struct proc_dir_entry *dp = PDE(inode);
         struct seq_file *seq;
         int rc;
+
         rc = seq_open(file, &filter_brw_stats_seq_sops);
         if (rc)
                 return rc;
@@ -315,6 +356,7 @@ static ssize_t filter_brw_stats_seq_write(struct file *file, const char *buf,
 }
 
 struct file_operations filter_brw_stats_fops = {
+        .owner   = THIS_MODULE,
         .open    = filter_brw_stats_seq_open,
         .read    = seq_read,
         .write   = filter_brw_stats_seq_write,
@@ -324,11 +366,11 @@ struct file_operations filter_brw_stats_fops = {
 
 int lproc_filter_attach_seqstat(struct obd_device *dev)
 {
-        return lprocfs_obd_seq_create(dev, "brw_stats", 0444, 
+        return lprocfs_obd_seq_create(dev, "brw_stats", 0444,
                                       &filter_brw_stats_fops, dev);
 }
 
 
 
 #endif /* LPROCFS */
-LPROCFS_INIT_VARS(filter,lprocfs_module_vars, lprocfs_obd_vars)
+LPROCFS_INIT_VARS(filter, lprocfs_module_vars, lprocfs_obd_vars)
index 93b4276..88b4d2a 100644 (file)
@@ -306,7 +306,7 @@ static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v)
         rpcs = cli->cl_brw_in_flight;
         r = cli->cl_pending_r_pages;
         w = cli->cl_pending_w_pages;
-                                                                                
+
         seq_printf(seq, "snapshot_time:         %lu:%lu (secs:usecs)\n",
                    now.tv_sec, now.tv_usec);
         seq_printf(seq, "RPCs in flight:        %d\n", rpcs);
@@ -327,9 +327,9 @@ static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v)
                 unsigned long w = cli->cl_write_page_hist.oh_buckets[i];
                 read_cum += r;
                 write_cum += w;
-                seq_printf(seq, "%d:\t\t%10lu %3lu %3lu   | %10lu %3lu %3lu\n", 
-                                 1 << i, r, pct(r, read_tot), 
-                                 pct(read_cum, read_tot), w, 
+                seq_printf(seq, "%d:\t\t%10lu %3lu %3lu   | %10lu %3lu %3lu\n",
+                                 1 << i, r, pct(r, read_tot),
+                                 pct(read_cum, read_tot), w,
                                  pct(w, write_tot),
                                  pct(write_cum, write_tot));
                 if (read_cum == read_tot && write_cum == write_tot)
@@ -350,9 +350,9 @@ static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v)
                 unsigned long w = cli->cl_write_rpc_hist.oh_buckets[i];
                 read_cum += r;
                 write_cum += w;
-                seq_printf(seq, "%d:\t\t%10lu %3lu %3lu   | %10lu %3lu %3lu\n", 
-                                 i, r, pct(r, read_tot), 
-                                 pct(read_cum, read_tot), w, 
+                seq_printf(seq, "%d:\t\t%10lu %3lu %3lu   | %10lu %3lu %3lu\n",
+                                 i, r, pct(r, read_tot),
+                                 pct(read_cum, read_tot), w,
                                  pct(w, write_tot),
                                  pct(write_cum, write_tot));
                 if (read_cum == read_tot && write_cum == write_tot)
@@ -391,7 +391,7 @@ static int osc_rpc_stats_seq_open(struct inode *inode, struct file *file)
         struct proc_dir_entry *dp = PDE(inode);
         struct seq_file *seq;
         int rc;
+
         rc = seq_open(file, &osc_rpc_stats_seq_sops);
         if (rc)
                 return rc;
@@ -416,6 +416,7 @@ static ssize_t osc_rpc_stats_seq_write(struct file *file, const char *buf,
 }
 
 struct file_operations osc_rpc_stats_fops = {
+        .owner   = THIS_MODULE,
         .open    = osc_rpc_stats_seq_open,
         .read    = seq_read,
         .write   = osc_rpc_stats_seq_write,
@@ -425,10 +426,9 @@ struct file_operations osc_rpc_stats_fops = {
 
 int lproc_osc_attach_seqstat(struct obd_device *dev)
 {
-        return lprocfs_obd_seq_create(dev, "rpc_stats", 0444, 
+        return lprocfs_obd_seq_create(dev, "rpc_stats", 0444,
                                       &osc_rpc_stats_fops, dev);
 }
 
-
 #endif /* LPROCFS */
-LPROCFS_INIT_VARS(osc,lprocfs_module_vars, lprocfs_obd_vars)
+LPROCFS_INIT_VARS(osc, lprocfs_module_vars, lprocfs_obd_vars)
index 3e81873..c8961b1 100644 (file)
 #include <linux/lustre_log.h>
 #include "osc_internal.h"
 
-
-static int osc_attach(struct obd_device *dev, obd_count len, void *data)
-{
-        struct lprocfs_static_vars lvars;
-        int rc;
-        ENTRY;
-
-        lprocfs_init_vars(osc,&lvars);
-        rc = lprocfs_obd_attach(dev, lvars.obd_vars);
-        if (rc < 0)
-                RETURN(rc);
-
-        rc = lproc_osc_attach_seqstat(dev);
-        if (rc < 0) {
-                lprocfs_obd_detach(dev);
-                RETURN(rc);
-        }
-
-        ptlrpc_lprocfs_register_obd(dev);
-        RETURN(0);
-}
-
-static int osc_detach(struct obd_device *dev)
-{
-        ptlrpc_lprocfs_unregister_obd(dev);
-        return lprocfs_obd_detach(dev);
-}
-
-
 /* Pack OSC object metadata for disk storage (LE byte order). */
 static int osc_packmd(struct obd_export *exp, struct lov_mds_md **lmmp,
                       struct lov_stripe_md *lsm)
@@ -2630,9 +2601,15 @@ static int osc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
         struct obd_ioctl_data *data = karg;
         int err = 0;
         ENTRY;
-        
-        MOD_INC_USE_COUNT;
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+        MOD_INC_USE_COUNT;
+#else
+       if (!try_module_get(THIS_MODULE)) {
+               CERROR("Can't get module. Is it alive?");
+               return -EINVAL;
+       }
+#endif
         switch (cmd) {
         case OBD_IOC_LOV_GET_CONFIG: {
                 char *buf;
@@ -2696,7 +2673,11 @@ static int osc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                 GOTO(out, err = -ENOTTY);
         }
 out:
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
         MOD_DEC_USE_COUNT;
+#else
+       module_put(THIS_MODULE);
+#endif
         return err;
 }
 
@@ -2951,10 +2932,19 @@ int osc_setup(struct obd_device *obd, obd_count len, void *buf)
                 return rc;
 
         rc = client_obd_setup(obd, len, buf);
-        if (rc)
+        if (rc) {
                 ptlrpcd_decref();
-        else
+        } else {
+                struct lprocfs_static_vars lvars;
+
+                lprocfs_init_vars(osc, &lvars);
+                if (lprocfs_obd_setup(obd, lvars.obd_vars) == 0) {
+                        lproc_osc_attach_seqstat(obd);
+                        ptlrpc_lprocfs_register_obd(obd);
+                }
+
                 oscc_init(obd);
+        }
 
         RETURN(rc);
 }
@@ -2963,6 +2953,9 @@ int osc_cleanup(struct obd_device *obd, int flags)
 {
         int rc;
 
+        ptlrpc_lprocfs_unregister_obd(obd);
+        lprocfs_obd_cleanup(obd);
+
         rc = client_obd_cleanup(obd, flags);
         ptlrpcd_decref();
         RETURN(rc);
@@ -2971,8 +2964,6 @@ int osc_cleanup(struct obd_device *obd, int flags)
 
 struct obd_ops osc_obd_ops = {
         o_owner:        THIS_MODULE,
-        o_attach:       osc_attach,
-        o_detach:       osc_detach,
         o_setup:        osc_setup,
         o_cleanup:      osc_cleanup,
         o_connect:      osc_connect,
@@ -3011,8 +3002,6 @@ struct obd_ops osc_obd_ops = {
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
 struct obd_ops sanosc_obd_ops = {
         o_owner:        THIS_MODULE,
-        o_attach:       osc_attach,
-        o_detach:       osc_detach,
         o_cleanup:      client_obd_cleanup,
         o_connect:      osc_connect,
         o_disconnect:   client_disconnect_export,
@@ -3069,6 +3058,7 @@ int __init osc_init(void)
         RETURN(rc);
 }
 
+#ifdef __KERNEL__
 static void /*__exit*/ osc_exit(void)
 {
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
@@ -3077,7 +3067,6 @@ static void /*__exit*/ osc_exit(void)
         class_unregister_type(LUSTRE_OSC_NAME);
 }
 
-#ifdef __KERNEL__
 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
 MODULE_DESCRIPTION("Lustre Object Storage Client (OSC)");
 MODULE_LICENSE("GPL");
index 1359623..f1c5e45 100644 (file)
@@ -1118,9 +1118,10 @@ out:
         return 0;
 }
 
-static int ost_setup(struct obd_device *obddev, obd_count len, void *buf)
+static int ost_setup(struct obd_device *obd, obd_count len, void *buf)
 {
-        struct ost_obd *ost = &obddev->u.ost;
+        struct ost_obd *ost = &obd->u.ost;
+        struct lprocfs_static_vars lvars;
         int rc;
         ENTRY;
 
@@ -1132,57 +1133,62 @@ static int ost_setup(struct obd_device *obddev, obd_count len, void *buf)
         if (rc < 0)
                 RETURN(rc);
 
-        ost->ost_service = 
+        lprocfs_init_vars(ost, &lvars);
+        lprocfs_obd_setup(obd, lvars.obd_vars);
+
+        ost->ost_service =
                 ptlrpc_init_svc(OST_NBUFS, OST_BUFSIZE, OST_MAXREQSIZE,
                                 OST_REQUEST_PORTAL, OSC_REPLY_PORTAL,
                                 ost_handle, "ost",
-                                obddev->obd_proc_entry);
+                                obd->obd_proc_entry);
         if (ost->ost_service == NULL) {
                 CERROR("failed to start service\n");
-                RETURN(-ENOMEM);
+                GOTO(out_lprocfs, rc = -ENOMEM);
         }
-        
-        rc = ptlrpc_start_n_threads(obddev, ost->ost_service, OST_NUM_THREADS, 
-                                 "ll_ost");
+
+        rc = ptlrpc_start_n_threads(obd, ost->ost_service, OST_NUM_THREADS,
+                                    "ll_ost");
         if (rc)
-                GOTO(out, rc = -EINVAL);
+                GOTO(out_service, rc = -EINVAL);
 
         ost->ost_create_service =
                 ptlrpc_init_svc(OST_NBUFS, OST_BUFSIZE, OST_MAXREQSIZE,
                                 OST_CREATE_PORTAL, OSC_REPLY_PORTAL,
                                 ost_handle, "ost_create",
-                                obddev->obd_proc_entry);
+                                obd->obd_proc_entry);
         if (ost->ost_create_service == NULL) {
                 CERROR("failed to start OST create service\n");
-                GOTO(out, rc = -ENOMEM);
+                GOTO(out_service, rc = -ENOMEM);
         }
 
-        rc = ptlrpc_start_n_threads(obddev, ost->ost_create_service, 1,
+        rc = ptlrpc_start_n_threads(obd, ost->ost_create_service, 1,
                                     "ll_ost_create");
-        if (rc) 
+        if (rc)
                 GOTO(out_create, rc = -EINVAL);
 
         RETURN(0);
 
 out_create:
         ptlrpc_unregister_service(ost->ost_create_service);
-out:
+out_service:
         ptlrpc_unregister_service(ost->ost_service);
+out_lprocfs:
+        lprocfs_obd_cleanup(obd);
         RETURN(rc);
 }
 
-static int ost_cleanup(struct obd_device *obddev, int flags)
+static int ost_cleanup(struct obd_device *obd, int flags)
 {
-        struct ost_obd *ost = &obddev->u.ost;
+        struct ost_obd *ost = &obd->u.ost;
         int err = 0;
         ENTRY;
 
-        spin_lock_bh(&obddev->obd_processing_task_lock);
-        if (obddev->obd_recovering) {
-                target_cancel_recovery_timer(obddev);
-                obddev->obd_recovering = 0;
+        spin_lock_bh(&obd->obd_processing_task_lock);
+        if (obd->obd_recovering) {
+                target_cancel_recovery_timer(obd);
+                obd->obd_recovering = 0;
         }
-        spin_unlock_bh(&obddev->obd_processing_task_lock);
+        spin_unlock_bh(&obd->obd_processing_task_lock);
 
         ptlrpc_stop_all_threads(ost->ost_service);
         ptlrpc_unregister_service(ost->ost_service);
@@ -1190,27 +1196,14 @@ static int ost_cleanup(struct obd_device *obddev, int flags)
         ptlrpc_stop_all_threads(ost->ost_create_service);
         ptlrpc_unregister_service(ost->ost_create_service);
 
-        RETURN(err);
-}
+        lprocfs_obd_cleanup(obd);
 
-int ost_attach(struct obd_device *dev, obd_count len, void *data)
-{
-        struct lprocfs_static_vars lvars;
-
-        lprocfs_init_vars(ost,&lvars);
-        return lprocfs_obd_attach(dev, lvars.obd_vars);
-}
-
-int ost_detach(struct obd_device *dev)
-{
-        return lprocfs_obd_detach(dev);
+        RETURN(err);
 }
 
 /* use obd ops to offer management infrastructure */
 static struct obd_ops ost_obd_ops = {
         o_owner:        THIS_MODULE,
-        o_attach:       ost_attach,
-        o_detach:       ost_detach,
         o_setup:        ost_setup,
         o_cleanup:      ost_cleanup,
 };
index 3bbda8d..4ca4047 100644 (file)
@@ -318,6 +318,7 @@ extern void kportal_blockallsigs (void);
 # define printk(format, args...) printf (format, ## args)
 # define PORTAL_ALLOC(ptr, size) do { (ptr) = malloc(size); } while (0);
 # define PORTAL_FREE(a, b) do { free(a); } while (0);
+void portals_debug_dumplog(void);
 # define portals_debug_msg(subsys, mask, file, fn, line, stack, format, a...) \
     printf("%02x:%06x (@%lu %s:%s,l. %d %d %lu): " format,                    \
            (subsys), (mask), (long)time(0), file, fn, line,                   \
index 861c07d..21e0abe 100644 (file)
@@ -24,6 +24,9 @@
  */
 
 #include "socknal.h"
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
+# include <linux/syscalls.h>
+#endif
 
 /*
  *  LIB functions follow
index 4e43aa5..a444e9e 100644 (file)
@@ -79,7 +79,7 @@ static char *debug_buf = NULL;
 static unsigned long debug_size = 0;
 static atomic_t debug_off_a = ATOMIC_INIT(0);
 static int debug_wrapped;
-wait_queue_head_t debug_ctlwq;
+static DECLARE_WAIT_QUEUE_HEAD(debug_ctlwq);
 #define DAEMON_SND_SIZE      (64 << 10)
 
 /*
@@ -266,7 +266,7 @@ int portals_do_debug_dumplog(void *arg)
                        PTR_ERR(file));
                 GOTO(out, PTR_ERR(file));
         } else {
-                printk(KERN_ALERT "LustreError: dumping log to %s ... writing ...\n",
+                printk(KERN_ALERT "LustreError: dumping log to %s ...\n",
                        debug_file_name);
         }
 
@@ -439,18 +439,26 @@ void portals_debug_print(void)
 void portals_debug_dumplog(void)
 {
         int rc;
+        DECLARE_WAITQUEUE(wait, current);
         ENTRY;
 
-        init_waitqueue_head(&debug_ctlwq);
+        /* we're being careful to ensure that the kernel thread is
+         * able to set our state to running as it exits before we
+         * get to schedule() */
+        set_current_state(TASK_INTERRUPTIBLE);
+        add_wait_queue(&debug_ctlwq, &wait);
 
         rc = kernel_thread(portals_do_debug_dumplog,
                            NULL, CLONE_VM | CLONE_FS | CLONE_FILES);
-        if (rc < 0) {
+        if (rc < 0)
                 printk(KERN_ERR "LustreError: cannot start log dump thread: "
                        "%d\n", rc);
-                return;
-        }
-        sleep_on(&debug_ctlwq);
+        else
+                schedule();
+
+        /* be sure to teardown if kernel_thread() failed */
+        remove_wait_queue(&debug_ctlwq, &wait);
+        set_current_state(TASK_RUNNING);
 }
 
 int portals_debug_daemon_start(char *file, unsigned int size)
index 29b8d1e..f6367d4 100644 (file)
@@ -11,9 +11,7 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <unistd.h>
-#include <asm/byteorder.h>
 #include <syslog.h>
-
 #include <errno.h>
 
 #include <portals/api-support.h>
index ff6631c..e45fae4 100644 (file)
@@ -29,9 +29,7 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <unistd.h>
-#include <asm/byteorder.h>
 #include <syslog.h>
-
 #include <errno.h>
 
 #include <portals/api-support.h>
index e42fda6..f078099 100644 (file)
@@ -34,7 +34,7 @@
 #include <unistd.h>
 #include <time.h>
 #include <stdarg.h>
-#include <asm/byteorder.h>
+#include <endian.h>
 
 #ifdef __CYGWIN__
 
index b51d09e..2ccf00e 100644 (file)
@@ -35,6 +35,7 @@
 static int ptlbd_cl_setup(struct obd_device *obd, obd_count len, void *buf)
 {
         struct ptlbd_obd *ptlbd = &obd->u.ptlbd;
+        struct lprocfs_static_vars lvars;
         struct obd_import *imp;
         struct lustre_cfg* lcfg = buf;
         ENTRY;
@@ -66,14 +67,17 @@ static int ptlbd_cl_setup(struct obd_device *obd, obd_count len, void *buf)
         }
         imp->imp_state = LUSTRE_IMP_FULL;
 
-        ptlrpc_init_client(PTLBD_REQUEST_PORTAL, PTLBD_REPLY_PORTAL, 
+        ptlrpc_init_client(PTLBD_REQUEST_PORTAL, PTLBD_REPLY_PORTAL,
                         "ptlbd", &ptlbd->bd_client);
         imp->imp_client = &ptlbd->bd_client;
         imp->imp_obd = obd;
-        memcpy(imp->imp_target_uuid.uuid, lcfg->lcfg_inlbuf1, 
+        memcpy(imp->imp_target_uuid.uuid, lcfg->lcfg_inlbuf1,
                lcfg->lcfg_inllen1);
         ptlbd_blk_register(ptlbd);
 
+        lprocfs_init_vars(ptlbd_cl, &lvars);
+        lprocfs_obd_setup(obd, lvars.obd_vars);
+
         RETURN(0);
 }
 
@@ -89,6 +93,8 @@ static int ptlbd_cl_cleanup(struct obd_device *obd, int flags)
         if (!imp->imp_connection)
                 RETURN(-ENOENT);
 
+        lprocfs_obd_cleanup(obd);
+
         ptlrpc_cleanup_client(imp);
         ptlrpc_put_connection(imp->imp_connection);
 
@@ -110,7 +116,7 @@ int ptlbd_cl_connect(struct lustre_handle *conn, struct obd_device *obd,
         int     rc, size[] = {sizeof(imp->imp_target_uuid),
                               sizeof(obd->obd_uuid),
                               sizeof(*conn)};
-        char *tmp[] = {imp->imp_target_uuid.uuid, 
+        char *tmp[] = {imp->imp_target_uuid.uuid,
                        obd->obd_uuid.uuid,
                        (char*)conn};
         ENTRY;
@@ -140,7 +146,7 @@ int ptlbd_cl_connect(struct lustre_handle *conn, struct obd_device *obd,
 
         imp->imp_state = LUSTRE_IMP_FULL;
         imp->imp_remote_handle = request->rq_repmsg->handle;
-        
+
 out_req:
         ptlrpc_req_finished(request);
 out_disco:
index c7ac53b..daa0b3c 100644 (file)
 
 static int ptlbd_sv_already_setup = 1;
 
-static int ptlbd_sv_setup(struct obd_device *obddev, obd_count len, void *buf)
+static int ptlbd_sv_setup(struct obd_device *obd, obd_count len, void *buf)
 {
-        struct ptlbd_obd *ptlbd = &obddev->u.ptlbd;
+        struct ptlbd_obd *ptlbd = &obd->u.ptlbd;
+        struct lprocfs_static_vars lvars;
         int rc;
         ENTRY;
 
@@ -48,17 +49,20 @@ static int ptlbd_sv_setup(struct obd_device *obddev, obd_count len, void *buf)
         if ( IS_ERR(ptlbd->filp) )
                 RETURN(PTR_ERR(ptlbd->filp));
 
+        lprocfs_init_vars(ptlbd_sv, &lvars);
+        lprocfs_obd_setup(obd, lvars.obd_vars);
+
         ptlbd->ptlbd_service =
                 ptlrpc_init_svc(PTLBD_NBUFS, PTLBD_BUFSIZE, PTLBD_MAXREQSIZE,
                                 PTLBD_REQUEST_PORTAL, PTLBD_REPLY_PORTAL,
                                 ptlbd_handle, "ptlbd_sv",
-                                obddev->obd_proc_entry);
+                                obd->obd_proc_entry);
 
-        if (ptlbd->ptlbd_service == NULL) 
+        if (ptlbd->ptlbd_service == NULL)
                 GOTO(out_filp, rc = -ENOMEM);
 
-        rc = ptlrpc_start_n_threads(obddev, ptlbd->ptlbd_service, 1, "ptldb");
-        if (rc != 0) 
+        rc = ptlrpc_start_n_threads(obd, ptlbd->ptlbd_service, 1, "ptldb");
+        if (rc != 0)
                 GOTO(out_thread, rc);
 
         ptlbd_sv_already_setup = 1;
@@ -69,13 +73,14 @@ out_thread:
         ptlrpc_unregister_service(ptlbd->ptlbd_service);
 out_filp:
         filp_close(ptlbd->filp, NULL);
+        lprocfs_obd_cleanup(obd);
 
         RETURN(rc);
 }
 
-static int ptlbd_sv_cleanup(struct obd_device *obddev, int flags)
+static int ptlbd_sv_cleanup(struct obd_device *obd, int flags)
 {
-        struct ptlbd_obd *ptlbd = &obddev->u.ptlbd;
+        struct ptlbd_obd *ptlbd = &obd->u.ptlbd;
         ENTRY;
 
         /* XXX check for state */
@@ -86,6 +91,9 @@ static int ptlbd_sv_cleanup(struct obd_device *obddev, int flags)
                 filp_close(ptlbd->filp, NULL);
 
         ptlbd_sv_already_setup = 0;
+
+        lprocfs_obd_cleanup(obd);
+
         RETURN(0);
 }
 
index 5995e31..9820a4c 100644 (file)
@@ -497,8 +497,11 @@ static int after_reply(struct ptlrpc_request *req)
                 spin_lock_irqsave(&imp->imp_lock, flags);
                 if (req->rq_replay || req->rq_transno != 0)
                         ptlrpc_retain_replayable_request(req, imp);
-                else if (req->rq_commit_cb != NULL)
+                else if (req->rq_commit_cb != NULL) {
+                       spin_unlock_irqrestore(&imp->imp_lock, flags);
                         req->rq_commit_cb(req);
+                       spin_lock_irqsave(&imp->imp_lock, flags);
+               }
 
                 if (req->rq_transno > imp->imp_max_transno)
                         imp->imp_max_transno = req->rq_transno;
index 466916b..c6a4163 100644 (file)
@@ -84,7 +84,8 @@ struct ptlrpc_connection *ptlrpc_get_connection(struct ptlrpc_peer *peer,
 
         /* FIXME: this should be a slab once we can validate slab addresses
          * without OOPSing */
-        OBD_ALLOC(c, sizeof(*c));
+        OBD_ALLOC_GFP(c, sizeof(*c), GFP_ATOMIC);
+       
         if (c == NULL)
                 GOTO(out, c);
 
index d29804d..26a9bb4 100644 (file)
@@ -158,7 +158,7 @@ void request_in_callback(ptl_event_t *ev)
         struct ptlrpc_srv_ni              *srv_ni = rqbd->rqbd_srv_ni;
         struct ptlrpc_service             *service = srv_ni->sni_service;
         struct ptlrpc_request             *req;
-        long                               flags;
+        unsigned long                     flags;
         ENTRY;
 
         LASSERT (ev->type == PTL_EVENT_PUT_END ||
@@ -558,7 +558,7 @@ static void cray_portals_callback(ptl_event_t *ev)
 {
         /* We get a callback from the client Cray portals implementation
          * whenever anyone calls PtlEQPoll(), and an event queue with a
-         * callback handler has outstanding events.  
+         * callback handler has outstanding events.
          *
          * If it's not liblustre calling PtlEQPoll(), this lets us know we
          * have outstanding events which we handle with
index 01d7d23..5641f63 100644 (file)
@@ -38,8 +38,6 @@
 static DECLARE_MUTEX(pinger_sem);
 static struct list_head pinger_imports = LIST_HEAD_INIT(pinger_imports);
 
-static struct ptlrpc_thread *pinger_thread = NULL;
-
 int ptlrpc_ping(struct obd_import *imp) 
 {
         struct ptlrpc_request *req;
@@ -170,6 +168,8 @@ static int ptlrpc_pinger_main(void *arg)
         return 0;
 }
 
+static struct ptlrpc_thread *pinger_thread = NULL;
+
 int ptlrpc_start_pinger(void)
 {
         struct l_wait_info lwi = { 0 };
index 18bc6f4..8db67c7 100644 (file)
@@ -286,7 +286,7 @@ void ptlrpc_request_handle_notconn(struct ptlrpc_request *failed_req)
  * This should only be called by the ioctl interface, currently
  * with the lctl deactivate and activate commands.
  */
-int  ptlrpc_set_import_active(struct obd_import *imp, int active)
+int ptlrpc_set_import_active(struct obd_import *imp, int active)
 {
         struct obd_device *obd = imp->imp_obd;
         int rc = 0;
index 751b787..825b240 100644 (file)
@@ -673,7 +673,7 @@ static int ptlrpc_main(void *arg)
         spin_lock_irqsave(&svc->srv_lock, flags);
         svc->srv_nthreads++;
         spin_unlock_irqrestore(&svc->srv_lock, flags);
-        
+
         /* XXX maintain a list of all managed devices: insert here */
 
         while ((thread->t_flags & SVC_STOPPING) == 0 ||
@@ -681,7 +681,7 @@ static int ptlrpc_main(void *arg)
                 /* Don't exit while there are replies to be handled */
                 struct l_wait_info lwi = LWI_TIMEOUT(svc->srv_rqbd_timeout,
                                                      ptlrpc_retry_rqbds, svc);
-                                  
+
                 l_wait_event_exclusive (svc->srv_waitq,
                               ((thread->t_flags & SVC_STOPPING) != 0 &&
                                svc->srv_n_difficult_replies == 0) ||
@@ -690,7 +690,7 @@ static int ptlrpc_main(void *arg)
                               !list_empty (&svc->srv_reply_queue) ||
                               (!list_empty (&svc->srv_request_queue) &&
                                (svc->srv_n_difficult_replies == 0 ||
-                                svc->srv_n_active_reqs < 
+                                svc->srv_n_active_reqs <
                                 (svc->srv_nthreads - 1))),
                               &lwi);
 
@@ -838,6 +838,8 @@ int ptlrpc_unregister_service(struct ptlrpc_service *service)
         list_del_init (&service->srv_list);
         spin_unlock (&ptlrpc_all_services_lock);
 
+        ptlrpc_lprocfs_unregister_service(service);
+
         for (i = 0; i < ptlrpc_ninterfaces; i++) {
                 srv_ni = &service->srv_interfaces[i];
                 CDEBUG(D_NET, "%s: tearing down interface %s\n",
@@ -939,8 +941,6 @@ int ptlrpc_unregister_service(struct ptlrpc_service *service)
                 CWARN("Unexpectedly long timeout %p\n", service);
         }
 
-        ptlrpc_lprocfs_unregister_service(service);
-
         OBD_FREE(service,
                  offsetof(struct ptlrpc_service,
                           srv_interfaces[ptlrpc_ninterfaces]));
index 34e855a..cec369b 100644 (file)
@@ -1,3 +1,6 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ */
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
@@ -95,44 +98,44 @@ static int get_verbose(char *func, const char *arg)
 int main(int argc, char *argv[])
 {
         char filename[1024];
-       int verbose = 0;
+        int verbose = 0;
         unsigned long count, i;
-       int threads = 0;
-       char *end;
-       int rc = 0;
+        int threads = 0;
+        char *end;
+        int rc = 0;
 
         if (argc < 3 || argc > 5) {
                 fprintf(stderr,
-                       "usage: %s <filename> <count> [verbose [threads]]\n",
-                       argv[0]);
+                        "usage: %s <filename> <count> [verbose [threads]]\n",
+                        argv[0]);
                 exit(1);
         }
 
         count = strtoul(argv[2], &end, 0);
-       if (*end) {
+        if (*end) {
                 fprintf(stderr, "%s: error: bad iteration count '%s'\n",
                         argv[0], argv[1]);
-               exit(2);
-       }
-       if (argc == 4) {
-               verbose = get_verbose(argv[0], argv[3]);
-               if (verbose == BAD_VERBOSE)
-                       exit(2);
-       }
-       if (argc == 5) {
-               threads = strtoul(argv[4], &end, 0);
-               if (*end) {
-                       fprintf(stderr, "%s: error: bad thread count '%s'\n",
-                               argv[0], argv[1]);
-                       exit(2);
-               }
-       }
+                exit(2);
+        }
+        if (argc == 4) {
+                verbose = get_verbose(argv[0], argv[3]);
+                if (verbose == BAD_VERBOSE)
+                        exit(2);
+        }
+        if (argc == 5) {
+                threads = strtoul(argv[4], &end, 0);
+                if (*end) {
+                        fprintf(stderr, "%s: error: bad thread count '%s'\n",
+                                argv[0], argv[1]);
+                        exit(2);
+                }
+        }
 
         for (i = 1; i <= threads; i++) {
                 rc = fork();
                 if (rc < 0) {
                         fprintf(stderr, "%s: error: #%ld - %s\n",
-                               cmdname(argv[0]), i, strerror(rc = errno));
+                                cmdname(argv[0]), i, strerror(rc = errno));
                         break;
                 } else if (rc == 0) {
                         thread = i;
@@ -143,7 +146,7 @@ int main(int argc, char *argv[])
                 rc = 0;
         }
 
-        if (threads && thread == 0) {  /* parent process */
+        if (threads && thread == 0) {   /* parent process */
                 int live_threads = threads;
 
                 while (live_threads > 0) {
@@ -178,47 +181,47 @@ int main(int argc, char *argv[])
                                 live_threads--;
                         }
                 }
-       } else {
+        } else {
                 struct timeval start, end, next_time;
-               unsigned long next_count;
-               double diff;
-
-               gettimeofday(&start, NULL);
-               next_time.tv_sec = start.tv_sec - verbose;
-               next_time.tv_usec = start.tv_usec;
-
-               for (i = 0, next_count = verbose; i < count; i++) {
-                       if (threads)
-                               sprintf(filename, "%s-%d-%ld",
-                                       argv[1], thread, i);
-                       else
-                               sprintf(filename, "%s-%ld", argv[1], i);
-
-                       rc = mknod(filename, S_IFREG, 0);
-                       if (rc < 0) {
-                               fprintf(stderr, "%s: error: mknod(%s): %s\n",
-                                       cmdname(argv[0]), filename,
-                                       strerror(errno));
-                               rc = errno;
-                               break;
-                       }
-                       if (unlink(filename) < 0) {
-                               fprintf(stderr, "%s: error: unlink(%s): %s\n",
-                                       cmdname(argv[0]), filename,
-                                       strerror(errno));
-                               rc = errno;
-                               break;
-                       }
-                       if (be_verbose(verbose, &next_time,i,&next_count,count))
-                               printf("%s: number %ld\n", cmdname(argv[0]), i);
-               }
-
-               gettimeofday(&end, NULL);
+                unsigned long next_count;
+                double diff;
+
+                gettimeofday(&start, NULL);
+                next_time.tv_sec = start.tv_sec - verbose;
+                next_time.tv_usec = start.tv_usec;
+
+                for (i = 0, next_count = verbose; i < count; i++) {
+                        if (threads)
+                                sprintf(filename, "%s-%d-%ld",
+                                        argv[1], thread, i);
+                        else
+                                sprintf(filename, "%s-%ld", argv[1], i);
+
+                        rc = mknod(filename, S_IFREG, 0);
+                        if (rc < 0) {
+                                fprintf(stderr, "%s: error: mknod(%s): %s\n",
+                                        cmdname(argv[0]), filename,
+                                        strerror(errno));
+                                rc = errno;
+                                break;
+                        }
+                        if (unlink(filename) < 0) {
+                                fprintf(stderr, "%s: error: unlink(%s): %s\n",
+                                        cmdname(argv[0]), filename,
+                                        strerror(errno));
+                                rc = errno;
+                                break;
+                        }
+                        if (be_verbose(verbose, &next_time,i,&next_count,count))
+                                printf("%s: number %ld\n", cmdname(argv[0]), i);
+                }
+
+                gettimeofday(&end, NULL);
                 diff = difftime(&end, &start);
 
-               printf("%s: %ldx2 files in %.4gs (%.4g ops/s): rc = %d: %s",
-                      cmdname(argv[0]), i, diff, (double)i * 2 / diff,
-                      rc, ctime(&end.tv_sec));
-       }
+                printf("%s: %ldx2 files in %.4gs (%.4g ops/s): rc = %d: %s",
+                       cmdname(argv[0]), i, diff, (double)i * 2 / diff,
+                       rc, ctime(&end.tv_sec));
+        }
         return rc;
 }
index 8524c91..12027d0 100644 (file)
@@ -96,7 +96,6 @@ char  *temp_buf;                      /* a pointer to the current data */
 char   *fname;                         /* name of our test file */
 char   logfile[1024];                  /* name of our log file */
 char   goodfile[1024];                 /* name of our test file */
-int    fd;                             /* fd for our test file */
 
 off_t          file_size = 0;
 off_t          biggest = 0;
@@ -384,12 +383,125 @@ check_buffers(unsigned offset, unsigned size)
        }
 }
 
+struct test_file {
+       char *path;
+       int fd;
+} *test_files = NULL;
+
+int num_test_files = 0;
+enum fd_iteration_policy {
+       FD_SINGLE,
+       FD_ROTATE,
+       FD_RANDOM,
+};
+int fd_policy = FD_RANDOM;
+int fd_last = 0;
+
+struct test_file * 
+get_tf(void)
+{
+       unsigned index = 0;
+
+       switch (fd_policy) {
+               case FD_ROTATE:
+                       index = fd_last++;
+                       break;
+               case FD_RANDOM:
+                       index = random();
+                       break;
+               case FD_SINGLE:
+                       index = 0;
+                       break;
+               default:
+                       prt("unknown policy");
+                       exit(1);
+                       break;
+       }
+       return &test_files[ index % num_test_files ];
+}
+
+void
+assign_fd_policy(char *policy)
+{
+       if (!strcmp(policy, "random"))
+               fd_policy = FD_RANDOM;
+       else if (!strcmp(policy, "rotate"))
+               fd_policy = FD_ROTATE;
+       else {
+               prt("unknown -I policy: '%s'\n", policy);
+               exit(1);
+       }
+}
+
+int 
+get_fd(void)
+{
+       struct test_file *tf = get_tf();
+       return tf->fd;
+}
+
+static const char *basename(const char *path)
+{
+       char *c = strrchr(path, '/');
+
+       return c ? c++ : path;
+}
+
+void 
+open_test_files(char **argv, int argc)
+{
+       struct test_file *tf;
+       int i;
+
+       num_test_files = argc;
+       if (num_test_files == 1)
+               fd_policy = FD_SINGLE;
+
+       test_files = calloc(num_test_files, sizeof(*test_files));
+       if (test_files == NULL) {
+               prterr("reallocating space for test files");
+               exit(1);
+       }
+
+       for (i = 0, tf = test_files; i < num_test_files; i++, tf++) {
+
+               tf->path = argv[i];
+               tf->fd = open(tf->path, O_RDWR|(lite ? 0 : O_CREAT|O_TRUNC), 
+                               0666);
+               if (tf->fd < 0) {
+                       prterr(tf->path);
+                       exit(91);
+               }
+       }
+
+       if (quiet || fd_policy == FD_SINGLE)
+               return;
+
+       for (i = 0, tf = test_files; i < num_test_files; i++, tf++)
+               prt("fd %d: %s\n", i, tf->path);
+}
+
+void
+close_test_files(void)
+{
+       int i;
+       struct test_file *tf;
+
+       for (i = 0, tf = test_files; i < num_test_files; i++, tf++) {
+               if (close(tf->fd)) {
+                       prterr("close");
+                       report_failure(99);
+               }
+       }
+}
+
 
 void
 check_size(void)
 {
        struct stat     statbuf;
        off_t   size_by_seek;
+       int fd = get_fd();
 
        if (fstat(fd, &statbuf)) {
                prterr("check_size: fstat");
@@ -410,6 +522,7 @@ void
 check_trunc_hack(void)
 {
        struct stat statbuf;
+       int fd = get_fd();
 
        ftruncate(fd, (off_t)0);
        ftruncate(fd, (off_t)100000);
@@ -421,6 +534,71 @@ check_trunc_hack(void)
        ftruncate(fd, 0);
 }
 
+static char *tf_buf = NULL;
+static int max_tf_len = 0;
+
+void
+alloc_tf_buf(void)
+{
+       char dummy = '\0';
+       int highest = num_test_files - 1;
+       int len;
+
+       len = snprintf(&dummy, 0, "%u ", highest);
+       if (len < 0) {
+               prterr("finding max tf_buf");
+               exit(1);
+       }
+       tf_buf = malloc(len + 1);
+       if (tf_buf == NULL) {
+               prterr("allocating tf_buf");
+               exit(1);
+       }
+       max_tf_len = sprintf(tf_buf, "%u ", highest);
+}
+
+char * 
+fill_tf_buf(struct test_file *tf)
+{
+       if (tf_buf == NULL)
+               alloc_tf_buf();
+
+       sprintf(tf_buf,"%u ", tf - test_files);
+       return tf_buf;
+}
+
+void
+output_line(struct test_file *tf, int op, unsigned long offset, 
+               unsigned long size, struct timeval *tv)
+{
+       char *tf_num = "";
+
+       char *ops[] = {
+               [OP_READ] = "read",
+               [OP_WRITE] = "write",
+               [OP_TRUNCATE] = "trunc from",
+               [OP_MAPREAD] = "mapread",
+               [OP_MAPWRITE] = "mapwrite",
+       };
+
+       if (fd_policy != FD_SINGLE)
+               tf_num = fill_tf_buf(tf);
+
+       /* W. */
+       if (!(!quiet && ((progressinterval &&
+                       testcalls % progressinterval == 0) ||
+                      (debug &&
+                       (monitorstart == -1 ||
+                        (offset + size > monitorstart &&
+                         (monitorend == -1 || offset <= monitorend)))))))
+               return;
+
+       prt("%06lu %lu.%06lu %*s%-10s %#08x %s %#08x\t(0x%x bytes)\n",
+               testcalls, tv->tv_sec, tv->tv_usec, max_tf_len,
+               tf_num, ops[op], 
+               offset, op == OP_TRUNCATE ? " to " : "thru",
+               offset + size - 1, size);
+}
 
 void
 doread(unsigned offset, unsigned size)
@@ -428,6 +606,8 @@ doread(unsigned offset, unsigned size)
        struct timeval t;
        off_t ret;
        unsigned iret;
+       struct test_file *tf = get_tf();
+       int fd = tf->fd;
 
        offset -= offset % readbdy;
        gettimeofday(&t, NULL);
@@ -449,15 +629,8 @@ doread(unsigned offset, unsigned size)
        if (testcalls <= simulatedopcount)
                return;
 
-       if (!quiet && ((progressinterval &&
-                       testcalls % progressinterval == 0) ||
-                      (debug &&
-                       (monitorstart == -1 ||
-                        (offset + size > monitorstart &&
-                         (monitorend == -1 || offset <= monitorend))))))
-               prt("%06lu %lu.%06lu read       %#08x thru %#08x\t(0x%x bytes)\n",
-                   testcalls, t.tv_sec, t.tv_usec, offset, offset + size - 1,
-                   size);
+       output_line(tf, OP_READ, offset, size, &t);
+
        ret = lseek(fd, (off_t)offset, SEEK_SET);
        if (ret == (off_t)-1) {
                prterr("doread: lseek");
@@ -490,6 +663,8 @@ domapread(unsigned offset, unsigned size)
        unsigned pg_offset;
        unsigned map_size;
        char    *p;
+       struct test_file *tf = get_tf();
+       int fd = tf->fd;
 
        offset -= offset % readbdy;
        gettimeofday(&t, NULL);
@@ -511,15 +686,7 @@ domapread(unsigned offset, unsigned size)
        if (testcalls <= simulatedopcount)
                return;
 
-       if (!quiet && ((progressinterval &&
-                       testcalls % progressinterval == 0) ||
-                      (debug &&
-                       (monitorstart == -1 ||
-                        (offset + size > monitorstart &&
-                         (monitorend == -1 || offset <= monitorend))))))
-               prt("%06lu %lu.%06lu mapread    %#08x thru %#08x\t(0x%x bytes)\n",
-                   testcalls, t.tv_sec, t.tv_usec, offset, offset + size - 1,
-                   size);
+       output_line(tf, OP_MAPREAD, offset, size, &t);
 
        pg_offset = offset & page_mask;
        map_size  = pg_offset + size;
@@ -578,6 +745,8 @@ dowrite(unsigned offset, unsigned size)
        struct timeval t;
        off_t ret;
        unsigned iret;
+       struct test_file *tf = get_tf();
+       int fd = tf->fd;
 
        offset -= offset % writebdy;
        gettimeofday(&t, NULL);
@@ -604,15 +773,8 @@ dowrite(unsigned offset, unsigned size)
        if (testcalls <= simulatedopcount)
                return;
 
-       if (!quiet && ((progressinterval &&
-                       testcalls % progressinterval == 0) ||
-                      (debug &&
-                       (monitorstart == -1 ||
-                        (offset + size > monitorstart &&
-                         (monitorend == -1 || offset <= monitorend))))))
-               prt("%06lu %lu.%06lu write      %#08x thru %#08x\t(0x%x bytes)\n",
-                   testcalls, t.tv_sec, t.tv_usec, offset, offset + size - 1,
-                   size);
+       output_line(tf, OP_WRITE, offset, size, &t);
+
        ret = lseek(fd, (off_t)offset, SEEK_SET);
        if (ret == (off_t)-1) {
                prterr("dowrite: lseek");
@@ -645,6 +807,8 @@ domapwrite(unsigned offset, unsigned size)
        unsigned map_size;
        off_t    cur_filesize;
        char    *p;
+       struct test_file *tf = get_tf();
+       int fd = tf->fd;
 
        offset -= offset % writebdy;
        gettimeofday(&t, NULL);
@@ -672,15 +836,7 @@ domapwrite(unsigned offset, unsigned size)
        if (testcalls <= simulatedopcount)
                return;
 
-       if (!quiet && ((progressinterval &&
-                       testcalls % progressinterval == 0) ||
-                      (debug &&
-                       (monitorstart == -1 ||
-                        (offset + size > monitorstart &&
-                         (monitorend == -1 || offset <= monitorend))))))
-               prt("%06lu %lu.%06lu mapwrite   %#08x thru %#08x\t(0x%x bytes)\n",
-                   testcalls, t.tv_sec, t.tv_usec, offset, offset + size - 1,
-                   size);
+       output_line(tf, OP_MAPWRITE, offset, size, &t);
 
        if (file_size > cur_filesize) {
                if (ftruncate(fd, file_size) == -1) {
@@ -748,6 +904,8 @@ dotruncate(unsigned size)
 {
        struct timeval t;
        int oldsize = file_size;
+       struct test_file *tf = get_tf();
+       int fd = tf->fd;
 
        size -= size % truncbdy;
        gettimeofday(&t, NULL);
@@ -766,11 +924,8 @@ dotruncate(unsigned size)
        if (testcalls <= simulatedopcount)
                return;
 
-       if ((progressinterval && testcalls % progressinterval == 0) ||
-           (debug && (monitorstart == -1 || monitorend == -1 ||
-                      size <= monitorend)))
-               prt("%06lu %lu.%06lu trunc from %#08x  to  %#08x\n",
-                   testcalls, t.tv_sec, t.tv_usec, oldsize, size);
+       output_line(tf, OP_TRUNCATE, oldsize, size, &t);
+
        if (ftruncate(fd, (off_t)size) == -1) {
                prt("ftruncate1: %x\n", size);
                prterr("dotruncate: ftruncate");
@@ -787,6 +942,7 @@ void
 writefileimage()
 {
        ssize_t iret;
+       int fd = get_fd();
 
        if (lseek(fd, (off_t)0, SEEK_SET) == (off_t)-1) {
                prterr("writefileimage: lseek");
@@ -813,6 +969,7 @@ void
 docloseopen(void)
 {
        struct timeval t;
+       struct test_file *tf = get_tf();
 
        if (testcalls <= simulatedopcount)
                return;
@@ -823,7 +980,7 @@ docloseopen(void)
        if (debug)
                prt("%06lu %lu.%06lu close/open\n", testcalls, t.tv_sec,
                    t.tv_usec);
-       if (close(fd)) {
+       if (close(tf->fd)) {
                prterr("docloseopen: close");
                report_failure(180);
        }
@@ -831,8 +988,8 @@ docloseopen(void)
                gettimeofday(&t, NULL);
                prt("       %lu.%06lu close done\n", t.tv_sec, t.tv_usec);
        }
-       fd = open(fname, O_RDWR, 0);
-       if (fd < 0) {
+       tf->fd = open(tf->path, O_RDWR, 0);
+       if (tf->fd < 0) {
                prterr("docloseopen: open");
                report_failure(181);
        }
@@ -930,7 +1087,7 @@ usage(void)
                "fsx [-dnqLOW] [-b opnum] [-c Prob] [-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"
+"[ -I random|rotate ] fname [additional paths to 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 [-d -d = more debugging]\n"
@@ -953,6 +1110,9 @@ usage(void)
 "      -S seed: for random # generator (default 1) 0 gets timestamp\n"
 "      -W: mapped write operations DISabled\n"
 "        -R: read() system calls only (mapped reads disabled)\n"
+"      -I: When multiple paths to the file are given each operation uses"
+"           a different path.  Iterate through them in order with 'rotate'"
+"           or chose then at 'random'.  (defaults to random)\n"
 "      fname: this filename is REQUIRED (no default)\n");
        exit(90);
 }
@@ -991,14 +1151,6 @@ getnum(char *s, char **e)
        return (ret);
 }
 
-
-static const char *basename(const char *path)
-{
-       char *c = strrchr(path, '/');
-
-       return c ? c++ : path;
-}
-
 int
 main(int argc, char **argv)
 {
@@ -1014,7 +1166,8 @@ main(int argc, char **argv)
 
        setvbuf(stdout, (char *)0, _IOLBF, 0); /* line buffered stdout */
 
-       while ((ch = getopt(argc, argv, "b:c:dl:m:no:p:qr:s:t:w:D:LN:OP:RS:W"))
+       while ((ch = getopt(argc, argv, 
+                               "b:c:dl:m:no:p:qr:s:t:w:D:I:LN:OP:RS:W"))
               != EOF)
                switch (ch) {
                case 'b':
@@ -1097,6 +1250,9 @@ main(int argc, char **argv)
                        if (debugstart < 1)
                                usage();
                        break;
+               case 'I':
+                       assign_fd_policy(optarg);
+                       break;
                case 'L':
                        lite = 1;
                        break;
@@ -1139,7 +1295,7 @@ main(int argc, char **argv)
                }
        argc -= optind;
        argv += optind;
-       if (argc != 1)
+       if (argc < 1)
                usage();
        fname = argv[0];
 
@@ -1156,11 +1312,9 @@ main(int argc, char **argv)
 
        initstate(seed, state, 256);
        setstate(state);
-       fd = open(fname, O_RDWR|(lite ? 0 : O_CREAT|O_TRUNC), 0666);
-       if (fd < 0) {
-               prterr(fname);
-               exit(91);
-       }
+
+       open_test_files(argv, argc);
+
        strncat(goodfile, dirpath ? basename(fname) : fname, 256);
        strcat (goodfile, ".fsxgood");
        fsxgoodfd = open(goodfile, O_RDWR|O_CREAT|O_TRUNC, 0666);
@@ -1177,6 +1331,7 @@ main(int argc, char **argv)
        }
        if (lite) {
                off_t ret;
+               int fd = get_fd();
                file_size = maxfilelen = lseek(fd, (off_t)0, SEEK_END);
                if (file_size == (off_t)-1) {
                        prterr(fname);
@@ -1199,6 +1354,7 @@ main(int argc, char **argv)
        memset(temp_buf, '\0', maxoplen);
        if (lite) {     /* zero entire existing file */
                ssize_t written;
+               int fd = get_fd();
 
                written = write(fd, good_buf, (size_t)maxfilelen);
                if (written != maxfilelen) {
@@ -1217,10 +1373,7 @@ main(int argc, char **argv)
        while (numops == -1 || numops--)
                test();
 
-       if (close(fd)) {
-               prterr("close");
-               report_failure(99);
-       }
+       close_test_files();
        prt("All operations completed A-OK!\n");
 
        exit(0);
index e5adcf5..0402aff 100755 (executable)
@@ -1,3 +1,6 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ */
 #define _GNU_SOURCE /* pull in O_DIRECTORY in bits/fcntl.h */
 #include <stdio.h>
 #include <fcntl.h>
@@ -47,22 +50,22 @@ void null_handler(int unused) { }
 static const char *
 pop_arg(int argc, char *argv[])
 {
-       static int cur_arg = 3;
+        static int cur_arg = 3;
 
-       if (cur_arg >= argc)
-               return NULL;
+        if (cur_arg >= argc)
+                return NULL;
 
-       return argv[cur_arg++];
+        return argv[cur_arg++];
 }
 #define POP_ARG() (pop_arg(argc, argv))
 
 int main(int argc, char **argv)
 {
         char *fname, *commands;
-       const char *newfile;
+        const char *newfile;
         struct stat st;
-       size_t mmap_len = 0, i;
-       unsigned char *mmap_ptr = NULL, junk = 0;
+        size_t mmap_len = 0, i;
+        unsigned char *mmap_ptr = NULL, junk = 0;
         int fd = -1;
 
         if (argc < 3) {
@@ -84,7 +87,7 @@ int main(int argc, char **argv)
                                 perror("close");
                                 exit(1);
                         }
-                       fd = -1;
+                        fd = -1;
                         break;
                 case 'd':
                         if (mkdir(fname, 0755) == -1) {
@@ -92,54 +95,54 @@ int main(int argc, char **argv)
                                 exit(1);
                         }
                         break;
-               case 'D':
-                       if (open(fname, O_DIRECTORY) == -1) {
-                               perror("open(O_DIRECTORY)");
-                               exit(1);
-                       }
-                       break;
-               case 'l':
-                       newfile = POP_ARG();
-                       if (!newfile)
-                               newfile = fname;
-                       if (symlink(fname, newfile)) {
-                               perror("symlink()");
-                               exit(1);
-                       }
-                       break;
-               case 'L':
-                       newfile = POP_ARG();
-                       if (!newfile)
-                               newfile = fname;
-                       if (link(fname, newfile)) {
-                               perror("symlink()");
-                               exit(1);
-                       }
-                       break;
+                case 'D':
+                        if (open(fname, O_DIRECTORY) == -1) {
+                                perror("open(O_DIRECTORY)");
+                                exit(1);
+                        }
+                        break;
+                case 'l':
+                        newfile = POP_ARG();
+                        if (!newfile)
+                                newfile = fname;
+                        if (symlink(fname, newfile)) {
+                                perror("symlink()");
+                                exit(1);
+                        }
+                        break;
+                case 'L':
+                        newfile = POP_ARG();
+                        if (!newfile)
+                                newfile = fname;
+                        if (link(fname, newfile)) {
+                                perror("symlink()");
+                                exit(1);
+                        }
+                        break;
                 case 'm':
                         if (mknod(fname, S_IFREG | 0644, 0) == -1) {
                                 perror("mknod(S_IFREG|0644, 0)");
                                 exit(1);
                         }
                         break;
-               case 'M':
-                       mmap_len = st.st_size;
-                       mmap_ptr = mmap(NULL, mmap_len, PROT_WRITE | PROT_READ,
-                                       MAP_SHARED, fd, 0);
-                       if (mmap_ptr == MAP_FAILED) {
-                               perror("mmap");
-                               exit(1);
-                       }
-                       break;
-               case 'N':
-                       newfile = POP_ARG();
-                       if (!newfile)
-                               newfile = fname;
-                       if (rename (fname, newfile)) {
-                               perror("rename()");
-                               exit(1);
-                       }
-                       break;
+                case 'M':
+                        mmap_len = st.st_size;
+                        mmap_ptr = mmap(NULL, mmap_len, PROT_WRITE | PROT_READ,
+                                        MAP_SHARED, fd, 0);
+                        if (mmap_ptr == MAP_FAILED) {
+                                perror("mmap");
+                                exit(1);
+                        }
+                        break;
+                case 'N':
+                        newfile = POP_ARG();
+                        if (!newfile)
+                                newfile = fname;
+                        if (rename (fname, newfile)) {
+                                perror("rename()");
+                                exit(1);
+                        }
+                        break;
                 case 'O':
                         fd = open(fname, O_CREAT|O_RDWR, 0644);
                         if (fd == -1) {
@@ -154,23 +157,23 @@ int main(int argc, char **argv)
                                 exit(1);
                         }
                         break;
-               case 'r': {
-                       char buf;
-                       if (read(fd, &buf, 1) == -1) {
-                               perror("read");
-                               exit(1);
-                       }
-               }
+                case 'r': {
+                        char buf;
+                        if (read(fd, &buf, 1) == -1) {
+                                perror("read");
+                                exit(1);
+                        }
+                        }
                 case 'S':
                         if (fstat(fd, &st) == -1) {
                                 perror("fstat");
                                 exit(1);
                         }
                         break;
-               case 'R':
-                       for (i = 0; i < mmap_len && mmap_ptr; i += 4096)
-                               junk += mmap_ptr[i];
-                       break;
+                case 'R':
+                        for (i = 0; i < mmap_len && mmap_ptr; i += 4096)
+                                junk += mmap_ptr[i];
+                        break;
                 case 's':
                         if (stat(fname, &st) == -1) {
                                 perror("stat");
@@ -195,39 +198,39 @@ int main(int argc, char **argv)
                                 exit(1);
                         }
                         break;
-               case 'U':
-                       if (munmap(mmap_ptr, mmap_len)) {
-                               perror("munmap");
-                               exit(1);
-                       }
-                       break;
-               case 'w':
-                       if (write(fd, "w", 1) == -1) {
-                               perror("write");
-                               exit(1);
-                       }
-                       break;
-               case 'W':
-                       for (i = 0; i < mmap_len && mmap_ptr; i += 4096)
-                               mmap_ptr[i] += junk++;
-                       break;
-               case 'y':
-                       if (fsync(fd) == -1) {
-                               perror("fsync");
-                               exit(1);
-                       }
-                       break;
-               case 'Y':
-                       if (fdatasync(fd) == -1) {
-                               perror("fdatasync");
-                               exit(1);
-                       }
-               case 'z':
-                       if (lseek(fd, 0, SEEK_SET) == -1) {
-                               perror("lseek");
-                               exit(1);
-                       }
-                       break;
+                case 'U':
+                        if (munmap(mmap_ptr, mmap_len)) {
+                                perror("munmap");
+                                exit(1);
+                        }
+                        break;
+                case 'w':
+                        if (write(fd, "w", 1) == -1) {
+                                perror("write");
+                                exit(1);
+                        }
+                        break;
+                case 'W':
+                        for (i = 0; i < mmap_len && mmap_ptr; i += 4096)
+                                mmap_ptr[i] += junk++;
+                        break;
+                case 'y':
+                        if (fsync(fd) == -1) {
+                                perror("fsync");
+                                exit(1);
+                        }
+                        break;
+                case 'Y':
+                        if (fdatasync(fd) == -1) {
+                                perror("fdatasync");
+                                exit(1);
+                        }
+                case 'z':
+                        if (lseek(fd, 0, SEEK_SET) == -1) {
+                                perror("lseek");
+                                exit(1);
+                        }
+                        break;
                 default:
                         fprintf(stderr, "unknown command \"%c\"\n", *commands);
                         fprintf(stderr, usage, argv[0]);
index 5a2646a..4e6b261 100755 (executable)
@@ -49,12 +49,14 @@ fi
 # flush cache to OST(s) so avail numbers are correct
 sync; sleep 1 ; sync
 
-for AVAIL in /proc/fs/lustre/osc/OSC*MNT*/kbytesavail; do
-       [ `cat $AVAIL` -lt 400 ] && OSCFULL=full
+for OSC in /proc/fs/lustre/osc/OSC*MNT*; do
+       AVAIL=`cat $OSC/kbytesavail`
+       GRANT=`cat $OSC/cur_grant_bytes`
+       [ $(($AVAIL - $GRANT / 1024)) -lt 400 ] && OSCFULL=full
 done
 if [ -z "$OSCFULL" ]; then
        echo "no OSTs are close to full"
-       grep "[0-9]" /proc/fs/lustre/osc/OSC*MNT*/{kbytesavail,cur*}
+       grep [0-9] /proc/fs/lustre/osc/OSC*MNT*/{kbytesavail,cur*}
        SUCCESS=0
 fi
 
index 22c6893..c9755cb 100644 (file)
@@ -54,12 +54,14 @@ fi
 # flush cache to OST(s) so avail numbers are correct
 sync; sleep 1 ; sync
 
-for AVAIL in /proc/fs/lustre/osc/OSC*MNT*/kbytesavail; do
-       [ `cat $AVAIL` -lt 400 ] && OSCFULL=full
+for OSC in /proc/fs/lustre/osc/OSC*MNT*; do
+       AVAIL=`cat $OSC/kbytesavail`
+       GRANT=`cat $OSC/cur_grant_bytes`
+       [ $(($AVAIL - $GRANT / 1024)) -lt 400 ] && OSCFULL=full
 done
 if [ -z "$OSCFULL" ]; then
        echo "no OSTs are close to full"
-       grep "[0-9]" /proc/fs/lustre/osc/OSC*MNT*/{kbytesavail,cur*} |tee -a $LOG
+       grep [0-9] /proc/fs/lustre/osc/OSC*MNT*/{kbytesavail,cur*} |tee -a $LOG
        SUCCESS=0
 fi
 
index 02e9f69..b1ad60c 100755 (executable)
@@ -1,3 +1,4 @@
 #!/bin/sh
 LUSTRE=`dirname $0`/..
-$LUSTRE/utils/lctl --device %$3 recover || logger -p kern.info recovery failed: $@
+PATH=$LUSTRE/utils:$PATH
+lctl --device %$3 recover || logger -p kern.info recovery failed: $@
index 77ed014..bb41aaa 100755 (executable)
@@ -75,13 +75,13 @@ unset REFORMAT
 
 test_1() {
     drop_request "mcreate $MOUNT/1"  || return 1
-    drop_reply "mcreate $MOUNT/2"    || return 2
+    drop_reint_reply "mcreate $MOUNT/2"    || return 2
 }
 run_test 1 "mcreate: drop req, drop rep"
 
 test_2() {
     drop_request "tchmod 111 $MOUNT/2"  || return 1
-    drop_reply "tchmod 666 $MOUNT/2"    || return 2
+    drop_reint_reply "tchmod 666 $MOUNT/2"    || return 2
 }
 run_test 2 "chmod: drop req, drop rep"
 
@@ -100,26 +100,26 @@ run_test 4 "open: drop req, drop rep"
 
 test_5() {
     drop_request "mv $MOUNT/resolv.conf $MOUNT/renamed" || return 1
-    drop_reply "mv $MOUNT/renamed $MOUNT/renamed-again" || return 2
+    drop_reint_reply "mv $MOUNT/renamed $MOUNT/renamed-again" || return 2
     do_facet client "checkstat -v $MOUNT/renamed-again"  || return 3
 }
 run_test 5 "rename: drop req, drop rep"
 
 test_6() {
     drop_request "mlink $MOUNT/renamed-again $MOUNT/link1" || return 1
-    drop_reply "mlink $MOUNT/renamed-again $MOUNT/link2"   || return 2
+    drop_reint_reply "mlink $MOUNT/renamed-again $MOUNT/link2"   || return 2
 }
 run_test 6 "link: drop req, drop rep"
 
 test_7() {
     drop_request "munlink $MOUNT/link1"   || return 1
-    drop_reply "munlink $MOUNT/link2"     || return 2
+    drop_reint_reply "munlink $MOUNT/link2"     || return 2
 }
 run_test 7 "unlink: drop req, drop rep"
 
 #bug 1423
 test_8() {
-    drop_reply "touch $MOUNT/renamed"    || return 1
+    drop_reint_reply "touch $MOUNT/renamed"    || return 1
 }
 run_test 8 "touch: drop rep (bug 1423)"
 
index f475dda..e884b73 100644 (file)
@@ -322,6 +322,12 @@ test_15() {        # bug 974 - ENOSPC
 }
 run_test 15 "test out-of-space with multiple writers ==========="
 
+test_16() {
+       ./fsx -R -W -c 50 -p 100 -N 2500 \
+               $MOUNT1/fsxfile $MOUNT2/fsxfile
+}
+run_test 16 "2500 iterations of dual-mount fsx ================="
+
 log "cleanup: ======================================================"
 rm -rf $DIR1/[df][0-9]* $DIR1/lnk || true
 
index 36eceb9..adb957d 100644 (file)
@@ -404,6 +404,15 @@ drop_reply() {
     return $RC
 }
 
+drop_reint_reply() {
+# OBD_FAIL_MDS_REINT_NET_REP
+    RC=0
+    do_facet mds "echo 0x119 > /proc/sys/lustre/fail_loc"
+    do_facet client "$@" || RC=$?
+    do_facet mds "echo 0 > /proc/sys/lustre/fail_loc"
+    return $RC
+}
+
 pause_bulk() {
 #define OBD_FAIL_OST_BRW_PAUSE_BULK      0x214
     RC=0
index d977b89..7bfb121 100644 (file)
@@ -60,7 +60,6 @@ void rprintf(int rank, int loop, const char *fmt, ...)
         vprintf(fmt, ap);
 
         MPI_Abort(MPI_COMM_WORLD, 1);
-        exit(1); /* shouldn't be needed, but some MPI_Abort()s are broken */
 }
 
 int main(int argc, char *argv[])
index 0be27e9..c9ffae6 100644 (file)
@@ -37,7 +37,6 @@ void rprintf(int rank, int loop, const char *fmt, ...)
         vprintf(fmt, ap);
  
         MPI_Abort(MPI_COMM_WORLD, 1);
-        exit(1); /* shouldn't be needed, but some MPI_Abort()s are broken */
 }
 
 int main (int argc, char *argv[]) {
index ab354af..658a921 100644 (file)
@@ -51,27 +51,28 @@ static int lfs_catinfo(int argc, char **argv);
 /* all avaialable commands */
 command_t cmdlist[] = {
         {"setstripe", lfs_setstripe, 0,
-         "To create a new file with a specific striping pattern, or to set default striping pattern on an existing directory\n"
+         "Create a new file with a specific striping pattern or\n"
+         "Set the default striping pattern on an existing directory\n"
          "usage: setstripe <filename|dirname> <stripe size> <stripe start> <stripe count>\n"
          "\tstripe size:  Number of bytes in each stripe (0 default)\n"
          "\tstripe start: OST index of first stripe (-1 default)\n"
-         "\tstripe count: Number of OSTs to stripe over (0 default)"},
+         "\tstripe count: Number of OSTs to stripe over (0 default, -1 all)"},
         {"find", lfs_find, 0,
-         "To list the extended attributes for a given filename or files in a directory "
-         "or recursively for all files in a directory tree.\n"
+         "To list the extended attributes for a given filename or files in a\n"
+         "directory or recursively for all files in a directory tree.\n"
          "usage: find [--obd <uuid>] [--quiet | --verbose] [--recursive] <dir|file> ..."},
         {"getstripe", lfs_getstripe, 0,
          "To list the striping pattern for given filename.\n"
          "usage:getstripe <filename>"},
         {"check", lfs_check, 0,
-         "Display the status of MDS or OSTs (as specified in the command) "
+         "Display the status of MDS or OSTs (as specified in the command)\n"
          "or all the servers (MDS and OSTs).\n"
          "usage: check <osts|mds|servers>"},
         {"catinfo", lfs_catinfo, 0,
          "Show information of specified type logs.\n"
-         "usage: catinfo <keyword> [node name]"
-         "keywords are one of followings: config, deletions.\n"
-         "client node name must be provided when use keyword config."},
+         "usage: catinfo {keyword} [node name]\n"
+         "\tkeywords are one of followings: config, deletions.\n"
+         "\tnode name must be provided when use keyword config."},
         {"osts", lfs_osts, 0, "osts"},
         {"help", Parser_help, 0, "help"},
         {"exit", Parser_quit, 0, "quit"},
@@ -220,7 +221,7 @@ static int lfs_osts(int argc, char **argv)
         } else {
                 mnt = getmntent(fp);
                 while (feof(fp) == 0 && ferror(fp) ==0) {
-                        if (strcmp(mnt->mnt_type, "lustre_lite") == 0) {
+                        if (llapi_is_lustre_mnttype(mnt->mnt_type)) {
                                 rc = op_find(mnt->mnt_dir, obduuid, 0, 0, 0);
                                 if (rc)
                                         fprintf(stderr, "error: lfs osts failed for %s\n",
@@ -271,19 +272,19 @@ static int lfs_check(int argc, char **argv)
         } else {
                 mnt = getmntent(fp);
                 while (feof(fp) == 0 && ferror(fp) ==0) {
-                        if (strcmp(mnt->mnt_type, "lustre_lite") == 0) 
+                        if (llapi_is_lustre_mnttype(mnt->mnt_type))
                                 break;
                         mnt = getmntent(fp);
                 }
                 endmntent(fp);
         }
-           
+
         rc = op_check(type_num,obd_type_p,mnt->mnt_dir);
 
         if (rc)
                 fprintf(stderr, "error: %s: %s status failed\n",
                                 argv[0],argv[1]);
-                                                                                                                             
+
         return rc;
 
 }
@@ -293,7 +294,7 @@ static int lfs_catinfo(int argc, char **argv)
         FILE *fp;
         struct mntent *mnt = NULL;
         int rc;
-        
+
         if (argc < 2 || (!strcmp(argv[1],"config") && argc < 3))
                 return CMD_HELP;
 
@@ -302,12 +303,12 @@ static int lfs_catinfo(int argc, char **argv)
 
         fp = setmntent(MOUNTED, "r");
         if (fp == NULL) {
-                 fprintf(stderr, "setmntent(%s): %s:", MOUNTED, 
+                 fprintf(stderr, "setmntent(%s): %s:", MOUNTED,
                          strerror(errno));
         } else {
                 mnt = getmntent(fp);
                 while (feof(fp) == 0 && ferror(fp) == 0) {
-                        if (strcmp(mnt->mnt_type, "lustre_lite") == 0) 
+                        if (llapi_is_lustre_mnttype(mnt->mnt_type))
                                 break;
                         mnt = getmntent(fp);
                 }
@@ -332,13 +333,13 @@ int main(int argc, char **argv)
         int rc;
 
         setlinebuf(stdout);
-                                                                                                                             
+
         ptl_initialize(argc, argv);
         if (obd_initialize(argc, argv) < 0)
                 exit(2);
         if (dbg_initialize(argc, argv) < 0)
                 exit(3);
-                                                                                                                             
+
         Parser_init("lfs > ", cmdlist);
 
         if (argc > 1) {
index 987550c..254d7a0 100644 (file)
@@ -74,7 +74,7 @@ int op_create_file(char *name, long stripe_size, int stripe_offset,
         lum.lmm_stripe_count = stripe_count;
 
         fd = open(name, O_CREAT | O_RDWR | O_LOV_DELAY_CREATE, 0644);
-        if (errno == EISDIR) 
+        if (errno == EISDIR)
                 fd = open(name, O_DIRECTORY | O_RDONLY);
 
         if (fd < 0) {
@@ -259,9 +259,9 @@ void lov_dump_user_lmm_v1(struct lov_user_md_v1 *lum, char *dname, char *fname,
                         printf("count: %d, size: %d, offset: %d\n\n",
                                lum->lmm_stripe_count, lum->lmm_stripe_size,
                                (short int)lum->lmm_stripe_offset);
-                }                
+                }
                 return;
-        }        
+        }
 
         if (header && (obdstripe == 1)) {
                 printf("lmm_magic:          0x%08X\n",  lum->lmm_magic);
@@ -273,18 +273,16 @@ void lov_dump_user_lmm_v1(struct lov_user_md_v1 *lum, char *dname, char *fname,
         }
 
         if (body) {
-                long long oid;
-
                 if ((!quiet) && (obdstripe == 1))
                         printf("\tobdidx\t\t objid\t\tobjid\t\t group\n");
 
                 for (i = 0; i < lum->lmm_stripe_count; i++) {
                         int idx = lum->lmm_objects[i].l_ost_idx;
-                        oid = lum->lmm_objects[i].l_object_id;
+                        long long oid = lum->lmm_objects[i].l_object_id;
+                        long long gr = lum->lmm_objects[i].l_object_gr;
                         if ((obdindex == OBD_NOT_FOUND) || (obdindex == idx))
-                                printf("\t%6u\t%14llu\t%#13llx\t%14lld%s\n",
-                                       idx, oid, oid, 
-                                       (long long)lum->lmm_objects[i].l_object_gr,
+                                printf("\t%6u\t%14llu\t%#13llx\t%14llu%s\n",
+                                       idx, oid, oid, gr,
                                        obdindex == idx ? " *" : "");
                 }
                 printf("\n");
@@ -349,7 +347,7 @@ int get_file_stripe(char *path, struct lov_user_md *lum)
 }
 
 static int process_file(DIR *dir, char *dname, char *fname,
-                         struct find_param *param)
+                        struct find_param *param)
 {
         int rc;
 
@@ -419,9 +417,8 @@ static int process_dir(DIR *dir, char *dname, struct find_param *param)
         rc = ioctl(dirfd(dir), LL_IOC_LOV_GETSTRIPE, (void *)param->lum);
         if (rc) {
                 if (errno == ENODATA) {
-                        if (!param->obduuid && !param->quiet)
-                                printf("%s/%s has no stripe info\n", 
-                                       dname, "");
+                        if (!param->obduuid && param->verbose)
+                                printf("%s/%s has no stripe info\n", dname, "");
                         rc = 0;
                 } else {
                         err_msg("IOC_MDC_GETSTRIPE ioctl failed");
@@ -561,12 +558,11 @@ out:
 
 int op_check(int type_num, char **obd_type, char *dir)
 {
+        char buf[MAX_STRING_SIZE];
+        FILE *fp = fopen(DEVICES_LIST, "r");
         int rc = 0;
         int i;
 
-        char buf[MAX_STRING_SIZE];
-        FILE *fp = fopen(DEVICES_LIST, "r");
-                                                                                                                                               
         if (fp == NULL) {
                 fprintf(stderr, "error: %s could not open file "
                         DEVICES_LIST " .\n", strerror(rc =  errno));
@@ -576,44 +572,46 @@ int op_check(int type_num, char **obd_type, char *dir)
         while (fgets(buf, sizeof(buf), fp) != NULL) {
                 char *obd_type_name = NULL;
                 char *obd_name = NULL;
-
                 char rawbuf[OBD_MAX_IOCTL_BUFFER];
                 char *bufl = rawbuf;
                 char *bufp = buf;
                 int max = sizeof(rawbuf);
                 struct obd_ioctl_data datal;
                 struct obd_statfs osfs_buffer;
-                                                                                
-                while(bufp[0] == ' ') bufp += 1;
+
+                while(bufp[0] == ' ')
+                        ++bufp;
+
                 for(i = 0; i < 3; i++) {
                         obd_type_name = strsep(&bufp, " ");
                 }
                 obd_name = strsep(&bufp, " ");
 
-                memset (&osfs_buffer, 0, sizeof (osfs_buffer));
+                memset(&osfs_buffer, 0, sizeof (osfs_buffer));
 
                 memset(bufl, 0, sizeof(rawbuf));
                 datal.ioc_pbuf1 = (char *)&osfs_buffer;
-                datal.ioc_plen1 = sizeof (osfs_buffer);
+                datal.ioc_plen1 = sizeof(osfs_buffer);
 
-                for (i=0;i<type_num;i++) 
+                for (i = 0; i < type_num; i++)
                         if (strcmp(obd_type_name, obd_type[i]) == 0) {
                                 datal.ioc_inlbuf1 = obd_name;
-                                datal.ioc_inllen1 = strlen(obd_name) + 1; 
+                                datal.ioc_inllen1 = strlen(obd_name) + 1;
 
                                 obd_ioctl_pack(&datal,&bufl,max);
 
-                                rc = ioctl(dirfd(opendir(dir)), OBD_IOC_PING,bufl);
+                                rc = ioctl(dirfd(opendir(dir)), OBD_IOC_PING,
+                                           bufl);
 
                                 if (rc) {
-                                        fprintf(stderr, "error: check %s: %s\n", 
+                                        fprintf(stderr, "error: check %s: %s\n",
                                                 obd_name, strerror(rc = errno));
                                 } else {
                                         printf("%s active.\n",obd_name);
                                 }
                         }
 
-        }                                                                                                  
+        }
         fclose(fp);
         return rc;
 }
@@ -629,7 +627,7 @@ int op_catinfo(char *dir, char *keyword, char *node_name)
         char key[30];
         DIR *root;
         int rc;
-        
+
         sprintf(key, "%s", keyword);
         memset(raw, 0, sizeof(buf));
         memset(out, 0, sizeof(out));
@@ -642,22 +640,26 @@ int op_catinfo(char *dir, char *keyword, char *node_name)
         data.ioc_pbuf1 = out;
         data.ioc_plen1 = sizeof(out);
         rc = obd_ioctl_pack(&data, &buf, sizeof(raw));
-        if (rc) 
+        if (rc)
                 return rc;
-        
+
         root = opendir(dir);
         if (root == NULL) {
                 err_msg("open %s failed", dir);
                 return errno;
         }
 
-        rc = ioctl(dirfd(root), OBD_IOC_LLOG_CATINFO, buf); 
+        rc = ioctl(dirfd(root), OBD_IOC_LLOG_CATINFO, buf);
         if (rc)
                 err_msg("ioctl OBD_IOC_CATINFO failed");
         else
                 fprintf(stdout, "%s", data.ioc_pbuf1);
-                
+
         closedir(root);
         return rc;
 }
-        
+
+int llapi_is_lustre_mnttype(char *type)
+{
+        return (strcmp(type,"lustre") == 0 || strcmp(type,"lustre_lite") == 0);
+}
index 1270f91..a8c9e6e 100644 (file)
@@ -194,7 +194,7 @@ set_local(struct lustre_mount_data *lmd)
                 if (rc != 0) {
                         fprintf(stderr, "%s: can't read Elan ID from /proc\n",
                                 progname);
-                                
+
                         return -1;
                 }
         }