[PATCH] add page->mapping handling interface [28/35] changes inOCFS2

From: KAMEZAWA Hiroyuki
Date: Mon Sep 10 2007 - 06:24:34 EST


Changes page->mapping handling in OCFS2

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>

---
fs/ocfs2/aops.c | 8 ++++----
fs/ocfs2/mmap.c | 3 ++-
2 files changed, 6 insertions(+), 5 deletions(-)

Index: test-2.6.23-rc4-mm1/fs/ocfs2/aops.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/ocfs2/aops.c
+++ test-2.6.23-rc4-mm1/fs/ocfs2/aops.c
@@ -208,7 +208,7 @@ bail:

static int ocfs2_readpage(struct file *file, struct page *page)
{
- struct inode *inode = page->mapping->host;
+ struct inode *inode = page_inode(page);
loff_t start = (loff_t)page->index << PAGE_CACHE_SHIFT;
int ret, unlock = 1;

@@ -540,14 +540,14 @@ static void ocfs2_dio_end_io(struct kioc
*/
static void ocfs2_invalidatepage(struct page *page, unsigned long offset)
{
- journal_t *journal = OCFS2_SB(page->mapping->host->i_sb)->journal->j_journal;
+ journal_t *journal = OCFS2_SB(page_inode(page)->i_sb)->journal->j_journal;

journal_invalidatepage(journal, page, offset);
}

static int ocfs2_releasepage(struct page *page, gfp_t wait)
{
- journal_t *journal = OCFS2_SB(page->mapping->host->i_sb)->journal->j_journal;
+ journal_t *journal = OCFS2_SB(page_inode(page)->i_sb)->journal->j_journal;

if (!page_has_buffers(page))
return 0;
@@ -1065,7 +1065,7 @@ static int ocfs2_grab_pages_for_write(st
*/
lock_page(mmap_page);

- if (mmap_page->mapping != mapping) {
+ if (!pagecache_consistent(mmap_page, mapping)) {
unlock_page(mmap_page);
/*
* Sanity check - the locking in
Index: test-2.6.23-rc4-mm1/fs/ocfs2/mmap.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/ocfs2/mmap.c
+++ test-2.6.23-rc4-mm1/fs/ocfs2/mmap.c
@@ -112,7 +112,8 @@ static int __ocfs2_page_mkwrite(struct i
* page mapping after taking the page lock inside of
* ocfs2_write_begin_nolock().
*/
- if (!PageUptodate(page) || page->mapping != inode->i_mapping) {
+ if (!PageUptodate(page) ||
+ !pagecache_consistent(page, inode->i_mapping)) {
ret = -EINVAL;
goto out;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/