From: Brian Behlendorf Date: Wed, 17 Feb 2010 17:49:23 +0000 (-0500) Subject: b=22074 incorrect triggering of synchronous IO X-Git-Tag: v1_8_2_50~1 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;ds=sidebyside;h=437e58696856e0637c7c24cae66c2eaf220fad61;p=fs%2Flustre-release.git b=22074 incorrect triggering of synchronous IO The OSC can mistakenly fall back to synchronous IO when the max_dirty_mb limit is reached and no write requests have yet been issued. This can occur when the dirty pages are spread over many files all of which are below the optimal request size. o=behlendorf1@llnl.gov (Brian Behlendorf) i=adilger i=tom.wang --- diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index df25025..ea5737e 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -2763,10 +2763,14 @@ static int osc_enter_cache(struct client_obd *cli, struct lov_oinfo *loi, 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) { list_add_tail(&ocw.ocw_entry, &cli->cl_cache_waiters); cfs_waitq_init(&ocw.ocw_waitq); ocw.ocw_oap = oap;