Merge tag 'for-f2fs-v4.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs
Pull f2fs fixes from Jaegeuk Kim. * tag 'for-f2fs-v4.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs: f2fs: call set_page_dirty to attach i_wb for cgroup f2fs: handle error cases in move_encrypted_block
This commit is contained in:
commit
2ee6b00070
|
@ -2072,8 +2072,6 @@ static int f2fs_set_data_page_dirty(struct page *page)
|
|||
return 1;
|
||||
}
|
||||
|
||||
mark_inode_dirty(inode);
|
||||
|
||||
if (!PageDirty(page)) {
|
||||
__set_page_dirty_nobuffers(page);
|
||||
update_dirty_page(inode, page);
|
||||
|
|
|
@ -1331,12 +1331,13 @@ static int f2fs_ioc_commit_atomic_write(struct file *filp)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (f2fs_is_atomic_file(inode))
|
||||
if (f2fs_is_atomic_file(inode)) {
|
||||
clear_inode_flag(F2FS_I(inode), FI_ATOMIC_FILE);
|
||||
commit_inmem_pages(inode, false);
|
||||
}
|
||||
|
||||
ret = f2fs_sync_file(filp, 0, LONG_MAX, 0);
|
||||
mnt_drop_write_file(filp);
|
||||
clear_inode_flag(F2FS_I(inode), FI_ATOMIC_FILE);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1387,8 +1388,8 @@ static int f2fs_ioc_abort_volatile_write(struct file *filp)
|
|||
f2fs_balance_fs(F2FS_I_SB(inode));
|
||||
|
||||
if (f2fs_is_atomic_file(inode)) {
|
||||
commit_inmem_pages(inode, false);
|
||||
clear_inode_flag(F2FS_I(inode), FI_ATOMIC_FILE);
|
||||
commit_inmem_pages(inode, false);
|
||||
}
|
||||
|
||||
if (f2fs_is_volatile_file(inode))
|
||||
|
|
32
fs/f2fs/gc.c
32
fs/f2fs/gc.c
|
@ -556,27 +556,39 @@ static void move_encrypted_block(struct inode *inode, block_t bidx)
|
|||
if (!fio.encrypted_page)
|
||||
goto put_out;
|
||||
|
||||
f2fs_submit_page_bio(&fio);
|
||||
|
||||
/* allocate block address */
|
||||
f2fs_wait_on_page_writeback(dn.node_page, NODE);
|
||||
|
||||
allocate_data_block(fio.sbi, NULL, fio.blk_addr,
|
||||
&fio.blk_addr, &sum, CURSEG_COLD_DATA);
|
||||
dn.data_blkaddr = fio.blk_addr;
|
||||
err = f2fs_submit_page_bio(&fio);
|
||||
if (err)
|
||||
goto put_page_out;
|
||||
|
||||
/* write page */
|
||||
lock_page(fio.encrypted_page);
|
||||
|
||||
if (unlikely(!PageUptodate(fio.encrypted_page)))
|
||||
goto put_page_out;
|
||||
if (unlikely(fio.encrypted_page->mapping != META_MAPPING(fio.sbi)))
|
||||
goto put_page_out;
|
||||
|
||||
set_page_dirty(fio.encrypted_page);
|
||||
f2fs_wait_on_page_writeback(fio.encrypted_page, META);
|
||||
if (clear_page_dirty_for_io(fio.encrypted_page))
|
||||
dec_page_count(fio.sbi, F2FS_DIRTY_META);
|
||||
|
||||
set_page_writeback(fio.encrypted_page);
|
||||
|
||||
/* allocate block address */
|
||||
f2fs_wait_on_page_writeback(dn.node_page, NODE);
|
||||
allocate_data_block(fio.sbi, NULL, fio.blk_addr,
|
||||
&fio.blk_addr, &sum, CURSEG_COLD_DATA);
|
||||
fio.rw = WRITE_SYNC;
|
||||
f2fs_submit_page_mbio(&fio);
|
||||
|
||||
dn.data_blkaddr = fio.blk_addr;
|
||||
set_data_blkaddr(&dn);
|
||||
f2fs_update_extent_cache(&dn);
|
||||
set_inode_flag(F2FS_I(inode), FI_APPEND_WRITE);
|
||||
if (page->index == 0)
|
||||
set_inode_flag(F2FS_I(inode), FI_FIRST_BLOCK_WRITTEN);
|
||||
|
||||
put_page_out:
|
||||
f2fs_put_page(fio.encrypted_page, 1);
|
||||
put_out:
|
||||
f2fs_put_dnode(&dn);
|
||||
|
@ -605,8 +617,8 @@ static void move_data_page(struct inode *inode, block_t bidx, int gc_type)
|
|||
.page = page,
|
||||
.encrypted_page = NULL,
|
||||
};
|
||||
set_page_dirty(page);
|
||||
f2fs_wait_on_page_writeback(page, DATA);
|
||||
|
||||
if (clear_page_dirty_for_io(page))
|
||||
inode_dec_dirty_pages(inode);
|
||||
set_cold_data(page);
|
||||
|
|
|
@ -141,6 +141,8 @@ int f2fs_convert_inline_page(struct dnode_of_data *dn, struct page *page)
|
|||
kunmap_atomic(dst_addr);
|
||||
SetPageUptodate(page);
|
||||
no_update:
|
||||
set_page_dirty(page);
|
||||
|
||||
/* clear dirty state */
|
||||
dirty = clear_page_dirty_for_io(page);
|
||||
|
||||
|
|
|
@ -257,6 +257,7 @@ void commit_inmem_pages(struct inode *inode, bool abort)
|
|||
if (!abort) {
|
||||
lock_page(cur->page);
|
||||
if (cur->page->mapping == inode->i_mapping) {
|
||||
set_page_dirty(cur->page);
|
||||
f2fs_wait_on_page_writeback(cur->page, DATA);
|
||||
if (clear_page_dirty_for_io(cur->page))
|
||||
inode_dec_dirty_pages(inode);
|
||||
|
|
Loading…
Reference in New Issue