diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2015-01-05 16:02:20 -0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2015-01-09 17:02:27 -0800 |
commit | 38aa0889b2504bbe68e47f51cf73bf7f0a7246bd (patch) | |
tree | bfe9f9ed78dfd70dfec64a83a87835279ecefbf3 /fs/f2fs/data.c | |
parent | 41ef94b35c8df8e01780b4a3362246c51f3aa79b (diff) | |
download | lwn-38aa0889b2504bbe68e47f51cf73bf7f0a7246bd.tar.gz lwn-38aa0889b2504bbe68e47f51cf73bf7f0a7246bd.zip |
f2fs: align direct_io'ed data to section
This patch aligns the start block address of a file for direct io to the f2fs's
section size.
Some flash devices manage an over 4KB-sized page as a write unit, and if the
direct_io'ed data are written but not aligned to that unit, the performance can
be degraded due to the partial page copies.
Thus, since f2fs has a section that is well aligned to FTL units, we can align
the block address to the section size so that f2fs avoids this misalignment.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/data.c')
-rw-r--r-- | fs/f2fs/data.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 3e0f5f303c97..b48b355104c3 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -564,6 +564,7 @@ static int __allocate_data_block(struct dnode_of_data *dn) struct f2fs_inode_info *fi = F2FS_I(dn->inode); struct f2fs_summary sum; struct node_info ni; + int seg = CURSEG_WARM_DATA; pgoff_t fofs; if (unlikely(is_inode_flag_set(F2FS_I(dn->inode), FI_NO_ALLOC))) @@ -574,8 +575,10 @@ static int __allocate_data_block(struct dnode_of_data *dn) get_node_info(sbi, dn->nid, &ni); set_summary(&sum, dn->nid, dn->ofs_in_node, ni.version); - allocate_data_block(sbi, NULL, NULL_ADDR, &dn->data_blkaddr, &sum, - CURSEG_WARM_DATA); + if (dn->ofs_in_node == 0 && dn->inode_page == dn->node_page) + seg = CURSEG_DIRECT_IO; + + allocate_data_block(sbi, NULL, NULL_ADDR, &dn->data_blkaddr, &sum, seg); /* direct IO doesn't use extent cache to maximize the performance */ __set_data_blkaddr(dn); |