mirror of
https://github.com/torvalds/linux.git
synced 2024-11-16 00:52:01 +00:00
f2fs: don't need to call lock_op and lock_page for abort
We don't need to call lock_op and lock_page at the aborting path. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
88a70a69c0
commit
70c640b1d6
@ -240,33 +240,38 @@ void commit_inmem_pages(struct inode *inode, bool abort)
|
|||||||
* Otherwise, f2fs_gc in f2fs_balance_fs can wait forever until this
|
* Otherwise, f2fs_gc in f2fs_balance_fs can wait forever until this
|
||||||
* inode becomes free by iget_locked in f2fs_iget.
|
* inode becomes free by iget_locked in f2fs_iget.
|
||||||
*/
|
*/
|
||||||
if (!abort)
|
if (!abort) {
|
||||||
f2fs_balance_fs(sbi);
|
f2fs_balance_fs(sbi);
|
||||||
|
f2fs_lock_op(sbi);
|
||||||
f2fs_lock_op(sbi);
|
}
|
||||||
|
|
||||||
mutex_lock(&fi->inmem_lock);
|
mutex_lock(&fi->inmem_lock);
|
||||||
list_for_each_entry_safe(cur, tmp, &fi->inmem_pages, list) {
|
list_for_each_entry_safe(cur, tmp, &fi->inmem_pages, list) {
|
||||||
lock_page(cur->page);
|
if (!abort) {
|
||||||
if (!abort && cur->page->mapping == inode->i_mapping) {
|
lock_page(cur->page);
|
||||||
f2fs_wait_on_page_writeback(cur->page, DATA);
|
if (cur->page->mapping == inode->i_mapping) {
|
||||||
if (clear_page_dirty_for_io(cur->page))
|
f2fs_wait_on_page_writeback(cur->page, DATA);
|
||||||
inode_dec_dirty_pages(inode);
|
if (clear_page_dirty_for_io(cur->page))
|
||||||
do_write_data_page(cur->page, &fio);
|
inode_dec_dirty_pages(inode);
|
||||||
submit_bio = true;
|
do_write_data_page(cur->page, &fio);
|
||||||
|
submit_bio = true;
|
||||||
|
}
|
||||||
|
f2fs_put_page(cur->page, 1);
|
||||||
|
} else {
|
||||||
|
put_page(cur->page);
|
||||||
}
|
}
|
||||||
radix_tree_delete(&fi->inmem_root, cur->page->index);
|
radix_tree_delete(&fi->inmem_root, cur->page->index);
|
||||||
f2fs_put_page(cur->page, 1);
|
|
||||||
list_del(&cur->list);
|
list_del(&cur->list);
|
||||||
kmem_cache_free(inmem_entry_slab, cur);
|
kmem_cache_free(inmem_entry_slab, cur);
|
||||||
dec_page_count(F2FS_I_SB(inode), F2FS_INMEM_PAGES);
|
dec_page_count(F2FS_I_SB(inode), F2FS_INMEM_PAGES);
|
||||||
}
|
}
|
||||||
if (submit_bio)
|
|
||||||
f2fs_submit_merged_bio(sbi, DATA, WRITE);
|
|
||||||
mutex_unlock(&fi->inmem_lock);
|
mutex_unlock(&fi->inmem_lock);
|
||||||
|
|
||||||
filemap_fdatawait_range(inode->i_mapping, 0, LLONG_MAX);
|
if (!abort) {
|
||||||
f2fs_unlock_op(sbi);
|
f2fs_unlock_op(sbi);
|
||||||
|
if (submit_bio)
|
||||||
|
f2fs_submit_merged_bio(sbi, DATA, WRITE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user