X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fosc%2Fosc_page.c;h=affd0d265e0beedeb403c60018d9b2d64428bf54;hp=cba22fe88cd5010654a2b6836fcaa5e2fff08a3f;hb=27815a0611a2e315a9a7696a20c2f257d48aeb7e;hpb=e5a5abca5637d59187475bfc2e0ef45e2af41420;ds=sidebyside diff --git a/lustre/osc/osc_page.c b/lustre/osc/osc_page.c index cba22fe..affd0d2 100644 --- a/lustre/osc/osc_page.c +++ b/lustre/osc/osc_page.c @@ -70,7 +70,7 @@ static int osc_page_is_dlocked(const struct lu_env *env, struct lustre_handle *lockh; ldlm_policy_data_t *policy; ldlm_mode_t dlmmode; - int flags; + __u64 flags; might_sleep(); @@ -544,6 +544,30 @@ int osc_page_init(const struct lu_env *env, struct cl_object *obj, return result; } +int osc_over_unstable_soft_limit(struct client_obd *cli) +{ + long obd_upages, obd_dpages, osc_upages; + + /* Can't check cli->cl_unstable_count, therefore, no soft limit */ + if (cli == NULL) + return 0; + + obd_upages = cfs_atomic_read(&obd_unstable_pages); + obd_dpages = cfs_atomic_read(&obd_dirty_pages); + + osc_upages = cfs_atomic_read(&cli->cl_unstable_count); + + /* obd_max_dirty_pages is the max number of (dirty + unstable) + * pages allowed at any given time. To simulate an unstable page + * only limit, we subtract the current number of dirty pages + * from this max. This difference is roughly the amount of pages + * currently available for unstable pages. Thus, the soft limit + * is half of that difference. Check osc_upages to ensure we don't + * set SOFT_SYNC for OSCs without any outstanding unstable pages. */ + return osc_upages != 0 && + obd_upages >= (obd_max_dirty_pages - obd_dpages) / 2; +} + /** * Helper function called by osc_io_submit() for every page in an immediate * transfer (i.e., transferred synchronously). @@ -567,6 +591,9 @@ void osc_page_submit(const struct lu_env *env, struct osc_page *opg, oap->oap_count = opg->ops_to - opg->ops_from; oap->oap_brw_flags = OBD_BRW_SYNC | brw_flags; + if (osc_over_unstable_soft_limit(oap->oap_cli)) + oap->oap_brw_flags |= OBD_BRW_SOFT_SYNC; + if (!client_is_remote(osc_export(obj)) && cfs_capable(CFS_CAP_SYS_RESOURCE)) { oap->oap_brw_flags |= OBD_BRW_NOQUOTA;