From: nathan Date: Mon, 6 Apr 2009 19:36:32 +0000 (+0000) Subject: b=18798 X-Git-Tag: v1_8_0_110~124 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=a14abb7289b31a5e7ca39b3c2a930cbc3d1a8daa;p=fs%2Flustre-release.git b=18798 i=rread i=adliger Track import connection state changes in a new osc/mdc proc file Add overview-type data to the osc/mdc import proc file. --- diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 44302c3..8cbaace 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -31,6 +31,12 @@ tbd Sun Microsystems, Inc. of Lustre filesystem with 4K stack may cause a stack overflow. For more information, please refer to bugzilla 17630. +Severity : enhancement +Bugzilla : 18798 +Description: Add state history info file, enhance import info file +Details : Track import connection state changes in a new osc/mdc proc file; + add overview-type data to the osc/mdc import proc file. + Severity : normal Bugzilla : 18645 Description: Reduce small size read RPC diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h index 5c6c38f..20317a7 100644 --- a/lustre/include/lprocfs_status.h +++ b/lustre/include/lprocfs_status.h @@ -465,6 +465,8 @@ extern int lprocfs_rd_conn_uuid(char *page, char **start, off_t off, int count, int *eof, void *data); extern int lprocfs_rd_import(char *page, char **start, off_t off, int count, int *eof, void *data); +extern int lprocfs_rd_state(char *page, char **start, off_t off, int count, + int *eof, void *data); extern int lprocfs_rd_connect_flags(char *page, char **start, off_t off, int count, int *eof, void *data); extern int lprocfs_rd_num_exports(char *page, char **start, off_t off, @@ -514,11 +516,9 @@ void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value); void lprocfs_oh_clear(struct obd_histogram *oh); unsigned long lprocfs_oh_sum(struct obd_histogram *oh); -/* lprocfs_status.c: counter read/write functions */ -extern int lprocfs_counter_read(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_counter_write(struct file *file, const char *buffer, - unsigned long count, void *data); +void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx, + struct lprocfs_counter *cnt); + /* lprocfs_status.c: recovery status */ int lprocfs_obd_rd_recovery_status(char *page, char **start, off_t off, @@ -769,8 +769,12 @@ static inline int lprocfs_rd_server_uuid(char *page, char **start, off_t off, static inline int lprocfs_rd_conn_uuid(char *page, char **start, off_t off, int count, int *eof, void *data) { return 0; } -static inline int lprocfs_rd_import(char *page, char **start, off_t off, int count, - int *eof, void *data) { return 0; } +static inline int lprocfs_rd_import(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ return 0; } +static inline int lprocfs_rd_state(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ return 0; } static inline int lprocfs_rd_connect_flags(char *page, char **start, off_t off, int count, int *eof, void *data) { return 0; } @@ -844,11 +848,8 @@ void lprocfs_oh_clear(struct obd_histogram *oh) {} static inline unsigned long lprocfs_oh_sum(struct obd_histogram *oh) { return 0; } static inline -int lprocfs_counter_read(char *page, char **start, off_t off, - int count, int *eof, void *data) { return 0; } -static inline -int lprocfs_counter_write(struct file *file, const char *buffer, - unsigned long count, void *data) { return 0; } +void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx, + struct lprocfs_counter *cnt) {} static inline __u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx, diff --git a/lustre/include/lustre_import.h b/lustre/include/lustre_import.h index 28b650a..8fdb36e 100644 --- a/lustre/include/lustre_import.h +++ b/lustre/include/lustre_import.h @@ -110,6 +110,13 @@ struct imp_at { struct adaptive_timeout iat_service_estimate[IMP_AT_MAX_PORTALS]; }; +/* state history */ +#define IMP_STATE_HIST_LEN 16 +struct import_state_hist { + enum lustre_imp_state ish_state; + time_t ish_time; +}; + struct obd_import { struct portals_handle imp_handle; atomic_t imp_refcount; @@ -132,8 +139,11 @@ struct obd_import { atomic_t imp_inflight; atomic_t imp_unregistering; atomic_t imp_replay_inflight; - atomic_t imp_inval_count; + atomic_t imp_inval_count; /* in-progress invalidations */ + atomic_t imp_timeouts; enum lustre_imp_state imp_state; + struct import_state_hist imp_state_hist[IMP_STATE_HIST_LEN]; + int imp_state_hist_idx; int imp_generation; __u32 imp_conn_cnt; int imp_last_generation_checked; diff --git a/lustre/mdc/lproc_mdc.c b/lustre/mdc/lproc_mdc.c index accb538..46aae45 100644 --- a/lustre/mdc/lproc_mdc.c +++ b/lustre/mdc/lproc_mdc.c @@ -91,7 +91,8 @@ static struct lprocfs_vars lprocfs_mdc_obd_vars[] = { { "max_rpcs_in_flight", mdc_rd_max_rpcs_in_flight, mdc_wr_max_rpcs_in_flight, 0 }, { "timeouts", lprocfs_rd_timeouts, 0, 0 }, - { "import", lprocfs_rd_import, 0, 0 }, + { "import", lprocfs_rd_import, 0, 0 }, + { "state", lprocfs_rd_state, 0, 0 }, { 0 } }; diff --git a/lustre/mgc/lproc_mgc.c b/lustre/mgc/lproc_mgc.c index ba98f1b..bf708ab 100644 --- a/lustre/mgc/lproc_mgc.c +++ b/lustre/mgc/lproc_mgc.c @@ -49,6 +49,7 @@ static struct lprocfs_vars lprocfs_mgc_obd_vars[] = { { "mgs_server_uuid", lprocfs_rd_server_uuid, 0, 0 }, { "mgs_conn_uuid", lprocfs_rd_conn_uuid, 0, 0 }, { "import", lprocfs_rd_import, 0, 0 }, + { "state", lprocfs_rd_state, 0, 0 }, { 0 } }; diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index cddc0be..5e1b73b 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -617,15 +617,61 @@ int lprocfs_rd_conn_uuid(char *page, char **start, off_t off, int count, return rc; } -#define flag2str(flag) \ - if (imp->imp_##flag && max - len > 0) \ - len += snprintf(str + len, max - len, " " #flag); +/** add up per-cpu counters */ +void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx, + struct lprocfs_counter *cnt) +{ + unsigned int num_cpu; + struct lprocfs_counter t; + struct lprocfs_counter *percpu_cntr; + int centry, i; + + memset(cnt, 0, sizeof(*cnt)); + + if (stats == NULL) { + /* set count to 1 to avoid divide-by-zero errs in callers */ + cnt->lc_count = 1; + return; + } + + cnt->lc_min = LC_MIN_INIT; + + if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) + num_cpu = 1; + else + num_cpu = num_possible_cpus(); + + for (i = 0; i < num_cpu; i++) { + percpu_cntr = &(stats->ls_percpu[i])->lp_cntr[idx]; + + do { + centry = atomic_read(&percpu_cntr->lc_cntl.la_entry); + t.lc_count = percpu_cntr->lc_count; + t.lc_sum = percpu_cntr->lc_sum; + t.lc_min = percpu_cntr->lc_min; + t.lc_max = percpu_cntr->lc_max; + t.lc_sumsquare = percpu_cntr->lc_sumsquare; + } while (centry != atomic_read(&percpu_cntr->lc_cntl.la_entry) && + centry != atomic_read(&percpu_cntr->lc_cntl.la_exit)); + cnt->lc_count += t.lc_count; + cnt->lc_sum += t.lc_sum; + if (t.lc_min < cnt->lc_min) + cnt->lc_min = t.lc_min; + if (t.lc_max > cnt->lc_max) + cnt->lc_max = t.lc_max; + cnt->lc_sumsquare += t.lc_sumsquare; + } + + cnt->lc_units = stats->ls_percpu[0]->lp_cntr[idx].lc_units; +} /** * Append a space separated list of current set flags to str. */ -static int obd_import_flags2str(struct obd_import *imp, char *str, - int max) +#define flag2str(flag) \ + if (imp->imp_##flag && max - len > 0) \ + len += snprintf(str + len, max - len, "%s" #flag, len ? ", " : ""); +static int obd_import_flags2str(struct obd_import *imp, char *str, int max) { int len = 0; @@ -642,48 +688,202 @@ static int obd_import_flags2str(struct obd_import *imp, char *str, } #undef flags2str +static const char *obd_connect_names[] = { + "read_only", + "lov_index", + "unused", + "write_grant", + "server_lock", + "version", + "request_portal", + "acl", + "xattr", + "create_on_write", + "truncate_lock", + "initial_transno", + "inode_bit_locks", + "join_file", + "getattr_by_fid", + "no_oh_for_devices", + "local_client", + "remote_client", + "max_byte_per_rpc", + "64bit_qdata", + "mds_capability", + "oss_capability", + "early_lock_cancel", + "size_on_mds", + "adaptive_timeouts", + "lru_resize", + "mds_mds_connection", + "real_conn", + "change_qunit_size", + "alt_checksum_algorithm", + "fid_is_enabled", + "version_recovery", + "pools", + "grant_shrink", + "skip_orphan", + NULL +}; + +static int obd_connect_flags2str(char *page, int count, __u64 flags, char *sep) +{ + __u64 mask = 1; + int i, ret = 0; + + for (i = 0; obd_connect_names[i] != NULL; i++, mask <<= 1) { + if (flags & mask) + ret += snprintf(page + ret, count - ret, "%s%s", + ret ? sep : "", obd_connect_names[i]); + } + if (flags & ~(mask - 1)) + ret += snprintf(page + ret, count - ret, + "%sunknown flags "LPX64, + ret ? sep : "", flags & ~(mask - 1)); + return ret; +} + int lprocfs_rd_import(char *page, char **start, off_t off, int count, int *eof, void *data) { + struct lprocfs_counter ret; struct obd_device *obd = (struct obd_device *)data; struct obd_import *imp; - char *imp_state_name = NULL; - int rc = 0; + int i, j, k, rw = 0; LASSERT(obd != NULL); LPROCFS_CLIMP_CHECK(obd); imp = obd->u.cli.cl_import; - imp_state_name = ptlrpc_import_state_name(imp->imp_state); *eof = 1; - rc = snprintf(page, count, - "import: %s\n" - " target: %s@%s\n" - " state: %s\n" - " inflight: %u\n" - " unregistering: %u\n" - " conn_cnt: %u\n" - " generation: %u\n" - " inval_cnt: %u\n" - " last_replay_transno: "LPU64"\n" - " peer_committed_transno: "LPU64"\n" - " last_trasno_checked: "LPU64"\n" - " flags:", - obd->obd_name, - obd2cli_tgt(obd), imp->imp_connection->c_remote_uuid.uuid, - imp_state_name, - atomic_read(&imp->imp_inflight), - atomic_read(&imp->imp_unregistering), + i = snprintf(page, count, + "import:\n" + " name: %s\n" + " target: %s\n" + " current_connection: %s\n" + " state: %s\n" + " connect_flags: [", + obd->obd_name, + obd2cli_tgt(obd), + imp->imp_connection->c_remote_uuid.uuid, + ptlrpc_import_state_name(imp->imp_state)); + i += obd_connect_flags2str(page + i, count - i, + imp->imp_connect_data.ocd_connect_flags, + ", "); + i += snprintf(page + i, count - i, + "]\n" + " import_flags: ["); + i += obd_import_flags2str(imp, page + i, count - i); + + i += snprintf(page + i, count - i, + "]\n" + " connection:\n" + " connection_attempts: %u\n" + " generation: %u\n" + " in-progress_invalidations: %u\n", imp->imp_conn_cnt, imp->imp_generation, - atomic_read(&imp->imp_inval_count), + atomic_read(&imp->imp_inval_count)); + + lprocfs_stats_collect(obd->obd_svc_stats, PTLRPC_REQWAIT_CNTR, &ret); + do_div(ret.lc_sum, ret.lc_count); + i += snprintf(page + i, count - i, + " rpcs:\n" + " inflight: %u\n" + " unregistering: %u\n" + " timeouts: %u\n" + " avg_waittime: "LPU64" %s\n", + atomic_read(&imp->imp_inflight), + atomic_read(&imp->imp_unregistering), + atomic_read(&imp->imp_timeouts), + ret.lc_sum, ret.lc_units); + + k = 0; + for(j = 0; j < IMP_AT_MAX_PORTALS; j++) { + if (imp->imp_at.iat_portal[j] == 0) + break; + k = max_t(unsigned int, k, + at_get(&imp->imp_at.iat_service_estimate[j])); + } + i += snprintf(page + i, count - i, + " service_estimates:\n" + " services: %u sec\n" + " network: %u sec\n", + k, + at_get(&imp->imp_at.iat_net_latency)); + + i += snprintf(page + i, count - i, + " transactions:\n" + " last_replay: "LPU64"\n" + " peer_committed: "LPU64"\n" + " last_checked: "LPU64"\n", imp->imp_last_replay_transno, imp->imp_peer_committed_transno, imp->imp_last_transno_checked); - rc += obd_import_flags2str(imp, page + rc, count - rc); - rc += snprintf(page+rc, count - rc, "\n"); + + /* avg data rates */ + for (rw = 0; rw <= 1; rw++) { + lprocfs_stats_collect(obd->obd_svc_stats, + PTLRPC_LAST_CNTR + BRW_READ_BYTES + rw, + &ret); + if (ret.lc_sum > 0) { + do_div(ret.lc_sum, ret.lc_count); + i += snprintf(page + i, count - i, + " %s_data_averages:\n" + " bytes_per_rpc: "LPU64"\n", + rw ? "write" : "read", + ret.lc_sum); + } + k = (int)ret.lc_sum; + j = opcode_offset(OST_READ + rw) + EXTRA_MAX_OPCODES; + lprocfs_stats_collect(obd->obd_svc_stats, j, &ret); + if (ret.lc_sum > 0) { + do_div(ret.lc_sum, ret.lc_count); + i += snprintf(page + i, count - i, + " %s_per_rpc: "LPU64"\n", + ret.lc_units, ret.lc_sum); + j = (int)ret.lc_sum; + if (j > 0) + i += snprintf(page + i, count - i, + " MB_per_sec: %u.%.02u\n", + k / j, (100 * k / j) % 100); + } + } + LPROCFS_CLIMP_EXIT(obd); - return rc; + return i; +} + +int lprocfs_rd_state(char *page, char **start, off_t off, int count, + int *eof, void *data) +{ + struct obd_device *obd = (struct obd_device *)data; + struct obd_import *imp; + int i, j, k; + + LASSERT(obd != NULL); + LPROCFS_CLIMP_CHECK(obd); + imp = obd->u.cli.cl_import; + *eof = 1; + + i = snprintf(page, count, "current_state: %s\n", + ptlrpc_import_state_name(imp->imp_state)); + i += snprintf(page + i, count - i, + "state_history:\n"); + k = imp->imp_state_hist_idx; + for (j = 0; j < IMP_STATE_HIST_LEN; j++) { + struct import_state_hist *ish = + &imp->imp_state_hist[(k + j) % IMP_STATE_HIST_LEN]; + if (ish->ish_state == 0) + continue; + i += snprintf(page + i, count - i, " - ["CFS_TIME_T", %s]\n", + ish->ish_time, + ptlrpc_import_state_name(ish->ish_state)); + } + + LPROCFS_CLIMP_EXIT(obd); + return i; } int lprocfs_at_hist_helper(char *page, int count, int rc, @@ -749,64 +949,18 @@ int lprocfs_rd_timeouts(char *page, char **start, off_t off, int count, return rc; } -/* see OBD_CONNECT_* */ -static const char *obd_connect_names[] = { - "read_only", - "lov_index", - "mds_connection", - "write_grant", - "server_lock", - "version", - "request_portal", - "acl", - "xattr", - "create_on_write", - "truncate_lock", - "initial_transno", - "inode_bit_locks", - "join_file", - "getattr_by_fid", - "no_oh_for_devices", - "local_1.8_client", - "remote_1.8_client", - "max_byte_per_rpc", - "64bit_qdata", - "fid_capability", - "oss_capability", - "early_lock_cancel", - "size_on_mds", - "adaptive_timeout", - "lru_resize", - "mds_mds_connection", - "real_conn", - "change_qunit_size", - "alt_checksum_algorithm", - "fid_is_enabled", - "version_recovery", - "pools", - "grant_shrink", - NULL -}; - int lprocfs_rd_connect_flags(char *page, char **start, off_t off, int count, int *eof, void *data) { struct obd_device *obd = data; - __u64 mask = 1, flags; - int i, ret = 0; + __u64 flags; + int ret = 0; LPROCFS_CLIMP_CHECK(obd); flags = obd->u.cli.cl_import->imp_connect_data.ocd_connect_flags; ret = snprintf(page, count, "flags="LPX64"\n", flags); - for (i = 0; obd_connect_names[i] != NULL; i++, mask <<= 1) { - if (flags & mask) - ret += snprintf(page + ret, count - ret, "%s\n", - obd_connect_names[i]); - } - if (flags & ~(mask - 1)) - ret += snprintf(page + ret, count - ret, - "unknown flags "LPX64"\n", flags & ~(mask - 1)); - + ret += obd_connect_flags2str(page + ret, count - ret, flags, "\n"); + ret += snprintf(page + ret, count - ret, "\n"); LPROCFS_CLIMP_EXIT(obd); return ret; } @@ -1044,9 +1198,8 @@ static int lprocfs_stats_seq_show(struct seq_file *p, void *v) { struct lprocfs_stats *stats = p->private; struct lprocfs_counter *cntr = v; - struct lprocfs_counter t, ret = { .lc_min = LC_MIN_INIT }; - int i, idx, rc = 0; - unsigned int num_cpu; + struct lprocfs_counter ret; + int idx, rc = 0; if (cntr == &(stats->ls_percpu[0])->lp_cntr[0]) { struct timeval now; @@ -1058,39 +1211,14 @@ static int lprocfs_stats_seq_show(struct seq_file *p, void *v) } idx = cntr - &(stats->ls_percpu[0])->lp_cntr[0]; - if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) - num_cpu = 1; - else - num_cpu = num_possible_cpus(); - - for (i = 0; i < num_cpu; i++) { - struct lprocfs_counter *percpu_cntr = - &(stats->ls_percpu[i])->lp_cntr[idx]; - int centry; - - do { - centry = atomic_read(&percpu_cntr->lc_cntl.la_entry); - t.lc_count = percpu_cntr->lc_count; - t.lc_sum = percpu_cntr->lc_sum; - t.lc_min = percpu_cntr->lc_min; - t.lc_max = percpu_cntr->lc_max; - t.lc_sumsquare = percpu_cntr->lc_sumsquare; - } while (centry != atomic_read(&percpu_cntr->lc_cntl.la_entry) && - centry != atomic_read(&percpu_cntr->lc_cntl.la_exit)); - ret.lc_count += t.lc_count; - ret.lc_sum += t.lc_sum; - if (t.lc_min < ret.lc_min) - ret.lc_min = t.lc_min; - if (t.lc_max > ret.lc_max) - ret.lc_max = t.lc_max; - ret.lc_sumsquare += t.lc_sumsquare; - } + lprocfs_stats_collect(stats, idx, &ret); if (ret.lc_count == 0) goto out; rc = seq_printf(p, "%-25s "LPD64" samples [%s]", cntr->lc_name, ret.lc_count, cntr->lc_units); + if (rc < 0) goto out; @@ -2149,6 +2277,7 @@ EXPORT_SYMBOL(lprocfs_rd_num_exports); EXPORT_SYMBOL(lprocfs_rd_numrefs); EXPORT_SYMBOL(lprocfs_at_hist_helper); EXPORT_SYMBOL(lprocfs_rd_import); +EXPORT_SYMBOL(lprocfs_rd_state); EXPORT_SYMBOL(lprocfs_rd_timeouts); EXPORT_SYMBOL(lprocfs_rd_blksize); EXPORT_SYMBOL(lprocfs_rd_kbytestotal); @@ -2162,4 +2291,5 @@ EXPORT_SYMBOL(lprocfs_write_frac_helper); EXPORT_SYMBOL(lprocfs_read_frac_helper); EXPORT_SYMBOL(lprocfs_write_u64_helper); EXPORT_SYMBOL(lprocfs_write_frac_u64_helper); +EXPORT_SYMBOL(lprocfs_stats_collect); #endif /* LPROCFS*/ diff --git a/lustre/osc/lproc_osc.c b/lustre/osc/lproc_osc.c index 15c6860..8c42b04 100644 --- a/lustre/osc/lproc_osc.c +++ b/lustre/osc/lproc_osc.c @@ -476,6 +476,7 @@ static struct lprocfs_vars lprocfs_osc_obd_vars[] = { { "resend_count", osc_rd_resend_count, osc_wr_resend_count, 0}, { "timeouts", lprocfs_rd_timeouts, 0, 0 }, { "import", lprocfs_rd_import, 0, 0 }, + { "state", lprocfs_rd_state, 0, 0 }, { 0 } }; diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index 54bceb2..337cf9b 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -928,9 +928,11 @@ static int after_reply(struct ptlrpc_request *req) do_gettimeofday(&work_start); timediff = cfs_timeval_sub(&work_start, &req->rq_arrival_time, NULL); - if (obd->obd_svc_stats != NULL) + if (obd->obd_svc_stats != NULL) { lprocfs_counter_add(obd->obd_svc_stats, PTLRPC_REQWAIT_CNTR, timediff); + ptlrpc_lprocfs_rpc_sent(req, timediff); + } OBD_FAIL_TIMEOUT(OBD_FAIL_PTLRPC_PAUSE_REP, obd_fail_val); ptlrpc_at_adj_service(req, lustre_msg_get_timeout(req->rq_repmsg)); @@ -1374,6 +1376,8 @@ int ptlrpc_expire_one_request(struct ptlrpc_request *req, int async_unlink) RETURN(1); } + atomic_inc(&imp->imp_timeouts); + /* The DLM server doesn't want recovery run on its imports. */ if (imp->imp_dlm_fake) RETURN(1); diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c index f4f909b..38caf6a 100644 --- a/lustre/ptlrpc/import.c +++ b/lustre/ptlrpc/import.c @@ -58,6 +58,17 @@ struct ptlrpc_connect_async_args { int pcaa_initial_connect; }; +static void __import_set_state(struct obd_import *imp, + enum lustre_imp_state state) +{ + imp->imp_state = state; + imp->imp_state_hist[imp->imp_state_hist_idx].ish_state = state; + imp->imp_state_hist[imp->imp_state_hist_idx].ish_time = + cfs_time_current_sec(); + imp->imp_state_hist_idx = (imp->imp_state_hist_idx + 1) % + IMP_STATE_HIST_LEN; +} + /* A CLOSED import should remain so. */ #define IMPORT_SET_STATE_NOLOCK(imp, state) \ do { \ @@ -66,7 +77,7 @@ do { \ imp, obd2cli_tgt(imp->imp_obd), \ ptlrpc_import_state_name(imp->imp_state), \ ptlrpc_import_state_name(state)); \ - imp->imp_state = state; \ + __import_set_state(imp, state); \ } \ } while(0) diff --git a/lustre/ptlrpc/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c index f9983a9..5a55dca 100644 --- a/lustre/ptlrpc/lproc_ptlrpc.c +++ b/lustre/ptlrpc/lproc_ptlrpc.c @@ -591,7 +591,7 @@ void ptlrpc_lprocfs_register_obd(struct obd_device *obddev) } EXPORT_SYMBOL(ptlrpc_lprocfs_register_obd); -void ptlrpc_lprocfs_rpc_sent(struct ptlrpc_request *req) +void ptlrpc_lprocfs_rpc_sent(struct ptlrpc_request *req, long amount) { struct lprocfs_stats *svc_stats; __u32 op = lustre_msg_get_opc(req->rq_reqmsg); @@ -602,7 +602,7 @@ void ptlrpc_lprocfs_rpc_sent(struct ptlrpc_request *req) return; LASSERT(opc < LUSTRE_MAX_OPCODES); if (!(op == LDLM_ENQUEUE || op == MDS_REINT)) - lprocfs_counter_add(svc_stats, opc + EXTRA_MAX_OPCODES, 0); + lprocfs_counter_add(svc_stats, opc + EXTRA_MAX_OPCODES, amount); } void ptlrpc_lprocfs_brw(struct ptlrpc_request *req, int bytes) diff --git a/lustre/ptlrpc/niobuf.c b/lustre/ptlrpc/niobuf.c index 5112e13..e48cf86 100644 --- a/lustre/ptlrpc/niobuf.c +++ b/lustre/ptlrpc/niobuf.c @@ -623,10 +623,8 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) connection, request->rq_request_portal, request->rq_xid, 0); - if (rc == 0) { - ptlrpc_lprocfs_rpc_sent(request); + if (rc == 0) RETURN(rc); - } ptlrpc_req_finished(request); if (noreply) diff --git a/lustre/ptlrpc/ptlrpc_internal.h b/lustre/ptlrpc/ptlrpc_internal.h index bdcdf48..98ba674 100644 --- a/lustre/ptlrpc/ptlrpc_internal.h +++ b/lustre/ptlrpc/ptlrpc_internal.h @@ -72,7 +72,7 @@ int lustre_unpack_rep_ptlrpc_body(struct ptlrpc_request *req, int offset); void ptlrpc_lprocfs_register_service(struct proc_dir_entry *proc_entry, struct ptlrpc_service *svc); void ptlrpc_lprocfs_unregister_service(struct ptlrpc_service *svc); -void ptlrpc_lprocfs_rpc_sent(struct ptlrpc_request *req); +void ptlrpc_lprocfs_rpc_sent(struct ptlrpc_request *req, long amount); void ptlrpc_lprocfs_do_request_stat (struct ptlrpc_request *req, long q_usec, long work_usec); #else