From 300526627be80c16be05dd1abd9a05b563dc0763 Mon Sep 17 00:00:00 2001 From: Jinshan Xiong Date: Tue, 6 Nov 2012 08:59:58 -0800 Subject: [PATCH] LU-2286 osc: unplug OSC queue at the end of truncate It was missed somehow. Otherwise, this extent would never be flushed until the next write to this file is coming. Even writepage() won't help out this case. Signed-off-by: Jinshan Xiong Change-Id: I179269163e5ad5382448036046925a5747282472 Reviewed-on: http://review.whamcloud.com/4477 Tested-by: Hudson Reviewed-by: Niu Yawei Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/osc/osc_cache.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lustre/osc/osc_cache.c b/lustre/osc/osc_cache.c index 519ed39..0470836 100644 --- a/lustre/osc/osc_cache.c +++ b/lustre/osc/osc_cache.c @@ -2389,7 +2389,7 @@ int osc_flush_async_page(const struct lu_env *env, struct cl_io *io, struct cl_page *cp = ops->ops_cl.cpl_page; pgoff_t index = cp->cp_index; struct osc_async_page *oap = &ops->ops_oap; - int unplug = 0; + bool unplug = false; int rc = 0; ENTRY; @@ -2437,7 +2437,7 @@ int osc_flush_async_page(const struct lu_env *env, struct cl_io *io, OSC_EXTENT_DUMP(D_CACHE, ext, "flush page %p make it urgent.\n", oap); cfs_list_add_tail(&ext->oe_link, &obj->oo_urgent_exts); - unplug = 1; + unplug = true; } rc = 0; EXIT; @@ -2698,6 +2698,8 @@ void osc_cache_truncate_end(const struct lu_env *env, struct osc_io *oio, oio->oi_trunc = NULL; if (ext != NULL) { + bool unplug = false; + EASSERT(ext->oe_nr_pages > 0, ext); EASSERT(ext->oe_state == OES_TRUNC, ext); EASSERT(!ext->oe_urgent, ext); @@ -2708,12 +2710,14 @@ void osc_cache_truncate_end(const struct lu_env *env, struct osc_io *oio, if (ext->oe_fsync_wait && !ext->oe_urgent) { ext->oe_urgent = 1; cfs_list_move_tail(&ext->oe_link, &obj->oo_urgent_exts); + unplug = true; } osc_update_pending(obj, OBD_BRW_WRITE, ext->oe_nr_pages); osc_object_unlock(obj); osc_extent_put(env, ext); - osc_list_maint(osc_cli(obj), obj); + if (unplug) + osc_io_unplug_async(env, osc_cli(obj), obj); } } @@ -2787,7 +2791,7 @@ int osc_cache_writeback_range(const struct lu_env *env, struct osc_object *obj, { struct osc_extent *ext; CFS_LIST_HEAD(discard_list); - int unplug = 0; + bool unplug = false; int result = 0; ENTRY; @@ -2817,7 +2821,7 @@ int osc_cache_writeback_range(const struct lu_env *env, struct osc_object *obj, } if (list != NULL) { cfs_list_move_tail(&ext->oe_link, list); - unplug = 1; + unplug = true; } } else { /* the only discarder is lock cancelling, so -- 1.8.3.1