Whamcloud - gitweb
branch: HEAD
[fs/lustre-release.git] / lustre / mgs / mgs_internal.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  */
4
5 #ifndef _MGS_INTERNAL_H
6 #define _MGS_INTERNAL_H
7
8 #ifdef __KERNEL__
9 # include <linux/fs.h>
10 #endif
11 #include <libcfs/libcfs.h>
12 #include <lustre/lustre_idl.h>
13 #include <lustre_lib.h>
14 #include <lustre_dlm.h>
15 #include <lustre_log.h>
16 #include <lustre_export.h>
17
18 /* mgs_llog.c */
19 int class_dentry_readdir(struct obd_device *obd, struct dentry *dir,
20                          struct vfsmount *inmnt, 
21                          struct list_head *dentry_list);
22  
23 struct mgs_tgt_srpc_conf {
24         struct mgs_tgt_srpc_conf  *mtsc_next;
25         char                      *mtsc_tgt;
26         struct sptlrpc_rule_set    mtsc_rset;
27 };
28
29 #define INDEX_MAP_SIZE  8192     /* covers indicies to FFFF */
30 #define FSDB_LOG_EMPTY  0x0001  /* missing client log */
31 #define FSDB_OLDLOG14   0x0002  /* log starts in old (1.4) style */
32
33
34 struct fs_db {
35         char              fsdb_name[9];
36         struct list_head  fsdb_list;           /* list of databases */
37         struct semaphore  fsdb_sem;
38         void             *fsdb_ost_index_map;  /* bitmap of used indicies */
39         void             *fsdb_mdt_index_map;  /* bitmap of used indicies */
40         /* COMPAT_146 these items must be recorded out of the old client log */
41         char             *fsdb_clilov;         /* COMPAT_146 client lov name */
42         char             *fsdb_clilmv;
43         char             *fsdb_mdtlov;         /* COMPAT_146 mds lov name */
44         char             *fsdb_mdtlmv;
45         char             *fsdb_mdc;            /* COMPAT_146 mdc name */
46         /* end COMPAT_146 */
47         __u32             fsdb_flags;
48         __u32             fsdb_gen;
49
50         /* in-memory copy of the srpc rules, guarded by fsdb_sem */
51         struct sptlrpc_rule_set   fsdb_srpc_gen;
52         struct mgs_tgt_srpc_conf *fsdb_srpc_tgt;
53         unsigned int              fsdb_srpc_fl_udesc:1;
54 };
55
56 int mgs_init_fsdb_list(struct obd_device *obd);
57 int mgs_cleanup_fsdb_list(struct obd_device *obd);
58 int mgs_check_index(struct obd_device *obd, struct mgs_target_info *mti);
59 int mgs_check_failnid(struct obd_device *obd, struct mgs_target_info *mti);
60 int mgs_write_log_target(struct obd_device *obd, struct mgs_target_info *mti);
61 int mgs_upgrade_sv_14(struct obd_device *obd, struct mgs_target_info *mti);
62 int mgs_erase_log(struct obd_device *obd, char *name);
63 int mgs_erase_logs(struct obd_device *obd, char *fsname);
64 int mgs_setparam(struct obd_device *obd, struct lustre_cfg *lcfg, char *fsname);
65
66 /* mgs_fs.c */
67 int mgs_fs_setup(struct obd_device *obd, struct vfsmount *mnt);
68 int mgs_fs_cleanup(struct obd_device *obddev);
69
70 #define strsuf(buf, suffix) (strcmp((buf)+strlen(buf)-strlen(suffix), (suffix)))
71 #ifdef LPROCFS
72 int lproc_mgs_setup(struct obd_device *dev);
73 int lproc_mgs_cleanup(struct obd_device *obd);
74 int lproc_mgs_add_live(struct obd_device *obd, struct fs_db *fsdb);
75 int lproc_mgs_del_live(struct obd_device *obd, struct fs_db *fsdb);
76 void lprocfs_mgs_init_vars(struct lprocfs_static_vars *lvars);
77 #else
78 static inline int lproc_mgs_setup(struct obd_device *dev) 
79 {return 0;}
80 static inline int lproc_mgs_cleanup(struct obd_device *obd)
81 {return 0;}
82 static inline int lproc_mgs_add_live(struct obd_device *obd, struct fs_db *fsdb)
83 {return 0;}
84 static inline int lproc_mgs_del_live(struct obd_device *obd, struct fs_db *fsdb)
85 {return 0;}
86 static void lprocfs_mgs_init_vars(struct lprocfs_static_vars *lvars)
87 {
88         memset(lvars, 0, sizeof(*lvars));
89 }
90 #endif
91
92 /* mgs/lproc_mgs.c */
93 enum {
94         LPROC_MGS_CONNECT = 0,
95         LPROC_MGS_DISCONNECT,
96         LPROC_MGS_EXCEPTION,
97         LPROC_MGS_TARGET_REG,
98         LPROC_MGS_TARGET_DEL,
99         LPROC_MGS_LAST
100 };
101 void mgs_counter_incr(struct obd_export *exp, int opcode);
102 void mgs_stats_counter_init(struct lprocfs_stats *stats);
103
104 #endif /* _MGS_INTERNAL_H */