From 6a6369e59a8bad629912685048172c166d505435 Mon Sep 17 00:00:00 2001 From: braam Date: Thu, 25 Jul 2002 16:05:45 +0000 Subject: [PATCH] - remove two almost unused fields from the OST request packets - this makes separate opcodes out of OST_BRW: OST_WRITE and OST_READ - documentation updates, still in progress for 0.5.1 --- lustre/include/linux/lustre_idl.h | 25 ++++++++++++------------- lustre/osc/osc_request.c | 6 ++---- lustre/ost/ost_handler.c | 27 +++++++++++---------------- 3 files changed, 25 insertions(+), 33 deletions(-) diff --git a/lustre/include/linux/lustre_idl.h b/lustre/include/linux/lustre_idl.h index 097faf7..80f32c4 100644 --- a/lustre/include/linux/lustre_idl.h +++ b/lustre/include/linux/lustre_idl.h @@ -114,10 +114,10 @@ struct lustre_msg { __u64 cookie; /* security token */ __u32 magic; __u32 version; + __u32 opc; __u64 last_rcvd; __u64 last_committed; __u64 transno; - __u32 opc; __u32 status; __u32 type; __u32 bufcount; @@ -135,16 +135,17 @@ struct lustre_msg { #define OST_REPLY 0 /* reply ? */ #define OST_GETATTR 1 #define OST_SETATTR 2 -#define OST_BRW 3 -#define OST_CREATE 4 -#define OST_DESTROY 5 -#define OST_GET_INFO 6 -#define OST_CONNECT 7 -#define OST_DISCONNECT 8 -#define OST_PUNCH 9 -#define OST_OPEN 10 -#define OST_CLOSE 11 -#define OST_STATFS 12 +#define OST_READ 3 +#define OST_WRITE 4 +#define OST_CREATE 5 +#define OST_DESTROY 6 +#define OST_GET_INFO 7 +#define OST_CONNECT 8 +#define OST_DISCONNECT 9 +#define OST_PUNCH 10 +#define OST_OPEN 11 +#define OST_CLOSE 12 +#define OST_STATFS 13 typedef uint64_t obd_id; @@ -275,8 +276,6 @@ struct connmgr_body { #define OST_REQ_HAS_OA1 0x1 struct ost_body { - __u32 connid; - __u32 data; struct obdo oa; }; diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index e7e6d54..f740a2e 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -492,12 +492,11 @@ static int osc_brw_read(struct lustre_handle *conn, struct lov_stripe_md *md, osc_con2cl(conn, &cl, &connection, &rconn); request = ptlrpc_prep_req2(cl, connection, rconn, - OST_BRW, 3, size, NULL); + OST_READ, 3, size, NULL); if (!request) RETURN(-ENOMEM); body = lustre_msg_buf(request->rq_reqmsg, 0); - body->data = OBD_BRW_READ; desc = ptlrpc_prep_bulk(connection); if (!desc) @@ -622,12 +621,11 @@ static int osc_brw_write(struct lustre_handle *conn, osc_con2cl(conn, &cl, &connection, &rconn); request = ptlrpc_prep_req2(cl, connection, rconn, - OST_BRW, 3, size, NULL); + OST_WRITE, 3, size, NULL); if (!request) RETURN(-ENOMEM); body = lustre_msg_buf(request->rq_reqmsg, 0); - body->data = OBD_BRW_WRITE; desc = ptlrpc_prep_bulk(connection); if (!desc) diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index a9221b4..baa1252 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -213,7 +213,7 @@ static int ost_brw_read(struct ptlrpc_request *req) end2 = (char *)tmp2 + req->rq_reqmsg->buflens[2]; objcount = req->rq_reqmsg->buflens[1] / sizeof(*ioo); niocount = req->rq_reqmsg->buflens[2] / sizeof(*remote_nb); - cmd = body->data; + cmd = OBD_BRW_READ; for (i = 0; i < objcount; i++) { ost_unpack_ioo(&tmp1, &ioo); @@ -304,7 +304,7 @@ static int ost_brw_write(struct ptlrpc_request *req) end2 = (char *)tmp2 + req->rq_reqmsg->buflens[2]; objcount = req->rq_reqmsg->buflens[1] / sizeof(*ioo); niocount = req->rq_reqmsg->buflens[2] / sizeof(*remote_nb); - cmd = body->data; + cmd = OBD_BRW_WRITE; for (i = 0; i < objcount; i++) { ost_unpack_ioo((void *)&tmp1, &ioo); @@ -398,17 +398,6 @@ fail_preprw: goto out_free; } -static int ost_brw(struct ptlrpc_request *req) -{ - struct ost_body *body = lustre_msg_buf(req->rq_reqmsg, 0); - - if (body->data & OBD_BRW_WRITE) - return ost_brw_write(req); - else - return ost_brw_read(req); -} - - static int ost_handle(struct ptlrpc_request *req) { int rc; @@ -477,10 +466,16 @@ static int ost_handle(struct ptlrpc_request *req) OBD_FAIL_RETURN(OBD_FAIL_OST_CLOSE_NET, 0); rc = ost_close(req); break; - case OST_BRW: - CDEBUG(D_INODE, "brw\n"); + case OST_WRITE: + CDEBUG(D_INODE, "write\n"); + OBD_FAIL_RETURN(OBD_FAIL_OST_BRW_NET, 0); + rc = ost_brw_write(req); + /* ost_brw sends its own replies */ + RETURN(rc); + case OST_READ: + CDEBUG(D_INODE, "read\n"); OBD_FAIL_RETURN(OBD_FAIL_OST_BRW_NET, 0); - rc = ost_brw(req); + rc = ost_brw_read(req); /* ost_brw sends its own replies */ RETURN(rc); case OST_PUNCH: -- 1.8.3.1