diff --git a/lustre/include/linux/obd.h b/lustre/include/linux/obd.h index a6a7146ea650aeb5609f7781ec358d267a05c2db..4b00043f322599641f0497bba025db6b9db59836 100644 --- a/lustre/include/linux/obd.h +++ b/lustre/include/linux/obd.h @@ -302,7 +302,6 @@ struct mds_server_data; #define OSC_MAX_DIRTY_DEFAULT (4*OSC_MAX_RIF_DEFAULT*PTLRPC_MAX_BRW_SIZE>>20) #define OSC_MAX_DIRTY_MB_MAX 512 /* totally arbitrary */ - struct mdc_rpc_lock; struct client_obd { struct obd_import *cl_import; @@ -373,6 +372,8 @@ struct client_obd { unsigned long cl_dirty_dmax; unsigned long cl_dirty_dmin; + + unsigned long cl_sync_rpcs; }; /* Like a client, with some hangers-on. Keep mc_client_obd first so that we diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index c4f5f606421835c538e55c5421887a6a1f42e71c..e16c61a7cbeddf19bffce882e5eced16817ab2e4 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -238,6 +238,7 @@ int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf) cli->cl_dirty = 0; cli->cl_avail_grant = 0; + /* FIXME: should limit this for the sum of all cl_dirty_max */ cli->cl_dirty_max = OSC_MAX_DIRTY_DEFAULT * 1024 * 1024; if (cli->cl_dirty_max >> PAGE_SHIFT > num_physpages / 8) @@ -269,6 +270,7 @@ int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf) cli->cl_dirty_av = 0; cli->cl_dirty_dmax = 0; cli->cl_dirty_dmin = 0; + cli->cl_sync_rpcs = 0; if (num_physpages >> (20 - PAGE_SHIFT) <= 128) { /* <= 128 MB */ cli->cl_max_pages_per_rpc = PTLRPC_MAX_BRW_PAGES / 4; @@ -373,6 +375,7 @@ int client_obd_cleanup(struct obd_device *obddev, int flags) if (!cli->cl_import) RETURN(-EINVAL); + if (cli->cl_mgmtcli_obd) { mgmtcli_deregister_for_events_t dereg_f; @@ -383,10 +386,10 @@ int client_obd_cleanup(struct obd_device *obddev, int flags) if (cli->cl_write_gaps) { CWARN("%s: [writes num: %lu, reads num: %lu]: %lu write gaps: %lu " - "av. (usec), %lu total (usec)\n", obddev->obd_name, - cli->cl_write_num, cli->cl_read_num, cli->cl_write_gaps, - cli->cl_write_gap_sum / cli->cl_write_gaps, - cli->cl_write_gap_sum); + "av. (usec), %lu total (usec), %lu rpcs falled back to sync\n", + obddev->obd_name, cli->cl_write_num, cli->cl_read_num, + cli->cl_write_gaps, cli->cl_write_gap_sum / cli->cl_write_gaps, + cli->cl_write_gap_sum, cli->cl_sync_rpcs); } if (cli->cl_cache_wait_num) { @@ -396,14 +399,13 @@ int client_obd_cleanup(struct obd_device *obddev, int flags) } if (cli->cl_dirty_av) { - CWARN("%s: pipe loading av. %lu (b), max pipe space %lu (b), pipe " - "loading ratio %lu%%\n", obddev->obd_name, cli->cl_dirty_av, - cli->cl_dirty_max, (cli->cl_dirty_av * 100) / cli->cl_dirty_max); - } - - if (cli->cl_dirty_dmax) { - CWARN("%s: pipe dirty max %lu (b), pipe dirty min %lu (b)\n", - obddev->obd_name, cli->cl_dirty_dmax, cli->cl_dirty_dmin); + CWARN("%s: pipe loading av. %lu (b), max pipe room %lu (b), pipe " + "loading av. ratio %lu%%, pipe dirty max %lu (b), pipe dirty " + "min %lu (b), pipe loading max ratio %lu%%\n", obddev->obd_name, + cli->cl_dirty_av, cli->cl_dirty_max, + (cli->cl_dirty_av * 100) / cli->cl_dirty_max, + cli->cl_dirty_dmax, cli->cl_dirty_dmin, + (cli->cl_dirty_dmax * 100) / cli->cl_dirty_max); } /* Here we try to drop the security structure after destroy import, diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index b2463ac83ae019aa829b369c876ee006ad1c8b03..de0f5290bf6806a7f840c53de4f7fbf4ea90a6ea 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -1861,13 +1861,14 @@ static int osc_enter_cache(struct client_obd *cli, struct lov_oinfo *loi, struct osc_cache_waiter ocw; struct l_wait_info lwi = { 0 }; struct timeval start, stop; + ENTRY; CDEBUG(D_CACHE, "dirty: %ld dirty_max: %ld dropped: %lu grant: %lu\n", cli->cl_dirty, cli->cl_dirty_max, cli->cl_lost_grant, cli->cl_avail_grant); if (cli->cl_dirty_max < PAGE_SIZE) - return(-EDQUOT); + GOTO(out, -EDQUOT); if (~0ul - cli->cl_dirty_sum <= cli->cl_dirty) { cli->cl_dirty_av = (cli->cl_dirty_av + @@ -1892,7 +1893,7 @@ static int osc_enter_cache(struct client_obd *cli, struct lov_oinfo *loi, cli->cl_avail_grant >= PAGE_SIZE) { /* account for ourselves */ osc_consume_write_grant(cli, oap); - return(0); + RETURN(0); } /* Make sure that there are write rpcs in flight to wait for. This @@ -1925,7 +1926,10 @@ static int osc_enter_cache(struct client_obd *cli, struct lov_oinfo *loi, RETURN(ocw.ocw_rc); } - RETURN(-EDQUOT); + EXIT; +out: + cli->cl_sync_rpcs++; + return -EDQUOT; } /* the companion to enter_cache, called when an oap is no longer part of the