4 fs/ext3/ext3-exports.c | 3 ++
5 fs/ext3/inode.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++
6 2 files changed, 58 insertions(+)
8 Index: lum/fs/ext3/inode.c
9 ===================================================================
10 --- lum.orig/fs/ext3/inode.c Sat Nov 22 16:38:51 2003
11 +++ lum/fs/ext3/inode.c Fri Nov 28 00:37:18 2003
12 @@ -2979,3 +2979,75 @@
17 +/* copied from fs/buffer.c */
18 +static void unmap_underlying_metadata(struct buffer_head * bh)
20 + struct buffer_head *old_bh;
22 + old_bh = get_hash_table(bh->b_dev, bh->b_blocknr, bh->b_size);
24 + mark_buffer_clean(old_bh);
25 + wait_on_buffer(old_bh);
26 + clear_bit(BH_Req, &old_bh->b_state);
31 +int ext3_map_inode_page(struct inode *inode, struct page *page,
32 + unsigned long *blocks, int *created, int create)
34 + unsigned int blocksize, blocks_per_page;
35 + unsigned long iblock;
37 + int i, rc = 0, failed = 0, needed_blocks;
39 + blocksize = inode->i_sb->s_blocksize;
40 + blocks_per_page = PAGE_SIZE >> inode->i_sb->s_blocksize_bits;
41 + iblock = page->index * blocks_per_page;
43 + for (i = 0; i < blocks_per_page; i++, iblock++) {
44 + blocks[i] = ext3_bmap(inode->i_mapping, iblock);
45 + if (blocks[i] == 0) {
53 + if (failed == 0 || create == 0)
56 + needed_blocks = ext3_writepage_trans_blocks(inode);
58 + handle = ext3_journal_start(inode, needed_blocks);
61 + return PTR_ERR(handle);
63 + iblock = page->index * blocks_per_page;
64 + for (i = 0; i < blocks_per_page; i++, iblock++) {
65 + struct buffer_head bh;
70 + rc = ext3_get_block_handle(handle, inode, iblock, &bh, 1);
72 + printk(KERN_INFO "ext3_map_inode_page: error %d "
73 + "allocating block %ld\n", rc, iblock);
76 + if (buffer_new(&bh))
77 + unmap_underlying_metadata(&bh);
78 + blocks[i] = bh.b_blocknr;
84 + ext3_journal_stop(handle, inode);
88 Index: lum/fs/ext3/ext3-exports.c
89 ===================================================================
90 --- lum.orig/fs/ext3/ext3-exports.c Sat Nov 22 16:38:51 2003
91 +++ lum/fs/ext3/ext3-exports.c Sat Nov 22 16:38:51 2003
94 int ext3_prep_san_write(struct inode *inode, long *blocks,
95 int nblocks, loff_t newsize);
96 +int ext3_map_inode_page(struct inode *inode, struct page *page,
97 + unsigned long *block, int *created, int create);
99 EXPORT_SYMBOL(ext3_force_commit);
100 EXPORT_SYMBOL(ext3_bread);
102 EXPORT_SYMBOL(ext3_xattr_list);
103 EXPORT_SYMBOL(ext3_xattr_set);
104 EXPORT_SYMBOL(ext3_prep_san_write);
105 +EXPORT_SYMBOL(ext3_map_inode_page);