From: Nick Piggin These are some write_begin aops conversion fixes for the current -mm tree. I didn't quite get it building, but did compile test at least. Patches all address the same silly bug in my directory pagecache conversions. ext2 directory code has a conversion overflow. Spotted by Hugh Dickins. Probably would hurt anyone in practice unless they are using >4GB directories, but must fix. Signed-off-by: Nick Piggin Signed-off-by: Andrew Morton --- fs/ext2/dir.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff -puN fs/ext2/dir.c~ext2-convert-to-new-aops-fix fs/ext2/dir.c --- a/fs/ext2/dir.c~ext2-convert-to-new-aops-fix +++ a/fs/ext2/dir.c @@ -424,7 +424,7 @@ ino_t ext2_inode_by_name(struct inode * void ext2_set_link(struct inode *dir, struct ext2_dir_entry_2 *de, struct page *page, struct inode *inode) { - loff_t pos = (page->index << PAGE_CACHE_SHIFT) + + loff_t pos = page_offset(page) + (char *) de - (char *) page_address(page); unsigned len = le16_to_cpu(de->rec_len); int err; @@ -511,7 +511,7 @@ int ext2_add_link (struct dentry *dentry return -EINVAL; got_it: - pos = (page->index << PAGE_CACHE_SHIFT) + + pos = page_offset(page) + (char*)de - (char*)page_address(page); err = __ext2_write_begin(NULL, page->mapping, pos, rec_len, 0, &page, NULL); @@ -569,7 +569,7 @@ int ext2_delete_entry (struct ext2_dir_e } if (pde) from = (char*)pde - (char*)page_address(page); - pos = (page->index << PAGE_CACHE_SHIFT) + from; + pos = page_offset(page) + from; lock_page(page); err = __ext2_write_begin(NULL, page->mapping, pos, to - from, 0, &page, NULL); _