All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shivani Bhardwaj <shivanib134@gmail.com>
To: outreachy-kernel@googlegroups.com
Subject: [PATCH] Staging: lustre: tracefile: Remove wrapper function
Date: Mon, 2 Nov 2015 23:42:37 +0530	[thread overview]
Message-ID: <20151102181237.GA41744@ubuntu> (raw)

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

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

diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.c b/drivers/staging/lustre/lustre/libcfs/tracefile.c
index 973c7c2..907214a 100644
--- a/drivers/staging/lustre/lustre/libcfs/tracefile.c
+++ b/drivers/staging/lustre/lustre/libcfs/tracefile.c
@@ -59,12 +59,6 @@ static atomic_t cfs_tage_allocated = ATOMIC_INIT(0);
 static void put_pages_on_tcd_daemon_list(struct page_collection *pc,
 					 struct cfs_trace_cpu_data *tcd);
 
-static inline struct cfs_trace_page *
-cfs_tage_from_list(struct list_head *list)
-{
-	return list_entry(list, struct cfs_trace_page, linkage);
-}
-
 static struct cfs_trace_page *cfs_tage_alloc(gfp_t gfp)
 {
 	struct page	    *page;
@@ -142,14 +136,16 @@ cfs_trace_get_tage_try(struct cfs_trace_cpu_data *tcd, unsigned long len)
 
 	if (tcd->tcd_cur_pages > 0) {
 		__LASSERT(!list_empty(&tcd->tcd_pages));
-		tage = cfs_tage_from_list(tcd->tcd_pages.prev);
+		tage = list_entry(tcd->tcd_pages.prev,
+				  struct cfs_trace_page, linkage);
 		if (tage->used + len <= PAGE_CACHE_SIZE)
 			return tage;
 	}
 
 	if (tcd->tcd_cur_pages < tcd->tcd_max_pages) {
 		if (tcd->tcd_cur_stock_pages > 0) {
-			tage = cfs_tage_from_list(tcd->tcd_stock_pages.prev);
+			tage = list_entry(tcd->tcd_stock_pages.prev,
+					  struct cfs_trace_page, linkage);
 			--tcd->tcd_cur_stock_pages;
 			list_del_init(&tage->linkage);
 		} else {
@@ -233,7 +229,8 @@ static struct cfs_trace_page *cfs_trace_get_tage(struct cfs_trace_cpu_data *tcd,
 	if (thread_running)
 		cfs_tcd_shrink(tcd);
 	if (tcd->tcd_cur_pages > 0) {
-		tage = cfs_tage_from_list(tcd->tcd_pages.next);
+		tage = list_entry(tcd->tcd_pages.next,
+				  struct cfs_trace_page, linkage);
 		tage->used = 0;
 		cfs_tage_to_tail(tage, &tcd->tcd_pages);
 	}
@@ -607,7 +604,8 @@ static void put_pages_on_tcd_daemon_list(struct page_collection *pc,
 			struct cfs_trace_page *victim;
 
 			__LASSERT(!list_empty(&tcd->tcd_daemon_pages));
-			victim = cfs_tage_from_list(tcd->tcd_daemon_pages.next);
+			victim = list_entry(tcd->tcd_daemon_pages.next,
+					    struct cfs_trace_page, linkage);
 
 			__LASSERT_TAGE_INVARIANT(victim);
 
-- 
2.1.0



             reply	other threads:[~2015-11-02 18:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-02 18:12 Shivani Bhardwaj [this message]
2015-11-04 19:01 ` [Outreachy kernel] [PATCH] Staging: lustre: tracefile: Remove wrapper function Greg KH
2015-11-04 19:16   ` Shivani Bhardwaj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151102181237.GA41744@ubuntu \
    --to=shivanib134@gmail.com \
    --cc=outreachy-kernel@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.