Whamcloud - gitweb
b=14184
[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/kp30.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 /* in ms */
19 #define MGS_SERVICE_WATCHDOG_TIMEOUT (obd_timeout * 1000)
20
21 /* mgs_llog.c */
22 int class_dentry_readdir(struct obd_device *obd, struct dentry *dir,
23                          struct vfsmount *inmnt, 
24                          struct list_head *dentry_list);
25  
26 #define INDEX_MAP_SIZE  8192     /* covers indicies to FFFF */
27 #define FSDB_LOG_EMPTY  0x0001  /* missing client log */
28 #define FSDB_OLDLOG14   0x0002  /* log starts in old (1.4) style */
29
30
31 struct fs_db {
32         char              fsdb_name[9];
33         struct list_head  fsdb_list;           /* list of databases */
34         struct semaphore  fsdb_sem;
35         void             *fsdb_ost_index_map;  /* bitmap of used indicies */
36         void             *fsdb_mdt_index_map;  /* bitmap of used indicies */
37         /* COMPAT_146 these items must be recorded out of the old client log */
38         char             *fsdb_clilov;         /* COMPAT_146 client lov name */
39         char             *fsdb_clilmv;
40         char             *fsdb_mdtlov;         /* COMPAT_146 mds lov name */
41         char             *fsdb_mdtlmv;
42         char             *fsdb_mdc;            /* COMPAT_146 mdc name */
43         /* end COMPAT_146 */
44         __u32             fsdb_flags;
45         __u32             fsdb_gen;
46 };
47
48 int mgs_init_fsdb_list(struct obd_device *obd);
49 int mgs_cleanup_fsdb_list(struct obd_device *obd);
50 int mgs_check_index(struct obd_device *obd, struct mgs_target_info *mti);
51 int mgs_check_failnid(struct obd_device *obd, struct mgs_target_info *mti);
52 int mgs_write_log_target(struct obd_device *obd, struct mgs_target_info *mti);
53 int mgs_upgrade_sv_14(struct obd_device *obd, struct mgs_target_info *mti);
54 int mgs_erase_log(struct obd_device *obd, char *name);
55 int mgs_erase_logs(struct obd_device *obd, char *fsname);
56 int mgs_setparam(struct obd_device *obd, struct lustre_cfg *lcfg, char *fsname);
57
58 /* mgs_fs.c */
59 int mgs_fs_setup(struct obd_device *obd, struct vfsmount *mnt);
60 int mgs_fs_cleanup(struct obd_device *obddev);
61
62 #define strsuf(buf, suffix) (strcmp((buf)+strlen(buf)-strlen(suffix), (suffix)))
63 #ifdef LPROCFS
64 int lproc_mgs_setup(struct obd_device *dev);
65 int lproc_mgs_add_live(struct obd_device *obd, struct fs_db *fsdb);
66 int lproc_mgs_del_live(struct obd_device *obd, struct fs_db *fsdb);
67 void lprocfs_mgs_init_vars(struct lprocfs_static_vars *lvars);
68 #else
69 static inline int lproc_mgs_setup(struct obd_device *dev) 
70 {return 0;}
71 static int lproc_mgs_add_live(struct obd_device *obd, struct fs_db *fsdb)
72 {return 0;}
73 static int lproc_mgs_del_live(struct obd_device *obd, struct fs_db *fsdb)
74 {return 0;}
75 static void lprocfs_mgs_init_vars(struct lprocfs_static_vars *lvars)
76 {
77         memset(lvars, 0, sizeof(*lvars));
78 }
79 #endif
80
81 #endif /* _MGS_INTERNAL_H */
82
83