From 95cfb3636a813b01f2e240230c1106e0309c3539 Mon Sep 17 00:00:00 2001 From: wangdi Date: Wed, 27 Sep 2006 10:36:29 +0000 Subject: [PATCH] Branch: b_new_cmd 1) some fixes about split after capa commit 2) we should connect with CLI flags. since mdt will return this flags anyway for local idmap when connect between mds. --- lustre/cmm/cmm_split.c | 12 ++++++++---- lustre/mdc/mdc_request.c | 6 +++--- lustre/mdt/mdt_handler.c | 23 ++++++++++++++++++++--- lustre/ptlrpc/layout.c | 3 ++- 4 files changed, 33 insertions(+), 11 deletions(-) diff --git a/lustre/cmm/cmm_split.c b/lustre/cmm/cmm_split.c index 4f82634..f839715 100644 --- a/lustre/cmm/cmm_split.c +++ b/lustre/cmm/cmm_split.c @@ -128,13 +128,15 @@ static int cmm_alloc_fid(const struct lu_context *ctx, struct cmm_device *cmm, struct cmm_object *cmm_object_find(const struct lu_context *ctxt, struct cmm_device *d, - const struct lu_fid *f) + const struct lu_fid *f, + struct lustre_capa *capa) { struct lu_object *o; struct cmm_object *m; ENTRY; - o = lu_object_find(ctxt, d->cmm_md_dev.md_lu_dev.ld_site, f); + o = lu_object_find(ctxt, d->cmm_md_dev.md_lu_dev.ld_site, f, + capa); if (IS_ERR(o)) m = (struct cmm_object *)o; else @@ -160,7 +162,9 @@ static int cmm_creat_remote_obj(const struct lu_context *ctx, int rc; ENTRY; - obj = cmm_object_find(ctx, cmm, fid); + /* XXX Since capablity will not work with split. so we + * pass NULL capablity here */ + obj = cmm_object_find(ctx, cmm, fid, NULL); if (IS_ERR(obj)) RETURN(PTR_ERR(obj)); @@ -238,7 +242,7 @@ static int cmm_send_split_pages(const struct lu_context *ctx, int rc = 0; ENTRY; - obj = cmm_object_find(ctx, cmm, fid); + obj = cmm_object_find(ctx, cmm, fid, NULL); if (IS_ERR(obj)) RETURN(PTR_ERR(obj)); diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index def5806..ca2a095 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -903,12 +903,12 @@ int mdc_sendpage(struct obd_export *exp, const struct lu_fid *fid, struct ptlrpc_request *req = NULL; struct ptlrpc_bulk_desc *desc = NULL; struct mdt_body *body; - int rc, size[2] = { sizeof(struct ptlrpc_body), sizeof(*body) }; + int rc, size[3] = { sizeof(struct ptlrpc_body), sizeof(*body) }; ENTRY; CDEBUG(D_INODE, "object: "DFID"\n", PFID(fid)); - req = ptlrpc_prep_req(imp, LUSTRE_MDS_VERSION, MDS_WRITEPAGE, 2, size, + req = ptlrpc_prep_req(imp, LUSTRE_MDS_VERSION, MDS_WRITEPAGE, 3, size, NULL); if (req == NULL) GOTO(out, rc = -ENOMEM); @@ -921,7 +921,7 @@ int mdc_sendpage(struct obd_export *exp, const struct lu_fid *fid, /* NB req now owns desc and will free it when it gets freed */ ptlrpc_prep_bulk_page(desc, (struct page*)page, 0, offset); - mdc_readdir_pack(req, REQ_REC_OFF, 0, offset, fid); + mdc_readdir_pack(req, REQ_REC_OFF, 0, offset, fid, NULL); ptlrpc_req_set_repsize(req, 2, size); rc = ptlrpc_queue_wait(req); diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 96a89da..dd97fce 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -2463,6 +2463,24 @@ out_seq_fini: return rc; } +static int mdt_md_connect(const struct lu_context *ctx, + struct lustre_handle *conn, + struct obd_device *mdc) +{ + struct obd_connect_data *ocd; + int rc; + + OBD_ALLOC_PTR(ocd); + if (!ocd) + RETURN(-ENOMEM); + /* The connection between MDS must be local */ + ocd->ocd_connect_flags |= OBD_CONNECT_LCL_CLIENT; + rc = obd_connect(ctx, conn, mdc, &mdc->obd_uuid, ocd); + + OBD_FREE_PTR(ocd); + + RETURN(rc); +} /* * Init client sequence manager which is used by local MDS to talk to sequence * controller on remote node. @@ -2513,12 +2531,11 @@ static int mdt_seq_init_cli(const struct lu_context *ctx, rc = -EINVAL; } else { struct lustre_handle conn = {0, }; - + CDEBUG(D_CONFIG, "connect to controller %s(%s)\n", mdc->obd_name, mdc->obd_uuid.uuid); - rc = obd_connect(ctx, &conn, mdc, &mdc->obd_uuid, NULL); - + rc = mdt_md_connect(ctx, &conn, mdc); if (rc) { CERROR("target %s connect error %d\n", mdc->obd_name, rc); diff --git a/lustre/ptlrpc/layout.c b/lustre/ptlrpc/layout.c index b8d7e53..6504641 100644 --- a/lustre/ptlrpc/layout.c +++ b/lustre/ptlrpc/layout.c @@ -704,9 +704,10 @@ const struct req_format RQF_MDS_READPAGE = mdt_body_capa, mdt_body_only); EXPORT_SYMBOL(RQF_MDS_READPAGE); +/* This is for split */ const struct req_format RQF_MDS_WRITEPAGE = DEFINE_REQ_FMT0("MDS_WRITEPAGE", - mdt_body_only, mdt_body_only); + mdt_body_capa, mdt_body_only); EXPORT_SYMBOL(RQF_MDS_WRITEPAGE); const struct req_format RQF_MDS_IS_SUBDIR = -- 1.8.3.1