X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fosc%2Fosc_request.c;h=074308e63b71a9076ad2375f6cc08149f9b830e8;hp=68452b059153f1557d9f6d5489280e8dd6ff8ddb;hb=e817ad5b75570e433a70228ce9226e910bc35188;hpb=9f604f5da06a2aa428388905ca9158b128e5016c diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 68452b0..074308e 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -2818,10 +2818,14 @@ static int osc_enter_cache(const struct lu_env *env, osc_enter_cache_try(env, cli, loi, oap, 0)) RETURN(0); - /* Make sure that there are write rpcs in flight to wait for. This - * is a little silly as this object may not have any pending but - * other objects sure might. */ - if (cli->cl_w_in_flight) { + /* It is safe to block as a cache waiter as long as there is grant + * space available or the hope of additional grant being returned + * when an in flight write completes. Using the write back cache + * if possible is preferable to sending the data synchronously + * because write pages can then be merged in to large requests. + * The addition of this cache waiter will causing pending write + * pages to be sent immediately. */ + if (cli->cl_w_in_flight || cli->cl_avail_grant >= CFS_PAGE_SIZE) { cfs_list_add_tail(&ocw.ocw_entry, &cli->cl_cache_waiters); cfs_waitq_init(&ocw.ocw_waitq); ocw.ocw_oap = oap;