This patch should be merged with ext4-online-defrag-relocate-file-data.patch It originally came from ext4_journal_credits_fix_for_writepages.patch, but was split off when this patch was moved into the stable part of the patch queue. Cc: Akira Fujita Cc: Takashi Sato Signed-off-by: Mingming Cao Signed-off-by: "Theodore Ts'o" --- Index: linux-2.6.26-git6/fs/ext4/defrag.c =================================================================== --- linux-2.6.26-git6.orig/fs/ext4/defrag.c 2008-07-25 17:39:23.000000000 -0700 +++ linux-2.6.26-git6/fs/ext4/defrag.c 2008-07-25 17:39:52.000000000 -0700 @@ -1494,7 +1495,7 @@ ext4_defrag_partial(struct inode *tmp_in * It needs twice the amount of ordinary journal buffers because * inode and tmp_inode may change each different metadata blocks. */ - jblocks = ext4_writepage_trans_blocks(org_inode) * 2; + jblocks = ext4_writepages_trans_blocks(org_inode, 1) * 2; handle = ext4_journal_start(org_inode, jblocks); if (IS_ERR(handle)) { ret = PTR_ERR(handle);