4 fs/ext3/ext3-exports.c | 3 ++
5 fs/ext3/inode.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++
6 2 files changed, 58 insertions(+)
8 Index: linux-2.4.21-suse2/fs/ext3/inode.c
9 ===================================================================
10 --- linux-2.4.21-suse2.orig/fs/ext3/inode.c 2004-01-10 15:38:24.000000000 +0300
11 +++ linux-2.4.21-suse2/fs/ext3/inode.c 2004-01-10 16:22:45.000000000 +0300
13 /* alloc blocks one by one */
14 for (i = 0; i < nblocks; i++) {
15 ret = ext3_get_block_handle(handle, inode, blocks[i],
21 @@ -3105,3 +3105,75 @@
26 +/* copied from fs/buffer.c */
27 +static void unmap_underlying_metadata(struct buffer_head * bh)
29 + struct buffer_head *old_bh;
31 + old_bh = get_hash_table(bh->b_dev, bh->b_blocknr, bh->b_size);
33 + mark_buffer_clean(old_bh);
34 + wait_on_buffer(old_bh);
35 + clear_bit(BH_Req, &old_bh->b_state);
40 +int ext3_map_inode_page(struct inode *inode, struct page *page,
41 + unsigned long *blocks, int *created, int create)
43 + unsigned int blocksize, blocks_per_page;
44 + unsigned long iblock;
46 + int i, rc = 0, failed = 0, needed_blocks;
48 + blocksize = inode->i_sb->s_blocksize;
49 + blocks_per_page = PAGE_SIZE >> inode->i_sb->s_blocksize_bits;
50 + iblock = page->index * blocks_per_page;
52 + for (i = 0; i < blocks_per_page; i++, iblock++) {
53 + blocks[i] = ext3_bmap(inode->i_mapping, iblock);
54 + if (blocks[i] == 0) {
62 + if (failed == 0 || create == 0)
65 + needed_blocks = ext3_writepage_trans_blocks(inode);
67 + handle = ext3_journal_start(inode, needed_blocks);
70 + return PTR_ERR(handle);
72 + iblock = page->index * blocks_per_page;
73 + for (i = 0; i < blocks_per_page; i++, iblock++) {
74 + struct buffer_head bh;
79 + rc = ext3_get_block_handle(handle, inode, iblock, &bh, 1, 1);
81 + printk(KERN_INFO "ext3_map_inode_page: error %d "
82 + "allocating block %ld\n", rc, iblock);
85 + if (buffer_new(&bh))
86 + unmap_underlying_metadata(&bh);
87 + blocks[i] = bh.b_blocknr;
93 + ext3_journal_stop(handle, inode);
97 Index: linux-2.4.21-suse2/fs/ext3/ext3-exports.c
98 ===================================================================
99 --- linux-2.4.21-suse2.orig/fs/ext3/ext3-exports.c 2004-01-10 15:38:24.000000000 +0300
100 +++ linux-2.4.21-suse2/fs/ext3/ext3-exports.c 2004-01-10 16:22:09.000000000 +0300
103 int ext3_prep_san_write(struct inode *inode, long *blocks,
104 int nblocks, loff_t newsize);
105 +int ext3_map_inode_page(struct inode *inode, struct page *page,
106 + unsigned long *block, int *created, int create);
108 EXPORT_SYMBOL(ext3_force_commit);
109 EXPORT_SYMBOL(ext3_bread);
111 EXPORT_SYMBOL(ext3_xattr_list);
112 EXPORT_SYMBOL(ext3_xattr_set);
113 EXPORT_SYMBOL(ext3_prep_san_write);
114 +EXPORT_SYMBOL(ext3_map_inode_page);