From patchwork Tue Jun 14 16:09:26 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suresh Jayaraman X-Patchwork-Id: 879432 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p5EG9hO9010777 for ; Tue, 14 Jun 2011 16:09:43 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752457Ab1FNQJa (ORCPT ); Tue, 14 Jun 2011 12:09:30 -0400 Received: from cantor.suse.de ([195.135.220.2]:54541 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752398Ab1FNQJ2 (ORCPT ); Tue, 14 Jun 2011 12:09:28 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 3A7F48FEA2; Tue, 14 Jun 2011 18:09:27 +0200 (CEST) Message-ID: <4DF787B6.1090104@suse.de> Date: Tue, 14 Jun 2011 21:39:26 +0530 From: Suresh Jayaraman User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110414 SUSE/3.1.10 Thunderbird/3.1.10 MIME-Version: 1.0 To: Steve French Cc: linux-cifs Subject: [PATCH] cifs: add list_to_page macro and use it Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 14 Jun 2011 16:09:43 +0000 (UTC) Signed-off-by: Suresh Jayaraman --- fs/cifs/file.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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++;