cifs: add list_to_page macro and use it
Subsystems (2)
PATCH 1/1 cifs: add list_to_page macro and use it
Signed-off-by Suresh Jayaraman <[email protected]>
--- fs/cifs/file.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)
fs/cifs/file.c +5 -3
@@ -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++;