linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] Remove wrappers from statahead
@ 2015-11-07  9:49 Shivani Bhardwaj
  2015-11-07  9:50 ` [PATCH 1/5] Staging: lustre: statahead: Remove ll_sa_entry_unhashed wrapper Shivani Bhardwaj
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Shivani Bhardwaj @ 2015-11-07  9:49 UTC (permalink / raw)
  To: gregkh; +Cc: oleg.drokin, andreas.dilger, devel, linux-kernel

This patchset removes unnecessary wrapper functions as the purpose of
clarifying the job of function is still served by the arguments in wrapped
functions. Hence, all the calls to wrapper functions are replaced by the
standard function they wrapped.
After applying this patch, code becomes cleaner.

Shivani Bhardwaj (5):
  Staging: lustre: statahead: Remove ll_sa_entry_unhashed wrapper
  Staging: lustre: statahead: Remove sa_first_received_entry wrapper
  Staging: lustre: statahead: Remove agl_first_entry wrapper
  Staging: lustre: statahead: Remove sa_received_empty wrapper
  Staging: lustre: statahead: Remove agl_list_empty wrapper

 drivers/staging/lustre/lustre/llite/statahead.c | 76 ++++++++++---------------
 1 file changed, 31 insertions(+), 45 deletions(-)

-- 
2.1.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/5] Staging: lustre: statahead: Remove ll_sa_entry_unhashed wrapper
  2015-11-07  9:49 [PATCH 0/5] Remove wrappers from statahead Shivani Bhardwaj
@ 2015-11-07  9:50 ` Shivani Bhardwaj
  2015-11-07  9:50 ` [PATCH 2/5] Staging: lustre: statahead: Remove sa_first_received_entry wrapper Shivani Bhardwaj
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Shivani Bhardwaj @ 2015-11-07  9:50 UTC (permalink / raw)
  To: gregkh; +Cc: oleg.drokin, andreas.dilger, devel, linux-kernel

Remove the function ll_sa_entry_unhashed() and replace all its calls
with the function list_empty() that it wrapped.

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
---
 drivers/staging/lustre/lustre/llite/statahead.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c
index 18f5f2b..8085557 100644
--- a/drivers/staging/lustre/lustre/llite/statahead.c
+++ b/drivers/staging/lustre/lustre/llite/statahead.c
@@ -87,11 +87,6 @@ struct ll_sa_entry {
 static unsigned int sai_generation;
 static DEFINE_SPINLOCK(sai_generation_lock);
 
-static inline int ll_sa_entry_unhashed(struct ll_sa_entry *entry)
-{
-	return list_empty(&entry->se_hash);
-}
-
 /*
  * The entry only can be released by the caller, it is necessary to hold lock.
  */
@@ -331,7 +326,7 @@ static void ll_sa_entry_put(struct ll_statahead_info *sai,
 
 		LASSERT(list_empty(&entry->se_link));
 		LASSERT(list_empty(&entry->se_list));
-		LASSERT(ll_sa_entry_unhashed(entry));
+		LASSERT(list_empty(&entry->se_hash));
 
 		ll_sa_entry_cleanup(sai, entry);
 		iput(entry->se_inode);
@@ -346,7 +341,7 @@ do_sa_entry_fini(struct ll_statahead_info *sai, struct ll_sa_entry *entry)
 {
 	struct ll_inode_info *lli = ll_i2info(sai->sai_inode);
 
-	LASSERT(!ll_sa_entry_unhashed(entry));
+	LASSERT(!list_empty(&entry->se_hash));
 	LASSERT(!list_empty(&entry->se_link));
 
 	ll_sa_entry_unhash(sai, entry);
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/5] Staging: lustre: statahead: Remove sa_first_received_entry wrapper
  2015-11-07  9:49 [PATCH 0/5] Remove wrappers from statahead Shivani Bhardwaj
  2015-11-07  9:50 ` [PATCH 1/5] Staging: lustre: statahead: Remove ll_sa_entry_unhashed wrapper Shivani Bhardwaj
@ 2015-11-07  9:50 ` Shivani Bhardwaj
  2015-11-07  9:51 ` [PATCH 3/5] Staging: lustre: statahead: Remove agl_first_entry wrapper Shivani Bhardwaj
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Shivani Bhardwaj @ 2015-11-07  9:50 UTC (permalink / raw)
  To: gregkh; +Cc: oleg.drokin, andreas.dilger, devel, linux-kernel

Remove the function sa_first_received_entry() and replace all its calls
with the function list_entry() that it wraps.

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
---
 drivers/staging/lustre/lustre/llite/statahead.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c
index 8085557..d80ca93 100644
--- a/drivers/staging/lustre/lustre/llite/statahead.c
+++ b/drivers/staging/lustre/lustre/llite/statahead.c
@@ -133,13 +133,6 @@ static inline int agl_should_run(struct ll_statahead_info *sai,
 	return (inode != NULL && S_ISREG(inode->i_mode) && sai->sai_agl_valid);
 }
 
-static inline struct ll_sa_entry *
-sa_first_received_entry(struct ll_statahead_info *sai)
-{
-	return list_entry(sai->sai_entries_received.next,
-			      struct ll_sa_entry, se_list);
-}
-
 static inline struct ll_inode_info *
 agl_first_entry(struct ll_statahead_info *sai)
 {
@@ -620,7 +613,8 @@ static void ll_post_statahead(struct ll_statahead_info *sai)
 		spin_unlock(&lli->lli_sa_lock);
 		return;
 	}
-	entry = sa_first_received_entry(sai);
+	entry = list_entry(sai->sai_entries_received.next,
+			   struct ll_sa_entry, se_list);
 	atomic_inc(&entry->se_refcount);
 	list_del_init(&entry->se_list);
 	spin_unlock(&lli->lli_sa_lock);
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/5] Staging: lustre: statahead: Remove agl_first_entry wrapper
  2015-11-07  9:49 [PATCH 0/5] Remove wrappers from statahead Shivani Bhardwaj
  2015-11-07  9:50 ` [PATCH 1/5] Staging: lustre: statahead: Remove ll_sa_entry_unhashed wrapper Shivani Bhardwaj
  2015-11-07  9:50 ` [PATCH 2/5] Staging: lustre: statahead: Remove sa_first_received_entry wrapper Shivani Bhardwaj
@ 2015-11-07  9:51 ` Shivani Bhardwaj
  2015-11-07  9:52 ` [PATCH 4/5] Staging: lustre: statahead: Remove sa_received_empty wrapper Shivani Bhardwaj
  2015-11-07  9:53 ` [PATCH 5/5] Staging: lustre: statahead: Remove agl_list_empty wrapper Shivani Bhardwaj
  4 siblings, 0 replies; 6+ messages in thread
From: Shivani Bhardwaj @ 2015-11-07  9:51 UTC (permalink / raw)
  To: gregkh; +Cc: oleg.drokin, andreas.dilger, devel, linux-kernel

Remove the wrapper function agl_first_entry() and replace its calls with
the function list_entry() that it wraps.

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
---
 drivers/staging/lustre/lustre/llite/statahead.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c
index d80ca93..fbc34af 100644
--- a/drivers/staging/lustre/lustre/llite/statahead.c
+++ b/drivers/staging/lustre/lustre/llite/statahead.c
@@ -133,13 +133,6 @@ static inline int agl_should_run(struct ll_statahead_info *sai,
 	return (inode != NULL && S_ISREG(inode->i_mode) && sai->sai_agl_valid);
 }
 
-static inline struct ll_inode_info *
-agl_first_entry(struct ll_statahead_info *sai)
-{
-	return list_entry(sai->sai_entries_agl.next,
-			      struct ll_inode_info, lli_agl_list);
-}
-
 static inline int sa_sent_full(struct ll_statahead_info *sai)
 {
 	return atomic_read(&sai->sai_cache_count) >= sai->sai_max;
@@ -973,7 +966,8 @@ static int ll_agl_thread(void *arg)
 		/* The statahead thread maybe help to process AGL entries,
 		 * so check whether list empty again. */
 		if (!agl_list_empty(sai)) {
-			clli = agl_first_entry(sai);
+			clli = list_entry(sai->sai_entries_agl.next,
+					  struct ll_inode_info, lli_agl_list);
 			list_del_init(&clli->lli_agl_list);
 			spin_unlock(&plli->lli_agl_lock);
 			ll_agl_trigger(&clli->lli_vfs_inode, sai);
@@ -985,7 +979,8 @@ static int ll_agl_thread(void *arg)
 	spin_lock(&plli->lli_agl_lock);
 	sai->sai_agl_valid = 0;
 	while (!agl_list_empty(sai)) {
-		clli = agl_first_entry(sai);
+		clli = list_entry(sai->sai_entries_agl.next,
+				  struct ll_inode_info, lli_agl_list);
 		list_del_init(&clli->lli_agl_list);
 		spin_unlock(&plli->lli_agl_lock);
 		clli->lli_agl_index = 0;
@@ -1146,7 +1141,8 @@ interpret_it:
 			if (sa_sent_full(sai)) {
 				spin_lock(&plli->lli_agl_lock);
 				while (!agl_list_empty(sai)) {
-					clli = agl_first_entry(sai);
+					clli = list_entry(sai->sai_entries_agl.next,
+							  struct ll_inode_info, lli_agl_list);
 					list_del_init(&clli->lli_agl_list);
 					spin_unlock(&plli->lli_agl_lock);
 					ll_agl_trigger(&clli->lli_vfs_inode,
@@ -1204,7 +1200,8 @@ do_it:
 			spin_lock(&plli->lli_agl_lock);
 			while (!agl_list_empty(sai) &&
 			       thread_is_running(thread)) {
-				clli = agl_first_entry(sai);
+				clli = list_entry(sai->sai_entries_agl.next,
+						  struct ll_inode_info, lli_agl_list);
 				list_del_init(&clli->lli_agl_list);
 				spin_unlock(&plli->lli_agl_lock);
 				ll_agl_trigger(&clli->lli_vfs_inode, sai);
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/5] Staging: lustre: statahead: Remove sa_received_empty wrapper
  2015-11-07  9:49 [PATCH 0/5] Remove wrappers from statahead Shivani Bhardwaj
                   ` (2 preceding siblings ...)
  2015-11-07  9:51 ` [PATCH 3/5] Staging: lustre: statahead: Remove agl_first_entry wrapper Shivani Bhardwaj
@ 2015-11-07  9:52 ` Shivani Bhardwaj
  2015-11-07  9:53 ` [PATCH 5/5] Staging: lustre: statahead: Remove agl_list_empty wrapper Shivani Bhardwaj
  4 siblings, 0 replies; 6+ messages in thread
From: Shivani Bhardwaj @ 2015-11-07  9:52 UTC (permalink / raw)
  To: gregkh; +Cc: oleg.drokin, andreas.dilger, devel, linux-kernel

Remove the wrapper sa_received_empty() and replace its calls with the
function it wrapped.

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
---
 drivers/staging/lustre/lustre/llite/statahead.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c
index fbc34af..3a1d294 100644
--- a/drivers/staging/lustre/lustre/llite/statahead.c
+++ b/drivers/staging/lustre/lustre/llite/statahead.c
@@ -518,7 +518,7 @@ static void ll_sai_put(struct ll_statahead_info *sai)
 			do_sa_entry_fini(sai, entry);
 
 		LASSERT(list_empty(&sai->sai_entries));
-		LASSERT(sa_received_empty(sai));
+		LASSERT(list_empty(&sai->sai_entries_received));
 		LASSERT(list_empty(&sai->sai_entries_stated));
 
 		LASSERT(atomic_read(&sai->sai_cache_count) == 0);
@@ -602,7 +602,7 @@ static void ll_post_statahead(struct ll_statahead_info *sai)
 	int		     rc    = 0;
 
 	spin_lock(&lli->lli_sa_lock);
-	if (unlikely(sa_received_empty(sai))) {
+	if (unlikely(list_empty(&sai->sai_entries_received))) {
 		spin_unlock(&lli->lli_sa_lock);
 		return;
 	}
@@ -738,7 +738,7 @@ static int ll_statahead_interpret(struct ptlrpc_request *req,
 			 * for readpage and other tries to enqueue lock on child
 			 * with parent's lock held, for example: unlink. */
 			entry->se_handle = handle;
-			wakeup = sa_received_empty(sai);
+			wakeup = list_empty(&sai->sai_entries_received);
 			list_add_tail(&entry->se_list,
 					  &sai->sai_entries_received);
 		}
@@ -1120,13 +1120,13 @@ static int ll_statahead_thread(void *arg)
 keep_it:
 			l_wait_event(thread->t_ctl_waitq,
 				     !sa_sent_full(sai) ||
-				     !sa_received_empty(sai) ||
+				     !list_empty(&sai->sai_entries_received) ||
 				     !agl_list_empty(sai) ||
 				     !thread_is_running(thread),
 				     &lwi);
 
 interpret_it:
-			while (!sa_received_empty(sai))
+			while (!list_empty(&sai->sai_entries_received))
 				ll_post_statahead(sai);
 
 			if (unlikely(!thread_is_running(thread))) {
@@ -1148,7 +1148,7 @@ interpret_it:
 					ll_agl_trigger(&clli->lli_vfs_inode,
 						       sai);
 
-					if (!sa_received_empty(sai))
+					if (!list_empty(&sai->sai_entries_received))
 						goto interpret_it;
 
 					if (unlikely(
@@ -1179,12 +1179,12 @@ do_it:
 			ll_release_page(page, 0);
 			while (1) {
 				l_wait_event(thread->t_ctl_waitq,
-					     !sa_received_empty(sai) ||
+					     !list_empty(&sai->sai_entries_received) ||
 					     sai->sai_sent == sai->sai_replied ||
 					     !thread_is_running(thread),
 					     &lwi);
 
-				while (!sa_received_empty(sai))
+				while (!list_empty(&sai->sai_entries_received))
 					ll_post_statahead(sai);
 
 				if (unlikely(!thread_is_running(thread))) {
@@ -1193,7 +1193,7 @@ do_it:
 				}
 
 				if (sai->sai_sent == sai->sai_replied &&
-				    sa_received_empty(sai))
+				    list_empty(&sai->sai_entries_received))
 					break;
 			}
 
@@ -1246,12 +1246,12 @@ out:
 	}
 	ll_dir_chain_fini(&chain);
 	spin_lock(&plli->lli_sa_lock);
-	if (!sa_received_empty(sai)) {
+	if (!list_empty(&sai->sai_entries_received)) {
 		thread_set_flags(thread, SVC_STOPPING);
 		spin_unlock(&plli->lli_sa_lock);
 
 		/* To release the resources held by received entries. */
-		while (!sa_received_empty(sai))
+		while (!list_empty(&sai->sai_entries_received))
 			ll_post_statahead(sai);
 
 		spin_lock(&plli->lli_sa_lock);
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 5/5] Staging: lustre: statahead: Remove agl_list_empty wrapper
  2015-11-07  9:49 [PATCH 0/5] Remove wrappers from statahead Shivani Bhardwaj
                   ` (3 preceding siblings ...)
  2015-11-07  9:52 ` [PATCH 4/5] Staging: lustre: statahead: Remove sa_received_empty wrapper Shivani Bhardwaj
@ 2015-11-07  9:53 ` Shivani Bhardwaj
  4 siblings, 0 replies; 6+ messages in thread
From: Shivani Bhardwaj @ 2015-11-07  9:53 UTC (permalink / raw)
  To: gregkh; +Cc: oleg.drokin, andreas.dilger, devel, linux-kernel

Remove the function agl_list_empty() and replace its calls with the
function it wrapped.

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
---
 drivers/staging/lustre/lustre/llite/statahead.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c
index 3a1d294..caee0a6 100644
--- a/drivers/staging/lustre/lustre/llite/statahead.c
+++ b/drivers/staging/lustre/lustre/llite/statahead.c
@@ -428,7 +428,7 @@ static void ll_agl_add(struct ll_statahead_info *sai,
 
 		igrab(inode);
 		spin_lock(&parent->lli_agl_lock);
-		if (agl_list_empty(sai))
+		if (list_empty(&sai->sai_entries_agl))
 			added = 1;
 		list_add_tail(&child->lli_agl_list, &sai->sai_entries_agl);
 		spin_unlock(&parent->lli_agl_lock);
@@ -522,7 +522,7 @@ static void ll_sai_put(struct ll_statahead_info *sai)
 		LASSERT(list_empty(&sai->sai_entries_stated));
 
 		LASSERT(atomic_read(&sai->sai_cache_count) == 0);
-		LASSERT(agl_list_empty(sai));
+		LASSERT(list_empty(&sai->sai_entries_agl));
 
 		iput(inode);
 		kfree(sai);
@@ -955,7 +955,7 @@ static int ll_agl_thread(void *arg)
 
 	while (1) {
 		l_wait_event(thread->t_ctl_waitq,
-			     !agl_list_empty(sai) ||
+			     !list_empty(&sai->sai_entries_agl) ||
 			     !thread_is_running(thread),
 			     &lwi);
 
@@ -965,7 +965,7 @@ static int ll_agl_thread(void *arg)
 		spin_lock(&plli->lli_agl_lock);
 		/* The statahead thread maybe help to process AGL entries,
 		 * so check whether list empty again. */
-		if (!agl_list_empty(sai)) {
+		if (!list_empty(&sai->sai_entries_agl)) {
 			clli = list_entry(sai->sai_entries_agl.next,
 					  struct ll_inode_info, lli_agl_list);
 			list_del_init(&clli->lli_agl_list);
@@ -978,7 +978,7 @@ static int ll_agl_thread(void *arg)
 
 	spin_lock(&plli->lli_agl_lock);
 	sai->sai_agl_valid = 0;
-	while (!agl_list_empty(sai)) {
+	while (!list_empty(&sai->sai_entries_agl)) {
 		clli = list_entry(sai->sai_entries_agl.next,
 				  struct ll_inode_info, lli_agl_list);
 		list_del_init(&clli->lli_agl_list);
@@ -1121,7 +1121,7 @@ keep_it:
 			l_wait_event(thread->t_ctl_waitq,
 				     !sa_sent_full(sai) ||
 				     !list_empty(&sai->sai_entries_received) ||
-				     !agl_list_empty(sai) ||
+				     !list_empty(&sai->sai_entries_agl) ||
 				     !thread_is_running(thread),
 				     &lwi);
 
@@ -1140,7 +1140,7 @@ interpret_it:
 			 * to process the AGL entries. */
 			if (sa_sent_full(sai)) {
 				spin_lock(&plli->lli_agl_lock);
-				while (!agl_list_empty(sai)) {
+				while (!list_empty(&sai->sai_entries_agl)) {
 					clli = list_entry(sai->sai_entries_agl.next,
 							  struct ll_inode_info, lli_agl_list);
 					list_del_init(&clli->lli_agl_list);
@@ -1198,7 +1198,7 @@ do_it:
 			}
 
 			spin_lock(&plli->lli_agl_lock);
-			while (!agl_list_empty(sai) &&
+			while (!list_empty(&sai->sai_entries_agl) &&
 			       thread_is_running(thread)) {
 				clli = list_entry(sai->sai_entries_agl.next,
 						  struct ll_inode_info, lli_agl_list);
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-11-07  9:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-07  9:49 [PATCH 0/5] Remove wrappers from statahead Shivani Bhardwaj
2015-11-07  9:50 ` [PATCH 1/5] Staging: lustre: statahead: Remove ll_sa_entry_unhashed wrapper Shivani Bhardwaj
2015-11-07  9:50 ` [PATCH 2/5] Staging: lustre: statahead: Remove sa_first_received_entry wrapper Shivani Bhardwaj
2015-11-07  9:51 ` [PATCH 3/5] Staging: lustre: statahead: Remove agl_first_entry wrapper Shivani Bhardwaj
2015-11-07  9:52 ` [PATCH 4/5] Staging: lustre: statahead: Remove sa_received_empty wrapper Shivani Bhardwaj
2015-11-07  9:53 ` [PATCH 5/5] Staging: lustre: statahead: Remove agl_list_empty wrapper Shivani Bhardwaj

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).