From patchwork Thu Feb 27 21:09:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11409817 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 887D714BC for ; Thu, 27 Feb 2020 21:23:09 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7163D246A0 for ; Thu, 27 Feb 2020 21:23:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7163D246A0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lustre-devel-bounces@lists.lustre.org Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id D89AA3489E0; Thu, 27 Feb 2020 13:21:21 -0800 (PST) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 362C721FB7B for ; Thu, 27 Feb 2020 13:18:55 -0800 (PST) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id B4E031053; Thu, 27 Feb 2020 16:18:14 -0500 (EST) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id B37A346F; Thu, 27 Feb 2020 16:18:14 -0500 (EST) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Thu, 27 Feb 2020 16:09:53 -0500 Message-Id: <1582838290-17243-126-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> References: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 125/622] lustre: osc: move obdo_cache to OSC code X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Andreas Dilger The obdo_cache slab is only used by the OSC code today, so it does not need to be allocated in obdclass on servers. Move it to only be allocated when the OSC module is loaded. Rename obdo_cachep to osc_obdo_kmem to match other slab caches created by the OSC. WC-bug-id: https://jira.whamcloud.com/browse/LU-10899 Lustre-commit: 48df66be72c9 ("LU-10899 osc: move obdo_cache to OSC code") Signed-off-by: Andreas Dilger Reviewed-on: https://review.whamcloud.com/33141 Reviewed-by: James Simmons Reviewed-by: Bobi Jam Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/include/lustre_osc.h | 1 + fs/lustre/include/obd_class.h | 3 --- fs/lustre/obdclass/genops.c | 10 ---------- fs/lustre/osc/osc_dev.c | 8 ++++++-- fs/lustre/osc/osc_request.c | 11 +++++------ 5 files changed, 12 insertions(+), 21 deletions(-) diff --git a/fs/lustre/include/lustre_osc.h b/fs/lustre/include/lustre_osc.h index dc8071a..dabcee0 100644 --- a/fs/lustre/include/lustre_osc.h +++ b/fs/lustre/include/lustre_osc.h @@ -557,6 +557,7 @@ struct osc_brw_async_args { extern struct kmem_cache *osc_session_kmem; extern struct kmem_cache *osc_extent_kmem; extern struct kmem_cache *osc_quota_kmem; +extern struct kmem_cache *osc_obdo_kmem; extern struct lu_context_key osc_key; extern struct lu_context_key osc_session_key; diff --git a/fs/lustre/include/obd_class.h b/fs/lustre/include/obd_class.h index a3ef5d5..01eb385 100644 --- a/fs/lustre/include/obd_class.h +++ b/fs/lustre/include/obd_class.h @@ -1651,9 +1651,6 @@ static inline int md_unpackmd(struct obd_export *exp, int obd_init_caches(void); void obd_cleanup_caches(void); -/* support routines */ -extern struct kmem_cache *obdo_cachep; - typedef int (*register_lwp_cb)(void *data); struct lwp_register_item { diff --git a/fs/lustre/obdclass/genops.c b/fs/lustre/obdclass/genops.c index a122332..e5e2f73 100644 --- a/fs/lustre/obdclass/genops.c +++ b/fs/lustre/obdclass/genops.c @@ -46,8 +46,6 @@ static struct obd_device *obd_devs[MAX_OBD_DEVICES]; static struct kmem_cache *obd_device_cachep; -struct kmem_cache *obdo_cachep; -EXPORT_SYMBOL(obdo_cachep); static struct kobj_type class_ktype; static struct workqueue_struct *zombie_wq; @@ -645,8 +643,6 @@ void obd_cleanup_caches(void) { kmem_cache_destroy(obd_device_cachep); obd_device_cachep = NULL; - kmem_cache_destroy(obdo_cachep); - obdo_cachep = NULL; } int obd_init_caches(void) @@ -658,12 +654,6 @@ int obd_init_caches(void) if (!obd_device_cachep) goto out; - LASSERT(!obdo_cachep); - obdo_cachep = kmem_cache_create("ll_obdo_cache", sizeof(struct obdo), - 0, 0, NULL); - if (!obdo_cachep) - goto out; - return 0; out: obd_cleanup_caches(); diff --git a/fs/lustre/osc/osc_dev.c b/fs/lustre/osc/osc_dev.c index 3d0687a..b8bf75a 100644 --- a/fs/lustre/osc/osc_dev.c +++ b/fs/lustre/osc/osc_dev.c @@ -55,9 +55,8 @@ struct kmem_cache *osc_thread_kmem; struct kmem_cache *osc_session_kmem; struct kmem_cache *osc_extent_kmem; -EXPORT_SYMBOL(osc_extent_kmem); struct kmem_cache *osc_quota_kmem; -EXPORT_SYMBOL(osc_quota_kmem); +struct kmem_cache *osc_obdo_kmem; struct lu_kmem_descr osc_caches[] = { { @@ -91,6 +90,11 @@ struct lu_kmem_descr osc_caches[] = { .ckd_size = sizeof(struct osc_quota_info) }, { + .ckd_cache = &osc_obdo_kmem, + .ckd_name = "osc_obdo_kmem", + .ckd_size = sizeof(struct obdo) + }, + { .ckd_cache = NULL } }; diff --git a/fs/lustre/osc/osc_request.c b/fs/lustre/osc/osc_request.c index 2784e1e..e968360 100644 --- a/fs/lustre/osc/osc_request.c +++ b/fs/lustre/osc/osc_request.c @@ -749,7 +749,7 @@ static int osc_shrink_grant_interpret(const struct lu_env *env, LASSERT(body); osc_update_grant(cli, body); out: - kmem_cache_free(obdo_cachep, oa); + kmem_cache_free(osc_obdo_kmem, oa); return rc; } @@ -2115,7 +2115,7 @@ static int brw_interpret(const struct lu_env *env, cl_object_attr_update(env, obj, attr, valid); cl_object_attr_unlock(obj); } - kmem_cache_free(obdo_cachep, aa->aa_oa); + kmem_cache_free(osc_obdo_kmem, aa->aa_oa); if (lustre_msg_get_opc(req->rq_reqmsg) == OST_WRITE && rc == 0) osc_inc_unstable_pages(req); @@ -2223,7 +2223,7 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, goto out; } - oa = kmem_cache_zalloc(obdo_cachep, GFP_NOFS); + oa = kmem_cache_zalloc(osc_obdo_kmem, GFP_NOFS); if (!oa) { rc = -ENOMEM; goto out; @@ -2349,8 +2349,7 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, if (rc != 0) { LASSERT(!req); - if (oa) - kmem_cache_free(obdo_cachep, oa); + kmem_cache_free(osc_obdo_kmem, oa); kfree(pga); /* this should happen rarely and is pretty bad, it makes the * pending list not follow the dirty order @@ -2960,7 +2959,7 @@ int osc_set_info_async(const struct lu_env *env, struct obd_export *exp, struct obdo *oa; aa = ptlrpc_req_async_args(aa, req); - oa = kmem_cache_zalloc(obdo_cachep, GFP_NOFS); + oa = kmem_cache_zalloc(osc_obdo_kmem, GFP_NOFS); if (!oa) { ptlrpc_req_finished(req); return -ENOMEM;