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,67 @@ 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_ind_get_blocks(handle, inode, iblock, 1, &dummy,
48 + EXT4_GET_BLOCKS_CREATE);
50 + printk(KERN_INFO "ext4_map_inode_page: error reading "
51 + "block %ld\n", iblock);
58 + /* Unmap any metadata buffers from the block mapping, to avoid
59 + * data corruption due to direct-write from Lustre being
60 + * clobbered by a later flush of the blockdev metadata buffer.*/
61 + if (buffer_new(&dummy))
62 + unmap_underlying_metadata(dummy.b_bdev,
64 + blocks[i] = dummy.b_blocknr;
70 + ext4_journal_stop(handle);
73 Index: linux-2.6.18.i386/fs/ext4/super.c
74 ===================================================================
75 --- linux-2.6.18.i386.orig/fs/ext4/super.c
76 +++ linux-2.6.18.i386/fs/ext4/super.c
77 @@ -3498,6 +3498,10 @@ static void __exit exit_ext4_fs(void)
78 __free_page(ext4_zero_page);
81 +int ext4_map_inode_page(struct inode *inode, struct page *page,
82 + unsigned long *blocks, int *created, int create);
83 +EXPORT_SYMBOL(ext4_map_inode_page);
85 MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others");
86 MODULE_DESCRIPTION("Fourth Extended Filesystem with extents");
87 MODULE_LICENSE("GPL");