1 fs/ext3/inode.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 fs/ext3/super.c | 3 +++
3 2 files changed, 55 insertions(+)
5 Index: linux-2.6.0/fs/ext3/inode.c
6 ===================================================================
7 --- linux-2.6.0.orig/fs/ext3/inode.c 2003-12-31 00:33:49.000000000 +0300
8 +++ linux-2.6.0/fs/ext3/inode.c 2003-12-31 01:14:17.000000000 +0300
14 +int ext3_map_inode_page(struct inode *inode, struct page *page,
15 + unsigned long *blocks, int *created, int create)
17 + unsigned int blocksize, blocks_per_page;
18 + unsigned long iblock;
19 + struct buffer_head dummy;
21 + int i, rc = 0, failed = 0, needed_blocks;
23 + blocksize = inode->i_sb->s_blocksize;
24 + blocks_per_page = PAGE_SIZE >> inode->i_sb->s_blocksize_bits;
25 + iblock = page->index * blocks_per_page;
27 + for (i = 0; i < blocks_per_page; i++, iblock++) {
28 + blocks[i] = ext3_bmap(inode->i_mapping, iblock);
29 + if (blocks[i] == 0) {
33 + } else if (created) {
38 + if (failed == 0 || create == 0)
41 + needed_blocks = ext3_writepage_trans_blocks(inode);
42 + handle = ext3_journal_start(inode, needed_blocks);
44 + return PTR_ERR(handle);
46 + iblock = page->index * blocks_per_page;
47 + for (i = 0; i < blocks_per_page; i++, iblock++) {
51 + rc = ext3_get_block_handle(handle, inode, iblock, &dummy, 1, 1);
53 + printk(KERN_INFO "ext3_map_inode_page: error reading "
54 + "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 + ext3_journal_stop(handle);
72 Index: linux-2.6.0/fs/ext3/super.c
73 ===================================================================
74 --- linux-2.6.0.orig/fs/ext3/super.c 2003-12-31 00:33:49.000000000 +0300
75 +++ linux-2.6.0/fs/ext3/super.c 2003-12-31 01:10:40.000000000 +0300
76 @@ -2051,6 +2051,10 @@
77 int nblocks, loff_t newsize);
78 EXPORT_SYMBOL(ext3_prep_san_write);
80 +int ext3_map_inode_page(struct inode *inode, struct page *page,
81 + unsigned long *blocks, int *created, int create);
82 +EXPORT_SYMBOL(ext3_map_inode_page);
84 MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others");
85 MODULE_DESCRIPTION("Second Extended Filesystem with journaling extensions");
86 MODULE_LICENSE("GPL");