Whamcloud - gitweb
Fixes some scability and access to not inited memory problems
[fs/lustre-release.git] / lustre / include / obd.h
index d16b2ea..ef4c7ff 100644 (file)
 #include <lustre_quota.h>
 #include <lustre_fld.h>
 #include <lustre_capa.h>
+#include <class_hash.h>
+
+#include <libcfs/bitmap.h>
+
 
 #define MAX_OBD_DEVICES 8192
 
@@ -376,6 +380,7 @@ struct filter_obd {
 #define OSC_MAX_RIF_MAX         256
 #define OSC_MAX_DIRTY_DEFAULT  (OSC_MAX_RIF_DEFAULT * 4)
 #define OSC_MAX_DIRTY_MB_MAX   2048     /* arbitrary, but < MAX_LONG bytes */
+#define OSC_DEFAULT_RESENDS      10
 
 #define MDC_MAX_RIF_DEFAULT       8
 #define MDC_MAX_RIF_MAX         512
@@ -465,6 +470,8 @@ struct client_obd {
 
         /* sequence manager */
         struct lu_client_seq    *cl_seq;
+
+        atomic_t                 cl_resends; /* resend count */
 };
 #define obd2cli_tgt(obd) ((char *)(obd)->u.cli.cl_target_uuid.uuid)
 
@@ -520,12 +527,17 @@ struct mds_obd {
         struct obd_export               *mds_osc_exp; /* XXX lov_exp */
         struct lov_desc                  mds_lov_desc;
         __u32                            mds_id;
-        obd_id                          *mds_lov_objids;
-        int                              mds_lov_objids_size;
-        __u32                            mds_lov_objids_in_file;
-        unsigned int                     mds_lov_objids_dirty:1;
-        int                              mds_lov_nextid_set;
+
+        /* mark pages dirty for write. */
+        bitmap_t                         *mds_lov_page_dirty;
+        /* array for store pages with obd_id */
+        void                            **mds_lov_page_array;
+        /* file for store objid */
         struct file                     *mds_lov_objid_filp;
+        __u32                            mds_lov_objid_count;
+        __u32                            mds_lov_objid_lastpage;
+        __u32                            mds_lov_objid_lastidx;
+
         struct file                     *mds_health_check_filp;
         unsigned long                   *mds_client_bitmap;
 //        struct upcall_cache             *mds_group_hash;
@@ -533,10 +545,11 @@ struct mds_obd {
         struct lustre_quota_info         mds_quota_info;
         struct semaphore                 mds_qonoff_sem;
         struct semaphore                 mds_health_sem;
-        unsigned long                    mds_lov_objids_valid:1,
-                                         mds_fl_user_xattr:1,
-                                         mds_fl_acl:1;
-
+        unsigned long                    mds_fl_user_xattr:1,
+                                         mds_fl_acl:1,
+                                         mds_evict_ost_nids:1,
+                                         mds_fl_cfglog:1,
+                                         mds_fl_synced:1;
 
         struct upcall_cache             *mds_identity_cache;
         struct upcall_cache             *mds_rmtacl_cache;
@@ -548,6 +561,25 @@ struct mds_obd {
         struct lustre_capa_key          *mds_capa_keys;
 };
 
+/* lov objid */
+extern __u32 mds_max_ost_index;
+
+#define MDS_LOV_ALLOC_SIZE (CFS_PAGE_SIZE)
+
+#define OBJID_PER_PAGE() (MDS_LOV_ALLOC_SIZE / sizeof(obd_id))
+
+#define MDS_LOV_OBJID_PAGES_COUNT (mds_max_ost_index/OBJID_PER_PAGE())
+
+extern int mds_lov_init_objids(struct obd_device *obd);
+extern void mds_lov_destroy_objids(struct obd_device *obd);
+
+struct obd_id_info {
+        __u32   idx;
+        obd_id  *data;
+};
+
+/* */
+
 struct echo_obd {
         struct obdo          eo_oa;
         spinlock_t           eo_lock;
@@ -709,7 +741,6 @@ struct niobuf_local {
 struct obd_trans_info {
         __u64                    oti_transno;
         __u64                    oti_xid;
-        __u64                   *oti_objid;
         /* Only used on the server side for tracking acks. */
         struct oti_req_ack_lock {
                 struct lustre_handle lock;
@@ -790,6 +821,12 @@ enum obd_notify_event {
         OBD_NOTIFY_CONFIG
 };
 
+/* bit-mask flags for config events */
+enum config_flags {
+        CONFIG_LOG = 0x1,  /* finished processing config log */
+        CONFIG_SYNC = 0x2  /* mdt synced 1 ost */
+};
+
 /*
  * Data structure used to pass obd_notify()-event to non-obd listeners (llite
  * and liblustre being main examples).
@@ -835,7 +872,13 @@ struct obd_device {
                      obd_force:1,         /* cleanup with > 0 obd refcount */
                      obd_fail:1,          /* cleanup with failover */
                      obd_async_recov:1,   /* allow asyncronous orphan cleanup */
-                     obd_no_conn:1;       /* deny new connections */
+                     obd_no_conn:1,       /* deny new connections */
+                     obd_inactive:1;      /* device active/inactive
+                                           * (for /proc/status only!!) */
+        /* uuid-export hash body */
+        struct lustre_class_hash_body *obd_uuid_hash_body;
+        /* nid-export hash body */
+        struct lustre_class_hash_body *obd_nid_hash_body; 
         atomic_t obd_refcount;
         cfs_waitq_t             obd_refcount_waitq;
         struct list_head        obd_exports;
@@ -911,6 +954,8 @@ struct obd_device {
         cfs_proc_dir_entry_t  *obd_svc_procroot;
         struct lprocfs_stats  *obd_svc_stats;
         struct semaphore       obd_proc_exp_sem;
+        atomic_t               obd_evict_inprogress;
+        cfs_waitq_t            obd_evict_inprogress_waitq;
 };
 
 #define OBD_OPT_FORCE           0x0001
@@ -1214,18 +1259,23 @@ struct lustre_md {
         struct obd_capa         *oss_capa;
 };
 
+struct md_open_data {
+        struct obd_client_handle *mod_och;
+        struct list_head          mod_replay_list;
+};
+
 struct md_ops {
         int (*m_getstatus)(struct obd_export *, struct lu_fid *,
                            struct obd_capa **);
         int (*m_change_cbdata)(struct obd_export *, const struct lu_fid *,
                                ldlm_iterator_t, void *);
         int (*m_close)(struct obd_export *, struct md_op_data *,
-                       struct obd_client_handle *, struct ptlrpc_request **);
+                       struct md_open_data *, struct ptlrpc_request **);
         int (*m_create)(struct obd_export *, struct md_op_data *,
                         const void *, int, int, __u32, __u32, __u32,
                         __u64, struct ptlrpc_request **);
         int (*m_done_writing)(struct obd_export *, struct md_op_data  *,
-                              struct obd_client_handle *);
+                              struct md_open_data *);
         int (*m_enqueue)(struct obd_export *, struct ldlm_enqueue_info *,
                          struct lookup_intent *, struct md_op_data *,
                          struct lustre_handle *, void *, int, int);
@@ -1248,7 +1298,8 @@ struct md_ops {
                            const struct lu_fid *,
                            struct ptlrpc_request **);
         int (*m_setattr)(struct obd_export *, struct md_op_data *, void *,
-                         int , void *, int, struct ptlrpc_request **);
+                         int , void *, int, struct ptlrpc_request **,
+                         struct md_open_data **mod);
         int (*m_sync)(struct obd_export *, const struct lu_fid *,
                       struct obd_capa *, struct ptlrpc_request **);
         int (*m_readpage)(struct obd_export *, const struct lu_fid *,
@@ -1283,9 +1334,10 @@ struct md_ops {
                                         struct obd_client_handle *);
         int (*m_set_lock_data)(struct obd_export *, __u64 *, void *);
 
-        int (*m_lock_match)(struct obd_export *, int, const struct lu_fid *,
-                            ldlm_type_t, ldlm_policy_data_t *, ldlm_mode_t,
-                            struct lustre_handle *);
+        ldlm_mode_t (*m_lock_match)(struct obd_export *, int,
+                                    const struct lu_fid *, ldlm_type_t,
+                                    ldlm_policy_data_t *, ldlm_mode_t,
+                                    struct lustre_handle *);
 
         int (*m_cancel_unused)(struct obd_export *, const struct lu_fid *,
                                ldlm_policy_data_t *, ldlm_mode_t, int flags,