Whamcloud - gitweb
LU-3186 lmv: do not need allocate FID for open by FID
[fs/lustre-release.git] / lustre / mgs / mgs_internal.h
index 099f62c..73e4eef 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, Whamcloud, Inc.
+ * Copyright (c) 2011, 2012, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -38,7 +38,9 @@
 #define _MGS_INTERNAL_H
 
 #include <libcfs/libcfs.h>
+#include <lustre_log.h>
 #include <lustre_export.h>
+#include <dt_object.h>
 
 #define MGSSELF_NAME    "_mgs"
 
@@ -95,7 +97,7 @@ struct mgs_fsc {
 struct mgs_nidtbl {
         struct fs_db *mn_fsdb;
         struct file  *mn_version_file;
-        cfs_mutex_t   mn_lock;
+       struct mutex    mn_lock;
         u64           mn_version;
         int           mn_nr_targets;
         cfs_list_t    mn_targets;
@@ -119,7 +121,7 @@ struct mgs_tgt_srpc_conf {
 struct fs_db {
         char              fsdb_name[9];
         cfs_list_t        fsdb_list;           /* list of databases */
-        cfs_mutex_t       fsdb_mutex;
+       struct mutex      fsdb_mutex;
         void             *fsdb_ost_index_map;  /* bitmap of used indicies */
         void             *fsdb_mdt_index_map;  /* bitmap of used indicies */
         int               fsdb_mdt_count;
@@ -141,13 +143,12 @@ struct fs_db {
         struct mgs_nidtbl    fsdb_nidtbl;
 
         /* async thread to notify clients */
-        struct obd_device   *fsdb_obd;
        struct mgs_device   *fsdb_mgs;
         cfs_waitq_t          fsdb_notify_waitq;
-        cfs_completion_t     fsdb_notify_comp;
+       struct completion       fsdb_notify_comp;
         cfs_time_t           fsdb_notify_start;
         cfs_atomic_t         fsdb_notify_phase;
-        volatile int         fsdb_notify_async:1,
+       volatile unsigned int fsdb_notify_async:1,
                              fsdb_notify_stop:1;
         /* statistic data */
         unsigned int         fsdb_notify_total;
@@ -155,27 +156,23 @@ struct fs_db {
         unsigned int         fsdb_notify_count;
 };
 
-/* mgs_llog.c */
-int class_dentry_readdir(const struct lu_env *env,
-                        struct mgs_device *mgs, cfs_list_t *list);
-
 struct mgs_device {
        struct dt_device                 mgs_dt_dev;
        struct ptlrpc_service           *mgs_service;
        struct dt_device                *mgs_bottom;
        struct obd_export               *mgs_bottom_exp;
        struct dt_object                *mgs_configs_dir;
-       struct dentry                   *mgs_configs_dir_old;
        struct dt_object                *mgs_nidtbl_dir;
        cfs_list_t                       mgs_fs_db_list;
-       cfs_spinlock_t                   mgs_lock; /* covers mgs_fs_db_list */
+       spinlock_t                       mgs_lock; /* covers mgs_fs_db_list */
        cfs_proc_dir_entry_t            *mgs_proc_live;
+       cfs_proc_dir_entry_t            *mgs_proc_osd;
+       cfs_proc_dir_entry_t            *mgs_proc_fstype;
+       cfs_proc_dir_entry_t            *mgs_proc_mntdev;
        cfs_time_t                       mgs_start_time;
        struct obd_device               *mgs_obd;
        struct local_oid_storage        *mgs_los;
-       struct vfsmount                 *mgs_vfsmnt;
-       struct super_block              *mgs_sb;
-       cfs_mutex_t                      mgs_mutex;
+       struct mutex                     mgs_mutex;
 };
 
 /* this is a top object */
@@ -195,7 +192,8 @@ int mgs_get_fsdb_srpc_from_llog(const struct lu_env *env, struct mgs_device *mgs
 int mgs_check_index(const struct lu_env *env, struct mgs_device *mgs, struct mgs_target_info *mti);
 int mgs_check_failnid(const struct lu_env *env, struct mgs_device *mgs, struct mgs_target_info *mti);
 int mgs_write_log_target(const struct lu_env *env, struct mgs_device *mgs, struct mgs_target_info *mti,
-                         struct fs_db *fsdb);
+                        struct fs_db *fsdb);
+int mgs_replace_nids(const struct lu_env *env, struct mgs_device *mgs, char *devname, char *nids);
 int mgs_erase_log(const struct lu_env *env, struct mgs_device *mgs,
                  char *name);
 int mgs_erase_logs(const struct lu_env *env, struct mgs_device *mgs,
@@ -241,21 +239,20 @@ int mgs_client_free(struct obd_export *exp);
 int mgs_fs_setup(const struct lu_env *env, struct mgs_device *m);
 int mgs_fs_cleanup(const struct lu_env *env, struct mgs_device *m);
 
-#define strsuf(buf, suffix) (strcmp((buf)+strlen(buf)-strlen(suffix), (suffix)))
 #ifdef LPROCFS
-int lproc_mgs_setup(struct mgs_device *mgs);
-int lproc_mgs_cleanup(struct mgs_device *mgs);
+int lproc_mgs_setup(struct mgs_device *mgs, const char *osd_name);
+void lproc_mgs_cleanup(struct mgs_device *mgs);
 int lproc_mgs_add_live(struct mgs_device *mgs, struct fs_db *fsdb);
 int lproc_mgs_del_live(struct mgs_device *mgs, struct fs_db *fsdb);
 void lprocfs_mgs_init_vars(struct lprocfs_static_vars *lvars);
 #else
-static inline int lproc_mgs_setup(struct obd_device *dev)
-{return 0;}
-static inline int lproc_mgs_cleanup(struct obd_device *obd)
+static inline int lproc_mgs_setup(struct mgs_device *mgs, const char *osd_name)
 {return 0;}
-static inline int lproc_mgs_add_live(struct mgs_device *obd, struct fs_db *fsdb)
+static inline void lproc_mgs_cleanup(struct mgs_device *mgs)
+{}
+static inline int lproc_mgs_add_live(struct mgs_device *mgs, struct fs_db *fsdb)
 {return 0;}
-static inline int lproc_mgs_del_live(struct mgs_device *obd, struct fs_db *fsdb)
+static inline int lproc_mgs_del_live(struct mgs_device *mgs, struct fs_db *fsdb)
 {return 0;}
 static void lprocfs_mgs_init_vars(struct lprocfs_static_vars *lvars)
 {
@@ -275,13 +272,11 @@ enum {
 void mgs_counter_incr(struct obd_export *exp, int opcode);
 void mgs_stats_counter_init(struct lprocfs_stats *stats);
 
-struct temp_comp
-{
+struct temp_comp {
        struct mgs_target_info  *comp_tmti;
        struct mgs_target_info  *comp_mti;
        struct fs_db            *comp_fsdb;
-       struct mgs_device       *comp_mgs;
-       const struct lu_env     *comp_env;
+       struct obd_device       *comp_obd;
 };
 
 struct mgs_thread_info {
@@ -398,4 +393,8 @@ static inline struct mgs_direntry *mgs_direntry_alloc(int len)
        return de;
 }
 
+/* mgs_llog.c */
+int class_dentry_readdir(const struct lu_env *env, struct mgs_device *mgs,
+                        cfs_list_t *list);
+
 #endif /* _MGS_INTERNAL_H */