X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fkernel_patches%2Fpatches%2Fext3-map_inode_page.patch;h=675dc95c589826166e53a202c6178d0afe7cd521;hb=9c9c56e49212f4a005916b8abf942d6de267579d;hp=80f14de6a79cd9fdd1ce0a67e62e5ff59935f74e;hpb=a85b25f04f6ba5bb45c116927c9e5d0e4639dc97;p=fs%2Flustre-release.git diff --git a/lustre/kernel_patches/patches/ext3-map_inode_page.patch b/lustre/kernel_patches/patches/ext3-map_inode_page.patch index 80f14de..675dc95 100644 --- a/lustre/kernel_patches/patches/ext3-map_inode_page.patch +++ b/lustre/kernel_patches/patches/ext3-map_inode_page.patch @@ -5,25 +5,40 @@ fs/ext3/inode.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) ---- linux-2.4.20-l18/fs/ext3/inode.c~ext3-map_inode_page Tue Jul 8 20:07:23 2003 -+++ linux-2.4.20-l18-phil/fs/ext3/inode.c Wed Jul 9 03:56:41 2003 -@@ -2867,3 +2867,58 @@ int ext3_prep_san_write(struct inode *in +Index: lum/fs/ext3/inode.c +=================================================================== +--- lum.orig/fs/ext3/inode.c Sat Nov 22 16:38:51 2003 ++++ lum/fs/ext3/inode.c Fri Nov 28 00:37:18 2003 +@@ -2979,3 +2979,75 @@ ret = ret2; return ret; } + ++/* copied from fs/buffer.c */ ++static void unmap_underlying_metadata(struct buffer_head * bh) ++{ ++ struct buffer_head *old_bh; ++ ++ old_bh = get_hash_table(bh->b_dev, bh->b_blocknr, bh->b_size); ++ if (old_bh) { ++ mark_buffer_clean(old_bh); ++ wait_on_buffer(old_bh); ++ clear_bit(BH_Req, &old_bh->b_state); ++ __brelse(old_bh); ++ } ++} ++ +int ext3_map_inode_page(struct inode *inode, struct page *page, + unsigned long *blocks, int *created, int create) +{ + unsigned int blocksize, blocks_per_page; + unsigned long iblock; -+ struct buffer_head dummy; + void *handle; + int i, rc = 0, failed = 0, needed_blocks; + + blocksize = inode->i_sb->s_blocksize; + blocks_per_page = PAGE_SIZE >> inode->i_sb->s_blocksize_bits; -+ iblock = page->index >> (PAGE_SHIFT - inode->i_sb->s_blocksize_bits); ++ iblock = page->index * blocks_per_page; + + for (i = 0; i < blocks_per_page; i++, iblock++) { + blocks[i] = ext3_bmap(inode->i_mapping, iblock); @@ -38,25 +53,29 @@ + if (failed == 0 || create == 0) + return 0; + -+ needed_blocks = ext3_writepage_trans_blocks(inode) * failed; ++ needed_blocks = ext3_writepage_trans_blocks(inode); + lock_kernel(); + handle = ext3_journal_start(inode, needed_blocks); + unlock_kernel(); + if (IS_ERR(handle)) + return PTR_ERR(handle); + -+ iblock = page->index >> (PAGE_SHIFT - inode->i_sb->s_blocksize_bits); ++ iblock = page->index * blocks_per_page; + for (i = 0; i < blocks_per_page; i++, iblock++) { ++ struct buffer_head bh; ++ + if (blocks[i] != 0) + continue; + -+ rc = ext3_get_block_handle(handle, inode, iblock, &dummy, 1); ++ rc = ext3_get_block_handle(handle, inode, iblock, &bh, 1); + if (rc) { -+ printk(KERN_INFO "ext3_map_inode_page: error reading " -+ "block %ld\n", iblock); ++ printk(KERN_INFO "ext3_map_inode_page: error %d " ++ "allocating block %ld\n", rc, iblock); + goto out; + } -+ blocks[i] = dummy.b_blocknr; ++ if (buffer_new(&bh)) ++ unmap_underlying_metadata(&bh); ++ blocks[i] = bh.b_blocknr; + created[i] = 1; + } + @@ -66,8 +85,10 @@ + unlock_kernel(); + return rc; +} ---- linux-2.4.20-l18/fs/ext3/ext3-exports.c~ext3-map_inode_page Tue Jul 8 20:07:10 2003 -+++ linux-2.4.20-l18-phil/fs/ext3/ext3-exports.c Tue Jul 8 20:09:02 2003 +Index: lum/fs/ext3/ext3-exports.c +=================================================================== +--- lum.orig/fs/ext3/ext3-exports.c Sat Nov 22 16:38:51 2003 ++++ lum/fs/ext3/ext3-exports.c Sat Nov 22 16:38:51 2003 @@ -9,6 +9,8 @@ int ext3_prep_san_write(struct inode *inode, long *blocks, @@ -77,7 +98,7 @@ EXPORT_SYMBOL(ext3_force_commit); EXPORT_SYMBOL(ext3_bread); -@@ -18,3 +20,4 @@ EXPORT_SYMBOL(ext3_xattr_get); +@@ -18,3 +20,4 @@ EXPORT_SYMBOL(ext3_xattr_list); EXPORT_SYMBOL(ext3_xattr_set); EXPORT_SYMBOL(ext3_prep_san_write);