Whamcloud - gitweb
b=19808 2.6.29-fc11 patchless client support
[fs/lustre-release.git] / lustre / include / lustre_export.h
index 33b5248..75457a2 100644 (file)
 #ifndef __EXPORT_H
 #define __EXPORT_H
 
+#include <lprocfs_status.h>
 #include <lustre/lustre_idl.h>
 #include <lustre_dlm.h>
-#include <lprocfs_status.h>
-#include <class_hash.h>
 
 struct mds_client_data;
 struct mdt_client_data;
@@ -74,7 +73,7 @@ struct mdt_export_data {
 
 struct osc_creator {
         spinlock_t              oscc_lock;
-        struct list_head        oscc_list;
+        struct list_head        oscc_wait_create_list;
         struct obd_device       *oscc_obd;
         obd_id                  oscc_last_id;//last available pre-created object
         obd_id                  oscc_next_id;// what object id to give out next
@@ -109,24 +108,31 @@ struct filter_export_data {
 #define fed_lr_off      fed_led.led_lr_off
 #define fed_lr_idx      fed_led.led_lr_idx
 
-typedef struct nid_stat_uuid {
-        struct list_head ns_uuid_list;
-        struct obd_uuid  ns_uuid;
-} nid_stat_uuid_t;
-
 typedef struct nid_stat {
         lnet_nid_t               nid;
         struct hlist_node        nid_hash;
         struct list_head         nid_list;
-        struct list_head         nid_uuid_list;
         struct obd_device       *nid_obd;
         struct proc_dir_entry   *nid_proc;
         struct lprocfs_stats    *nid_stats;
         struct lprocfs_stats    *nid_ldlm_stats;
         struct brw_stats        *nid_brw_stats;
-        int                      nid_exp_ref_count;
+        atomic_t                 nid_exp_ref_count; /* for obd_nid_stats_hash
+                                                           exp_nid_stats */
 }nid_stat_t;
 
+#define nidstat_getref(nidstat)                                                \
+do {                                                                           \
+        atomic_inc(&(nidstat)->nid_exp_ref_count);                             \
+} while(0)
+
+#define nidstat_putref(nidstat)                                                \
+do {                                                                           \
+        atomic_dec(&(nidstat)->nid_exp_ref_count);                             \
+        LASSERTF(atomic_read(&(nidstat)->nid_exp_ref_count) >= 0,              \
+                 "stat %p nid_exp_ref_count < 0\n", nidstat);                  \
+} while(0)
+
 enum obd_option {
         OBD_OPT_FORCE =         0x0001,
         OBD_OPT_FAILOVER =      0x0002,
@@ -136,7 +142,20 @@ enum obd_option {
 struct obd_export {
         struct portals_handle     exp_handle;
         atomic_t                  exp_refcount;
-        atomic_t                  exp_rpc_count;
+        /**
+         * Set of counters below is to track where export references are
+         * kept. The exp_rpc_count is used for reconnect handling also,
+         * the cb_count and locks_count are for debug purposes only for now.
+         * The sum of them should be less than exp_refcount by 3
+         */
+        atomic_t                  exp_rpc_count; /** RPC references */
+        atomic_t                  exp_cb_count; /** Commit callback references */
+        atomic_t                  exp_locks_count; /** Lock references */
+#if LUSTRE_TRACKS_LOCK_EXP_REFS
+        struct list_head          exp_locks_list;
+        spinlock_t                exp_locks_list_guard;
+#endif
+        atomic_t                  exp_replay_count;
         struct obd_uuid           exp_client_uuid;
         struct list_head          exp_obd_chain;
         struct hlist_node         exp_uuid_hash; /* uuid-export hash*/
@@ -149,7 +168,7 @@ struct obd_export {
         struct lprocfs_stats     *exp_md_stats;
         struct ptlrpc_connection *exp_connection;
         __u32                     exp_conn_cnt;
-        lustre_hash_t            *exp_lock_hash; /* existing lock hash */
+        cfs_hash_t               *exp_lock_hash; /* existing lock hash */
         spinlock_t                exp_lock_hash_lock;
         struct list_head          exp_outstanding_replies;
         struct list_head          exp_uncommitted_replies;
@@ -174,7 +193,10 @@ struct obd_export {
                                   exp_need_sync:1,
                                   exp_flvr_changed:1,
                                   exp_flvr_adapt:1,
-                                  exp_libclient:1; /* liblustre client? */
+                                  exp_libclient:1, /* liblustre client? */
+                                  /* client timed out and tried to reconnect,
+                                   * but couldn't because of active rpcs */
+                                  exp_abort_active_req:1;
         struct list_head          exp_queued_rpc;  /* RPC to be handled */
         /* also protected by exp_lock */
         enum lustre_sec_part      exp_sp_peer;
@@ -235,6 +257,12 @@ static inline int exp_connect_vbr(struct obd_export *exp)
         return !!(exp->exp_connect_flags & OBD_CONNECT_VBR);
 }
 
+static inline int exp_connect_som(struct obd_export *exp)
+{
+        LASSERT(exp != NULL);
+        return !!(exp->exp_connect_flags & OBD_CONNECT_SOM);
+}
+
 static inline int imp_connect_lru_resize(struct obd_import *imp)
 {
         struct obd_connect_data *ocd;