Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH] cifs: add list_to_page macro and use it
@ 2011-06-14 16:09 Suresh Jayaraman
  0 siblings, 0 replies; only message in thread
From: Suresh Jayaraman @ 2011-06-14 16:09 UTC (permalink / raw)
  To: Steve French; +Cc: linux-cifs


Signed-off-by: Suresh Jayaraman <sjayaraman-l3A5Bk7waGM@public.gmane.org>
---
 fs/cifs/file.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index e960072..37f7e00 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -42,6 +42,8 @@
 #include "cifs_fs_sb.h"
 #include "fscache.h"
 
+#define list_to_page(head) (list_entry((head)->prev, struct page, lru))
+
 static inline int cifs_convert_flags(unsigned int flags)
 {
 	if ((flags & O_ACCMODE) == O_RDONLY)
@@ -1954,7 +1956,7 @@ static void cifs_copy_cache_pages(struct address_space *mapping,
 		if (list_empty(pages))
 			break;
 
-		page = list_entry(pages->prev, struct page, lru);
+		page = list_to_page(pages);
 		list_del(&page->lru);
 
 		if (add_to_page_cache_lru(page, mapping, page->index,
@@ -2043,13 +2045,13 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
 		if (list_empty(page_list))
 			break;
 
-		page = list_entry(page_list->prev, struct page, lru);
+		page = list_to_page(page_list);
 		offset = (loff_t)page->index << PAGE_CACHE_SHIFT;
 
 		/* count adjacent pages that we will read into */
 		contig_pages = 0;
 		expected_index =
-			list_entry(page_list->prev, struct page, lru)->index;
+			list_to_page(page_list)->index;
 		list_for_each_entry_reverse(tmp_page, page_list, lru) {
 			if (tmp_page->index == expected_index) {
 				contig_pages++;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-06-14 16:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-14 16:09 [PATCH] cifs: add list_to_page macro and use it Suresh Jayaraman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox