-int mgs_init_fsdb_list(struct obd_device *obd);
-int mgs_cleanup_fsdb_list(struct obd_device *obd);
-int mgs_check_index(struct obd_device *obd, struct mgs_target_info *mti);
-int mgs_check_failnid(struct obd_device *obd, struct mgs_target_info *mti);
-int mgs_write_log_target(struct obd_device *obd, struct mgs_target_info *mti);
-int mgs_upgrade_sv_14(struct obd_device *obd, struct mgs_target_info *mti);
-int mgs_erase_log(struct obd_device *obd, char *name);
-int mgs_erase_logs(struct obd_device *obd, char *fsname);
-int mgs_setparam(struct obd_device *obd, struct lustre_cfg *lcfg, char *fsname);
+/* this is a top object */
+struct mgs_object {
+ struct lu_object_header mgo_header;
+ struct dt_object mgo_obj;
+ int mgo_no_attrs;
+ int mgo_reserved;
+};
+
+int mgs_init_fsdb_list(struct mgs_device *mgs);
+int mgs_cleanup_fsdb_list(struct mgs_device *mgs);
+int mgs_find_or_make_fsdb(const struct lu_env *env, struct mgs_device *mgs, char *name,
+ struct fs_db **dbh);
+struct fs_db *mgs_find_fsdb(struct mgs_device *mgs, char *fsname);
+int mgs_get_fsdb_srpc_from_llog(const struct lu_env *env, struct mgs_device *mgs, struct fs_db *fsdb);
+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);
+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,
+ char *fsname);
+int mgs_setparam(const struct lu_env *env, struct mgs_device *mgs,
+ struct lustre_cfg *lcfg, char *fsname);
+int mgs_list_logs(const struct lu_env *env, struct mgs_device *mgs,
+ struct obd_ioctl_data *data);
+int mgs_pool_cmd(const struct lu_env *env, struct mgs_device *mgs,
+ enum lcfg_command_type cmd, char *poolname, char *fsname,
+ char *ostname);
+int mgs_nodemap_cmd(const struct lu_env *env, struct mgs_device *mgs,
+ enum lcfg_command_type cmd, const char *nodemap_name,
+ const char *param);
+
+/* mgs_handler.c */
+int mgs_get_lock(struct obd_device *obd, struct ldlm_res_id *res,
+ struct lustre_handle *lockh);
+int mgs_put_lock(struct lustre_handle *lockh);
+void mgs_revoke_lock(struct mgs_device *mgs, struct fs_db *fsdb, int type);
+
+/* mgs_nids.c */
+int mgs_ir_update(const struct lu_env *env, struct mgs_device *mgs,
+ struct mgs_target_info *mti);
+int mgs_ir_init_fs(const struct lu_env *env, struct mgs_device *mgs,
+ struct fs_db *fsdb);
+void mgs_ir_fini_fs(struct mgs_device *mgs, struct fs_db *fsdb);
+void mgs_ir_notify_complete(struct fs_db *fsdb);
+int mgs_get_ir_logs(struct ptlrpc_request *req);
+int lprocfs_wr_ir_state(struct file *file, const char *buffer,
+ size_t count, void *data);
+int lprocfs_rd_ir_state(struct seq_file *seq, void *data);
+ssize_t
+lprocfs_ir_timeout_seq_write(struct file *file, const char *buffer,
+ size_t count, loff_t *off);
+int lprocfs_ir_timeout_seq_show(struct seq_file *seq, void *data);
+void mgs_fsc_cleanup(struct obd_export *exp);
+void mgs_fsc_cleanup_by_fsdb(struct fs_db *fsdb);
+int mgs_fsc_attach(const struct lu_env *env, struct obd_export *exp,
+ char *fsname);