Skip to content

Commit 09cb646

Browse files
committed
Merge tag 'for-f2fs-4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs
Pull f2fs updates from Jaegeuk Kim: "This patch series contains several performance tuning patches regarding to the IO submission flow, in addition to supporting new features such as a ZBC-base drive and multiple devices. It also includes some major bug fixes such as: - checkpoint version control - fdatasync-related roll-forward recovery routine - memory boundary or null-pointer access in corner cases - missing error cases It has various minor clean-up patches as well" * tag 'for-f2fs-4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs: (66 commits) f2fs: fix a missing size change in f2fs_setattr f2fs: fix to access nullified flush_cmd_control pointer f2fs: free meta pages if sanity check for ckpt is failed f2fs: detect wrong layout f2fs: call sync_fs when f2fs is idle Revert "f2fs: use percpu_counter for # of dirty pages in inode" f2fs: return AOP_WRITEPAGE_ACTIVATE for writepage f2fs: do not activate auto_recovery for fallocated i_size f2fs: fix to determine start_cp_addr by sbi->cur_cp_pack f2fs: fix 32-bit build f2fs: set ->owner for debugfs status file's file_operations f2fs: fix incorrect free inode count in ->statfs f2fs: drop duplicate header timer.h f2fs: fix wrong AUTO_RECOVER condition f2fs: do not recover i_size if it's valid f2fs: fix fdatasync f2fs: fix to account total free nid correctly f2fs: fix an infinite loop when flush nodes in cp f2fs: don't wait writeback for datas during checkpoint f2fs: fix wrong written_valid_blocks counting ...
2 parents 19d37ce + c0ed440 commit 09cb646

22 files changed

Lines changed: 1048 additions & 476 deletions

File tree

fs/f2fs/acl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ int f2fs_init_acl(struct inode *inode, struct inode *dir, struct page *ipage,
384384
if (error)
385385
return error;
386386

387-
f2fs_mark_inode_dirty_sync(inode);
387+
f2fs_mark_inode_dirty_sync(inode, true);
388388

389389
if (default_acl) {
390390
error = __f2fs_set_acl(inode, ACL_TYPE_DEFAULT, default_acl,

fs/f2fs/checkpoint.c

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ void ra_meta_pages_cond(struct f2fs_sb_info *sbi, pgoff_t index)
228228
f2fs_put_page(page, 0);
229229

230230
if (readahead)
231-
ra_meta_pages(sbi, index, MAX_BIO_BLOCKS(sbi), META_POR, true);
231+
ra_meta_pages(sbi, index, BIO_MAX_PAGES, META_POR, true);
232232
}
233233

234234
static int f2fs_write_meta_page(struct page *page,
@@ -770,7 +770,12 @@ int get_valid_checkpoint(struct f2fs_sb_info *sbi)
770770

771771
/* Sanity checking of checkpoint */
772772
if (sanity_check_ckpt(sbi))
773-
goto fail_no_cp;
773+
goto free_fail_no_cp;
774+
775+
if (cur_page == cp1)
776+
sbi->cur_cp_pack = 1;
777+
else
778+
sbi->cur_cp_pack = 2;
774779

775780
if (cp_blks <= 1)
776781
goto done;
@@ -793,6 +798,9 @@ int get_valid_checkpoint(struct f2fs_sb_info *sbi)
793798
f2fs_put_page(cp2, 1);
794799
return 0;
795800

801+
free_fail_no_cp:
802+
f2fs_put_page(cp1, 1);
803+
f2fs_put_page(cp2, 1);
796804
fail_no_cp:
797805
kfree(sbi->ckpt);
798806
return -EINVAL;
@@ -921,7 +929,11 @@ int f2fs_sync_inode_meta(struct f2fs_sb_info *sbi)
921929
inode = igrab(&fi->vfs_inode);
922930
spin_unlock(&sbi->inode_lock[DIRTY_META]);
923931
if (inode) {
924-
update_inode_page(inode);
932+
sync_inode_metadata(inode, 0);
933+
934+
/* it's on eviction */
935+
if (is_inode_flag_set(inode, FI_DIRTY_INODE))
936+
update_inode_page(inode);
925937
iput(inode);
926938
}
927939
};
@@ -987,7 +999,7 @@ static void unblock_operations(struct f2fs_sb_info *sbi)
987999
{
9881000
up_write(&sbi->node_write);
9891001

990-
build_free_nids(sbi);
1002+
build_free_nids(sbi, false);
9911003
f2fs_unlock_all(sbi);
9921004
}
9931005

@@ -998,7 +1010,7 @@ static void wait_on_all_pages_writeback(struct f2fs_sb_info *sbi)
9981010
for (;;) {
9991011
prepare_to_wait(&sbi->cp_wait, &wait, TASK_UNINTERRUPTIBLE);
10001012

1001-
if (!atomic_read(&sbi->nr_wb_bios))
1013+
if (!get_pages(sbi, F2FS_WB_CP_DATA))
10021014
break;
10031015

10041016
io_schedule_timeout(5*HZ);
@@ -1123,7 +1135,7 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
11231135
le32_to_cpu(ckpt->checksum_offset)))
11241136
= cpu_to_le32(crc32);
11251137

1126-
start_blk = __start_cp_addr(sbi);
1138+
start_blk = __start_cp_next_addr(sbi);
11271139

11281140
/* need to wait for end_io results */
11291141
wait_on_all_pages_writeback(sbi);
@@ -1184,9 +1196,9 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
11841196
if (unlikely(f2fs_cp_error(sbi)))
11851197
return -EIO;
11861198

1187-
clear_prefree_segments(sbi, cpc);
11881199
clear_sbi_flag(sbi, SBI_IS_DIRTY);
11891200
clear_sbi_flag(sbi, SBI_NEED_CP);
1201+
__set_cp_next_pack(sbi);
11901202

11911203
/*
11921204
* redirty superblock if metadata like node page or inode cache is
@@ -1261,8 +1273,12 @@ int write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
12611273

12621274
/* unlock all the fs_lock[] in do_checkpoint() */
12631275
err = do_checkpoint(sbi, cpc);
1264-
1265-
f2fs_wait_all_discard_bio(sbi);
1276+
if (err) {
1277+
release_discard_addrs(sbi);
1278+
} else {
1279+
clear_prefree_segments(sbi, cpc);
1280+
f2fs_wait_all_discard_bio(sbi);
1281+
}
12661282

12671283
unblock_operations(sbi);
12681284
stat_inc_cp_count(sbi->stat_info);

0 commit comments

Comments
 (0)