From b34768e9bb1ae15fe7297081a27be7ee75e291b6 Mon Sep 17 00:00:00 2001 From: adilger Date: Fri, 14 Nov 2003 21:49:34 +0000 Subject: [PATCH] Re-add lgd_len in case it is needed at some point (conflict resolution error). b=1821 --- lustre/ptlrpc/llog_client.c | 38 +++++++++++++++++++------------------- lustre/ptlrpc/llog_server.c | 8 ++++---- lustre/utils/wirecheck.c | 1 + lustre/utils/wiretest.c | 2 ++ 4 files changed, 26 insertions(+), 23 deletions(-) diff --git a/lustre/ptlrpc/llog_client.c b/lustre/ptlrpc/llog_client.c index e9b196d..513a7aa 100644 --- a/lustre/ptlrpc/llog_client.c +++ b/lustre/ptlrpc/llog_client.c @@ -40,7 +40,7 @@ static int llog_client_create(struct llog_ctxt *ctxt, struct llog_handle **res, struct llog_logid *logid, char *name) { - struct obd_import *imp; + struct obd_import *imp; struct llogd_body req_body; struct llogd_body *body; struct llog_handle *handle; @@ -61,17 +61,17 @@ static int llog_client_create(struct llog_ctxt *ctxt, struct llog_handle **res, *res = handle; memset(&req_body, 0, sizeof(req_body)); - if (logid) + if (logid) req_body.lgd_logid = *logid; req_body.lgd_ctxt_idx = ctxt->loc_idx - 1; - + if (name) { size[bufcount] = strlen(name) + 1; tmp[bufcount] = name; bufcount++; } - req = ptlrpc_prep_req(imp, LLOG_ORIGIN_HANDLE_CREATE, bufcount, size, tmp); + req = ptlrpc_prep_req(imp, LLOG_ORIGIN_HANDLE_CREATE,bufcount,size,tmp); if (!req) GOTO(err_free, rc = -ENOMEM); @@ -79,7 +79,7 @@ static int llog_client_create(struct llog_ctxt *ctxt, struct llog_handle **res, rc = ptlrpc_queue_wait(req); if (rc) GOTO(err_free, rc); - + body = lustre_swab_repbuf(req, 0, sizeof(*body), lustre_swab_llogd_body); if (body == NULL) { @@ -101,9 +101,9 @@ err_free: } -static int llog_client_next_block(struct llog_handle *loghandle, - int *cur_idx, int next_idx, - __u64 *cur_offset, void *buf, int len) +static int llog_client_next_block(struct llog_handle *loghandle, + int *cur_idx, int next_idx, + __u64 *cur_offset, void *buf, int len) { struct obd_import *imp = loghandle->lgh_ctxt->loc_imp; struct ptlrpc_request *req = NULL; @@ -114,31 +114,32 @@ static int llog_client_next_block(struct llog_handle *loghandle, int rc; ENTRY; - req = ptlrpc_prep_req(imp, LLOG_ORIGIN_HANDLE_NEXT_BLOCK, 1, &size, NULL); + req = ptlrpc_prep_req(imp, LLOG_ORIGIN_HANDLE_NEXT_BLOCK, 1,&size,NULL); if (!req) GOTO(out, rc = -ENOMEM); - + body = lustre_msg_buf(req->rq_reqmsg, 0, sizeof (*body)); body->lgd_logid = loghandle->lgh_id; body->lgd_ctxt_idx = loghandle->lgh_ctxt->loc_idx - 1; body->lgd_llh_flags = loghandle->lgh_hdr->llh_flags; - body->lgd_cur_offset = *cur_offset; body->lgd_index = next_idx; body->lgd_saved_index = *cur_idx; + body->lgd_len = len; + body->lgd_cur_offset = *cur_offset; repsize[1] = len; req->rq_replen = lustre_msg_size(2, repsize); rc = ptlrpc_queue_wait(req); if (rc) GOTO(out, rc); - + body = lustre_swab_repbuf(req, 0, sizeof(*body), lustre_swab_llogd_body); if (body == NULL) { CERROR ("Can't unpack llogd_body\n"); GOTO(out, rc =-EFAULT); } - + ptr = lustre_msg_buf(req->rq_repmsg, 1, len); if (ptr == NULL) { CERROR ("Can't unpack bitmap\n"); @@ -147,7 +148,7 @@ static int llog_client_next_block(struct llog_handle *loghandle, *cur_idx = body->lgd_saved_index; *cur_offset = body->lgd_cur_offset; - + memcpy(buf, ptr, len); out: @@ -168,10 +169,10 @@ static int llog_client_read_header(struct llog_handle *handle) 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 = lustre_msg_buf(req->rq_reqmsg, 0, sizeof (*body)); body->lgd_logid = handle->lgh_id; body->lgd_ctxt_idx = handle->lgh_ctxt->loc_idx - 1; @@ -181,9 +182,8 @@ static int llog_client_read_header(struct llog_handle *handle) rc = ptlrpc_queue_wait(req); if (rc) GOTO(out, rc); - - hdr = lustre_swab_repbuf(req, 0, sizeof(*hdr), - lustre_swab_llog_hdr); + + hdr = lustre_swab_repbuf(req, 0, sizeof(*hdr), lustre_swab_llog_hdr); if (hdr == NULL) { CERROR ("Can't unpack llog_hdr\n"); GOTO(out, rc =-EFAULT); diff --git a/lustre/ptlrpc/llog_server.c b/lustre/ptlrpc/llog_server.c index 6b117d0..a8bcaff 100644 --- a/lustre/ptlrpc/llog_server.c +++ b/lustre/ptlrpc/llog_server.c @@ -137,15 +137,15 @@ int llog_origin_handle_next_block(struct ptlrpc_request *req) GOTO(out_close, rc); memset(buf, 0, LLOG_CHUNK_SIZE); - rc = llog_next_block(loghandle, &body->lgd_saved_index, - body->lgd_index, + rc = llog_next_block(loghandle, &body->lgd_saved_index, + body->lgd_index, &body->lgd_cur_offset, buf, LLOG_CHUNK_SIZE); if (rc) GOTO(out_close, rc); rc = lustre_pack_msg(2, size, NULL, &req->rq_replen, &req->rq_repmsg); - if (rc) + if (rc) GOTO(out_close, rc = -ENOMEM); ptr = lustre_msg_buf(req->rq_repmsg, 0, sizeof (body)); @@ -210,7 +210,7 @@ int llog_origin_handle_read_header(struct ptlrpc_request *req) rc = lustre_pack_msg(1, size, NULL, &req->rq_replen, &req->rq_repmsg); - if (rc) + if (rc) GOTO(out_close, rc = -ENOMEM); hdr = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*hdr)); diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index 8fa2e34..944ecb0 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -561,6 +561,7 @@ check_llogd_body(void) CHECK_MEMBER(llogd_body, lgd_llh_flags); CHECK_MEMBER(llogd_body, lgd_index); CHECK_MEMBER(llogd_body, lgd_saved_index); + CHECK_MEMBER(llogd_body, lgd_len); CHECK_MEMBER(llogd_body, lgd_cur_offset); CHECK_VALUE(LLOG_ORIGIN_HANDLE_CREATE); diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index b44ad08..e00ef2a 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -675,6 +675,8 @@ void lustre_assert_wire_constants(void) LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_index) == 4); LASSERT(offsetof(struct llogd_body, lgd_saved_index) == 32); LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_saved_index) == 4); + LASSERT(offsetof(struct llogd_body, lgd_len) == 36); + LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_len) == 4); LASSERT(offsetof(struct llogd_body, lgd_cur_offset) == 40); LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_cur_offset) == 8); LASSERT(LLOG_ORIGIN_HANDLE_CREATE == 501); -- 1.8.3.1