From b991edd2bbf5ded7b1a371bdf117e0dc3042915d Mon Sep 17 00:00:00 2001 From: lincent Date: Mon, 17 Oct 2005 12:22:45 +0000 Subject: [PATCH] mgc codes --- lustre/include/linux/lustre_dlm.h | 2 +- lustre/include/linux/lustre_idl.h | 2 ++ lustre/include/linux/lustre_log.h | 4 +--- lustre/include/linux/obd.h | 2 +- lustre/mgc/mgc_llog.c | 24 +++++++++++++++++++++++- lustre/mgc/mgc_lock.c | 3 ++- lustre/mgc/mgc_request.c | 3 ++- lustre/obdclass/obd_config.c | 1 - 8 files changed, 32 insertions(+), 9 deletions(-) diff --git a/lustre/include/linux/lustre_dlm.h b/lustre/include/linux/lustre_dlm.h index 5fb0019..d1ed5a2 100644 --- a/lustre/include/linux/lustre_dlm.h +++ b/lustre/include/linux/lustre_dlm.h @@ -267,7 +267,7 @@ struct ldlm_resource { struct list_head lr_converting; struct list_head lr_waiting; ldlm_mode_t lr_most_restr; - ldlm_type_t lr_type; /* LDLM_{PLAIN,EXTENT,FLOCK} */ + ldlm_type_t lr_type; /* LDLM_{PLAIN,EXTENT,FLOCK,LLOG} */ struct ldlm_resource *lr_root; struct ldlm_res_id lr_name; atomic_t lr_refcount; diff --git a/lustre/include/linux/lustre_idl.h b/lustre/include/linux/lustre_idl.h index d601ebd..630cd85 100644 --- a/lustre/include/linux/lustre_idl.h +++ b/lustre/include/linux/lustre_idl.h @@ -1086,6 +1086,7 @@ struct llog_gen_rec { struct llog_log_hdr { struct llog_rec_hdr llh_hdr; + __u64 llh_version; __u64 llh_timestamp; __u32 llh_count; __u32 llh_bitmap_offset; @@ -1124,6 +1125,7 @@ enum llogd_rpc_ops { struct llogd_body { struct llog_logid lgd_logid; + __u64 lgd_local_version; __u32 lgd_ctxt_idx; __u32 lgd_llh_flags; __u32 lgd_index; diff --git a/lustre/include/linux/lustre_log.h b/lustre/include/linux/lustre_log.h index 108e656..02f1e00 100644 --- a/lustre/include/linux/lustre_log.h +++ b/lustre/include/linux/lustre_log.h @@ -60,6 +60,7 @@ struct llog_handle { struct rw_semaphore lgh_lock; struct llog_logid lgh_id; /* id of this log */ struct llog_log_hdr *lgh_hdr; + struct mgc_open_llog *lgh_mol; struct file *lgh_file; char *lgh_fsname; int lgh_last_idx; @@ -184,7 +185,6 @@ struct llog_operations { struct obd_uuid *uuid); int (*lop_update)(struct llog_ctxt *ctxt, struct llog_handle **, struct llog_logid *logid, void *data); - /* XXX add 2 more: commit callbacks and llog recovery functions */ }; /* llog_lvfs.c */ @@ -364,7 +364,6 @@ static inline int llog_next_block(struct llog_handle *loghandle, int *cur_idx, } static inline int llog_create(struct llog_ctxt *ctxt, struct llog_handle **res, -// struct llog_logid *logid, char*fsname, char *name) struct llog_logid *logid, char *name) { struct llog_operations *lop; @@ -377,7 +376,6 @@ static inline int llog_create(struct llog_ctxt *ctxt, struct llog_handle **res, if (lop->lop_create == NULL) RETURN(-EOPNOTSUPP); - // rc = lop->lop_create(ctxt, res, logid, fsname, name); rc = lop->lop_create(ctxt, res, logid, name); RETURN(rc); } diff --git a/lustre/include/linux/obd.h b/lustre/include/linux/obd.h index 327998f..b690d5c 100644 --- a/lustre/include/linux/obd.h +++ b/lustre/include/linux/obd.h @@ -328,8 +328,8 @@ struct mgc_obd { struct mgc_rpc_lock *mgc_rpc_lock; struct vfsmount *mgc_vfsmnt; /* for local config dirs */ struct super_block *mgc_sb; - struct file *mgc_rcvd_filp; struct dentry *mgc_configs_dir; + struct list_head mgc_open_llogs; }; struct mgs_obd { diff --git a/lustre/mgc/mgc_llog.c b/lustre/mgc/mgc_llog.c index 07b05de..e8005c5 100644 --- a/lustre/mgc/mgc_llog.c +++ b/lustre/mgc/mgc_llog.c @@ -46,4 +46,26 @@ #include "mgc_internal.h" -static +int mgc_get_process_llog(struct obd_device *obd, char *llog_name, + struct config_llog_instance *cfg) +{ + struct llog_ctxt *ctxt; + + ctxt = llog_get_context(obd, LLOG_CONFIG_REPL_CTXT); + + rc = class_config_parse_llog(ctxt, llog_name, cfg); + + if (!rc) { + if (rc == -EINVAL) + LCONSOLE_ERROR("%s: The configuration '%s' could not " + "be read from the MGS. Make sure this " + "client and the MGS are running " + "compatible versions of Lustre.\n", + obd->obd_name, llog_name); + else + CERROR("class_config_parse_llog failed: rc = %d\n", rc); + } + return 0; +} + +EXPORT_SYMBOL(mgc_get_process_llog) diff --git a/lustre/mgc/mgc_lock.c b/lustre/mgc/mgc_lock.c index 7e3398b..262582c 100644 --- a/lustre/mgc/mgc_lock.c +++ b/lustre/mgc/mgc_lock.c @@ -73,7 +73,7 @@ int mgc_enqueue(struct obd_export *exp, int lock_mode, rc = ldlm_cli_enqueue(exp, req, obd->obd_namespace, res_id, LDLM_LLOG, NULL, mode, flags, bl_cb, cp_cb, gl_cb, data, - &lvb, sizeof(lvb), lustre_swab_ost_lvb, lockh); + NULL, 0, NULL, lockh); if (req != NULL) { if (rc == ELDLM_LOCK_ABORTED) { @@ -89,3 +89,4 @@ int mgc_enqueue(struct obd_export *exp, int lock_mode, RETURN(rc); } +EXPORT_SYMBOL(mgc_enqueue) diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index 2a04d12..a58c217 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -189,6 +189,8 @@ static int mgc_setup(struct obd_device *obd, obd_count len, void *buf) mgc_cleanup(obd); RETURN(-ENOENT); } + INIT_LIST_HEAD(&mgc->mgc_open_llogs); + RETURN(rc); err_rpc_lock: @@ -197,7 +199,6 @@ err_rpc_lock: RETURN(rc); } - static int mgc_iocontrol(unsigned int cmd, struct obd_export *exp, int len, void *karg, void *uarg) { diff --git a/lustre/obdclass/obd_config.c b/lustre/obdclass/obd_config.c index c188756..6d064f9 100644 --- a/lustre/obdclass/obd_config.c +++ b/lustre/obdclass/obd_config.c @@ -776,7 +776,6 @@ parse_out: rc = rc2; RETURN(rc); - } int class_config_dump_handler(struct llog_handle * handle, -- 1.8.3.1