1 Index: linux-2.6.18.i386/fs/ext4/inode.c
2 ===================================================================
3 --- linux-2.6.18.i386.orig/fs/ext4/inode.c
4 +++ linux-2.6.18.i386/fs/ext4/inode.c
5 @@ -3666,3 +3666,66 @@ out_unlock:
10 +int ext4_map_inode_page(struct inode *inode, struct page *page,
11 + unsigned long *blocks, int *created, int create)
13 + unsigned int blocksize, blocks_per_page;
14 + unsigned long iblock;
15 + struct buffer_head dummy;
17 + int i, rc = 0, failed = 0, needed_blocks;
19 + blocksize = inode->i_sb->s_blocksize;
20 + blocks_per_page = PAGE_SIZE >> inode->i_sb->s_blocksize_bits;
21 + iblock = page->index * blocks_per_page;
23 + for (i = 0; i < blocks_per_page; i++, iblock++) {
24 + blocks[i] = ext4_bmap(inode->i_mapping, iblock);
25 + if (blocks[i] == 0) {
29 + } else if (created) {
34 + if (failed == 0 || create == 0)
37 + needed_blocks = ext4_writepage_trans_blocks(inode);
38 + handle = ext4_journal_start(inode, needed_blocks);
40 + return PTR_ERR(handle);
42 + iblock = page->index * blocks_per_page;
43 + for (i = 0; i < blocks_per_page; i++, iblock++) {
47 + rc = ext4_get_blocks_handle(handle, inode, iblock, 1, &dummy, 1, 1);
49 + printk(KERN_INFO "ext4_map_inode_page: error reading "
50 + "block %ld\n", iblock);
57 + /* Unmap any metadata buffers from the block mapping, to avoid
58 + * data corruption due to direct-write from Lustre being
59 + * clobbered by a later flush of the blockdev metadata buffer.*/
60 + if (buffer_new(&dummy))
61 + unmap_underlying_metadata(dummy.b_bdev,
63 + blocks[i] = dummy.b_blocknr;
69 + ext4_journal_stop(handle);
72 Index: linux-2.6.18.i386/fs/ext4/super.c
73 ===================================================================
74 --- linux-2.6.18.i386.orig/fs/ext4/super.c
75 +++ linux-2.6.18.i386/fs/ext4/super.c
76 @@ -3498,6 +3498,10 @@ static void __exit exit_ext4_fs(void)
77 __free_page(ext4_zero_page);
80 +int ext4_map_inode_page(struct inode *inode, struct page *page,
81 + unsigned long *blocks, int *created, int create);
82 +EXPORT_SYMBOL(ext4_map_inode_page);
84 MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others");
85 MODULE_DESCRIPTION("Fourth Extended Filesystem with extents");
86 MODULE_LICENSE("GPL");