From 199fc54185c4eb5f4766912a3a0a997bbea1e389 Mon Sep 17 00:00:00 2001 From: pschwan Date: Sun, 8 Sep 2002 20:05:16 +0000 Subject: [PATCH] - We don't use pga[i].pg->index, so don't overwrite it, since that seems pretty dangerous - obd_dev's definition is already in a common header file, it doesn't need to be in each module - add an assertion that will perhaps catch the callback bug - fix PTL_RPC_MSG_ERR reporting, which I don't think has ever worked properly --- lustre/ldlm/ldlm_lockd.c | 4 ++-- lustre/llite/rw.c | 2 -- lustre/lov/lov_obd.c | 23 +++-------------------- lustre/obdecho/echo.c | 6 ++---- lustre/obdfilter/filter.c | 1 - lustre/osc/osc_request.c | 7 +++++++ lustre/ptlrpc/niobuf.c | 13 ++++++++----- lustre/ptlrpc/service.c | 20 ++++++++++---------- 8 files changed, 32 insertions(+), 44 deletions(-) diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index 67f73c7..4c473d4 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -419,8 +419,8 @@ static int ldlm_handle_cp_callback(struct ptlrpc_request *req) lock = ldlm_handle2lock(&dlm_req->lock_handle1); if (!lock) { - CERROR("completion callback on lock "LPX64" - lock disappeared\n", - dlm_req->lock_handle1.addr); + CERROR("completion callback on lock "LPX64" - lock " + "disappeared\n", dlm_req->lock_handle1.addr); RETURN(0); } diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index 8a87af7..bd45708 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -306,8 +306,6 @@ static int ll_direct_IO(int rw, struct inode *inode, struct kiobuf *iobuf, * instead of "blocknr" because ->index contains garbage. */ for (i = 0; i < bufs_per_obdo; i++, blocknr++) { - iobuf->maplist[i]->index = blocknr; /* XXX blksz = PAGE_SIZE? */ - pga[i].pg = iobuf->maplist[i]; pga[i].count = PAGE_SIZE; pga[i].off = (obd_off)blocknr << PAGE_SHIFT; diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index 77fecc1..6112b0e 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -25,8 +25,6 @@ #include #include -extern struct obd_device obd_dev[MAX_OBD_DEVICES]; - /* obd methods */ static int lov_connect(struct lustre_handle *conn, struct obd_device *obd, char *cluuid) @@ -466,7 +464,7 @@ static int lov_close(struct lustre_handle *conn, struct obdo *oa, #endif /* compute offset in stripe i corresponding to offset "in" */ -__u64 lov_offset(struct lov_stripe_md *md, __u64 in, int i) +static __u64 lov_offset(struct lov_stripe_md *md, __u64 in, int i) { __u32 ssz = md->lmd_stripe_size; /* full stripes across all * stripe size */ @@ -487,21 +485,7 @@ __u64 lov_offset(struct lov_stripe_md *md, __u64 in, int i) return (__u64) out; } -/* compute offset in stripe i corresponding to offset "in" */ -__u64 lov_stripe(struct lov_stripe_md *md, __u64 in, int *j) -{ - __u32 ssz = md->lmd_stripe_size; - __u32 off, out; - /* full stripes across all * stripe size */ - *j = (((__u32) in)/ssz) % md->lmd_stripe_count; - off = (__u32)in % (md->lmd_stripe_count * ssz); - out = ( ((__u32)in) / (md->lmd_stripe_count * ssz)) * ssz + - (off - ((*j) * ssz)) % ssz;; - - return (__u64) out; -} - -int lov_stripe_which(struct lov_stripe_md *md, __u64 in) +static int lov_stripe_which(struct lov_stripe_md *md, __u64 in) { __u32 ssz = md->lmd_stripe_size; int j; @@ -572,8 +556,7 @@ static int lov_osc_brw_callback(struct io_cb_data *cbd, int err, int phase) } static inline int lov_brw(int cmd, struct lustre_handle *conn, - struct lov_stripe_md *md, - obd_count oa_bufs, + struct lov_stripe_md *md, obd_count oa_bufs, struct brw_page *pga, brw_callback_t callback, struct io_cb_data *cbd) { diff --git a/lustre/obdecho/echo.c b/lustre/obdecho/echo.c index bc242a9..d3d3f5b 100644 --- a/lustre/obdecho/echo.c +++ b/lustre/obdecho/echo.c @@ -12,8 +12,8 @@ * and Andreas Dilger */ -static char rcsid[] __attribute ((unused)) = "$Id: echo.c,v 1.35 2002/09/08 09:56:57 adilger Exp $"; -#define OBDECHO_VERSION "$Revision: 1.35 $" +static char rcsid[] __attribute ((unused)) = "$Id: echo.c,v 1.36 2002/09/08 20:05:15 pschwan Exp $"; +#define OBDECHO_VERSION "$Revision: 1.36 $" #define EXPORT_SYMTAB @@ -36,8 +36,6 @@ static char rcsid[] __attribute ((unused)) = "$Id: echo.c,v 1.35 2002/09/08 09:5 #include #include -extern struct obd_device obd_dev[MAX_OBD_DEVICES]; - static atomic_t echo_page_rws; static atomic_t echo_getattrs; diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index cd7b328..60e6a18 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -22,7 +22,6 @@ #include #include -extern struct obd_device obd_dev[MAX_OBD_DEVICES]; long filter_memory; #define FILTER_ROOTINO 2 diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index c63e7f1..b05df59 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -518,6 +518,13 @@ static int osc_brw_write(struct lustre_handle *conn, struct lov_stripe_md *md, for (mapped = 0; mapped < page_count; mapped++) { local[mapped].addr = kmap(pga[mapped].pg); + + CDEBUG(D_INFO, "kmap(pg) = %p ; pg->flags = %lx ; pg->count = " + "%d ; pg->virtual = %p ; page %d of %d\n", + local[mapped].addr, pga[mapped].pg->flags, + page_count(pga[mapped].pg), pga[mapped].pg->virtual, + mapped, page_count - 1); + local[mapped].offset = pga[mapped].off; local[mapped].len = pga[mapped].count; ost_pack_niobuf(&nioptr, pga[mapped].off, pga[mapped].count, diff --git a/lustre/ptlrpc/niobuf.c b/lustre/ptlrpc/niobuf.c index b6e6ce5..c66bf96 100644 --- a/lustre/ptlrpc/niobuf.c +++ b/lustre/ptlrpc/niobuf.c @@ -37,6 +37,8 @@ static int ptl_send_buf(struct ptlrpc_request *request, ptl_process_id_t remote_id; ptl_handle_md_t md_h; + LASSERT(conn); + request->rq_req_md.user_ptr = request; switch (request->rq_type) { @@ -46,6 +48,7 @@ static int ptl_send_buf(struct ptlrpc_request *request, request->rq_req_md.length = request->rq_reqlen; request->rq_req_md.eventq = request_out_eq; break; + case PTL_RPC_MSG_ERR: case PTL_RPC_MSG_REPLY: request->rq_repmsg->type = HTON__u32(request->rq_type); request->rq_req_md.start = request->rq_repmsg; @@ -78,8 +81,8 @@ static int ptl_send_buf(struct ptlrpc_request *request, rc = PtlPut(md_h, PTL_NOACK_REQ, remote_id, portal, 0, request->rq_xid, 0, 0); if (rc != PTL_OK) { - CERROR("PtlPut("LPU64", %d, "LPD64") failed: %d\n", remote_id.nid, - portal, request->rq_xid, rc); + CERROR("PtlPut("LPU64", %d, "LPD64") failed: %d\n", + remote_id.nid, portal, request->rq_xid, rc); PtlMDUnlink(md_h); } @@ -132,7 +135,7 @@ int ptlrpc_send_bulk(struct ptlrpc_bulk_desc *desc) desc->bd_md.user_ptr = desc; atomic_set (&desc->bd_source_callback_count, 2); - + list_for_each_safe(tmp, next, &desc->bd_page_list) { struct ptlrpc_bulk_page *bulk; bulk = list_entry(tmp, struct ptlrpc_bulk_page, bp_link); @@ -299,7 +302,7 @@ int ptlrpc_error(struct ptlrpc_service *svc, struct ptlrpc_request *req) if (rc) RETURN(rc); - req->rq_repmsg->type = HTON__u32(PTL_RPC_MSG_ERR); + req->rq_type = PTL_RPC_MSG_ERR; rc = ptlrpc_reply(svc, req); RETURN(rc); @@ -392,7 +395,7 @@ void ptlrpc_link_svc_me(struct ptlrpc_request_buffer_desc *rqbd) /* Attach the leading ME on which we build the ring */ rc = PtlMEAttach(service->srv_self.peer_ni, service->srv_req_portal, - match_id, 0, ~0, + match_id, 0, ~0, PTL_UNLINK, PTL_INS_AFTER, &rqbd->rqbd_me_h); if (rc != PTL_OK) { CERROR("PtlMEAttach failed: %d\n", rc); diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index 6163a71..38bc4ab 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -344,32 +344,32 @@ int ptlrpc_start_thread(struct obd_device *dev, struct ptlrpc_service *svc, int ptlrpc_unregister_service(struct ptlrpc_service *service) { int rc, i; - + /* NB service->srv_nbuffs gets set before we attempt (and possibly * fail) to allocate srv_rqbds. */ - if (service->srv_rqbds != NULL) - { + if (service->srv_rqbds != NULL) { for (i = 0; i < service->srv_nbuffs; i++) { - struct ptlrpc_request_buffer_desc *rqbd = &service->srv_rqbds[i]; - + struct ptlrpc_request_buffer_desc *rqbd = + &service->srv_rqbds[i]; + if (rqbd->rqbd_buffer == NULL) /* no buffer allocated */ continue; /* => never initialised */ - + /* Buffer allocated => got linked */ LASSERT (ptl_is_valid_handle (&rqbd->rqbd_me_h)); - + rc = PtlMEUnlink(rqbd->rqbd_me_h); if (rc) CERROR("PtlMEUnlink failed: %d\n", rc); - + OBD_FREE(rqbd->rqbd_buffer, service->srv_buf_size); } - + OBD_FREE(service->srv_rqbds, service->srv_nbuffs * sizeof (struct ptlrpc_request_buffer_desc)); } - + rc = PtlEQFree(service->srv_eq_h); if (rc) CERROR("PtlEQFree failed: %d\n", rc); -- 1.8.3.1