Hi, this patch set adds following functions - page_inode(page) ... returns inode from page, (page->mapping->host) - page_mapping_cache(page) ... returns addrees_space from page - page_mapping_anon(page) ... return anon_vma from page - page_is_pagecache(page) ... returns 1 if the page is page cache - pagecache_consistent(page, mapping) ... returns if page_mapping_cache(page) equals to mapping. By adding aboves, this patch set removes all *direct* references to page->mapping in usual codes. (compile tested with all mod config.) I think this can improve VM/FS dependency and make things robust. In addition, page->mapping is not a just address_space, now. (And we can hide page->mapping details from moduled FSs.) patch set is structured as [1] ... new interface definition [2] ... changes in /mm [3] ... changes in /kernel and /fs [4...] ... changes in each FSs. (most of patches are very small.) Any comments are welcome. Thanks, -Kame -
- changes page->mapping from address_space* to unsigned long
- add page_mapping_anon() function.
- add linux/page-cache.h
- add page_inode() function
- add page_is_pagecache() function
- add pagecaceh_consisten() function for pagecache consistency test.
- expoterd swapper_space. inline function page_mapping() refers this.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
include/linux/fs.h | 1 +
include/linux/mm.h | 20 +++++++++++++++++---
include/linux/mm_types.h | 2 +-
include/linux/page-cache.h | 39 +++++++++++++++++++++++++++++++++++++++
mm/swap_state.c | 2 ++
5 files changed, 60 insertions(+), 4 deletions(-)
Index: test-2.6.23-rc4-mm1/include/linux/page-cache.h
===================================================================
--- /dev/null
+++ test-2.6.23-rc4-mm1/include/linux/page-cache.h
@@ -0,0 +1,39 @@
+/*
+ * For interface definitions between memory management and file systems.
+ * - This file defines small interface functions for handling page cache.
+ */
+
+#ifndef _LINUX_PAGECACHE_H
+#define _LINUX_PAGECACHE_H
+
+#include <linux/mm.h>
+/* page_mapping_xxx() function is defined in mm.h */
+
+static inline int page_is_pagecache(struct page *page)
+{
+ if (!page->mapping || (page->mapping & PAGE_MAPPING_ANON))
+ return 0;
+ return 1;
+}
+
+/*
+ * Return an inode this page belongs to
+ */
+
+static inline struct inode *page_inode(struct page *page)
+{
+ if (!page_is_pagecache(page))
+ return NULL;
+ return page_mapping_cache(page)->host;
+}
+
+/*
+ * Test a page is a page-cache of an address_space.
+ */
+static inline int
+pagecache_consistent(struct page *page, struct address_space *as)
+{
+ return (page_mapping(page) == as);
+}
+
+#endif
Index: test-2.6.23-rc4-mm1/include/linux/fs.h
===================================================================
--- test-2.6.23-rc4-mm1.orig/include/linux/fs.h
+++ test-2.6.23-rc4-mm1/include/linux/fs.h
@@ -582,6 ...Not easier with 'return page->mapping && (page->mapping & Change to bool? Then "you" can also remove the '!!' from: <snip> If you don't mind bool(eans) (for some reason), I can/will check out the rest. Richard Knutsson -
On Thu, 13 Sep 2007 22:19:20 +0200 Ah, I missed bool type just because I have no experience to use 'bool' in Thank you. I'll try 'bool' type. Regards, -Kame -
Changes page->mapping handling in /mm directory.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
mm/filemap.c | 24 +++++++++++++-----------
mm/memory.c | 6 ++++--
mm/migrate.c | 17 ++++++-----------
mm/page-writeback.c | 4 ++--
mm/rmap.c | 27 ++++++++++++---------------
mm/shmem.c | 4 ++--
mm/truncate.c | 15 ++++++++-------
7 files changed, 47 insertions(+), 50 deletions(-)
Index: test-2.6.23-rc4-mm1/mm/filemap.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/mm/filemap.c
+++ test-2.6.23-rc4-mm1/mm/filemap.c
@@ -115,11 +115,11 @@ generic_file_direct_IO(int rw, struct ki
*/
void __remove_from_page_cache(struct page *page)
{
- struct address_space *mapping = page->mapping;
+ struct address_space *mapping = page_mapping(page);
mem_container_uncharge_page(page);
radix_tree_delete(&mapping->page_tree, page->index);
- page->mapping = NULL;
+ page->mapping = 0;
mapping->nrpages--;
__dec_zone_page_state(page, NR_FILE_PAGES);
BUG_ON(page_mapped(page));
@@ -127,7 +127,7 @@ void __remove_from_page_cache(struct pag
void remove_from_page_cache(struct page *page)
{
- struct address_space *mapping = page->mapping;
+ struct address_space *mapping = page_mapping(page);
BUG_ON(!PageLocked(page));
@@ -454,7 +454,7 @@ int add_to_page_cache(struct page *page,
if (!error) {
page_cache_get(page);
SetPageLocked(page);
- page->mapping = mapping;
+ page->mapping = (unsigned long)mapping;
page->index = offset;
mapping->nrpages++;
__inc_zone_page_state(page, NR_FILE_PAGES);
@@ -642,7 +642,7 @@ repeat:
__lock_page(page);
/* Has the page been truncated while we slept? */
- if (unlikely(page->mapping != mapping)) {
+ if (unlikely(!pagecache_consistent(page, mapping))) {
unlock_page(page);
page_cache_release(page);
goto repeat;
@@ -751,7 +751,8 @@ unsigned ...Changes page->mapping hanlding of generic fs routine and kexec.
(other than mm layer..)
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/buffer.c | 43 ++++++++++++++++++++++---------------------
fs/libfs.c | 2 +-
fs/mpage.c | 13 +++++++------
kernel/kexec.c | 2 +-
4 files changed, 31 insertions(+), 29 deletions(-)
Index: test-2.6.23-rc4-mm1/kernel/kexec.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/kernel/kexec.c
+++ test-2.6.23-rc4-mm1/kernel/kexec.c
@@ -347,7 +347,7 @@ static struct page *kimage_alloc_pages(g
pages = alloc_pages(gfp_mask, order);
if (pages) {
unsigned int count, i;
- pages->mapping = NULL;
+ pages->mapping = 0;
set_page_private(pages, order);
count = 1 << order;
for (i = 0; i < count; i++)
Index: test-2.6.23-rc4-mm1/fs/buffer.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/buffer.c
+++ test-2.6.23-rc4-mm1/fs/buffer.c
@@ -467,7 +467,7 @@ static void end_buffer_async_write(struc
"I/O error on %s\n",
bdevname(bh->b_bdev, b));
}
- set_bit(AS_EIO, &page->mapping->flags);
+ set_bit(AS_EIO, &page_mapping_cache(page)->flags);
set_buffer_write_io_error(bh);
clear_buffer_uptodate(bh);
SetPageError(page);
@@ -678,7 +678,7 @@ void write_boundary_block(struct block_d
void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode)
{
struct address_space *mapping = inode->i_mapping;
- struct address_space *buffer_mapping = bh->b_page->mapping;
+ struct address_space *buffer_mapping = page_mapping_cache(bh->b_page);
mark_buffer_dirty(bh);
if (!mapping->assoc_mapping) {
@@ -713,7 +713,7 @@ static int __set_page_dirty(struct page
return 0;
write_lock_irq(&mapping->tree_lock);
- if (page->mapping) { /* Race with truncate? */
+ if (page_is_pagecache(page)) { /* Race with truncate? */
WARN_ON_ONCE(warn && ...use page_inode() in AFFS
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/affs/file.c | 4 ++--
fs/affs/symlink.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
Index: test-2.6.23-rc4-mm1/fs/affs/file.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/affs/file.c
+++ test-2.6.23-rc4-mm1/fs/affs/file.c
@@ -485,7 +485,7 @@ affs_getemptyblk_ino(struct inode *inode
static int
affs_do_readpage_ofs(struct file *file, struct page *page, unsigned from, unsigned to)
{
- struct inode *inode = page->mapping->host;
+ struct inode *inode = page_inode(page);
struct super_block *sb = inode->i_sb;
struct buffer_head *bh;
char *data;
@@ -593,7 +593,7 @@ out:
static int
affs_readpage_ofs(struct file *file, struct page *page)
{
- struct inode *inode = page->mapping->host;
+ struct inode *inode = page_inode(page);
u32 to;
int err;
Index: test-2.6.23-rc4-mm1/fs/affs/symlink.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/affs/symlink.c
+++ test-2.6.23-rc4-mm1/fs/affs/symlink.c
@@ -13,7 +13,7 @@
static int affs_symlink_readpage(struct file *file, struct page *page)
{
struct buffer_head *bh;
- struct inode *inode = page->mapping->host;
+ struct inode *inode = page_inode(page);
char *link = kmap(page);
struct slink_front *lf;
int err;
-
Use page->mapping interface in AFS
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/afs/file.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
Index: test-2.6.23-rc4-mm1/fs/afs/file.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/afs/file.c
+++ test-2.6.23-rc4-mm1/fs/afs/file.c
@@ -145,7 +145,7 @@ static int afs_readpage(struct file *fil
off_t offset;
int ret;
- inode = page->mapping->host;
+ inode = page_inode(page);
ASSERT(file != NULL);
key = file->private_data;
@@ -253,8 +253,7 @@ static void afs_invalidatepage(struct pa
ret = 0;
if (!PageWriteback(page))
- ret = page->mapping->a_ops->releasepage(page,
- 0);
+ ret = page_mapping_cache(page)->a_ops->releasepage(page, 0);
/* possibly should BUG_ON(!ret); - neilb */
}
}
@@ -277,7 +276,7 @@ static int afs_launder_page(struct page
*/
static int afs_releasepage(struct page *page, gfp_t gfp_flags)
{
- struct afs_vnode *vnode = AFS_FS_I(page->mapping->host);
+ struct afs_vnode *vnode = AFS_FS_I(page_inode(page));
struct afs_writeback *wb;
_enter("{{%x:%u}[%lu],%lx},%x",
-
Change page->mapping handling in CIFS
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/cifs/file.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
Index: test-2.6.23-rc4-mm1/fs/cifs/file.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/cifs/file.c
+++ test-2.6.23-rc4-mm1/fs/cifs/file.c
@@ -1056,7 +1056,7 @@ struct cifsFileInfo *find_writable_file(
static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to)
{
- struct address_space *mapping = page->mapping;
+ struct address_space *mapping = page_mapping_cache(page);
loff_t offset = (loff_t)page->index << PAGE_CACHE_SHIFT;
char *write_data;
int rc = -EFAULT;
@@ -1069,7 +1069,7 @@ static int cifs_partialpagewrite(struct
if (!mapping || !mapping->host)
return -EFAULT;
- inode = page->mapping->host;
+ inode = page_inode(page);
cifs_sb = CIFS_SB(inode->i_sb);
pTcon = cifs_sb->tcon;
@@ -1209,7 +1209,7 @@ retry:
else if (TestSetPageLocked(page))
break;
- if (unlikely(page->mapping != mapping)) {
+ if (unlikely(pagecache_consistent(page, mapping))) {
unlock_page(page);
break;
}
@@ -1371,7 +1371,7 @@ static int cifs_commit_write(struct file
{
int xid;
int rc = 0;
- struct inode *inode = page->mapping->host;
+ struct inode *inode = page_inode(page);
loff_t position = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
char *page_data;
@@ -1973,7 +1973,7 @@ static int cifs_prepare_write(struct fil
}
offset = (loff_t)page->index << PAGE_CACHE_SHIFT;
- i_size = i_size_read(page->mapping->host);
+ i_size = i_size_read(page_inode(page));
if ((offset >= i_size) ||
((from == 0) && (offset + to) >= i_size)) {
-
Change page->mapping handling in CODA
Singed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/coda/symlink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: test-2.6.23-rc4-mm1/fs/coda/symlink.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/coda/symlink.c
+++ test-2.6.23-rc4-mm1/fs/coda/symlink.c
@@ -23,7 +23,7 @@
static int coda_symlink_filler(struct file *file, struct page *page)
{
- struct inode *inode = page->mapping->host;
+ struct inode *inode = page_inode(page);
int error;
struct coda_inode_info *cii;
unsigned int len = PAGE_SIZE;
-
patches for handling page->mapping in CRAMFS.
Signed-off-by : KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/cramfs/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: test-2.6.23-rc4-mm1/fs/cramfs/inode.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/cramfs/inode.c
+++ test-2.6.23-rc4-mm1/fs/cramfs/inode.c
@@ -469,7 +469,7 @@ static struct dentry * cramfs_lookup(str
static int cramfs_readpage(struct file *file, struct page * page)
{
- struct inode *inode = page->mapping->host;
+ struct inode *inode = page_inode(page);
u32 maxblock, bytes_filled;
void *pgdata;
-
Change page->mapping handling in ecryptfs
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/ecryptfs/crypto.c | 9 ++++-----
fs/ecryptfs/mmap.c | 14 +++++++-------
2 files changed, 11 insertions(+), 12 deletions(-)
Index: test-2.6.23-rc4-mm1/fs/ecryptfs/crypto.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/ecryptfs/crypto.c
+++ test-2.6.23-rc4-mm1/fs/ecryptfs/crypto.c
@@ -504,8 +504,8 @@ int ecryptfs_encrypt_page(struct ecryptf
#define ECRYPTFS_PAGE_STATE_WRITTEN 3
int page_state;
- lower_inode = ecryptfs_inode_to_lower(ctx->page->mapping->host);
- inode_info = ecryptfs_inode_to_private(ctx->page->mapping->host);
+ lower_inode = ecryptfs_inode_to_lower(page_inode(ctx->page));
+ inode_info = ecryptfs_inode_to_private(page_inode(ctx->page));
crypt_stat = &inode_info->crypt_stat;
if (!(crypt_stat->flags & ECRYPTFS_ENCRYPTED)) {
rc = ecryptfs_copy_page_to_lower(ctx->page, lower_inode,
@@ -636,9 +636,8 @@ int ecryptfs_decrypt_page(struct file *f
int num_extents_per_page;
int page_state;
- crypt_stat = &(ecryptfs_inode_to_private(
- page->mapping->host)->crypt_stat);
- lower_inode = ecryptfs_inode_to_lower(page->mapping->host);
+ crypt_stat = &(ecryptfs_inode_to_private(page_inode(page))->crypt_stat);
+ lower_inode = ecryptfs_inode_to_lower(page_inode(page));
if (!(crypt_stat->flags & ECRYPTFS_ENCRYPTED)) {
rc = ecryptfs_do_readpage(file, page, page->index);
if (rc)
Index: test-2.6.23-rc4-mm1/fs/ecryptfs/mmap.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/ecryptfs/mmap.c
+++ test-2.6.23-rc4-mm1/fs/ecryptfs/mmap.c
@@ -363,7 +363,7 @@ out:
*/
static int fill_zeros_to_end_of_page(struct page *page, unsigned int to)
{
- struct inode *inode = page->mapping->host;
+ struct inode *inode = page_inode(page);
int end_byte_in_page;
if ((i_size_read(inode) / PAGE_CACHE_SIZE) != ...Change page->mapping handling in EFS
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Index: test-2.6.23-rc4-mm1/fs/efs/symlink.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/efs/symlink.c
+++ test-2.6.23-rc4-mm1/fs/efs/symlink.c
@@ -16,7 +16,7 @@ static int efs_symlink_readpage(struct f
{
char *link = kmap(page);
struct buffer_head * bh;
- struct inode * inode = page->mapping->host;
+ struct inode * inode = page_inode(page);
efs_block_t size = inode->i_size;
int err;
-
Change page->mapping handling in ext2
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/ext2/dir.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
Index: test-2.6.23-rc4-mm1/fs/ext2/dir.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/ext2/dir.c
+++ test-2.6.23-rc4-mm1/fs/ext2/dir.c
@@ -65,7 +65,7 @@ ext2_last_byte(struct inode *inode, unsi
static int ext2_commit_chunk(struct page *page, loff_t pos, unsigned len)
{
- struct address_space *mapping = page->mapping;
+ struct address_space *mapping = page_mapping_cache(page);
struct inode *dir = mapping->host;
int err = 0;
@@ -87,7 +87,7 @@ static int ext2_commit_chunk(struct page
static void ext2_check_page(struct page *page)
{
- struct inode *dir = page->mapping->host;
+ struct inode *dir = page_inode(page);
struct super_block *sb = dir->i_sb;
unsigned chunk_size = ext2_chunk_size(dir);
char *kaddr = page_address(page);
@@ -429,7 +429,7 @@ void ext2_set_link(struct inode *dir, st
int err;
lock_page(page);
- err = __ext2_write_begin(NULL, page->mapping, pos, len,
+ err = __ext2_write_begin(NULL, page_mapping_cache(page), pos, len,
AOP_FLAG_UNINTERRUPTIBLE, &page, NULL);
BUG_ON(err);
de->inode = cpu_to_le32(inode->i_ino);
@@ -512,8 +512,8 @@ int ext2_add_link (struct dentry *dentry
got_it:
pos = page_offset(page) +
(char*)de - (char*)page_address(page);
- err = __ext2_write_begin(NULL, page->mapping, pos, rec_len, 0,
- &page, NULL);
+ err = __ext2_write_begin(NULL, page_mapping_cache(page), pos, rec_len,
+ 0, &page, NULL);
if (err)
goto out_unlock;
if (de->inode) {
@@ -546,7 +546,7 @@ out_unlock:
*/
int ext2_delete_entry (struct ext2_dir_entry_2 * dir, struct page * page )
{
- struct address_space *mapping = page->mapping;
+ struct address_space *mapping = page_mapping_cache(page);
struct inode *inode = mapping->host;
char *kaddr = ...Change page->mapping handling in EXT3
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/ext3/inode.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
Index: test-2.6.23-rc4-mm1/fs/ext3/inode.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/ext3/inode.c
+++ test-2.6.23-rc4-mm1/fs/ext3/inode.c
@@ -1484,7 +1484,7 @@ static int journal_dirty_data_fn(handle_
static int ext3_ordered_writepage(struct page *page,
struct writeback_control *wbc)
{
- struct inode *inode = page->mapping->host;
+ struct inode *inode = page_inode(page);
struct buffer_head *page_bufs;
handle_t *handle = NULL;
int ret = 0;
@@ -1550,7 +1550,7 @@ out_fail:
static int ext3_writeback_writepage(struct page *page,
struct writeback_control *wbc)
{
- struct inode *inode = page->mapping->host;
+ struct inode *inode = page_inode(page);
handle_t *handle = NULL;
int ret = 0;
int err;
@@ -1583,7 +1583,7 @@ out_fail:
static int ext3_journalled_writepage(struct page *page,
struct writeback_control *wbc)
{
- struct inode *inode = page->mapping->host;
+ struct inode *inode = page_inode(page);
handle_t *handle = NULL;
int ret = 0;
int err;
@@ -1653,7 +1653,7 @@ ext3_readpages(struct file *file, struct
static void ext3_invalidatepage(struct page *page, unsigned long offset)
{
- journal_t *journal = EXT3_JOURNAL(page->mapping->host);
+ journal_t *journal = EXT3_JOURNAL(page_inode(page));
/*
* If it's a full truncate we just forget about the pending dirtying
@@ -1666,7 +1666,7 @@ static void ext3_invalidatepage(struct p
static int ext3_releasepage(struct page *page, gfp_t wait)
{
- journal_t *journal = EXT3_JOURNAL(page->mapping->host);
+ journal_t *journal = EXT3_JOURNAL(page_inode(page));
WARN_ON(PageChecked(page));
if (!page_has_buffers(page))
-
Changes page->mapping handling in EXT4
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/ext4/inode.c | 10 +++++-----
fs/ext4/writeback.c | 24 ++++++++++++------------
2 files changed, 17 insertions(+), 17 deletions(-)
Index: test-2.6.23-rc4-mm1/fs/ext4/inode.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/ext4/inode.c
+++ test-2.6.23-rc4-mm1/fs/ext4/inode.c
@@ -1482,7 +1482,7 @@ static int jbd2_journal_dirty_data_fn(ha
static int ext4_ordered_writepage(struct page *page,
struct writeback_control *wbc)
{
- struct inode *inode = page->mapping->host;
+ struct inode *inode = page_inode(page);
struct buffer_head *page_bufs;
handle_t *handle = NULL;
int ret = 0;
@@ -1548,7 +1548,7 @@ out_fail:
static int ext4_writeback_writepage(struct page *page,
struct writeback_control *wbc)
{
- struct inode *inode = page->mapping->host;
+ struct inode *inode = page_inode(page);
handle_t *handle = NULL;
int ret = 0;
int err;
@@ -1581,7 +1581,7 @@ out_fail:
static int ext4_journalled_writepage(struct page *page,
struct writeback_control *wbc)
{
- struct inode *inode = page->mapping->host;
+ struct inode *inode = page_inode(page);
handle_t *handle = NULL;
int ret = 0;
int err;
@@ -1651,7 +1651,7 @@ ext4_readpages(struct file *file, struct
static void ext4_invalidatepage(struct page *page, unsigned long offset)
{
- journal_t *journal = EXT4_JOURNAL(page->mapping->host);
+ journal_t *journal = EXT4_JOURNAL(page_inode(page));
/*
* If it's a full truncate we just forget about the pending dirtying
@@ -1664,7 +1664,7 @@ static void ext4_invalidatepage(struct p
static int ext4_releasepage(struct page *page, gfp_t wait)
{
- journal_t *journal = EXT4_JOURNAL(page->mapping->host);
+ journal_t *journal = EXT4_JOURNAL(page_inode(page));
WARN_ON(PageChecked(page));
if (!page_has_buffers(page))
Index: ...Changes page->mapping handling in freevxfs.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/freevxfs/vxfs_immed.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: test-2.6.23-rc4-mm1/fs/freevxfs/vxfs_immed.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/freevxfs/vxfs_immed.c
+++ test-2.6.23-rc4-mm1/fs/freevxfs/vxfs_immed.c
@@ -98,7 +98,7 @@ vxfs_immed_follow_link(struct dentry *dp
static int
vxfs_immed_readpage(struct file *fp, struct page *pp)
{
- struct vxfs_inode_info *vip = VXFS_INO(pp->mapping->host);
+ struct vxfs_inode_info *vip = VXFS_INO(page_inode(pp));
u_int64_t offset = (u_int64_t)pp->index << PAGE_CACHE_SHIFT;
caddr_t kaddr;
-
Changes page->mapping handling in FUSE
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/fuse/file.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: test-2.6.23-rc4-mm1/fs/fuse/file.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/fuse/file.c
+++ test-2.6.23-rc4-mm1/fs/fuse/file.c
@@ -310,7 +310,7 @@ static size_t fuse_send_read(struct fuse
static int fuse_readpage(struct file *file, struct page *page)
{
- struct inode *inode = page->mapping->host;
+ struct inode *inode = page_inode(page);
struct fuse_conn *fc = get_fuse_conn(inode);
struct fuse_req *req;
int err;
@@ -342,7 +342,7 @@ static void fuse_readpages_end(struct fu
{
int i;
- fuse_invalidate_attr(req->pages[0]->mapping->host); /* atime changed */
+ fuse_invalidate_attr(page_inode(req->pages[0])); /* atime changed */
for (i = 0; i < req->num_pages; i++) {
struct page *page = req->pages[i];
-
Changes page->mapping handling in GFS2
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/gfs2/log.c | 4 ++--
fs/gfs2/lops.c | 2 +-
fs/gfs2/meta_io.c | 2 +-
fs/gfs2/ops_address.c | 16 ++++++++--------
4 files changed, 12 insertions(+), 12 deletions(-)
Index: test-2.6.23-rc4-mm1/fs/gfs2/log.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/gfs2/log.c
+++ test-2.6.23-rc4-mm1/fs/gfs2/log.c
@@ -229,8 +229,8 @@ static void gfs2_ail2_empty_one(struct g
list_del(&bd->bd_ail_st_list);
list_del(&bd->bd_ail_gl_list);
atomic_dec(&bd->bd_gl->gl_ail_count);
- if (bd->bd_bh->b_page->mapping) {
- bh_ip = GFS2_I(bd->bd_bh->b_page->mapping->host);
+ if (page_is_pagecache(bd->bd_bh->b_page)) {
+ bh_ip = GFS2_I(page_inode(bd->bd_bh->b_page));
gfs2_meta_cache_flush(bh_ip);
}
brelse(bd->bd_bh);
Index: test-2.6.23-rc4-mm1/fs/gfs2/lops.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/gfs2/lops.c
+++ test-2.6.23-rc4-mm1/fs/gfs2/lops.c
@@ -473,7 +473,7 @@ static void databuf_lo_add(struct gfs2_s
{
struct gfs2_bufdata *bd = container_of(le, struct gfs2_bufdata, bd_le);
struct gfs2_trans *tr = current->journal_info;
- struct address_space *mapping = bd->bd_bh->b_page->mapping;
+ struct address_space *mapping = page_mapping_cache(bd->bd_bh->b_page);
struct gfs2_inode *ip = GFS2_I(mapping->host);
gfs2_log_lock(sdp);
Index: test-2.6.23-rc4-mm1/fs/gfs2/meta_io.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/gfs2/meta_io.c
+++ test-2.6.23-rc4-mm1/fs/gfs2/meta_io.c
@@ -388,7 +388,7 @@ void gfs2_meta_wipe(struct gfs2_inode *i
if (test_clear_buffer_pinned(bh)) {
struct gfs2_trans *tr = current->journal_info;
struct gfs2_inode *bh_ip =
- GFS2_I(bh->b_page->mapping->host);
+ GFS2_I(page_inode(bh->b_page));
...Changes page->mapping handling in HFS
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/hfs/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: test-2.6.23-rc4-mm1/fs/hfs/inode.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/hfs/inode.c
+++ test-2.6.23-rc4-mm1/fs/hfs/inode.c
@@ -52,7 +52,7 @@ static sector_t hfs_bmap(struct address_
static int hfs_releasepage(struct page *page, gfp_t mask)
{
- struct inode *inode = page->mapping->host;
+ struct inode *inode = page_inode(page);
struct super_block *sb = inode->i_sb;
struct hfs_btree *tree;
struct hfs_bnode *node;
-
Changes page->mapping handling in HFSPLUS
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/hfsplus/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: test-2.6.23-rc4-mm1/fs/hfsplus/inode.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/hfsplus/inode.c
+++ test-2.6.23-rc4-mm1/fs/hfsplus/inode.c
@@ -44,7 +44,7 @@ static sector_t hfsplus_bmap(struct addr
static int hfsplus_releasepage(struct page *page, gfp_t mask)
{
- struct inode *inode = page->mapping->host;
+ struct inode *inode = page_inode(page);
struct super_block *sb = inode->i_sb;
struct hfs_btree *tree;
struct hfs_bnode *node;
-
Changes page->mapping handling in HPFS
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/hpfs/namei.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: test-2.6.23-rc4-mm1/fs/hpfs/namei.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/hpfs/namei.c
+++ test-2.6.23-rc4-mm1/fs/hpfs/namei.c
@@ -511,7 +511,7 @@ out:
static int hpfs_symlink_readpage(struct file *file, struct page *page)
{
char *link = kmap(page);
- struct inode *i = page->mapping->host;
+ struct inode *i = page_inode(page);
struct fnode *fnode;
struct buffer_head *bh;
int err;
-
Changes page->mapping handling in ISOFS
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/isofs/rock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: test-2.6.23-rc4-mm1/fs/isofs/rock.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/isofs/rock.c
+++ test-2.6.23-rc4-mm1/fs/isofs/rock.c
@@ -640,7 +640,7 @@ int parse_rock_ridge_inode(struct iso_di
*/
static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
{
- struct inode *inode = page->mapping->host;
+ struct inode *inode = page_inode(page);
struct iso_inode_info *ei = ISOFS_I(inode);
char *link = kmap(page);
unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
-
Changes page->mapping handling in JBD
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/jbd/journal.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: test-2.6.23-rc4-mm1/fs/jbd/journal.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/jbd/journal.c
+++ test-2.6.23-rc4-mm1/fs/jbd/journal.c
@@ -1822,7 +1822,7 @@ repeat:
jh = bh2jh(bh);
} else {
if (!(atomic_read(&bh->b_count) > 0 ||
- (bh->b_page && bh->b_page->mapping))) {
+ (bh->b_page && page_mapping_cache(bh->b_page)))) {
printk(KERN_EMERG "%s: bh->b_count=%d\n",
__FUNCTION__, atomic_read(&bh->b_count));
printk(KERN_EMERG "%s: bh->b_page=%p\n",
@@ -1830,7 +1830,7 @@ repeat:
if (bh->b_page)
printk(KERN_EMERG "%s: "
"bh->b_page->mapping=%p\n",
- __FUNCTION__, bh->b_page->mapping);
+ __FUNCTION__, page_mapping_cache(bh->b_page));
}
if (!new_jh) {
-
Changes page->mapping handling in JFFS2
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/jffs2/file.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: test-2.6.23-rc4-mm1/fs/jffs2/file.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/jffs2/file.c
+++ test-2.6.23-rc4-mm1/fs/jffs2/file.c
@@ -111,11 +111,11 @@ int jffs2_do_readpage_unlock(struct inod
static int jffs2_readpage (struct file *filp, struct page *pg)
{
- struct jffs2_inode_info *f = JFFS2_INODE_INFO(pg->mapping->host);
+ struct jffs2_inode_info *f = JFFS2_INODE_INFO(page_inode(pg));
int ret;
down(&f->sem);
- ret = jffs2_do_readpage_unlock(pg->mapping->host, pg);
+ ret = jffs2_do_readpage_unlock(page_inode(pg), pg);
up(&f->sem);
return ret;
}
-
Looks reasonable to me; I assume it's not intended for me to take it and apply it yet, before the core parts are merged? I'll let you shepherd it upstream... -- dwmw2 -
On Mon, 10 Sep 2007 11:19:51 +0100 Ah, no. core patches are not merged. This patch's target is -mm, now. I just CC:ed to each FS maintainers to show what this patch set does. Thanks, -Kame -
Changes page->mapping handling in JFS
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/jfs/jfs_metapage.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: test-2.6.23-rc4-mm1/fs/jfs/jfs_metapage.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/jfs/jfs_metapage.c
+++ test-2.6.23-rc4-mm1/fs/jfs/jfs_metapage.c
@@ -113,7 +113,7 @@ static inline int insert_metapage(struct
}
if (mp) {
- l2mp_blocks = L2PSIZE - page->mapping->host->i_blkbits;
+ l2mp_blocks = L2PSIZE - page_inode(page)->i_blkbits;
index = (mp->index >> l2mp_blocks) & (MPS_PER_PAGE - 1);
a->mp_count++;
a->mp[index] = mp;
@@ -125,7 +125,7 @@ static inline int insert_metapage(struct
static inline void remove_metapage(struct page *page, struct metapage *mp)
{
struct meta_anchor *a = mp_anchor(page);
- int l2mp_blocks = L2PSIZE - page->mapping->host->i_blkbits;
+ int l2mp_blocks = L2PSIZE - page_inode(page)->i_blkbits;
int index;
index = (mp->index >> l2mp_blocks) & (MPS_PER_PAGE - 1);
@@ -364,7 +364,7 @@ static int metapage_writepage(struct pag
{
struct bio *bio = NULL;
unsigned int block_offset; /* block offset of mp within page */
- struct inode *inode = page->mapping->host;
+ struct inode *inode = page_inode(page);
unsigned int blocks_per_mp = JFS_SBI(inode->i_sb)->nbperpage;
unsigned int len;
unsigned int xlen;
@@ -484,7 +484,7 @@ skip:
static int metapage_readpage(struct file *fp, struct page *page)
{
- struct inode *inode = page->mapping->host;
+ struct inode *inode = page_inode(page);
struct bio *bio = NULL;
unsigned int block_offset;
unsigned int blocks_per_page = PAGE_CACHE_SIZE >> inode->i_blkbits;
-
Changes page->mapping handling in MINIXFS
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/minix/dir.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
Index: test-2.6.23-rc4-mm1/fs/minix/dir.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/minix/dir.c
+++ test-2.6.23-rc4-mm1/fs/minix/dir.c
@@ -52,7 +52,7 @@ static inline unsigned long dir_pages(st
static int dir_commit_chunk(struct page *page, loff_t pos, unsigned len)
{
- struct address_space *mapping = page->mapping;
+ struct address_space *mapping = page_mapping_cache(page);
struct inode *dir = mapping->host;
int err = 0;
block_write_end(NULL, mapping, pos, len, len, page, NULL);
@@ -281,7 +281,8 @@ int minix_add_link(struct dentry *dentry
got_it:
pos = (page->index >> PAGE_CACHE_SHIFT) + p - (char*)page_address(page);
- err = __minix_write_begin(NULL, page->mapping, pos, sbi->s_dirsize,
+ err = __minix_write_begin(NULL,
+ page_mapping_cache(page), pos, sbi->s_dirsize,
AOP_FLAG_UNINTERRUPTIBLE, &page, NULL);
if (err)
goto out_unlock;
@@ -307,7 +308,7 @@ out_unlock:
int minix_delete_entry(struct minix_dir_entry *de, struct page *page)
{
- struct address_space *mapping = page->mapping;
+ struct address_space *mapping = page_mapping_cache(page);
struct inode *inode = (struct inode*)mapping->host;
char *kaddr = page_address(page);
loff_t pos = page_offset(page) + (char*)de - kaddr;
@@ -431,7 +432,7 @@ not_empty:
void minix_set_link(struct minix_dir_entry *de, struct page *page,
struct inode *inode)
{
- struct address_space *mapping = page->mapping;
+ struct address_space *mapping = page_mapping_cache(page);
struct inode *dir = mapping->host;
struct minix_sb_info *sbi = minix_sb(dir->i_sb);
loff_t pos = page_offset(page) +
-
Changes page->mapping handling in NCPFS
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/ncpfs/symlink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: test-2.6.23-rc4-mm1/fs/ncpfs/symlink.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/ncpfs/symlink.c
+++ test-2.6.23-rc4-mm1/fs/ncpfs/symlink.c
@@ -42,7 +42,7 @@
static int ncp_symlink_readpage(struct file *file, struct page *page)
{
- struct inode *inode = page->mapping->host;
+ struct inode *inode = page_inode(page);
int error, length, len;
char *link, *rawlink;
char *buf = kmap(page);
-
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
===================================================================
--- ...Changes page->mapping handling in NTFS
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/ntfs/aops.c | 14 +++++++-------
fs/ntfs/compress.c | 2 +-
fs/ntfs/file.c | 6 +++---
3 files changed, 11 insertions(+), 11 deletions(-)
Index: test-2.6.23-rc4-mm1/fs/ntfs/aops.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/ntfs/aops.c
+++ test-2.6.23-rc4-mm1/fs/ntfs/aops.c
@@ -65,7 +65,7 @@ static void ntfs_end_buffer_async_read(s
int page_uptodate = 1;
page = bh->b_page;
- vi = page->mapping->host;
+ vi = page_inode(page);
ni = NTFS_I(vi);
if (likely(uptodate)) {
@@ -194,7 +194,7 @@ static int ntfs_read_block(struct page *
int i, nr;
unsigned char blocksize_bits;
- vi = page->mapping->host;
+ vi = page_inode(page);
ni = NTFS_I(vi);
vol = ni->vol;
@@ -413,7 +413,7 @@ retry_readpage:
unlock_page(page);
return 0;
}
- vi = page->mapping->host;
+ vi = page_inode(page);
ni = NTFS_I(vi);
/*
* Only $DATA attributes can be encrypted and only unnamed $DATA
@@ -553,7 +553,7 @@ static int ntfs_write_block(struct page
bool need_end_writeback;
unsigned char blocksize_bits;
- vi = page->mapping->host;
+ vi = page_inode(page);
ni = NTFS_I(vi);
vol = ni->vol;
@@ -909,7 +909,7 @@ static int ntfs_write_mst_block(struct p
struct writeback_control *wbc)
{
sector_t block, dblock, rec_block;
- struct inode *vi = page->mapping->host;
+ struct inode *vi = page_inode(page);
ntfs_inode *ni = NTFS_I(vi);
ntfs_volume *vol = ni->vol;
u8 *kaddr;
@@ -1342,7 +1342,7 @@ done:
static int ntfs_writepage(struct page *page, struct writeback_control *wbc)
{
loff_t i_size;
- struct inode *vi = page->mapping->host;
+ struct inode *vi = page_inode(page);
ntfs_inode *base_ni = NULL, *ni = NTFS_I(vi);
char *kaddr;
ntfs_attr_search_ctx *ctx = NULL;
@@ -1579,7 +1579,7 @@ const struct address_space_operations nt
* need the ...Changes page->mapping handling in OCFS2
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
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 != ...Changes page->mapping handling in reiser4
(sorry, changes for /reiserfs is also included.)
Todo:
Fix this warning caused by this patch(set). does anyone have an adivce ?
fs/reiser4/page_cache.c: In function ‘reiser4_tree_by_page’:
fs/reiser4/page_cache.c:315: warning: passing argument 1 of ‘page_inode’ discards qualifiers from pointer target type
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/reiser4/as_ops.c | 34 ++++++++++++++++---------------
fs/reiser4/entd.c | 6 ++---
fs/reiser4/jnode.c | 18 +++++++++-------
fs/reiser4/page_cache.c | 10 ++++-----
fs/reiser4/plugin/cluster.h | 14 ++++++------
fs/reiser4/plugin/file/cryptcompress.c | 15 +++++++------
fs/reiser4/plugin/file/file.c | 22 ++++++++++----------
fs/reiser4/plugin/file_ops.c | 8 +++----
fs/reiser4/plugin/item/ctail.c | 16 +++++++-------
fs/reiser4/plugin/item/extent_file_ops.c | 6 ++---
fs/reiser4/plugin/item/tail.c | 6 ++---
fs/reiser4/wander.c | 2 -
fs/reiserfs/inode.c | 16 +++++++-------
fs/reiserfs/journal.c | 3 +-
fs/reiserfs/tail_conversion.c | 2 -
15 files changed, 92 insertions(+), 86 deletions(-)
Index: test-2.6.23-rc4-mm1/fs/reiser4/as_ops.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/reiser4/as_ops.c
+++ test-2.6.23-rc4-mm1/fs/reiser4/as_ops.c
@@ -64,24 +64,25 @@
int reiser4_set_page_dirty(struct page *page)
{
/* this page can be unformatted only */
- assert("vs-1734", (page->mapping &&
- page->mapping->host &&
- reiser4_get_super_fake(page->mapping->host->i_sb) !=
- page->mapping->host
- && reiser4_get_cc_fake(page->mapping->host->i_sb) !=
- page->mapping->host
- && ...Changes page->mapping handling in ROMFS
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/romfs/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: test-2.6.23-rc4-mm1/fs/romfs/inode.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/romfs/inode.c
+++ test-2.6.23-rc4-mm1/fs/romfs/inode.c
@@ -417,7 +417,7 @@ out: unlock_kernel();
static int
romfs_readpage(struct file *file, struct page * page)
{
- struct inode *inode = page->mapping->host;
+ struct inode *inode = page_inode(page);
loff_t offset, avail, readlen;
void *buf;
int result = -EIO;
-
Changes page->mapping handlingi in SYSVFS.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/sysv/dir.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
Index: test-2.6.23-rc4-mm1/fs/sysv/dir.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/sysv/dir.c
+++ test-2.6.23-rc4-mm1/fs/sysv/dir.c
@@ -40,7 +40,7 @@ static inline unsigned long dir_pages(st
static int dir_commit_chunk(struct page *page, loff_t pos, unsigned len)
{
- struct address_space *mapping = page->mapping;
+ struct address_space *mapping = page_mapping_cache(page);
struct inode *dir = mapping->host;
int err = 0;
@@ -221,7 +221,8 @@ got_it:
pos = page_offset(page) +
(char*)de - (char*)page_address(page);
lock_page(page);
- err = __sysv_write_begin(NULL, page->mapping, pos, SYSV_DIRSIZE,
+ err = __sysv_write_begin(NULL, page_mapping_cache(page),
+ pos, SYSV_DIRSIZE,
AOP_FLAG_UNINTERRUPTIBLE, &page, NULL);
if (err)
goto out_unlock;
@@ -242,7 +243,7 @@ out_unlock:
int sysv_delete_entry(struct sysv_dir_entry *de, struct page *page)
{
- struct address_space *mapping = page->mapping;
+ struct address_space *mapping = page_mapping_cache(page);
struct inode *inode = (struct inode*)mapping->host;
char *kaddr = (char*)page_address(page);
loff_t pos = page_offset(page) + (char *)de - kaddr;
@@ -344,7 +345,7 @@ not_empty:
void sysv_set_link(struct sysv_dir_entry *de, struct page *page,
struct inode *inode)
{
- struct address_space *mapping = page->mapping;
+ struct address_space *mapping = page_mapping_cache(page);
struct inode *dir = mapping->host;
loff_t pos = page_offset(page) +
(char *)de-(char*)page_address(page);
-
Changes page->mapping handling in UDFFS
Signed-off-by: KAMEZAWA hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/udf/file.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: test-2.6.23-rc4-mm1/fs/udf/file.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/udf/file.c
+++ test-2.6.23-rc4-mm1/fs/udf/file.c
@@ -43,7 +43,7 @@
static int udf_adinicb_readpage(struct file *file, struct page *page)
{
- struct inode *inode = page->mapping->host;
+ struct inode *inode = page_inode(page);
char *kaddr;
BUG_ON(!PageLocked(page));
@@ -61,7 +61,7 @@ static int udf_adinicb_readpage(struct f
static int udf_adinicb_writepage(struct page *page, struct writeback_control *wbc)
{
- struct inode *inode = page->mapping->host;
+ struct inode *inode = page_inode(page);
char *kaddr;
BUG_ON(!PageLocked(page));
Index: test-2.6.23-rc4-mm1/fs/udf/symlink.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/udf/symlink.c
+++ test-2.6.23-rc4-mm1/fs/udf/symlink.c
@@ -73,7 +73,7 @@ static void udf_pc_to_char(struct super_
static int udf_symlink_filler(struct file *file, struct page *page)
{
- struct inode *inode = page->mapping->host;
+ struct inode *inode = page_inode(page);
struct buffer_head *bh = NULL;
char *symlink;
int err = -EIO;
-
Changes page->mapping handling in UFS
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/ufs/dir.c | 10 +++++-----
fs/ufs/util.c | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
Index: test-2.6.23-rc4-mm1/fs/ufs/dir.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/ufs/dir.c
+++ test-2.6.23-rc4-mm1/fs/ufs/dir.c
@@ -42,7 +42,7 @@ static inline int ufs_match(struct super
static int ufs_commit_chunk(struct page *page, loff_t pos, unsigned len)
{
- struct address_space *mapping = page->mapping;
+ struct address_space *mapping = page_mapping_cache(page);
struct inode *dir = mapping->host;
int err = 0;
@@ -95,7 +95,7 @@ void ufs_set_link(struct inode *dir, str
int err;
lock_page(page);
- err = __ufs_write_begin(NULL, page->mapping, pos, len,
+ err = __ufs_write_begin(NULL, page_mapping_cache(page), pos, len,
AOP_FLAG_UNINTERRUPTIBLE, &page, NULL);
BUG_ON(err);
@@ -111,7 +111,7 @@ void ufs_set_link(struct inode *dir, str
static void ufs_check_page(struct page *page)
{
- struct inode *dir = page->mapping->host;
+ struct inode *dir = page_inode(page);
struct super_block *sb = dir->i_sb;
char *kaddr = page_address(page);
unsigned offs, rec_len;
@@ -381,7 +381,7 @@ int ufs_add_link(struct dentry *dentry,
got_it:
pos = page_offset(page) +
(char*)de - (char*)page_address(page);
- err = __ufs_write_begin(NULL, page->mapping, pos, rec_len,
+ err = __ufs_write_begin(NULL, page_mapping_cache(page), pos, rec_len,
AOP_FLAG_UNINTERRUPTIBLE, &page, NULL);
if (err)
goto out_unlock;
@@ -518,7 +518,7 @@ int ufs_delete_entry(struct inode *inode
struct page * page)
{
struct super_block *sb = inode->i_sb;
- struct address_space *mapping = page->mapping;
+ struct address_space *mapping = page_mapping_cache(page);
char *kaddr = page_address(page);
unsigned from = ((char*)dir - kaddr) & ~(UFS_SB(sb)->s_uspi->s_dirblksize - ...Changes page->mapping handling in UNIONFS Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> --- fs/unionfs/mmap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) Index: test-2.6.23-rc4-mm1/fs/unionfs/mmap.c =================================================================== --- test-2.6.23-rc4-mm1.orig/fs/unionfs/mmap.c +++ test-2.6.23-rc4-mm1/fs/unionfs/mmap.c @@ -61,7 +61,7 @@ static int unionfs_writepage(struct page char *kaddr, *lower_kaddr; int saved_for_writepages = wbc->for_writepages; - inode = page->mapping->host; + inode = page_inode(page); lower_inode = unionfs_lower_inode(inode); /* find lower page (returns a locked page) */ @@ -225,7 +225,7 @@ static int unionfs_commit_write(struct f if ((err = unionfs_file_revalidate(file, 1))) goto out; - inode = page->mapping->host; + inode = page_inode(page); lower_inode = unionfs_lower_inode(inode); if (UNIONFS_F(file) != NULL) @@ -283,7 +283,7 @@ static void unionfs_sync_page(struct pag struct page *lower_page; struct address_space *mapping; - inode = page->mapping->host; + inode = page_inode(page); lower_inode = unionfs_lower_inode(inode); /* find lower page (returns a locked page) */ @@ -292,7 +292,7 @@ static void unionfs_sync_page(struct pag goto out; /* do the actual sync */ - mapping = lower_page->mapping; + mapping = page_mapping_cache(lower_page); /* * XXX: can we optimize ala RAIF and set the lower page to be * discarded after a successful sync_page? -
Change page->mapping handling in XFS
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/xfs/linux-2.6/xfs_aops.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
Index: test-2.6.23-rc4-mm1/fs/xfs/linux-2.6/xfs_aops.c
===================================================================
--- test-2.6.23-rc4-mm1.orig/fs/xfs/linux-2.6/xfs_aops.c
+++ test-2.6.23-rc4-mm1/fs/xfs/linux-2.6/xfs_aops.c
@@ -595,7 +595,7 @@ xfs_probe_page(
if (PageWriteback(page))
return 0;
- if (page->mapping && PageDirty(page)) {
+ if (page_mapping_cache(page) && PageDirty(page)) {
if (page_has_buffers(page)) {
struct buffer_head *bh, *head;
@@ -697,7 +697,7 @@ xfs_is_delayed_page(
if (PageWriteback(page))
return 0;
- if (page->mapping && page_has_buffers(page)) {
+ if (page_mapping_cache(page) && page_has_buffers(page)) {
struct buffer_head *bh, *head;
int acceptable = 0;
@@ -752,7 +752,7 @@ xfs_convert_page(
goto fail;
if (PageWriteback(page))
goto fail_unlock_page;
- if (page->mapping != inode->i_mapping)
+ if (pagecache_consistent(page, inode->i_mapping))
goto fail_unlock_page;
if (!xfs_is_delayed_page(page, (*ioendp)->io_type))
goto fail_unlock_page;
@@ -1178,7 +1178,7 @@ xfs_vm_writepage(
int error;
int need_trans;
int delalloc, unmapped, unwritten;
- struct inode *inode = page->mapping->host;
+ struct inode *inode = page_inode(page);
xfs_page_trace(XFS_WRITEPAGE_ENTER, inode, page, 0);
@@ -1270,7 +1270,7 @@ xfs_vm_releasepage(
struct page *page,
gfp_t gfp_mask)
{
- struct inode *inode = page->mapping->host;
+ struct inode *inode = page_inode(page);
int dirty, delalloc, unmapped, unwritten;
struct writeback_control wbc = {
.sync_mode = WB_SYNC_ALL,
@@ -1562,7 +1562,7 @@ xfs_vm_invalidatepage(
unsigned long offset)
{
xfs_page_trace(XFS_INVALIDPAGE_ENTER,
- page->mapping->host, page, offset);
+ page_inode(page), page, offset);
...