diff options
author | Jan Kara <jack@suse.cz> | 2016-11-20 18:10:09 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2016-11-20 18:10:09 -0500 |
commit | 96f8ba3dd632aff684cc7c67d9f4af435be0341c (patch) | |
tree | 37f21f25ad22a196966ce2a9ead0e4f695ccd17b /fs/ext4/inode.c | |
parent | 776722e85d3b0936253ecc3d14db4fba37f191ba (diff) | |
download | op-kernel-dev-96f8ba3dd632aff684cc7c67d9f4af435be0341c.zip op-kernel-dev-96f8ba3dd632aff684cc7c67d9f4af435be0341c.tar.gz |
ext4: avoid split extents for DAX writes
Currently mapping of blocks for DAX writes happen with
EXT4_GET_BLOCKS_PRE_IO flag set. That has a result that each
ext4_map_blocks() call creates a separate written extent, although it
could be merged to the neighboring extents in the extent tree. The
reason for using this flag is that in case the extent is unwritten, we
need to convert it to written one and zero it out. However this "convert
mapped range to written" operation is already implemented by
ext4_map_blocks() for the case of data writes into unwritten extent. So
just use flags for that mode of operation, simplify the code, and avoid
unnecessary split extents.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r-- | fs/ext4/inode.c | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 3941cee..29237f2 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -3359,7 +3359,6 @@ retry: return PTR_ERR(handle); ret = ext4_map_blocks(handle, inode, &map, - EXT4_GET_BLOCKS_PRE_IO | EXT4_GET_BLOCKS_CREATE_ZERO); if (ret < 0) { ext4_journal_stop(handle); @@ -3368,22 +3367,6 @@ retry: goto retry; return ret; } - /* For DAX writes we need to zero out unwritten extents */ - if (map.m_flags & EXT4_MAP_UNWRITTEN) { - /* - * We are protected by i_mmap_sem or i_rwsem so we know - * block cannot go away from under us even though we - * dropped i_data_sem. Convert extent to written and - * write zeros there. - */ - ret = ext4_map_blocks(handle, inode, &map, - EXT4_GET_BLOCKS_CONVERT | - EXT4_GET_BLOCKS_CREATE_ZERO); - if (ret < 0) { - ext4_journal_stop(handle); - return ret; - } - } /* * If we added blocks beyond i_size we need to make sure they |