From 524deb6f985beb512a4499501fd7275ecb77f815 Mon Sep 17 00:00:00 2001 From: Mr NeilBrown Date: Mon, 30 Sep 2019 09:09:54 +1000 Subject: [PATCH] LU-12820 osc: remove 'transient' arg from osc_enter_cache_try This arg is always '0', so remove it. Consequently, OBD_BRW_NOCACHE is never set, and cl_dirty_transit and obd_dirty_transit_pages are never non-zero. So they can be removed as well. Linux-commit: 8d1057264a75 Test-Parameters: trivial Signed-off-by: Mr NeilBrown Change-Id: Ia047affc33fb9277e6c28a8f6d7d088c385b51a8 Reviewed-on: https://review.whamcloud.com/36319 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Shaun Tancheff Reviewed-by: Ben Evans Reviewed-by: Oleg Drokin --- lustre/include/obd.h | 1 - lustre/include/obd_support.h | 1 - lustre/include/uapi/linux/lustre/lustre_idl.h | 1 + lustre/obdclass/class_obd.c | 3 --- lustre/osc/osc_cache.c | 20 +++++--------------- lustre/osc/osc_request.c | 13 +++++-------- 6 files changed, 11 insertions(+), 28 deletions(-) diff --git a/lustre/include/obd.h b/lustre/include/obd.h index 96c77a0..56b2e39 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -212,7 +212,6 @@ struct client_obd { /* the grant values are protected by loi_list_lock below */ unsigned long cl_dirty_pages; /* all _dirty_ in pages */ unsigned long cl_dirty_max_pages; /* allowed w/o rpc */ - unsigned long cl_dirty_transit; /* dirty synchronous */ unsigned long cl_avail_grant; /* bytes of credit for ost */ unsigned long cl_lost_grant; /* lost credits (trunc) */ /* grant consumed for dirty pages */ diff --git a/lustre/include/obd_support.h b/lustre/include/obd_support.h index 6e11bd8..8a0f778 100644 --- a/lustre/include/obd_support.h +++ b/lustre/include/obd_support.h @@ -68,7 +68,6 @@ extern int at_early_margin; extern int at_extra; extern unsigned long obd_max_dirty_pages; extern atomic_long_t obd_dirty_pages; -extern atomic_long_t obd_dirty_transit_pages; extern char obd_jobid_var[]; /* Some hash init argument constants */ diff --git a/lustre/include/uapi/linux/lustre/lustre_idl.h b/lustre/include/uapi/linux/lustre/lustre_idl.h index 5b02ad3..2d59f67 100644 --- a/lustre/include/uapi/linux/lustre/lustre_idl.h +++ b/lustre/include/uapi/linux/lustre/lustre_idl.h @@ -1358,6 +1358,7 @@ struct hsm_state_set { #define OBD_BRW_CHECK 0x10 #define OBD_BRW_FROM_GRANT 0x20 /* the osc manages this under llite */ #define OBD_BRW_GRANTED 0x40 /* the ost manages this */ +/* OBD_BRW_NOCACHE is currently neither set nor tested */ #define OBD_BRW_NOCACHE 0x80 /* this page is a part of non-cached IO */ #define OBD_BRW_NOQUOTA 0x100 #define OBD_BRW_SRVLOCK 0x200 /* Client holds no lock over this page */ diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c index 5eee8ef..703025f 100644 --- a/lustre/obdclass/class_obd.c +++ b/lustre/obdclass/class_obd.c @@ -98,9 +98,6 @@ EXPORT_SYMBOL(at_early_margin); int at_extra = 30; EXPORT_SYMBOL(at_extra); -atomic_long_t obd_dirty_transit_pages; -EXPORT_SYMBOL(obd_dirty_transit_pages); - #ifdef CONFIG_PROC_FS struct lprocfs_stats *obd_memory = NULL; EXPORT_SYMBOL(obd_memory); diff --git a/lustre/osc/osc_cache.c b/lustre/osc/osc_cache.c index 891d560..05f0c61 100644 --- a/lustre/osc/osc_cache.c +++ b/lustre/osc/osc_cache.c @@ -1427,11 +1427,6 @@ static void osc_release_write_grant(struct client_obd *cli, pga->flag &= ~OBD_BRW_FROM_GRANT; atomic_long_dec(&obd_dirty_pages); cli->cl_dirty_pages--; - if (pga->flag & OBD_BRW_NOCACHE) { - pga->flag &= ~OBD_BRW_NOCACHE; - atomic_long_dec(&obd_dirty_transit_pages); - cli->cl_dirty_transit--; - } EXIT; } @@ -1544,7 +1539,7 @@ static void osc_exit_cache(struct client_obd *cli, struct osc_async_page *oap) */ static int osc_enter_cache_try(struct client_obd *cli, struct osc_async_page *oap, - int bytes, int transient) + int bytes) { int rc; @@ -1558,11 +1553,6 @@ static int osc_enter_cache_try(struct client_obd *cli, if (atomic_long_add_return(1, &obd_dirty_pages) <= obd_max_dirty_pages) { osc_consume_write_grant(cli, &oap->oap_brw_page); - if (transient) { - cli->cl_dirty_transit++; - atomic_long_inc(&obd_dirty_transit_pages); - oap->oap_brw_flags |= OBD_BRW_NOCACHE; - } rc = 1; goto out; } else @@ -1618,7 +1608,7 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, /* Hopefully normal case - cache space and write credits available */ if (list_empty(&cli->cl_cache_waiters) && - osc_enter_cache_try(cli, oap, bytes, 0)) { + osc_enter_cache_try(cli, oap, bytes)) { OSC_DUMP_GRANT(D_CACHE, cli, "granted from cache\n"); GOTO(out, rc = 0); } @@ -1656,7 +1646,7 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, if (rc != -EDQUOT) break; - if (osc_enter_cache_try(cli, oap, bytes, 0)) { + if (osc_enter_cache_try(cli, oap, bytes)) { rc = 0; break; } @@ -1706,7 +1696,7 @@ void osc_wake_cache_waiters(struct client_obd *cli) ocw->ocw_rc = -EDQUOT; - if (osc_enter_cache_try(cli, ocw->ocw_oap, ocw->ocw_grant, 0)) + if (osc_enter_cache_try(cli, ocw->ocw_oap, ocw->ocw_grant)) ocw->ocw_rc = 0; if (ocw->ocw_rc == 0 || @@ -2440,7 +2430,7 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, /* it doesn't need any grant to dirty this page */ spin_lock(&cli->cl_loi_list_lock); - rc = osc_enter_cache_try(cli, oap, grants, 0); + rc = osc_enter_cache_try(cli, oap, grants); if (rc == 0) { /* try failed */ grants = 0; need_release = 1; diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 0e0092d..7a0a550 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -645,21 +645,18 @@ static void osc_announce_cached(struct client_obd *cli, struct obdo *oa, oa->o_dirty = cli->cl_dirty_grant; else oa->o_dirty = cli->cl_dirty_pages << PAGE_SHIFT; - if (unlikely(cli->cl_dirty_pages - cli->cl_dirty_transit > - cli->cl_dirty_max_pages)) { - CERROR("dirty %lu - %lu > dirty_max %lu\n", - cli->cl_dirty_pages, cli->cl_dirty_transit, + if (unlikely(cli->cl_dirty_pages > cli->cl_dirty_max_pages)) { + CERROR("dirty %lu > dirty_max %lu\n", + cli->cl_dirty_pages, cli->cl_dirty_max_pages); oa->o_undirty = 0; - } else if (unlikely(atomic_long_read(&obd_dirty_pages) - - atomic_long_read(&obd_dirty_transit_pages) > + } else if (unlikely(atomic_long_read(&obd_dirty_pages) > (long)(obd_max_dirty_pages + 1))) { /* The atomic_read() allowing the atomic_inc() are * not covered by a lock thus they may safely race and trip * this CERROR() unless we add in a small fudge factor (+1). */ - CERROR("%s: dirty %ld - %ld > system dirty_max %ld\n", + CERROR("%s: dirty %ld > system dirty_max %ld\n", cli_name(cli), atomic_long_read(&obd_dirty_pages), - atomic_long_read(&obd_dirty_transit_pages), obd_max_dirty_pages); oa->o_undirty = 0; } else if (unlikely(cli->cl_dirty_max_pages - cli->cl_dirty_pages > -- 1.8.3.1