[PATCH] cifs: add list_to_page macro and use it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Suresh Jayaraman <sjayaraman@xxxxxxx>
---
 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++;
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux