From: Mel Gorman <mgorman@suse.de>
Date: Wed, 9 Mar 2011 19:36:49 +0000
Subject: [PATCH] nfs: Use page_file_offset during page writeback
Patch-mainline: Not yet
References: bnc#677738

nfs_wb_page could conceivably be called for a PageSwapCache page so play
it safe and use page_file_offset() to lookup the correct index.

Signed-off-by: Mel Gorman <mgorman@suse.de>
Reviewed-by: NeilBrown <neilb@suse.de>
Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
---
 fs/nfs/write.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Index: linux-2.6.37-openSUSE-11.4/fs/nfs/write.c
===================================================================
--- linux-2.6.37-openSUSE-11.4.orig/fs/nfs/write.c
+++ linux-2.6.37-openSUSE-11.4/fs/nfs/write.c
@@ -1520,7 +1520,7 @@ int nfs_wb_page_cancel(struct inode *ino
  */
 int nfs_wb_page(struct inode *inode, struct page *page)
 {
-	loff_t range_start = page_offset(page);
+	loff_t range_start = page_file_offset(page);
 	loff_t range_end = range_start + (loff_t)(PAGE_CACHE_SIZE - 1);
 	struct writeback_control wbc = {
 		.sync_mode = WB_SYNC_ALL,
