4 fs/ext3/ext3-exports.c | 3 ++
5 fs/ext3/inode.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++
6 2 files changed, 58 insertions(+)
8 Index: linux-2.4.18-p4smp/fs/ext3/ext3-exports.c
9 ===================================================================
10 --- linux-2.4.18-p4smp.orig/fs/ext3/ext3-exports.c Thu Nov 27 22:18:40 2003
11 +++ linux-2.4.18-p4smp/fs/ext3/ext3-exports.c Thu Nov 27 22:18:40 2003
14 int ext3_prep_san_write(struct inode *inode, long *blocks,
15 int nblocks, loff_t newsize);
16 +int ext3_map_inode_page(struct inode *inode, struct page *page,
17 + unsigned long *block, int *created, int create);
19 EXPORT_SYMBOL(ext3_force_commit);
20 EXPORT_SYMBOL(ext3_bread);
22 EXPORT_SYMBOL(ext3_xattr_list);
23 EXPORT_SYMBOL(ext3_xattr_set);
24 EXPORT_SYMBOL(ext3_prep_san_write);
25 +EXPORT_SYMBOL(ext3_map_inode_page);
26 Index: linux-2.4.18-p4smp/fs/ext3/inode.c
27 ===================================================================
28 --- linux-2.4.18-p4smp.orig/fs/ext3/inode.c Thu Nov 27 22:18:40 2003
29 +++ linux-2.4.18-p4smp/fs/ext3/inode.c Thu Nov 27 22:20:36 2003
30 @@ -3004,3 +3004,75 @@
35 +/* copied from fs/buffer.c */
36 +static void unmap_underlying_metadata(struct buffer_head * bh)
38 + struct buffer_head *old_bh;
40 + old_bh = get_hash_table(bh->b_dev, bh->b_blocknr, bh->b_size);
42 + mark_buffer_clean(old_bh);
43 + wait_on_buffer(old_bh);
44 + clear_bit(BH_Req, &old_bh->b_state);
49 +int ext3_map_inode_page(struct inode *inode, struct page *page,
50 + unsigned long *blocks, int *created, int create)
52 + unsigned int blocksize, blocks_per_page;
53 + unsigned long iblock;
55 + int i, rc = 0, failed = 0, needed_blocks;
57 + blocksize = inode->i_sb->s_blocksize;
58 + blocks_per_page = PAGE_SIZE >> inode->i_sb->s_blocksize_bits;
59 + iblock = page->index * blocks_per_page;
61 + for (i = 0; i < blocks_per_page; i++, iblock++) {
62 + blocks[i] = ext3_bmap(inode->i_mapping, iblock);
63 + if (blocks[i] == 0) {
71 + if (failed == 0 || create == 0)
74 + needed_blocks = ext3_writepage_trans_blocks(inode);
76 + handle = ext3_journal_start(inode, needed_blocks);
79 + return PTR_ERR(handle);
81 + iblock = page->index * blocks_per_page;
82 + for (i = 0; i < blocks_per_page; i++, iblock++) {
83 + struct buffer_head bh;
88 + rc = ext3_get_block_handle(handle, inode, iblock, &bh, 1);
90 + printk(KERN_INFO "ext3_map_inode_page: error %d "
91 + "allocating block %ld\n", rc, iblock);
94 + if (buffer_new(&bh))
95 + unmap_underlying_metadata(&bh);
96 + blocks[i] = bh.b_blocknr;
102 + ext3_journal_stop(handle, inode);