All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] f2fs: fix m_may_create to make OPU DIO write correctly
@ 2018-11-16 19:41 Jia Zhu
  2018-11-19  6:24 ` Chao Yu
  2018-11-19 20:29 ` [PATCH v2] " Jia Zhu
  0 siblings, 2 replies; 5+ messages in thread
From: Jia Zhu @ 2018-11-16 19:41 UTC (permalink / raw)
  To: jaegeuk, chao, yuchao0, jaizhu.zj; +Cc: Jia Zhu, linux-f2fs-devel

Commit 7bc0f46d418a ("f2fs: fix out-place-update DIO write")
added a parameter map.m_may_create to replace @create for
triggering OPU allocation correctly.

But we find it is still in-place-update when used AndroBench
to test this feature.In f2fs_map_blocks(), @create has been
overwritten by the code below. So the function can not allocate
new block address and directly go out.
code:
create = dio->op == REQ_OP_WRITE;
if (dio->flags & DIO_SKIP_HOLES) {
	if (fs_startblk <= ((i_size_read(dio->inode) -1) >>i_blkbits))
		create = 0;
		}

This patch use @map.m_may_create to replace @create to avoid
this problem.

Signed-off-by: Jia Zhu <zhujia13@huawei.com>
---
 fs/f2fs/data.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 8780f3d..9b61cba 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1034,7 +1034,7 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map,
 	pgofs =	(pgoff_t)map->m_lblk;
 	end = pgofs + maxblocks;
 
-	if (!create && f2fs_lookup_extent_cache(inode, pgofs, &ei)) {
+	if (!map->m_may_create && f2fs_lookup_extent_cache(inode, pgofs, &ei)) {
 		map->m_pblk = ei.blk + pgofs - ei.fofs;
 		map->m_len = min((pgoff_t)maxblocks, ei.fofs + ei.len - pgofs);
 		map->m_flags = F2FS_MAP_MAPPED;
@@ -1093,7 +1093,7 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map,
 				set_inode_flag(inode, FI_APPEND_WRITE);
 		}
 	} else {
-		if (create) {
+		if (map->m_may_create) {
 			if (unlikely(f2fs_cp_error(sbi))) {
 				err = -EIO;
 				goto sync_out;
-- 
2.10.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-11-27  3:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-16 19:41 [PATCH] f2fs: fix m_may_create to make OPU DIO write correctly Jia Zhu
2018-11-19  6:24 ` Chao Yu
2018-11-19 20:29 ` [PATCH v2] " Jia Zhu
2018-11-20 11:58   ` Chao Yu
2018-11-27  3:15     ` Chao Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.