Commit caa4e082 authored by Ross Zwisler's avatar Ross Zwisler Committed by Greg Kroah-Hartman

ext4: use jbd2_inode dirty range scoping

commit 73131fbb upstream.

Use the newly introduced jbd2_inode dirty range scoping to prevent us
from waiting forever when trying to complete a journal transaction.
Signed-off-by: default avatarRoss Zwisler <zwisler@google.com>
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent af3812b6
...@@ -361,20 +361,20 @@ static inline int ext4_journal_force_commit(journal_t *journal) ...@@ -361,20 +361,20 @@ static inline int ext4_journal_force_commit(journal_t *journal)
} }
static inline int ext4_jbd2_inode_add_write(handle_t *handle, static inline int ext4_jbd2_inode_add_write(handle_t *handle,
struct inode *inode) struct inode *inode, loff_t start_byte, loff_t length)
{ {
if (ext4_handle_valid(handle)) if (ext4_handle_valid(handle))
return jbd2_journal_inode_add_write(handle, return jbd2_journal_inode_ranged_write(handle,
EXT4_I(inode)->jinode); EXT4_I(inode)->jinode, start_byte, length);
return 0; return 0;
} }
static inline int ext4_jbd2_inode_add_wait(handle_t *handle, static inline int ext4_jbd2_inode_add_wait(handle_t *handle,
struct inode *inode) struct inode *inode, loff_t start_byte, loff_t length)
{ {
if (ext4_handle_valid(handle)) if (ext4_handle_valid(handle))
return jbd2_journal_inode_add_wait(handle, return jbd2_journal_inode_ranged_wait(handle,
EXT4_I(inode)->jinode); EXT4_I(inode)->jinode, start_byte, length);
return 0; return 0;
} }
......
...@@ -729,10 +729,16 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, ...@@ -729,10 +729,16 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
!(flags & EXT4_GET_BLOCKS_ZERO) && !(flags & EXT4_GET_BLOCKS_ZERO) &&
!ext4_is_quota_file(inode) && !ext4_is_quota_file(inode) &&
ext4_should_order_data(inode)) { ext4_should_order_data(inode)) {
loff_t start_byte =
(loff_t)map->m_lblk << inode->i_blkbits;
loff_t length = (loff_t)map->m_len << inode->i_blkbits;
if (flags & EXT4_GET_BLOCKS_IO_SUBMIT) if (flags & EXT4_GET_BLOCKS_IO_SUBMIT)
ret = ext4_jbd2_inode_add_wait(handle, inode); ret = ext4_jbd2_inode_add_wait(handle, inode,
start_byte, length);
else else
ret = ext4_jbd2_inode_add_write(handle, inode); ret = ext4_jbd2_inode_add_write(handle, inode,
start_byte, length);
if (ret) if (ret)
return ret; return ret;
} }
...@@ -4058,7 +4064,8 @@ static int __ext4_block_zero_page_range(handle_t *handle, ...@@ -4058,7 +4064,8 @@ static int __ext4_block_zero_page_range(handle_t *handle,
err = 0; err = 0;
mark_buffer_dirty(bh); mark_buffer_dirty(bh);
if (ext4_should_order_data(inode)) if (ext4_should_order_data(inode))
err = ext4_jbd2_inode_add_write(handle, inode); err = ext4_jbd2_inode_add_write(handle, inode, from,
length);
} }
unlock: unlock:
......
...@@ -390,7 +390,8 @@ move_extent_per_page(struct file *o_filp, struct inode *donor_inode, ...@@ -390,7 +390,8 @@ move_extent_per_page(struct file *o_filp, struct inode *donor_inode,
/* Even in case of data=writeback it is reasonable to pin /* Even in case of data=writeback it is reasonable to pin
* inode to transaction, to prevent unexpected data loss */ * inode to transaction, to prevent unexpected data loss */
*err = ext4_jbd2_inode_add_write(handle, orig_inode); *err = ext4_jbd2_inode_add_write(handle, orig_inode,
(loff_t)orig_page_offset << PAGE_SHIFT, replaced_size);
unlock_pages: unlock_pages:
unlock_page(pagep[0]); unlock_page(pagep[0]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment