Skip to content

Commit

Permalink
Merge tag 'for-f2fs-v4.2-rc5' of git://git.kernel.org/pub/scm/linux/k…
Browse files Browse the repository at this point in the history
…ernel/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
  • Loading branch information
Linus Torvalds committed Jul 28, 2015
2 parents cbfe8fa + 6282adb commit 2ee6b00
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 14 deletions.
2 changes: 0 additions & 2 deletions fs/f2fs/data.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 4 additions & 3 deletions fs/f2fs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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))
Expand Down
30 changes: 21 additions & 9 deletions fs/f2fs/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
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);
dn.data_blkaddr = fio.blk_addr;

/* write page */
lock_page(fio.encrypted_page);
set_page_writeback(fio.encrypted_page);
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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions fs/f2fs/inline.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
1 change: 1 addition & 0 deletions fs/f2fs/segment.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2ee6b00

Please sign in to comment.