linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: trond.myklebust@fys.uio.no, LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	"nickpiggin@yahoo.com.au" <nickpiggin@yahoo.com.au>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: [PATCH] add page->mapping handling interface [26/35] changes in NFS
Date: Mon, 10 Sep 2007 19:21:53 +0900	[thread overview]
Message-ID: <20070910192153.4d684408.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <20070910184048.286dfc6e.kamezawa.hiroyu@jp.fujitsu.com>

Changes page->mapping handling in NFS

Singed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

---
 fs/nfs/file.c     |   11 ++++++-----
 fs/nfs/internal.h |    2 +-
 fs/nfs/pagelist.c |    2 +-
 fs/nfs/read.c     |    4 ++--
 fs/nfs/write.c    |   35 ++++++++++++++++++-----------------
 5 files changed, 28 insertions(+), 26 deletions(-)

Index: test-2.6.23-rc4-mm1/fs/nfs/file.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/nfs/file.c
+++ test-2.6.23-rc4-mm1/fs/nfs/file.c
@@ -357,7 +357,7 @@ static void nfs_invalidate_page(struct p
 	if (offset != 0)
 		return;
 	/* Cancel any unstarted writes on this page */
-	nfs_wb_page_cancel(page->mapping->host, page);
+	nfs_wb_page_cancel(page_inode(page), page);
 }
 
 static int nfs_release_page(struct page *page, gfp_t gfp)
@@ -368,7 +368,7 @@ static int nfs_release_page(struct page 
 
 static int nfs_launder_page(struct page *page)
 {
-	return nfs_wb_page(page->mapping->host, page);
+	return nfs_wb_page(page_inode(page), page);
 }
 
 const struct address_space_operations nfs_file_aops = {
@@ -395,16 +395,17 @@ static int nfs_vm_page_mkwrite(struct vm
 	void *fsdata;
 
 	lock_page(page);
-	if (page->mapping != vma->vm_file->f_path.dentry->d_inode->i_mapping)
+	if (!pagecache_consistent(page,
+			vma->vm_file->f_path.dentry->d_inode->i_mapping))
 		goto out_unlock;
 	pagelen = nfs_page_length(page);
 	if (pagelen == 0)
 		goto out_unlock;
-	ret = nfs_write_begin(filp, page->mapping,
+	ret = nfs_write_begin(filp, page_mapping_cache(page),
 				(loff_t)page->index << PAGE_CACHE_SHIFT,
 				pagelen, 0, &page, &fsdata);
 	if (!ret)
-		ret = nfs_write_end(filp, page->mapping,
+		ret = nfs_write_end(filp, page_mapping_cache(page),
 				(loff_t)page->index << PAGE_CACHE_SHIFT,
 				pagelen, pagelen, page, fsdata);
 out_unlock:
Index: test-2.6.23-rc4-mm1/fs/nfs/internal.h
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/nfs/internal.h
+++ test-2.6.23-rc4-mm1/fs/nfs/internal.h
@@ -220,7 +220,7 @@ void nfs_super_set_maxbytes(struct super
 static inline
 unsigned int nfs_page_length(struct page *page)
 {
-	loff_t i_size = i_size_read(page->mapping->host);
+	loff_t i_size = i_size_read(page_inode(page));
 
 	if (i_size > 0) {
 		pgoff_t end_index = (i_size - 1) >> PAGE_CACHE_SHIFT;
Index: test-2.6.23-rc4-mm1/fs/nfs/read.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/nfs/read.c
+++ test-2.6.23-rc4-mm1/fs/nfs/read.c
@@ -466,7 +466,7 @@ static const struct rpc_call_ops nfs_rea
 int nfs_readpage(struct file *file, struct page *page)
 {
 	struct nfs_open_context *ctx;
-	struct inode *inode = page->mapping->host;
+	struct inode *inode = page_inode(page);
 	int		error;
 
 	dprintk("NFS: nfs_readpage (%p %ld@%lu)\n",
@@ -517,7 +517,7 @@ static int
 readpage_async_filler(void *data, struct page *page)
 {
 	struct nfs_readdesc *desc = (struct nfs_readdesc *)data;
-	struct inode *inode = page->mapping->host;
+	struct inode *inode = page_inode(page);
 	struct nfs_page *new;
 	unsigned int len;
 	int error;
Index: test-2.6.23-rc4-mm1/fs/nfs/write.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/nfs/write.c
+++ test-2.6.23-rc4-mm1/fs/nfs/write.c
@@ -131,7 +131,7 @@ static struct nfs_page *nfs_page_find_re
 
 static struct nfs_page *nfs_page_find_request(struct page *page)
 {
-	struct inode *inode = page->mapping->host;
+	struct inode *inode = page_inode(page);
 	struct nfs_page *req = NULL;
 
 	spin_lock(&inode->i_lock);
@@ -143,7 +143,7 @@ static struct nfs_page *nfs_page_find_re
 /* Adjust the file length if we're writing beyond the end */
 static void nfs_grow_file(struct page *page, unsigned int offset, unsigned int count)
 {
-	struct inode *inode = page->mapping->host;
+	struct inode *inode = page_inode(page);
 	loff_t end, i_size = i_size_read(inode);
 	pgoff_t end_index = (i_size - 1) >> PAGE_CACHE_SHIFT;
 
@@ -160,7 +160,7 @@ static void nfs_grow_file(struct page *p
 static void nfs_set_pageerror(struct page *page)
 {
 	SetPageError(page);
-	nfs_zap_mapping(page->mapping->host, page->mapping);
+	nfs_zap_mapping(page_inode(page), page_mapping_cache(page));
 }
 
 /* We can set the PG_uptodate flag if we see that a write request
@@ -192,7 +192,7 @@ static int nfs_writepage_setup(struct nf
 		ret = PTR_ERR(req);
 		if (ret != -EBUSY)
 			return ret;
-		ret = nfs_wb_page(page->mapping->host, page);
+		ret = nfs_wb_page(page_inode(page), page);
 		if (ret != 0)
 			return ret;
 	}
@@ -226,7 +226,7 @@ static int nfs_set_page_writeback(struct
 	int ret = test_set_page_writeback(page);
 
 	if (!ret) {
-		struct inode *inode = page->mapping->host;
+		struct inode *inode = page_inode(page);
 		struct nfs_server *nfss = NFS_SERVER(inode);
 
 		if (atomic_long_inc_return(&nfss->writeback) >
@@ -238,7 +238,7 @@ static int nfs_set_page_writeback(struct
 
 static void nfs_end_page_writeback(struct page *page)
 {
-	struct inode *inode = page->mapping->host;
+	struct inode *inode = page_inode(page);
 	struct nfs_server *nfss = NFS_SERVER(inode);
 
 	end_page_writeback(page);
@@ -255,7 +255,7 @@ static void nfs_end_page_writeback(struc
 static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio,
 				struct page *page)
 {
-	struct inode *inode = page->mapping->host;
+	struct inode *inode = page_inode(page);
 	struct nfs_inode *nfsi = NFS_I(inode);
 	struct nfs_page *req;
 	int ret;
@@ -301,7 +301,7 @@ static int nfs_page_async_flush(struct n
 
 static int nfs_do_writepage(struct page *page, struct writeback_control *wbc, struct nfs_pageio_descriptor *pgio)
 {
-	struct inode *inode = page->mapping->host;
+	struct inode *inode = page_inode(page);
 
 	nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGE);
 	nfs_add_stats(inode, NFSIOS_WRITEPAGES, 1);
@@ -318,7 +318,7 @@ static int nfs_writepage_locked(struct p
 	struct nfs_pageio_descriptor pgio;
 	int err;
 
-	nfs_pageio_init_write(&pgio, page->mapping->host, wb_priority(wbc));
+	nfs_pageio_init_write(&pgio, page_inode(page), wb_priority(wbc));
 	err = nfs_do_writepage(page, wbc, &pgio);
 	nfs_pageio_complete(&pgio);
 	if (err < 0)
@@ -585,7 +585,7 @@ static inline int nfs_scan_commit(struct
 static struct nfs_page * nfs_update_request(struct nfs_open_context* ctx,
 		struct page *page, unsigned int offset, unsigned int bytes)
 {
-	struct address_space *mapping = page->mapping;
+	struct address_space *mapping = page_mapping_cache(page);
 	struct inode *inode = mapping->host;
 	struct nfs_page		*req, *new = NULL;
 	pgoff_t		rqend, end;
@@ -687,7 +687,7 @@ int nfs_flush_incompatible(struct file *
 		nfs_release_request(req);
 		if (!do_flush)
 			return 0;
-		status = nfs_wb_page(page->mapping->host, page);
+		status = nfs_wb_page(page_inode(page), page);
 	} while (status == 0);
 	return status;
 }
@@ -702,7 +702,7 @@ int nfs_updatepage(struct file *file, st
 		unsigned int offset, unsigned int count)
 {
 	struct nfs_open_context *ctx = nfs_file_open_context(file);
-	struct inode	*inode = page->mapping->host;
+	struct inode	*inode = page_inode(page);
 	int		status = 0;
 
 	nfs_inc_stats(inode, NFSIOS_VFSUPDATEPAGE);
@@ -958,7 +958,7 @@ static void nfs_writeback_done_partial(s
 	}
 
 	if (nfs_write_need_commit(data)) {
-		struct inode *inode = page->mapping->host;
+		struct inode *inode = page_inode(page);
 
 		spin_lock(&inode->i_lock);
 		if (test_bit(PG_NEED_RESCHED, &req->wb_flags)) {
@@ -1386,7 +1386,7 @@ int nfs_wb_page_cancel(struct inode *ino
 	loff_t range_start = page_offset(page);
 	loff_t range_end = range_start + (loff_t)(PAGE_CACHE_SIZE - 1);
 	struct writeback_control wbc = {
-		.bdi = page->mapping->backing_dev_info,
+		.bdi = page_mapping_cache(page)->backing_dev_info,
 		.sync_mode = WB_SYNC_ALL,
 		.nr_to_write = LONG_MAX,
 		.range_start = range_start,
@@ -1419,7 +1419,8 @@ int nfs_wb_page_cancel(struct inode *ino
 	}
 	if (!PagePrivate(page))
 		return 0;
-	ret = nfs_sync_mapping_wait(page->mapping, &wbc, FLUSH_INVALIDATE);
+	ret = nfs_sync_mapping_wait(page_mapping_cache(page),
+					&wbc, FLUSH_INVALIDATE);
 out:
 	return ret;
 }
@@ -1429,7 +1430,7 @@ int nfs_wb_page_priority(struct inode *i
 	loff_t range_start = page_offset(page);
 	loff_t range_end = range_start + (loff_t)(PAGE_CACHE_SIZE - 1);
 	struct writeback_control wbc = {
-		.bdi = page->mapping->backing_dev_info,
+		.bdi = page_mapping_cache(page)->backing_dev_info,
 		.sync_mode = WB_SYNC_ALL,
 		.nr_to_write = LONG_MAX,
 		.range_start = range_start,
@@ -1445,7 +1446,7 @@ int nfs_wb_page_priority(struct inode *i
 	}
 	if (!PagePrivate(page))
 		return 0;
-	ret = nfs_sync_mapping_wait(page->mapping, &wbc, how);
+	ret = nfs_sync_mapping_wait(page_mapping_cache(page), &wbc, how);
 	if (ret >= 0)
 		return 0;
 out:
Index: test-2.6.23-rc4-mm1/fs/nfs/pagelist.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/nfs/pagelist.c
+++ test-2.6.23-rc4-mm1/fs/nfs/pagelist.c
@@ -81,7 +81,7 @@ nfs_create_request(struct nfs_open_conte
 	page_cache_get(page);
 	BUG_ON(PagePrivate(page));
 	BUG_ON(!PageLocked(page));
-	BUG_ON(page->mapping->host != inode);
+	BUG_ON(page_inode(page) != inode);
 	req->wb_offset  = offset;
 	req->wb_pgbase	= offset;
 	req->wb_bytes   = count;

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2007-09-10 10:21 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-10  9:40 [PATCH] add page->mapping handling interface [0/35] intro KAMEZAWA Hiroyuki
2007-09-10  9:42 ` [PATCH] add page->mapping handling interface [1/35] interface definitions KAMEZAWA Hiroyuki
2007-09-13 20:19   ` Richard Knutsson
2007-09-14  1:06     ` KAMEZAWA Hiroyuki
2007-09-10  9:43 ` [PATCH] add page->mapping handling interface [2/35] changes in /mm KAMEZAWA Hiroyuki
2007-09-10  9:44 ` [PATCH] add page->mapping handling interface [3/35] changes in generic parts KAMEZAWA Hiroyuki
2007-09-10  9:46 ` [PATCH] add page->mapping handling interface [4/35] changes in AFFS KAMEZAWA Hiroyuki
2007-09-10  9:49 ` [PATCH] add page->mapping handling interface [5/35] changes in AFS KAMEZAWA Hiroyuki
2007-09-10  9:50 ` [PATCH] add page->mapping handling interface [6/35] changes in CIFS KAMEZAWA Hiroyuki
2007-09-10  9:51 ` [PATCH] add page->mapping handling interface [7/35] changes in CODA KAMEZAWA Hiroyuki
2007-09-10  9:53 ` [PATCH] add page->mapping handling interface [8/35] changes in CRAMFS KAMEZAWA Hiroyuki
2007-09-10  9:55 ` [PATCH] add page->mapping handling interface [9/35] changes in ECRYPTFS KAMEZAWA Hiroyuki
2007-09-10  9:56 ` [PATCH] add page->mapping handling interface [10/35] changes in EFS KAMEZAWA Hiroyuki
2007-09-10  9:57 ` [PATCH] add page->mapping handling interface [11/35] changes in EXT2 KAMEZAWA Hiroyuki
2007-09-10  9:59 ` [PATCH] add page->mapping handling interface [12/35] changes in EXT3 KAMEZAWA Hiroyuki
2007-09-10 10:00 ` [PATCH] add page->mapping handling interface [13/35] changes in EXT4 KAMEZAWA Hiroyuki
2007-09-10 10:02 ` [PATCH] add page->mapping handling interface [14/35] changes in freevxfs KAMEZAWA Hiroyuki
2007-09-10 10:04 ` [PATCH] add page->mapping handling interface [15/35] changes in FUSE KAMEZAWA Hiroyuki
2007-09-10 10:06 ` [PATCH] add page->mapping handling interface [16/35] changes in GFS2 KAMEZAWA Hiroyuki
2007-09-10 10:07 ` [PATCH] add page->mapping handling interface [17/35] changes in HFS KAMEZAWA Hiroyuki
2007-09-10 10:09 ` [PATCH] add page->mapping handling interface [18/35] changes in HFSPLUS KAMEZAWA Hiroyuki
2007-09-10 10:11 ` [PATCH] add page->mapping handling interface [19/35] changes in HPFS KAMEZAWA Hiroyuki
2007-09-10 10:13 ` [PATCH] add page->mapping handling interface [20/35] changes in ISOFS KAMEZAWA Hiroyuki
2007-09-10 10:15 ` [PATCH] add page->mapping handling interface [21/35] changes in JBD KAMEZAWA Hiroyuki
2007-09-10 10:16 ` [PATCH] add page->mapping handling interface [22/35] changes in JFFS2 KAMEZAWA Hiroyuki
2007-09-10 10:19   ` David Woodhouse
2007-09-10 10:41     ` KAMEZAWA Hiroyuki
2007-09-10 10:17 ` [PATCH] add page->mapping handling interface [23/35] changes in JFS KAMEZAWA Hiroyuki
2007-09-10 10:18 ` [PATCH] add page->mapping handling interface [24/35] changes in MINIX FS KAMEZAWA Hiroyuki
2007-09-10 10:20 ` [PATCH] add page->mapping handling interface [25/35] changes in NCPFS KAMEZAWA Hiroyuki
2007-09-10 10:21 ` KAMEZAWA Hiroyuki [this message]
2007-09-10 10:23 ` [PATCH] add page->mapping handling interface [27/35] changes in NTFS KAMEZAWA Hiroyuki
2007-09-10 10:25 ` [PATCH] add page->mapping handling interface [28/35] changes in OCFS2 KAMEZAWA Hiroyuki
2007-09-10 10:27 ` [PATCH] add page->mapping handling interface [29/35] changes in REISER4/REISERFS KAMEZAWA Hiroyuki
2007-09-10 10:28 ` [PATCH] add page->mapping handling interface [30/35] changes ROMFS KAMEZAWA Hiroyuki
2007-09-10 10:29 ` [PATCH] add page->mapping handling interface [31/35] changes in SYSVFS KAMEZAWA Hiroyuki
2007-09-10 10:32 ` [PATCH] add page->mapping handling interface [32/35] changes in UDFFS KAMEZAWA Hiroyuki
2007-09-10 10:33 ` [PATCH] add page->mapping handling interface [33/35] changes in UFS KAMEZAWA Hiroyuki
2007-09-10 10:35 ` [PATCH] add page->mapping handling interface [34/35] changes in UNIONFS KAMEZAWA Hiroyuki
2007-09-10 10:36 ` [PATCH] add page->mapping handling interface [35/35] changes in XFS KAMEZAWA Hiroyuki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070910192153.4d684408.kamezawa.hiroyu@jp.fujitsu.com \
    --to=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nickpiggin@yahoo.com.au \
    --cc=trond.myklebust@fys.uio.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox