diff options
| author | Hou Pengyang <houpengyang@huawei.com> | 2017-04-18 11:57:16 +0000 |
|---|---|---|
| committer | Moyster <oysterized@gmail.com> | 2017-05-21 18:42:18 +0200 |
| commit | 7d987c49a8e8050154286beda2f27b3afeedb2c2 (patch) | |
| tree | b1e1a1bc31d3a969ce122a6e80c8526ba2a14a63 /fs | |
| parent | 0d800e3b032e86df0f495e0eed39d8238f4ba962 (diff) | |
f2fs: introduce async IPU policy
This patch introduces an ASYNC IPU policy.
Under senario of large # of async updating(e.g. log writing in Android),
disk would be seriously fragmented, and higher frequent gc would be triggered.
This patch uses IPU to rewrite the async update writting, since async is
NOT sensitive to io latency.
Signed-off-by: Hou Pengyang <houpengyang@huawei.com>
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/f2fs/data.c | 2 | ||||
| -rw-r--r-- | fs/f2fs/file.c | 2 | ||||
| -rw-r--r-- | fs/f2fs/segment.h | 12 |
3 files changed, 13 insertions, 3 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 6521b780f..597dfc168 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1352,7 +1352,7 @@ retry_encrypt: if (unlikely(fio->old_blkaddr != NEW_ADDR && !is_cold_data(page) && !IS_ATOMIC_WRITTEN_PAGE(page) && - need_inplace_update(inode))) { + need_inplace_update(inode, fio))) { f2fs_unlock_op(F2FS_I_SB(inode)); fio->cp_rwsem_locked = false; err = rewrite_data_page(fio); diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index bf4e3c124..13631db23 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1930,7 +1930,7 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi, int err; /* if in-place-update policy is enabled, don't waste time here */ - if (need_inplace_update(inode)) + if (need_inplace_update(inode, NULL)) return -EINVAL; pg_start = range->start >> PAGE_SHIFT; diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index 7fbe87149..884fc7d62 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -555,9 +555,11 @@ enum { F2FS_IPU_UTIL, F2FS_IPU_SSR_UTIL, F2FS_IPU_FSYNC, + F2FS_IPU_ASYNC, }; -static inline bool need_inplace_update(struct inode *inode) +static inline bool need_inplace_update(struct inode *inode, + struct f2fs_io_info *fio) { struct f2fs_sb_info *sbi = F2FS_I_SB(inode); unsigned int policy = SM_I(sbi)->ipu_policy; @@ -580,6 +582,14 @@ static inline bool need_inplace_update(struct inode *inode) utilization(sbi) > SM_I(sbi)->min_ipu_util) return true; + /* + * IPU for rewrite async pages + */ + if (policy & (0x1 << F2FS_IPU_ASYNC) && + fio && fio->op == REQ_OP_WRITE && + !(fio->op_flags & REQ_SYNC)) + return true; + /* this is only set during fdatasync */ if (policy & (0x1 << F2FS_IPU_FSYNC) && is_inode_flag_set(inode, FI_NEED_IPU)) |
