Whamcloud - gitweb
Branch b1_4
authoradilger <adilger>
Fri, 3 Jun 2005 22:15:53 +0000 (22:15 +0000)
committeradilger <adilger>
Fri, 3 Jun 2005 22:15:53 +0000 (22:15 +0000)
Remove redundant ptlrpc_fail_export() function, use class_fail_export().
Move EXPORT_SYMBOL functions to where the function is defined, for clarity.
Move lov_merge_* declarations to a header (same as b_cray).
Fix some compile warnings for liblustre.
b=5921

16 files changed:
lustre/include/linux/lustre_ha.h
lustre/include/linux/obd_class.h
lustre/ldlm/ldlm_lockd.c
lustre/liblustre/file.c
lustre/liblustre/super.c
lustre/llite/file.c
lustre/llite/llite_mmap.c
lustre/mds/handler.c
lustre/obdclass/class_obd.c
lustre/obdclass/genops.c
lustre/obdclass/lprocfs_status.c
lustre/ost/ost_handler.c
lustre/ptlrpc/lproc_ptlrpc.c
lustre/ptlrpc/ptlrpc_module.c
lustre/ptlrpc/recover.c
lustre/utils/liblustreapi.c

index 8b7bef4..5083b94 100644 (file)
@@ -23,6 +23,5 @@ void ptlrpc_activate_import(struct obd_import *imp);
 void ptlrpc_deactivate_import(struct obd_import *imp);
 void ptlrpc_invalidate_import(struct obd_import *imp);
 void ptlrpc_fail_import(struct obd_import *imp, int generation);
-void ptlrpc_fail_export(struct obd_export *exp);
 
 #endif
index f306d12..a8c048f 100644 (file)
@@ -79,6 +79,15 @@ void oig_complete_one(struct obd_io_group *oig,
                        struct oig_callback_context *occ, int rc);
 void oig_release(struct obd_io_group *oig);
 int oig_wait(struct obd_io_group *oig);
+/* ping evictor */
+#ifdef __KERNEL__
+void ping_evictor_start(void);
+void ping_evictor_stop(void);
+#else
+#define ping_evictor_start()    do {} while (0)
+#define ping_evictor_stop()     do {} while (0)
+#endif
+
 
 /* buf should be len PTL_NALFMT_SIZE */
 char *obd_export_nid2str(struct obd_export *exp, char *buf);
@@ -97,9 +106,9 @@ struct config_llog_instance {
         struct obd_uuid cfg_uuid;
         ptl_nid_t  cfg_local_nid;
 };
-int class_config_parse_llog(struct llog_ctxt *ctxt, char *name, 
+int class_config_parse_llog(struct llog_ctxt *ctxt, char *name,
                             struct config_llog_instance *cfg);
-int class_config_dump_llog(struct llog_ctxt *ctxt, char *name, 
+int class_config_dump_llog(struct llog_ctxt *ctxt, char *name,
                            struct config_llog_instance *cfg);
 
 struct lustre_profile {
@@ -145,6 +154,7 @@ void class_put_type(struct obd_type *type);
 int class_connect(struct lustre_handle *conn, struct obd_device *obd,
                   struct obd_uuid *cluuid);
 int class_disconnect(struct obd_export *exp);
+void class_fail_export(struct obd_export *exp);
 void class_disconnect_exports(struct obd_device *obddev);
 void class_disconnect_stale_exports(struct obd_device *obddev);
 /* generic operations shared by various OBD types */
@@ -163,10 +173,6 @@ void obdo_cpy_md(struct obdo *dst, struct obdo *src, obd_flag valid);
 int obdo_cmp_md(struct obdo *dst, struct obdo *src, obd_flag compare);
 void obdo_to_ioobj(struct obdo *oa, struct obd_ioobj *ioobj);
 
-/* ping evictor */
-void ping_evictor_start(void);
-void ping_evictor_stop(void);
-
 
 #define OBT(dev)        (dev)->obd_type
 #define OBP(dev, op)    (dev)->obd_type->typ_ops->o_ ## op
@@ -318,10 +324,10 @@ obd_process_config(struct obd_device *obd, int datalen, void *data)
 {
         int rc;
         ENTRY;
+
         OBD_CHECK_OP(obd, process_config, -EOPNOTSUPP);
         OBD_COUNTER_INCREMENT(obd, process_config);
+
         rc = OBP(obd, process_config)(obd, datalen, data);
         RETURN(rc);
 }
@@ -478,17 +484,17 @@ static inline int obd_setattr(struct obd_export *exp, struct obdo *obdo,
         RETURN(rc);
 }
 
-static inline int obd_setattr_async(struct obd_export *exp, 
+static inline int obd_setattr_async(struct obd_export *exp,
                                     struct obdo *obdo,
                                     struct lov_stripe_md *ea,
                                     struct obd_trans_info *oti)
 {
         int rc;
         ENTRY;
-                                                                                                                             
+
         EXP_CHECK_OP(exp, setattr_async);
         OBD_COUNTER_INCREMENT(exp->exp_obd, setattr_async);
-                                                                                                                             
+
         rc = OBP(exp->exp_obd, setattr_async)(exp, obdo, ea, oti);
         RETURN(rc);
 }
@@ -616,7 +622,7 @@ static inline int obd_statfs(struct obd_device *obd, struct obd_statfs *osfs,
 }
 
 static inline int obd_sync(struct obd_export *exp, struct obdo *oa,
-                           struct lov_stripe_md *ea, obd_size start, 
+                           struct lov_stripe_md *ea, obd_size start,
                            obd_size end)
 {
         int rc;
@@ -685,11 +691,11 @@ static inline int obd_brw_async(int cmd, struct obd_export *exp,
         RETURN(rc);
 }
 
-static inline  int obd_prep_async_page(struct obd_export *exp, 
+static inline  int obd_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, 
+                                       struct lov_oinfo *loi,
+                                       struct page *page, obd_off offset,
+                                       struct obd_async_page_ops *ops,
                                        void *data, void **res)
 {
         int ret;
@@ -732,16 +738,16 @@ static inline int obd_set_async_flags(struct obd_export *exp,
         OBD_CHECK_OP(exp->exp_obd, set_async_flags, -EOPNOTSUPP);
         OBD_COUNTER_INCREMENT(exp->exp_obd, set_async_flags);
 
-        rc = OBP(exp->exp_obd, set_async_flags)(exp, lsm, loi, cookie, 
+        rc = OBP(exp->exp_obd, set_async_flags)(exp, lsm, loi, cookie,
                                                 async_flags);
         RETURN(rc);
 }
 
-static inline int obd_queue_group_io(struct obd_export *exp, 
-                                     struct lov_stripe_md *lsm, 
-                                     struct lov_oinfo *loi, 
-                                     struct obd_io_group *oig, 
-                                     void *cookie, int cmd, obd_off off, 
+static inline int obd_queue_group_io(struct obd_export *exp,
+                                     struct lov_stripe_md *lsm,
+                                     struct lov_oinfo *loi,
+                                     struct obd_io_group *oig,
+                                     void *cookie, int cmd, obd_off off,
                                      int count, obd_flag brw_flags,
                                      obd_flag async_flags)
 {
@@ -752,14 +758,14 @@ static inline int obd_queue_group_io(struct obd_export *exp,
         OBD_COUNTER_INCREMENT(exp->exp_obd, queue_group_io);
         LASSERT(cmd & OBD_BRW_RWMASK);
 
-        rc = OBP(exp->exp_obd, queue_group_io)(exp, lsm, loi, oig, cookie, 
+        rc = OBP(exp->exp_obd, queue_group_io)(exp, lsm, loi, oig, cookie,
                                                cmd, off, count, brw_flags,
                                                async_flags);
         RETURN(rc);
 }
 
-static inline int obd_trigger_group_io(struct obd_export *exp, 
-                                       struct lov_stripe_md *lsm, 
+static inline int obd_trigger_group_io(struct obd_export *exp,
+                                       struct lov_stripe_md *lsm,
                                        struct lov_oinfo *loi,
                                        struct obd_io_group *oig)
 {
@@ -819,6 +825,11 @@ static inline int obd_commitrw(int cmd, struct obd_export *exp, struct obdo *oa,
         RETURN(rc);
 }
 
+/* b1_4_bug5047 has changes to make this an obd_merge_lvb() method */
+__u64 lov_merge_size(struct lov_stripe_md *lsm, int kms_only);
+__u64 lov_merge_blocks(struct lov_stripe_md *lsm);
+__u64 lov_merge_mtime(struct lov_stripe_md *lsm, __u64 current_time);
+
 static inline int obd_adjust_kms(struct obd_export *exp,
                                  struct lov_stripe_md *lsm, obd_off size,
                                  int shrink)
@@ -880,7 +891,7 @@ static inline int obd_match(struct obd_export *exp, struct lov_stripe_md *ea,
 }
 
 static inline int obd_change_cbdata(struct obd_export *exp,
-                                    struct lov_stripe_md *lsm, 
+                                    struct lov_stripe_md *lsm,
                                     ldlm_iterator_t it, void *data)
 {
         int rc;
@@ -1020,7 +1031,7 @@ static inline int obd_quotacheck(struct obd_export *exp,
 
         rc = OBP(exp->exp_obd, quotacheck)(exp, oqctl);
         RETURN(rc);
-} 
+}
 
 static inline int obd_quotactl(struct obd_export *exp,
                                struct obd_quotactl *oqctl)
@@ -1033,7 +1044,7 @@ static inline int obd_quotactl(struct obd_export *exp,
 
         rc = OBP(exp->exp_obd, quotactl)(exp, oqctl);
         RETURN(rc);
-} 
+}
 
 
 static inline int obd_register_observer(struct obd_device *obd,
index 953c823..884cfb6 100644 (file)
@@ -167,7 +167,7 @@ static int expired_lock_main(void *arg)
                         export = class_export_get(lock->l_export);
                         spin_unlock_bh(&waiting_locks_spinlock);
 
-                        ptlrpc_fail_export(export);
+                        class_fail_export(export);
                         class_export_put(export);
                         spin_lock_bh(&waiting_locks_spinlock);
                 }
@@ -372,7 +372,7 @@ static void ldlm_failed_ast(struct ldlm_lock *lock, int rc,
 
         if (obd_dump_on_timeout)
                 portals_debug_dumplog();
-        ptlrpc_fail_export(lock->l_export);
+        class_fail_export(lock->l_export);
 }
 
 static int ldlm_handle_ast_error(struct ldlm_lock *lock,
index ab9017d..4df3b65 100644 (file)
@@ -77,8 +77,8 @@ void obdo_refresh_inode(struct inode *dst,
         valid &= src->o_valid;
 
         if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME))
-                CDEBUG(D_INODE, "valid %x, cur time %lu/%lu, new %lu/%lu\n",
-                       src->o_valid, LTIME_S(st->st_mtime), 
+                CDEBUG(D_INODE,"valid "LPX64", cur time %lu/%lu, new %lu/%lu\n",
+                       src->o_valid, LTIME_S(st->st_mtime),
                        LTIME_S(st->st_ctime),
                        (long)src->o_mtime, (long)src->o_ctime);
 
index d4bd1bf..7554335 100644 (file)
@@ -196,8 +196,8 @@ void obdo_to_inode(struct inode *dst, struct obdo *src, obd_flag valid)
         valid &= src->o_valid;
 
         if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME))
-                CDEBUG(D_INODE, "valid %x, cur time %lu/%lu, new %lu/%lu\n",
-                       src->o_valid, 
+                CDEBUG(D_INODE,"valid "LPX64", cur time %lu/%lu, new %lu/%lu\n",
+                       src->o_valid,
                        LTIME_S(st->st_mtime), LTIME_S(st->st_ctime),
                        (long)src->o_mtime, (long)src->o_ctime);
 
@@ -1415,8 +1415,6 @@ static int llu_iop_fcntl(struct inode *ino, int cmd, va_list ap, int *rtn)
 {
         struct llu_inode_info *lli = llu_i2info(ino);
         long flags;
-        struct flock *flock;
-        long err;
 
         switch (cmd) {
         case F_GETFL:
@@ -1436,17 +1434,21 @@ static int llu_iop_fcntl(struct inode *ino, int cmd, va_list ap, int *rtn)
                 *rtn = 0;
                 return 0;
 #if 0
-        case F_GETLK:
-                flock = va_arg(ap, struct flock *);
-                err = llu_fcntl_getlk(ino, flock);
-                *rtn = err? -1: 0;
+        case F_GETLK: {
+                struct flock *flock = va_arg(ap, struct flock *);
+                int err = llu_fcntl_getlk(ino, flock);
+                *rtn = err ? -1: 0;
+
                 return err;
+        }
         case F_SETLK:
-        case F_SETLKW:
-                flock = va_arg(ap, struct flock *);
-                err = llu_fcntl_setlk(ino, cmd, flock);
-                *rtn = err? -1: 0;
+        case F_SETLKW: {
+                struct flock *flock = va_arg(ap, struct flock *);
+                int err = llu_fcntl_setlk(ino, cmd, flock);
+                *rtn = err ? -1: 0;
+
                 return err;
+        }
 #endif
         }
 
@@ -1518,12 +1520,12 @@ static int llu_put_grouplock(struct inode *inode, unsigned long arg)
 static int llu_iop_ioctl(struct inode *ino, unsigned long int request,
                          va_list ap)
 {
-        unsigned long arg;
 
         liblustre_wait_event(0);
 
         switch (request) {
 #if 0
+        unsigned long arg;
         case LL_IOC_GROUP_LOCK:
                 arg = va_arg(ap, unsigned long);
                 return llu_get_grouplock(ino, arg);
@@ -1566,7 +1568,7 @@ struct inode *llu_iget(struct filesys *fs, struct lustre_md *md)
         if ((md->body->valid &
              (OBD_MD_FLGENER | OBD_MD_FLID | OBD_MD_FLTYPE)) !=
             (OBD_MD_FLGENER | OBD_MD_FLID | OBD_MD_FLTYPE)) {
-                CERROR("bad md body valid mask 0x%x\n", md->body->valid);
+                CERROR("bad md body valid mask "LPX64"\n", md->body->valid);
                 LBUG();
                 return ERR_PTR(-EPERM);
         }
index 94338d6..cab93f1 100644 (file)
@@ -639,10 +639,6 @@ static int ll_glimpse_callback(struct ldlm_lock *lock, void *reqp)
         return rc;
 }
 
-__u64 lov_merge_size(struct lov_stripe_md *lsm, int kms);
-__u64 lov_merge_blocks(struct lov_stripe_md *lsm);
-__u64 lov_merge_mtime(struct lov_stripe_md *lsm, __u64 current_time);
-
 /* NB: lov_merge_size will prefer locally cached writes if they extend the
  * file (because it prefers KMS over RSS when larger) */
 int ll_glimpse_size(struct inode *inode)
index 573db13..1e2b1d0 100644 (file)
@@ -68,7 +68,6 @@ struct ll_lock_tree_node {
         struct inode           *lt_inode;
 };
 
-__u64 lov_merge_size(struct lov_stripe_md *lsm, int kms);
 int lt_get_mmap_locks(struct ll_lock_tree *tree,
                       unsigned long addr, size_t count);
 
index 9537e48..b0ef204 100644 (file)
@@ -141,7 +141,7 @@ static int mds_sendpage(struct ptlrpc_request *req, struct file *file,
                   req->rq_export->exp_client_uuid.uuid,
                   req->rq_export->exp_connection->c_remote_uuid.uuid);
 
-        ptlrpc_fail_export(req->rq_export);
+        class_fail_export(req->rq_export);
 
         EXIT;
  abort_bulk:
index d1fd0a2..58568e8 100644 (file)
@@ -234,7 +234,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
                                               data->ioc_plen1);
                 if (err)
                         GOTO(out, err);
-                
+
                 OBD_ALLOC(lcfg, data->ioc_plen1);
                 err = copy_from_user(lcfg, data->ioc_pbuf1, data->ioc_plen1);
                 if (err)
@@ -399,10 +399,6 @@ void *obd_psdev = NULL;
 #endif
 
 EXPORT_SYMBOL(obd_dev);
-EXPORT_SYMBOL(obdo_cachep);
-EXPORT_SYMBOL(qunit_cachep);
-EXPORT_SYMBOL(qunit_hash_lock);
-EXPORT_SYMBOL(qunit_hash);
 EXPORT_SYMBOL(obd_fail_loc);
 EXPORT_SYMBOL(ll_set_rdonly);
 EXPORT_SYMBOL(ll_clear_rdonly);
@@ -428,32 +424,12 @@ EXPORT_SYMBOL(class_uuid2obd);
 EXPORT_SYMBOL(class_find_client_obd);
 EXPORT_SYMBOL(class_find_client_notype);
 EXPORT_SYMBOL(class_devices_in_group);
-EXPORT_SYMBOL(__class_export_put);
-EXPORT_SYMBOL(class_new_export);
-EXPORT_SYMBOL(class_unlink_export);
-EXPORT_SYMBOL(class_import_get);
-EXPORT_SYMBOL(class_import_put);
-EXPORT_SYMBOL(class_new_import);
-EXPORT_SYMBOL(class_destroy_import);
-EXPORT_SYMBOL(class_connect);
 EXPORT_SYMBOL(class_conn2export);
 EXPORT_SYMBOL(class_exp2obd);
 EXPORT_SYMBOL(class_conn2obd);
 EXPORT_SYMBOL(class_exp2cliimp);
 EXPORT_SYMBOL(class_conn2cliimp);
 EXPORT_SYMBOL(class_disconnect);
-EXPORT_SYMBOL(class_disconnect_exports);
-EXPORT_SYMBOL(class_disconnect_stale_exports);
-EXPORT_SYMBOL(class_update_export_timer);
-
-EXPORT_SYMBOL(oig_init);
-EXPORT_SYMBOL(oig_release);
-EXPORT_SYMBOL(oig_add_one);
-EXPORT_SYMBOL(oig_wait);
-EXPORT_SYMBOL(oig_complete_one);
-
-EXPORT_SYMBOL(ping_evictor_start);
-EXPORT_SYMBOL(ping_evictor_stop);
 
 /* uuid.c */
 EXPORT_SYMBOL(class_uuid_unparse);
index cb8b088..d7dfff4 100644 (file)
 
 extern struct list_head obd_types;
 static spinlock_t obd_types_lock = SPIN_LOCK_UNLOCKED;
+
 kmem_cache_t *obdo_cachep = NULL;
+EXPORT_SYMBOL(obdo_cachep);
 kmem_cache_t *import_cachep = NULL;
 
 kmem_cache_t *qunit_cachep = NULL;
 struct list_head qunit_hash[NR_DQHASH];
 spinlock_t qunit_hash_lock = SPIN_LOCK_UNLOCKED;
+EXPORT_SYMBOL(qunit_cachep);
+EXPORT_SYMBOL(qunit_hash);
+EXPORT_SYMBOL(qunit_hash_lock);
+
 
 int (*ptlrpc_put_connection_superhack)(struct ptlrpc_connection *c);
 void (*ptlrpc_abort_inflight_superhack)(struct obd_import *imp);
@@ -528,6 +534,7 @@ void __class_export_put(struct obd_export *exp)
                 class_decref(obd);
         }
 }
+EXPORT_SYMBOL(__class_export_put);
 
 /* Creates a new export, adds it to the hash table, and returns a
  * pointer to it. The refcount is 2: one for the hash reference, and
@@ -566,6 +573,7 @@ struct obd_export *class_new_export(struct obd_device *obd)
         obd_init_export(export);
         return export;
 }
+EXPORT_SYMBOL(class_new_export);
 
 void class_unlink_export(struct obd_export *exp)
 {
@@ -579,6 +587,7 @@ void class_unlink_export(struct obd_export *exp)
 
         class_export_put(exp);
 }
+EXPORT_SYMBOL(class_unlink_export);
 
 /* Import management functions */
 static void import_handle_addref(void *import)
@@ -595,6 +604,7 @@ struct obd_import *class_import_get(struct obd_import *import)
                atomic_read(&import->imp_refcount));
         return import;
 }
+EXPORT_SYMBOL(class_import_get);
 
 void class_import_put(struct obd_import *import)
 {
@@ -628,6 +638,7 @@ void class_import_put(struct obd_import *import)
         OBD_FREE(import, sizeof(*import));
         EXIT;
 }
+EXPORT_SYMBOL(class_import_put);
 
 struct obd_import *class_new_import(void)
 {
@@ -656,6 +667,7 @@ struct obd_import *class_new_import(void)
 
         return imp;
 }
+EXPORT_SYMBOL(class_new_import);
 
 void class_destroy_import(struct obd_import *import)
 {
@@ -673,6 +685,7 @@ void class_destroy_import(struct obd_import *import)
 
         class_import_put(import);
 }
+EXPORT_SYMBOL(class_destroy_import);
 
 /* A connection defines an export context in which preallocation can
    be managed. This releases the export pointer reference, and returns
@@ -700,6 +713,7 @@ int class_connect(struct lustre_handle *conn, struct obd_device *obd,
                cluuid->uuid, conn->cookie);
         RETURN(0);
 }
+EXPORT_SYMBOL(class_connect);
 
 /* This function removes two references from the export: one for the
  * hash entry and one for the export pointer passed in.  The export
@@ -721,10 +735,10 @@ int class_disconnect(struct obd_export *export)
         export->exp_disconnected = 1;
         spin_unlock(&export->exp_lock);
 
-        /* class_cleanup, abort_recovery, ptlrpc_fail_export, and
-           ping_evictor_fail_export all end up in here, and if any of them
-           race we shouldn't call extra class_export_puts. */
-        if (already_disconnected) 
+        /* class_cleanup(), abort_recovery(), and class_fail_export()
+         * all end up in here, and if any of them race we shouldn't
+         * call extra class_export_puts(). */
+        if (already_disconnected)
                 RETURN(0);
 
         CDEBUG(D_IOCTL, "disconnect: cookie "LPX64"\n",
@@ -735,7 +749,7 @@ int class_disconnect(struct obd_export *export)
         RETURN(0);
 }
 
-static void  class_disconnect_export_list(struct list_head *list, int flags)
+static void class_disconnect_export_list(struct list_head *list, int flags)
 {
         int rc;
         struct lustre_handle fake_conn;
@@ -802,6 +816,7 @@ void class_disconnect_exports(struct obd_device *obd)
         class_disconnect_export_list(&work_list, get_exp_flags_from_obd(obd));
         EXIT;
 }
+EXPORT_SYMBOL(class_disconnect_exports);
 
 /* Remove exports that have not completed recovery.
  */
@@ -830,6 +845,7 @@ void class_disconnect_stale_exports(struct obd_device *obd)
         class_disconnect_export_list(&work_list, get_exp_flags_from_obd(obd));
         EXIT;
 }
+EXPORT_SYMBOL(class_disconnect_stale_exports);
 
 int oig_init(struct obd_io_group **oig_out)
 {
@@ -850,16 +866,19 @@ int oig_init(struct obd_io_group **oig_out)
         *oig_out = oig;
         RETURN(0);
 };
+EXPORT_SYMBOL(oig_init);
 
 static inline void oig_grab(struct obd_io_group *oig)
 {
         atomic_inc(&oig->oig_refcount);
 }
+
 void oig_release(struct obd_io_group *oig)
 {
         if (atomic_dec_and_test(&oig->oig_refcount))
                 OBD_FREE(oig, sizeof(*oig));
 }
+EXPORT_SYMBOL(oig_release);
 
 void oig_add_one(struct obd_io_group *oig,
                   struct oig_callback_context *occ)
@@ -873,6 +892,7 @@ void oig_add_one(struct obd_io_group *oig,
         spin_unlock_irqrestore(&oig->oig_lock, flags);
         oig_grab(oig);
 }
+EXPORT_SYMBOL(oig_add_one);
 
 void oig_complete_one(struct obd_io_group *oig,
                       struct oig_callback_context *occ, int rc)
@@ -902,6 +922,7 @@ void oig_complete_one(struct obd_io_group *oig,
                 wake_up(wake);
         oig_release(oig);
 }
+EXPORT_SYMBOL(oig_complete_one);
 
 static int oig_done(struct obd_io_group *oig)
 {
@@ -962,12 +983,14 @@ int oig_wait(struct obd_io_group *oig)
         CDEBUG(D_CACHE, "done waiting on oig %p rc %d\n", oig, oig->oig_rc);
         return oig->oig_rc;
 }
-
+EXPORT_SYMBOL(oig_wait);
 
 /* Ping evictor thread */
+#define D_PET D_HA
+
+#ifdef __KERNEL__
 #define PET_READY     1
 #define PET_TERMINATE 2
-#define D_PET D_HA
 
 static int               pet_refcount = 0;
 static int               pet_state;
@@ -977,7 +1000,6 @@ static spinlock_t        pet_lock = SPIN_LOCK_UNLOCKED;
 
 static int ping_evictor_wake(struct obd_export *exp)
 {
-#ifdef __KERNEL__
         spin_lock(&pet_lock);
         if (pet_exp) {
                 /* eventually the new obd will call here again. */
@@ -993,17 +1015,14 @@ static int ping_evictor_wake(struct obd_export *exp)
            export in particular; we just need one to keep the obd. */
         class_export_get(pet_exp);
         wake_up(&pet_waitq);
-#endif
         return 0;
 }
 
-#ifdef __KERNEL__
-/* Same as ptlrpc_fail_export, but this module must load first... */
-void ping_evictor_fail_export(struct obd_export *exp)
+void class_fail_export(struct obd_export *exp)
 {
         int rc, already_failed;
         unsigned long flags;
-        
+
         spin_lock_irqsave(&exp->exp_lock, flags);
         already_failed = exp->exp_failed;
         exp->exp_failed = 1;
@@ -1015,9 +1034,12 @@ void ping_evictor_fail_export(struct obd_export *exp)
                 return;
         }
 
-        CDEBUG(D_PET, "disconnecting export %p/%s\n",
+        CDEBUG(D_HA, "disconnecting export %p/%s\n",
                exp, exp->exp_client_uuid.uuid);
 
+        if (obd_dump_on_timeout)
+                portals_debug_dumplog();
+
         /* Most callers into obd_disconnect are removing their own reference
          * (request, for example) in addition to the one from the hash table.
          * We don't have such a reference here, so make one. */
@@ -1025,9 +1047,11 @@ void ping_evictor_fail_export(struct obd_export *exp)
         rc = obd_disconnect(exp);
         if (rc)
                 CERROR("disconnecting export %p failed: %d\n", exp, rc);
-        CERROR("disconnected export %p/%s\n",
-               exp, exp->exp_client_uuid.uuid);
+        else
+                CDEBUG(D_HA, "disconnected export %p/%s\n",
+                       exp, exp->exp_client_uuid.uuid);
 }
+EXPORT_SYMBOL(class_fail_export);
 
 static int ping_evictor_main(void *arg)
 {
@@ -1082,10 +1106,10 @@ static int ping_evictor_main(void *arg)
                                               "and I am evicting it.\n",
                                               obd->obd_name,
                                               obd_export_nid2str(exp, ipbuf),
-                                              (long)(CURRENT_SECONDS - 
-                                                     exp->exp_last_request_time));
-                                
-                                ping_evictor_fail_export(exp);
+                                              (long)(CURRENT_SECONDS -
+                                                   exp->exp_last_request_time));
+
+                                class_fail_export(exp);
                         } else {
                                 /* List is sorted, so everyone below is ok */
                                 stop++;
@@ -1105,11 +1129,9 @@ static int ping_evictor_main(void *arg)
 
         RETURN(0);
 }
-#endif
 
 void ping_evictor_start(void)
 {
-#ifdef __KERNEL__
         int rc;
 
         if (++pet_refcount > 1)
@@ -1122,19 +1144,21 @@ void ping_evictor_start(void)
                 pet_refcount--;
                 CERROR("Cannot start ping evictor thread: %d\n", rc);
         }
-#endif
 }
+EXPORT_SYMBOL(ping_evictor_start);
 
 void ping_evictor_stop(void)
 {
-#ifdef __KERNEL__
         if (--pet_refcount > 0)
                 return;
 
         pet_state = PET_TERMINATE;
         wake_up(&pet_waitq);
-#endif
 }
+EXPORT_SYMBOL(ping_evictor_stop);
+#else /* !__KERNEL__ */
+#define ping_evictor_wake(exp)     1
+#endif
 
 /* This function makes sure dead exports are evicted in a timely manner.
    This function is only called when some export receives a message (i.e.,
@@ -1174,6 +1198,7 @@ void class_update_export_timer(struct obd_export *exp, time_t extra_delay)
 
         list_move_tail(&exp->exp_obd_chain_timed,
                        &exp->exp_obd->obd_exports_timed);
+
         oldest_exp = list_entry(exp->exp_obd->obd_exports_timed.next,
                                 struct obd_export, exp_obd_chain_timed);
         oldest_time = oldest_exp->exp_last_request_time;
@@ -1213,15 +1238,14 @@ void class_update_export_timer(struct obd_export *exp, time_t extra_delay)
 
         EXIT;
 }
+EXPORT_SYMBOL(class_update_export_timer);
 
 char *obd_export_nid2str(struct obd_export *exp, char *ipbuf)
 {
         struct ptlrpc_peer *peer;
-        
-        peer = exp->exp_connection 
-                ? &exp->exp_connection->c_peer
-                : NULL;
-        
+
+        peer = exp->exp_connection ? &exp->exp_connection->c_peer : NULL;
+
         if (peer && peer->peer_ni) {
                 portals_nid2str(peer->peer_ni->pni_number,
                                 peer->peer_id.nid,
index 0f8549d..cff37a3 100644 (file)
@@ -204,11 +204,11 @@ int lprocfs_rd_atomic(char *page, char **start, off_t off,
 int lprocfs_rd_uuid(char *page, char **start, off_t off, int count,
                     int *eof, void *data)
 {
-        struct obd_device *dev = (struct obd_device*)data;
+        struct obd_device *obd = (struct obd_device*)data;
 
-        LASSERT(dev != NULL);
+        LASSERT(obd != NULL);
         *eof = 1;
-        return snprintf(page, count, "%s\n", dev->obd_uuid.uuid);
+        return snprintf(page, count, "%s\n", obd->obd_uuid.uuid);
 }
 
 int lprocfs_rd_name(char *page, char **start, off_t off, int count,
index 1a6857e..4c868c5 100644 (file)
@@ -542,7 +542,7 @@ static int ost_brw_read(struct ptlrpc_request *req, struct obd_trans_info *oti)
                                req->rq_export->exp_client_uuid.uuid,
                                req->rq_export->exp_connection->c_remote_uuid.uuid,
                                req->rq_peerstr);
-                        ptlrpc_fail_export(req->rq_export);
+                        class_fail_export(req->rq_export);
                 } else {
                         CERROR("ignoring bulk IO comms error: "
                                "client reconnected %s@%s id %s\n",
@@ -759,7 +759,7 @@ static int ost_brw_write(struct ptlrpc_request *req, struct obd_trans_info *oti)
                                req->rq_export->exp_client_uuid.uuid,
                                req->rq_export->exp_connection->c_remote_uuid.uuid,
                                req->rq_peerstr);
-                        ptlrpc_fail_export(req->rq_export);
+                        class_fail_export(req->rq_export);
                 } else {
                         CERROR("ignoring bulk IO comms error: "
                                "client reconnected %s@%s id %s\n",
index 910613f..f82ec04 100644 (file)
@@ -485,7 +485,7 @@ int lprocfs_wr_evict_client(struct file *file, const char *buffer,
                 CERROR("can't disconnect %s: no export found\n", doomed.uuid);
         } else {
                 CERROR("evicting %s at adminstrative request\n", doomed.uuid);
-                ptlrpc_fail_export(doomed_exp);
+                class_fail_export(doomed_exp);
                 class_export_put(doomed_exp);
         }
         return count;
index 4629b71..f3e7c18 100644 (file)
@@ -189,7 +189,6 @@ EXPORT_SYMBOL(ptlrpc_activate_import);
 EXPORT_SYMBOL(ptlrpc_deactivate_import);
 EXPORT_SYMBOL(ptlrpc_invalidate_import);
 EXPORT_SYMBOL(ptlrpc_fail_import);
-EXPORT_SYMBOL(ptlrpc_fail_export);
 EXPORT_SYMBOL(ptlrpc_recover_import);
 
 /* pinger.c */
index bf5a75f..d1c33c8 100644 (file)
@@ -390,34 +390,3 @@ static int ptlrpc_recover_import_no_retry(struct obd_import *imp,
 
         RETURN(rc);
 }
-
-void ptlrpc_fail_export(struct obd_export *exp)
-{
-        int rc, already_failed;
-        unsigned long flags;
-
-        spin_lock_irqsave(&exp->exp_lock, flags);
-        already_failed = exp->exp_failed;
-        exp->exp_failed = 1;
-        spin_unlock_irqrestore(&exp->exp_lock, flags);
-
-        if (already_failed) {
-                CDEBUG(D_HA, "disconnecting dead export %p/%s; skipping\n",
-                       exp, exp->exp_client_uuid.uuid);
-                return;
-        }
-
-        CDEBUG(D_HA, "disconnecting export %p/%s\n",
-               exp, exp->exp_client_uuid.uuid);
-
-        if (obd_dump_on_timeout)
-                portals_debug_dumplog();
-
-        /* Most callers into obd_disconnect are removing their own reference
-         * (request, for example) in addition to the one from the hash table.
-         * We don't have such a reference here, so make one. */
-        class_export_get(exp);
-        rc = obd_disconnect(exp);
-        if (rc)
-                CERROR("disconnecting export %p failed: %d\n", exp, rc);
-}
index 079fbba..12782df 100644 (file)
@@ -207,7 +207,7 @@ int llapi_lov_get_uuids(int fd, struct obd_uuid *uuidp, int *ost_count)
         __u32 *obdgens;
 
         max_ost_count = (OBD_MAX_IOCTL_BUFFER - size_round(sizeof(data)) -
-                         size_round(sizeof(desc))) / 
+                         size_round(sizeof(desc))) /
                         (sizeof(*uuidp) + sizeof(*obdgens));
         if (max_ost_count > *ost_count)
                 max_ost_count = *ost_count;
@@ -260,23 +260,23 @@ static int setup_obd_uuids(DIR *dir, char *dname, struct find_param *param)
         char buf[1024];
         FILE *fp;
         int rc = 0, index;
-        
+
         param->got_uuids = 1;
 
         /* Get the lov name */
         rc = ioctl(dirfd(dir), OBD_IOC_GETNAME, (void *)uuid);
         if (rc) {
-                fprintf(stderr, "error: can't get lov name: %s\n", 
+                fprintf(stderr, "error: can't get lov name: %s\n",
                         strerror(rc = errno));
                 return rc;
         }
 
         /* Now get the ost uuids from /proc */
-        snprintf(buf, sizeof(buf), "/proc/fs/lustre/lov/%s/target_obd", 
+        snprintf(buf, sizeof(buf), "/proc/fs/lustre/lov/%s/target_obd",
                  uuid);
         fp = fopen(buf, "r");
         if (fp == NULL) {
-                fprintf(stderr, "error: %s opening %s\n", 
+                fprintf(stderr, "error: %s opening %s\n",
                         strerror(rc = errno), buf);
                 return rc;
         }
@@ -287,7 +287,7 @@ static int setup_obd_uuids(DIR *dir, char *dname, struct find_param *param)
         while (fgets(buf, sizeof(buf), fp) != NULL) {
                 if (sscanf(buf, "%d: %s", &index, uuid) < 2)
                         break;
-                
+
                 if (param->obduuid) {
                         if (strncmp(param->obduuid->uuid, uuid,
                                     sizeof(uuid)) == 0) {
@@ -301,14 +301,14 @@ static int setup_obd_uuids(DIR *dir, char *dname, struct find_param *param)
         }
 
         fclose(fp);
-        
+
         if (param->obduuid && (param->obdindex == OBD_NOT_FOUND)) {
                 printf("unknown obduuid: %s\n", param->obduuid->uuid);
                 rc =  EINVAL;
         }
-        
+
         return (rc);
-}                
+}
 
 void lov_dump_user_lmm_v1(struct lov_user_md_v1 *lum, char *dname, char *fname,
                           int obdindex, int quiet, int header, int body)