Staging: lustre: tracefile: Remove wrapper function
PATCH 1/1 Staging: lustre: tracefile: Remove wrapper function
Remove the function cfs_tage_from_list() and replace all its calls with the function it wrapped.
--- drivers/staging/lustre/lustre/libcfs/tracefile.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
drivers/staging/lustre/lustre/libcfs/tracefile.c +8 -10
@@ -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);
Signature · 1 line
2.1.0
Greg KH
maintainerQuoted 13 lines · Shivani Bhardwaj
Remove the function
cfs_tage_from_list()and replace all its calls with the function it wrapped.Signed-off-by Shivani Bhardwaj <[email protected]>--- drivers/staging/lustre/lustre/libcfs/tracefile.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)drivers/staging/lustre/lustre/libcfs/tracefile.c +0
-0
drivers/staging/lustre/lustre/libcfs/tracefile.c static atomic_t cfs_tage_allocated = ATOMIC_INIT(0); · line 66
Quoted 8 lines
drivers/staging/lustre/lustre/libcfs/tracefile.c +0
-5@@ -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
Quoted 27 lines · Greg KH
Quoted 13 lines · Shivani Bhardwaj
Remove the function
cfs_tage_from_list()and replace all its calls with the function it wrapped.Signed-off-by Shivani Bhardwaj <[email protected]>--- drivers/staging/lustre/lustre/libcfs/tracefile.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)drivers/staging/lustre/lustre/libcfs/tracefile.c +0
-0drivers/staging/lustre/lustre/libcfs/tracefile.c static atomic_t cfs_tage_allocated = ATOMIC_INIT(0); · line 66
Quoted 8 lines
drivers/staging/lustre/lustre/libcfs/tracefile.c +0
-5@@ -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.
Quoted 2 lines
So please keep this one.
Alright.
Thank you
Quoted 3 lines
thanks,
greg k-h