Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1367685

[PATCH v2 37/46] staging/lustre/llite: Remove ccc_global_{init,fini}()

From green@linuxhacker.ru
Newsgroups linux.kernel
Subject [PATCH v2 37/46] staging/lustre/llite: Remove ccc_global_{init,fini}()
Date 2016-03-31 02:00 +0200
Message-ID <riybM-4r2-25@gated-at.bofh.it> (permalink)
References <riy25-4mi-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: John Hammond <john.hammond@intel.com>

Merge their contents into vvp_global_{init,fini}() and
{init,exit}_lustre_lite().
Rename ccc_inode_fini_* to cl_inode_fini_*.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-on: http://review.whamcloud.com/13714
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5971
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
---
 drivers/staging/lustre/lustre/llite/lcommon_cl.c   | 53 +++++-----------------
 .../staging/lustre/lustre/llite/llite_internal.h   |  7 +--
 drivers/staging/lustre/lustre/llite/super25.c      | 14 +++++-
 drivers/staging/lustre/lustre/llite/vvp_dev.c      | 25 ++++++----
 drivers/staging/lustre/lustre/llite/vvp_internal.h |  4 +-
 5 files changed, 46 insertions(+), 57 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/lcommon_cl.c b/drivers/staging/lustre/lustre/llite/lcommon_cl.c
index 5b523e33..164737a 100644
--- a/drivers/staging/lustre/lustre/llite/lcommon_cl.c
+++ b/drivers/staging/lustre/lustre/llite/lcommon_cl.c
@@ -72,49 +72,18 @@
  */
 
 /**
- * An `emergency' environment used by ccc_inode_fini() when cl_env_get()
- * fails. Access to this environment is serialized by ccc_inode_fini_guard
+ * An `emergency' environment used by cl_inode_fini() when cl_env_get()
+ * fails. Access to this environment is serialized by cl_inode_fini_guard
  * mutex.
  */
-static struct lu_env *ccc_inode_fini_env;
+struct lu_env *cl_inode_fini_env;
+int cl_inode_fini_refcheck;
 
 /**
  * A mutex serializing calls to slp_inode_fini() under extreme memory
  * pressure, when environments cannot be allocated.
  */
-static DEFINE_MUTEX(ccc_inode_fini_guard);
-static int dummy_refcheck;
-
-int ccc_global_init(struct lu_device_type *device_type)
-{
-	int result;
-
-	result = lu_device_type_init(device_type);
-	if (result)
-		return result;
-
-	ccc_inode_fini_env = cl_env_alloc(&dummy_refcheck,
-					  LCT_REMEMBER | LCT_NOREF);
-	if (IS_ERR(ccc_inode_fini_env)) {
-		result = PTR_ERR(ccc_inode_fini_env);
-		goto out_device;
-	}
-
-	ccc_inode_fini_env->le_ctx.lc_cookie = 0x4;
-	return 0;
-out_device:
-	lu_device_type_fini(device_type);
-	return result;
-}
-
-void ccc_global_fini(struct lu_device_type *device_type)
-{
-	if (ccc_inode_fini_env) {
-		cl_env_put(ccc_inode_fini_env, &dummy_refcheck);
-		ccc_inode_fini_env = NULL;
-	}
-	lu_device_type_fini(device_type);
-}
+static DEFINE_MUTEX(cl_inode_fini_guard);
 
 int cl_setattr_ost(struct inode *inode, const struct iattr *attr)
 {
@@ -286,10 +255,10 @@ void cl_inode_fini(struct inode *inode)
 		env = cl_env_get(&refcheck);
 		emergency = IS_ERR(env);
 		if (emergency) {
-			mutex_lock(&ccc_inode_fini_guard);
-			LASSERT(ccc_inode_fini_env);
-			cl_env_implant(ccc_inode_fini_env, &refcheck);
-			env = ccc_inode_fini_env;
+			mutex_lock(&cl_inode_fini_guard);
+			LASSERT(cl_inode_fini_env);
+			cl_env_implant(cl_inode_fini_env, &refcheck);
+			env = cl_inode_fini_env;
 		}
 		/*
 		 * cl_object cache is a slave to inode cache (which, in turn
@@ -301,8 +270,8 @@ void cl_inode_fini(struct inode *inode)
 		cl_object_put_last(env, clob);
 		lli->lli_clob = NULL;
 		if (emergency) {
-			cl_env_unplant(ccc_inode_fini_env, &refcheck);
-			mutex_unlock(&ccc_inode_fini_guard);
+			cl_env_unplant(cl_inode_fini_env, &refcheck);
+			mutex_unlock(&cl_inode_fini_guard);
 		} else {
 			cl_env_put(env, &refcheck);
 		}
diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h
index a6ee2fe..993cee8 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -984,9 +984,6 @@ void free_rmtperm_hash(struct hlist_head *hash);
 int ll_update_remote_perm(struct inode *inode, struct mdt_remote_perm *perm);
 int lustre_check_remote_perm(struct inode *inode, int mask);
 
-/* llite/llite_cl.c */
-extern struct lu_device_type vvp_device_type;
-
 /**
  * Common IO arguments for various VFS I/O interfaces.
  */
@@ -1371,4 +1368,8 @@ void ll_xattr_fini(void);
 int ll_page_sync_io(const struct lu_env *env, struct cl_io *io,
 		    struct cl_page *page, enum cl_req_type crt);
 
+/* lcommon_cl.c */
+extern struct lu_env *cl_inode_fini_env;
+extern int cl_inode_fini_refcheck;
+
 #endif /* LLITE_INTERNAL_H */
diff --git a/drivers/staging/lustre/lustre/llite/super25.c b/drivers/staging/lustre/lustre/llite/super25.c
index 61856d3..415750b 100644
--- a/drivers/staging/lustre/lustre/llite/super25.c
+++ b/drivers/staging/lustre/lustre/llite/super25.c
@@ -164,9 +164,18 @@ static int __init lustre_init(void)
 	if (rc != 0)
 		goto out_sysfs;
 
+	cl_inode_fini_env = cl_env_alloc(&cl_inode_fini_refcheck,
+					 LCT_REMEMBER | LCT_NOREF);
+	if (IS_ERR(cl_inode_fini_env)) {
+		rc = PTR_ERR(cl_inode_fini_env);
+		goto out_vvp;
+	}
+
+	cl_inode_fini_env->le_ctx.lc_cookie = 0x4;
+
 	rc = ll_xattr_init();
 	if (rc != 0)
-		goto out_vvp;
+		goto out_inode_fini_env;
 
 	lustre_register_client_fill_super(ll_fill_super);
 	lustre_register_kill_super_cb(ll_kill_super);
@@ -174,6 +183,8 @@ static int __init lustre_init(void)
 
 	return 0;
 
+out_inode_fini_env:
+	cl_env_put(cl_inode_fini_env, &cl_inode_fini_refcheck);
 out_vvp:
 	vvp_global_fini();
 out_sysfs:
@@ -198,6 +209,7 @@ static void __exit lustre_exit(void)
 	kset_unregister(llite_kset);
 
 	ll_xattr_fini();
+	cl_env_put(cl_inode_fini_env, &cl_inode_fini_refcheck);
 	vvp_global_fini();
 
 	kmem_cache_destroy(ll_inode_cachep);
diff --git a/drivers/staging/lustre/lustre/llite/vvp_dev.c b/drivers/staging/lustre/lustre/llite/vvp_dev.c
index b33cd35..e35c1a1 100644
--- a/drivers/staging/lustre/lustre/llite/vvp_dev.c
+++ b/drivers/staging/lustre/lustre/llite/vvp_dev.c
@@ -293,20 +293,27 @@ struct lu_device_type vvp_device_type = {
  */
 int vvp_global_init(void)
 {
-	int result;
+	int rc;
 
-	result = lu_kmem_init(vvp_caches);
-	if (result == 0) {
-		result = ccc_global_init(&vvp_device_type);
-		if (result != 0)
-			lu_kmem_fini(vvp_caches);
-	}
-	return result;
+	rc = lu_kmem_init(vvp_caches);
+	if (rc != 0)
+		return rc;
+
+	rc = lu_device_type_init(&vvp_device_type);
+	if (rc != 0)
+		goto out_kmem;
+
+	return 0;
+
+out_kmem:
+	lu_kmem_fini(vvp_caches);
+
+	return rc;
 }
 
 void vvp_global_fini(void)
 {
-	ccc_global_fini(&vvp_device_type);
+	lu_device_type_fini(&vvp_device_type);
 	lu_kmem_fini(vvp_caches);
 }
 
diff --git a/drivers/staging/lustre/lustre/llite/vvp_internal.h b/drivers/staging/lustre/lustre/llite/vvp_internal.h
index 0e15202..fe29fb5 100644
--- a/drivers/staging/lustre/lustre/llite/vvp_internal.h
+++ b/drivers/staging/lustre/lustre/llite/vvp_internal.h
@@ -164,6 +164,8 @@ struct vvp_io {
 	bool		vui_ra_valid;
 };
 
+extern struct lu_device_type vvp_device_type;
+
 extern struct lu_context_key vvp_session_key;
 extern struct lu_context_key vvp_thread_key;
 
@@ -324,8 +326,6 @@ void ccc_key_fini(const struct lu_context *ctx,
 		  struct lu_context_key *key, void *data);
 
 void ccc_umount(const struct lu_env *env, struct cl_device *dev);
-int ccc_global_init(struct lu_device_type *device_type);
-void ccc_global_fini(struct lu_device_type *device_type);
 
 static inline struct lu_device *vvp2lu_dev(struct vvp_device *vdv)
 {
-- 
2.1.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 00/46] Lustre IO stack simplifications and cleanups green@linuxhacker.ru - 2016-03-31 01:50 +0200
  [PATCH v2 04/46] staging/lustre: Reintroduce global env list green@linuxhacker.ru - 2016-03-31 01:50 +0200
  [PATCH v2 06/46] staging/lustre/osc: to drop LRU pages with cl_lru_work green@linuxhacker.ru - 2016-03-31 01:50 +0200
  [PATCH v2 31/46] staging/lustre/llite: use vui prefix for struct vvp_io members green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 34/46] staging/lustre/llite: Rename struct ccc_grouplock to ll_grouplock green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 43/46] staging/lustre/ldlm: restore the ELC for enqueue green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 36/46] staging/lustre/llite: rename struct ccc_thread_info to vvp_thread_info green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 15/46] staging/lustre/obd: remove struct client_obd_lock green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 18/46] staging/lustre/clio: generalize cl_sync_io green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 14/46] staging/lustre/lmv: remove lmv_init_{lock,unlock}() green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 16/46] staging/lustre/llite: remove some cl wrappers green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 37/46] staging/lustre/llite: Remove ccc_global_{init,fini}() green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 33/46] staging/lustre/llite: rename ccc_req to vvp_req green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 27/46] staging/lustre/llite: rename ccc_page to vvp_page green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 29/46] staging/lustre:llite: remove struct ll_ra_read green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 21/46] staging/lustre/llite: clip page correctly for vvp_io_commit_sync green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 22/46] staging/lustre/llite: deadlock for page write green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 45/46] staging/lustre/ldlm: Solve a race for LRU lock cancel green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 30/46] staging/lustre/llite: merge ccc_io and vvp_io green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 10/46] staging/lustre/osc: add weight function for DLM lock green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 38/46] staging/lustre/llite: Move ll_dirent_type_get and make it static green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 35/46] staging/lustre/llite: Rename struct vvp_thread_info to ll_thread_info green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 23/46] staging/lustre/llite: make sure we do cl_page_clip on the last page green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 32/46] staging/lustre/llite: move vvp_io functions to vvp_io.c green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 17/46] staging/lustre: Remove struct ll_iattr green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 46/46] staging/lustre: lov_io_init() should return error code green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 25/46] staging/lustre/llite: rename ccc_device to vvp_device green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 08/46] staging/lustre/obdclass: Add a preallocated percpu cl_env green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 44/46] staging/lustre: Fix spacing style before open parenthesis green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 28/46] staging/lustre/llite: rename ccc_lock to vvp_lock green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 13/46] staging/lustre/llite: remove lli_lvb green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 41/46] staging/lustre/ldlm: ELC picks locks in a safer policy green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 40/46] staging/lustre/llite: Remove unused vui_local_lock field green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 12/46] staging/lustre/clio: optimize read ahead code green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 42/46] staging/lustre/ldlm: revert changes to ldlm_cancel_aged_policy() green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 39/46] staging/lustre/llite: Move several declarations to llite_internal.h green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 20/46] staging/lustre: update comments after cl_lock simplification green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 24/46] staging/lustre/llite: merge lclient.h into llite/vvp_internal.h green@linuxhacker.ru - 2016-03-31 02:00 +0200
  [PATCH v2 01/46] staging/lustre/obdclass: limit lu_site hash table size green@linuxhacker.ru - 2016-03-31 02:10 +0200
  [PATCH v2 02/46] staging/lustre: Get rid of CFS_PAGE_MASK green@linuxhacker.ru - 2016-03-31 02:10 +0200
  [PATCH v2 05/46] staging/lustre/osc: Adjustment on osc LRU for performance green@linuxhacker.ru - 2016-03-31 02:10 +0200

csiph-web