All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: lustre: tracefile: Remove wrapper function
@ 2015-11-02 18:12 Shivani Bhardwaj
  2015-11-04 19:01 ` [Outreachy kernel] " Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Shivani Bhardwaj @ 2015-11-02 18:12 UTC (permalink / raw)
  To: outreachy-kernel

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



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

* Re: [Outreachy kernel] [PATCH] Staging: lustre: tracefile: Remove wrapper function
  2015-11-02 18:12 [PATCH] Staging: lustre: tracefile: Remove wrapper function Shivani Bhardwaj
@ 2015-11-04 19:01 ` Greg KH
  2015-11-04 19:16   ` Shivani Bhardwaj
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2015-11-04 19:01 UTC (permalink / raw)
  To: Shivani Bhardwaj; +Cc: outreachy-kernel

On Mon, Nov 02, 2015 at 11:42:37PM +0530, Shivani Bhardwaj wrote:
> 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);
> -}

No, this is a "good" function to keep around, it makes it easier to
understand what is going on, and easier to remember how to call it
instead of having to look up the list_entry() logic each time.

So please keep this one.

thanks,

greg k-h


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

* Re: [Outreachy kernel] [PATCH] Staging: lustre: tracefile: Remove wrapper function
  2015-11-04 19:01 ` [Outreachy kernel] " Greg KH
@ 2015-11-04 19:16   ` Shivani Bhardwaj
  0 siblings, 0 replies; 3+ messages in thread
From: Shivani Bhardwaj @ 2015-11-04 19:16 UTC (permalink / raw)
  To: Greg KH; +Cc: outreachy-kernel

On Thu, Nov 5, 2015 at 12:31 AM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Mon, Nov 02, 2015 at 11:42:37PM +0530, Shivani Bhardwaj wrote:
>> 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);
>> -}
>
> No, this is a "good" function to keep around, it makes it easier to
> understand what is going on, and easier to remember how to call it
> instead of having to look up the list_entry() logic each time.
>
> So please keep this one.
>

Alright.
Thank you

> thanks,
>
> greg k-h


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

end of thread, other threads:[~2015-11-04 19:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-02 18:12 [PATCH] Staging: lustre: tracefile: Remove wrapper function Shivani Bhardwaj
2015-11-04 19:01 ` [Outreachy kernel] " Greg KH
2015-11-04 19:16   ` Shivani Bhardwaj

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.