Skip to content

Commit 9547227

Browse files
Darrick J. Wongbrauner
authored andcommitted
fsdax: remove zeroing code from dax_unshare_iter
Remove the code in dax_unshare_iter that zeroes the destination memory because it's not necessary. If srcmap is unwritten, we don't have to do anything because that unwritten extent came from the regular file mapping, and unwritten extents cannot be shared. The same applies to holes. Furthermore, zeroing to unshare a mapping is just plain wrong because unsharing means copy on write, and we should be copying data. This is effectively a revert of commit 13dd4e0 ("fsdax: unshare: zero destination if srcmap is HOLE or UNWRITTEN") Cc: [email protected] Signed-off-by: Darrick J. Wong <[email protected]> Link: https://lore.kernel.org/r/172796813311.1131942.16033376284752798632.stgit@frogsfrogsfrogs Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 6ef6a0e commit 9547227

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

fs/dax.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,14 +1276,6 @@ static s64 dax_unshare_iter(struct iomap_iter *iter)
12761276
if (ret < 0)
12771277
goto out_unlock;
12781278

1279-
/* zero the distance if srcmap is HOLE or UNWRITTEN */
1280-
if (srcmap->flags & IOMAP_F_SHARED || srcmap->type == IOMAP_UNWRITTEN) {
1281-
memset(daddr, 0, length);
1282-
dax_flush(iomap->dax_dev, daddr, length);
1283-
ret = length;
1284-
goto out_unlock;
1285-
}
1286-
12871279
ret = dax_iomap_direct_access(srcmap, pos, length, &saddr, NULL);
12881280
if (ret < 0)
12891281
goto out_unlock;

0 commit comments

Comments
 (0)