#include <linux/obd_class.h>
#include <linux/lustre_log.h>
#include <linux/lustre_net.h>
+#include <linux/lustre_mgs.h>
#include <libcfs/list.h>
/* This is a callback from the llog_* functions.
* Assumes caller has already pushed us into the kernel context. */
static int llog_client_create(struct llog_ctxt *ctxt, struct llog_handle **res,
- struct llog_logid *logid, char* fsname ,char *name)
+ struct llog_logid *logid, char *name)
{
struct obd_import *imp;
struct llogd_body req_body;
struct llogd_body *body;
struct llog_handle *handle;
+ struct obd_device *obd = ctxt->loc_obd;
+ struct mgc_open_llog *mol;
struct ptlrpc_request *req = NULL;
- int size[3] = {sizeof(req_body)};
- char *tmp[3] = {(char*) &req_body};
+ int size[2] = {sizeof(req_body)};
+ char *tmp[2] = {(char*) &req_body};
int bufcount = 1;
int repsize[] = {sizeof (req_body)};
int rc;
req_body.lgd_logid = *logid;
req_body.lgd_ctxt_idx = ctxt->loc_idx - 1;
- if (fsname) {
- size[bufcount] = strlen(fsname) + 1;
- tmp[bufcount] = fsname;
- bufcount++;
- }
-
if (name) {
+ mol = mgc_find_open_llog(obd, name);
+ if (!mol) {
+ CERROR("The llog have not registered "
+ "in mgc obd when mount.\n");
+ GOTO(err_free, rc = -EINVAL);
+ }
+ handle->lgh_mol = mol;
size[bufcount] = strlen(name) + 1;
tmp[bufcount] = name;
bufcount++;
static int llog_client_read_header(struct llog_handle *handle)
{
+
struct obd_import *imp = handle->lgh_ctxt->loc_imp;
struct ptlrpc_request *req = NULL;
struct llogd_body *body;
struct llog_log_hdr *hdr;
struct llog_rec_hdr *llh_hdr;
+ struct mgc_open_llog *mol = handle->lgh_mol;
int size = sizeof(*body);
int repsize = sizeof (*hdr);
int rc;
ENTRY;
- req = ptlrpc_prep_req(imp, LLOG_ORIGIN_HANDLE_READ_HEADER,1,&size,NULL);
+ req = ptlrpc_prep_req(imp, LLOG_ORIGIN_HANDLE_READ_HEADER,
+ 1, &size, NULL);
if (!req)
GOTO(out, rc = -ENOMEM);
body->lgd_logid = handle->lgh_id;
body->lgd_ctxt_idx = handle->lgh_ctxt->loc_idx - 1;
body->lgd_llh_flags = handle->lgh_hdr->llh_flags;
+ if (mol)
+ body->lgd_local_version = mol->mol_version;
req->rq_replen = lustre_msg_size(1, &repsize);
rc = ptlrpc_queue_wait(req);
disk_obd = ctxt->loc_exp->exp_obd;
push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
- rc = llog_create(ctxt, &loghandle, logid, NULL, name);
+ rc = llog_create(ctxt, &loghandle, logid, name);
if (rc)
GOTO(out_pop, rc);
disk_obd = ctxt->loc_exp->exp_obd;
push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
- rc = llog_create(ctxt, &loghandle, &body->lgd_logid, NULL, NULL);
+ rc = llog_create(ctxt, &loghandle, &body->lgd_logid, NULL);
if (rc)
GOTO(out_pop, rc);
disk_obd = ctxt->loc_exp->exp_obd;
push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
- rc = llog_create(ctxt, &loghandle, &body->lgd_logid, NULL, NULL);
+ rc = llog_create(ctxt, &loghandle, &body->lgd_logid, NULL);
if (rc)
GOTO(out_pop, rc);
for (i = 0; i < 4; i++) {
int index, uncanceled = 0;
- rc = llog_create(ctxt, &handle, NULL, NULL, name[i]);
+ rc = llog_create(ctxt, &handle, NULL, name[i]);
if (rc)
GOTO(out_pop, rc);
rc = llog_init_handle(handle, 0, NULL);
lir = (struct llog_logid_rec *)rec;
logid = &lir->lid_id;
- rc = llog_create(ctxt, &handle, logid, NULL, NULL);
+ rc = llog_create(ctxt, &handle, logid, NULL);
if (rc)
RETURN(-EINVAL);
rc = llog_init_handle(handle, 0, NULL);
int l, index, uncanceled = 0;
id = &idarray[i].lci_logid;
- rc = llog_create(ctxt, &handle, id, NULL, NULL);
+ rc = llog_create(ctxt, &handle, id, NULL);
if (rc)
GOTO(out_pop, rc);
rc = llog_init_handle(handle, 0, NULL);