From: Patrick Farrell Date: Fri, 4 Mar 2022 22:08:44 +0000 (-0500) Subject: LU-15619 osc: Remove oap lock X-Git-Tag: 2.15.53~118 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=b2274a716087fad24490f56026775886c26f74b8;p=fs%2Flustre-release.git LU-15619 osc: Remove oap lock The OAP lock is taken around setting the oap flags, but not any of the other fields in oap. As far as I can tell, this is just some cargo cult belief about locking - there's no reason for it. Remove it entirely. (From the code, a queued spin lock appears to be 12 bytes on x86_64.) Signed-off-by: Patrick Farrell Change-Id: Ib61190d52c08d88c95a0c19b8ef7d114e26cfae2 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/46719 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Reviewed-by: Zhenyu Xu --- diff --git a/lustre/include/lustre_osc.h b/lustre/include/lustre_osc.h index 8b574b8..38abb70 100644 --- a/lustre/include/lustre_osc.h +++ b/lustre/include/lustre_osc.h @@ -84,8 +84,6 @@ struct osc_async_page { struct ptlrpc_request *oap_request; struct osc_object *oap_obj; - - spinlock_t oap_lock; }; #define oap_page oap_brw_page.pg diff --git a/lustre/osc/osc_cache.c b/lustre/osc/osc_cache.c index fb9b003..20408c0 100644 --- a/lustre/osc/osc_cache.c +++ b/lustre/osc/osc_cache.c @@ -1095,9 +1095,7 @@ static int osc_extent_make_ready(const struct lu_env *env, rc = osc_make_ready(env, oap, OBD_BRW_WRITE); switch (rc) { case 0: - spin_lock(&oap->oap_lock); oap->oap_async_flags |= ASYNC_READY; - spin_unlock(&oap->oap_lock); break; case -EALREADY: LASSERT((oap->oap_async_flags & ASYNC_READY) != 0); @@ -1117,9 +1115,7 @@ static int osc_extent_make_ready(const struct lu_env *env, "last_oap_count %d\n", last_oap_count); LASSERT(last->oap_page_off + last_oap_count <= PAGE_SIZE); last->oap_count = last_oap_count; - spin_lock(&last->oap_lock); last->oap_async_flags |= ASYNC_COUNT_STABLE; - spin_unlock(&last->oap_lock); } /* for the rest of pages, we don't need to call osf_refresh_count() @@ -1127,9 +1123,7 @@ static int osc_extent_make_ready(const struct lu_env *env, list_for_each_entry(oap, &ext->oe_pages, oap_pending_item) { if (!(oap->oap_async_flags & ASYNC_COUNT_STABLE)) { oap->oap_count = PAGE_SIZE - oap->oap_page_off; - spin_lock(&oap->oap_lock); oap->oap_async_flags |= ASYNC_COUNT_STABLE; - spin_unlock(&oap->oap_lock); } } @@ -1794,9 +1788,7 @@ static void osc_ap_completion(const struct lu_env *env, struct client_obd *cli, } /* As the transfer for this page is being done, clear the flags */ - spin_lock(&oap->oap_lock); oap->oap_async_flags = 0; - spin_unlock(&oap->oap_lock); if (oap->oap_cmd & OBD_BRW_WRITE && xid > 0) { spin_lock(&cli->cl_loi_list_lock); @@ -2264,7 +2256,6 @@ int osc_prep_async_page(struct osc_object *osc, struct osc_page *ops, INIT_LIST_HEAD(&oap->oap_pending_item); INIT_LIST_HEAD(&oap->oap_rpc_item); - spin_lock_init(&oap->oap_lock); CDEBUG(D_INFO, "oap %p vmpage %p obj off %llu\n", oap, vmpage, oap->oap_obj_off); RETURN(0); @@ -2546,9 +2537,7 @@ int osc_flush_async_page(const struct lu_env *env, struct cl_io *io, if (rc) GOTO(out, rc); - spin_lock(&oap->oap_lock); oap->oap_async_flags |= ASYNC_READY|ASYNC_URGENT; - spin_unlock(&oap->oap_lock); if (current->flags & PF_MEMALLOC) ext->oe_memalloc = 1; diff --git a/lustre/osc/osc_io.c b/lustre/osc/osc_io.c index aea22bb..f06dec3 100644 --- a/lustre/osc/osc_io.c +++ b/lustre/osc/osc_io.c @@ -194,10 +194,7 @@ int osc_io_submit(const struct lu_env *env, const struct cl_io_slice *ios, } if (page->cp_type != CPT_TRANSIENT) { - spin_lock(&oap->oap_lock); - oap->oap_async_flags = ASYNC_URGENT|ASYNC_READY; - oap->oap_async_flags |= ASYNC_COUNT_STABLE; - spin_unlock(&oap->oap_lock); + oap->oap_async_flags = ASYNC_URGENT|ASYNC_READY|ASYNC_COUNT_STABLE; } osc_page_submit(env, opg, crt, brw_flags); diff --git a/lustre/osc/osc_page.c b/lustre/osc/osc_page.c index 857545d..06aff96 100644 --- a/lustre/osc/osc_page.c +++ b/lustre/osc/osc_page.c @@ -207,12 +207,7 @@ static void osc_page_clip(const struct lu_env *env, opg->ops_from = from; /* argument @to is exclusive, but @ops_to is inclusive */ opg->ops_to = to - 1; - /* This isn't really necessary for transient pages, but we also don't - * call clip on transient pages often, so it's OK. - */ - spin_lock(&oap->oap_lock); oap->oap_async_flags |= ASYNC_COUNT_STABLE; - spin_unlock(&oap->oap_lock); } static int osc_page_flush(const struct lu_env *env,