From 27f3dcc0b6b89d32579abde893d0002e7596f0ee Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 16 Oct 2007 18:49:13 +0000 Subject: [PATCH] b=13537 i=johann i=adilger add mds req_history details --- lustre/include/lprocfs_status.h | 7 +++++++ lustre/mds/handler.c | 6 +++--- lustre/ost/lproc_ost.c | 34 ---------------------------------- lustre/ost/ost_handler.c | 6 +++--- lustre/ost/ost_internal.h | 6 ------ lustre/ptlrpc/lproc_ptlrpc.c | 38 +++++++++++++++++++++++++++++++++++--- 6 files changed, 48 insertions(+), 49 deletions(-) diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h index 49186e4..8a21292 100644 --- a/lustre/include/lprocfs_status.h +++ b/lustre/include/lprocfs_status.h @@ -459,6 +459,10 @@ struct file_operations name##_fops = { \ #define LPROC_SEQ_FOPS_RO(name) __LPROC_SEQ_FOPS(name, NULL) #define LPROC_SEQ_FOPS(name) __LPROC_SEQ_FOPS(name, name##_seq_write) +/* lproc_ptlrpc.c */ +struct ptlrpc_request; +extern void target_print_req(void *seq_file, struct ptlrpc_request *req); + #else /* LPROCFS is not defined */ static inline void lprocfs_counter_add(struct lprocfs_stats *stats, @@ -592,6 +596,9 @@ int lprocfs_counter_write(struct file *file, const char *buffer, #define LPROC_SEQ_FOPS_RO(name) #define LPROC_SEQ_FOPS(name) +/* lproc_ptlrpc.c */ +#define target_print_req NULL + #endif /* LPROCFS */ #endif /* LPROCFS_SNMP_H */ diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index 969b66a..0c3c428 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -2562,7 +2562,7 @@ static int mdt_setup(struct obd_device *obd, obd_count len, void *buf) MDS_MAXREPSIZE, MDS_REQUEST_PORTAL, MDC_REPLY_PORTAL, MDS_SERVICE_WATCHDOG_FACTOR, mds_handle, LUSTRE_MDS_NAME, - obd->obd_proc_entry, NULL, + obd->obd_proc_entry, target_print_req, mds_min_threads, mds_max_threads, "ll_mdt"); if (!mds->mds_service) { @@ -2579,7 +2579,7 @@ static int mdt_setup(struct obd_device *obd, obd_count len, void *buf) MDS_MAXREPSIZE, MDS_SETATTR_PORTAL, MDC_REPLY_PORTAL, MDS_SERVICE_WATCHDOG_FACTOR, mds_handle, "mds_setattr", - obd->obd_proc_entry, NULL, + obd->obd_proc_entry, target_print_req, mds_min_threads, mds_max_threads, "ll_mdt_attr"); if (!mds->mds_setattr_service) { @@ -2596,7 +2596,7 @@ static int mdt_setup(struct obd_device *obd, obd_count len, void *buf) MDS_MAXREPSIZE, MDS_READPAGE_PORTAL, MDC_REPLY_PORTAL, MDS_SERVICE_WATCHDOG_FACTOR, mds_handle, "mds_readpage", - obd->obd_proc_entry, NULL, + obd->obd_proc_entry, target_print_req, MDS_THREADS_MIN_READPAGE, mds_max_threads, "ll_mdt_rdpg"); if (!mds->mds_readpage_service) { diff --git a/lustre/ost/lproc_ost.c b/lustre/ost/lproc_ost.c index 38f9518..27c1286 100644 --- a/lustre/ost/lproc_ost.c +++ b/lustre/ost/lproc_ost.c @@ -40,39 +40,5 @@ static struct lprocfs_vars lprocfs_module_vars[] = { { 0 } }; -void -ost_print_req(void *seq_file, struct ptlrpc_request *req) -{ - /* Called holding srv_lock with irqs disabled. - * Print specific req contents and a newline. - * CAVEAT EMPTOR: check request message length before printing!!! - * You might have received any old crap so you must be just as - * careful here as the service's request parser!!! */ - struct seq_file *sf = seq_file; - - switch (req->rq_phase) { - case RQ_PHASE_NEW: - /* still awaiting a service thread's attention, or rejected - * because the generic request message didn't unpack */ - seq_printf(sf, "\n"); - break; - - case RQ_PHASE_INTERPRET: - /* being handled, so basic msg swabbed, and opc is valid - * but racing with ost_handle() */ - seq_printf(sf, "opc %d\n", lustre_msg_get_opc(req->rq_reqmsg)); - break; - - case RQ_PHASE_COMPLETE: - /* been handled by ost_handle() reply state possibly still - * volatile */ - seq_printf(sf, "opc %d\n", lustre_msg_get_opc(req->rq_reqmsg)); - break; - - default: - LBUG(); - } -} - LPROCFS_INIT_VARS(ost, lprocfs_module_vars, lprocfs_obd_vars) #endif /* LPROCFS */ diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index 4b5d7e6..81e7091 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -1765,7 +1765,7 @@ static int ost_setup(struct obd_device *obd, obd_count len, void *buf) OST_MAXREPSIZE, OST_REQUEST_PORTAL, OSC_REPLY_PORTAL, OSS_SERVICE_WATCHDOG_FACTOR, ost_handle, LUSTRE_OSS_NAME, - obd->obd_proc_entry, ost_print_req, + obd->obd_proc_entry, target_print_req, oss_min_threads, oss_max_threads, "ll_ost"); if (ost->ost_service == NULL) { CERROR("failed to start OST service\n"); @@ -1793,7 +1793,7 @@ static int ost_setup(struct obd_device *obd, obd_count len, void *buf) OST_MAXREPSIZE, OST_CREATE_PORTAL, OSC_REPLY_PORTAL, OSS_SERVICE_WATCHDOG_FACTOR, ost_handle, "ost_create", - obd->obd_proc_entry, ost_print_req, + obd->obd_proc_entry, target_print_req, oss_min_create_threads, oss_max_create_threads, "ll_ost_creat"); @@ -1811,7 +1811,7 @@ static int ost_setup(struct obd_device *obd, obd_count len, void *buf) OST_MAXREPSIZE, OST_IO_PORTAL, OSC_REPLY_PORTAL, OSS_SERVICE_WATCHDOG_FACTOR, ost_handle, "ost_io", - obd->obd_proc_entry, ost_print_req, + obd->obd_proc_entry, target_print_req, oss_min_threads, oss_max_threads, "ll_ost_io"); if (ost->ost_io_service == NULL) { CERROR("failed to start OST I/O service\n"); diff --git a/lustre/ost/ost_internal.h b/lustre/ost/ost_internal.h index e572ead..73c24cb 100644 --- a/lustre/ost/ost_internal.h +++ b/lustre/ost/ost_internal.h @@ -5,12 +5,6 @@ #ifndef OST_INTERNAL_H #define OST_INTERNAL_H -#ifdef LPROCFS -extern void ost_print_req(void *seq_file, struct ptlrpc_request *req); -#else -# define ost_print_req NULL -#endif - #define OSS_SERVICE_WATCHDOG_FACTOR 2000 /* diff --git a/lustre/ptlrpc/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c index 8fdacd8..07a26f1 100644 --- a/lustre/ptlrpc/lproc_ptlrpc.c +++ b/lustre/ptlrpc/lproc_ptlrpc.c @@ -327,6 +327,36 @@ ptlrpc_lprocfs_svc_req_history_next(struct seq_file *s, return srhi; } +/* common ost/mdt srv_request_history_print_fn */ +void target_print_req(void *seq_file, struct ptlrpc_request *req) +{ + /* Called holding srv_lock with irqs disabled. + * Print specific req contents and a newline. + * CAVEAT EMPTOR: check request message length before printing!!! + * You might have received any old crap so you must be just as + * careful here as the service's request parser!!! */ + struct seq_file *sf = seq_file; + + switch (req->rq_phase) { + case RQ_PHASE_NEW: + /* still awaiting a service thread's attention, or rejected + * because the generic request message didn't unpack */ + seq_printf(sf, "\n"); + break; + case RQ_PHASE_INTERPRET: + /* being handled, so basic msg swabbed, and opc is valid + * but racing with mds_handle() */ + case RQ_PHASE_COMPLETE: + /* been handled by mds_handle() reply state possibly still + * volatile */ + seq_printf(sf, "opc %d\n", lustre_msg_get_opc(req->rq_reqmsg)); + break; + default: + DEBUG_REQ(D_ERROR, req, "bad phase %d", req->rq_phase); + } +} +EXPORT_SYMBOL(target_print_req); + static int ptlrpc_lprocfs_svc_req_history_show(struct seq_file *s, void *iter) { struct ptlrpc_service *svc = s->private; @@ -347,11 +377,13 @@ static int ptlrpc_lprocfs_svc_req_history_show(struct seq_file *s, void *iter) * must be just as careful as the service's request * parser. Currently I only print stuff here I know is OK * to look at coz it was set up in request_in_callback()!!! */ - seq_printf(s, LPD64":%s:%s:"LPD64":%d:%s ", + seq_printf(s, LPD64":%s:%s:x"LPD64":%d:%s:%ld:%lds(%+lds) ", req->rq_history_seq, libcfs_nid2str(req->rq_self), libcfs_id2str(req->rq_peer), req->rq_xid, - req->rq_reqlen,ptlrpc_rqphase2str(req)); - + req->rq_reqlen, ptlrpc_rqphase2str(req), + req->rq_arrival_time.tv_sec, + req->rq_sent - req->rq_arrival_time.tv_sec, + req->rq_sent - req->rq_deadline); if (svc->srv_request_history_print_fn == NULL) seq_printf(s, "\n"); else -- 1.8.3.1