summaryrefslogtreecommitdiffstats
path: root/fs/ext4/extents.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.com>2015-12-07 15:10:26 -0500
committerTheodore Ts'o <tytso@mit.edu>2015-12-07 15:10:26 -0500
commitc86d8db33a922da808a5560aa15ed663a9569b37 (patch)
tree64ee357906cb5d2a0408a9613532460e49b7b6c9 /fs/ext4/extents.c
parent53085fac02d12fcd29a9cb074ec480ff0f77ae5c (diff)
downloadblackbird-op-linux-c86d8db33a922da808a5560aa15ed663a9569b37.tar.gz
blackbird-op-linux-c86d8db33a922da808a5560aa15ed663a9569b37.zip
ext4: implement allocation of pre-zeroed blocks
DAX page fault path needs to get blocks that are pre-zeroed to avoid races when two concurrent page faults happen in the same block of a file. Implement support for this in ext4_map_blocks(). Signed-off-by: Jan Kara <jack@suse.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/extents.c')
-rw-r--r--fs/ext4/extents.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 867e98b6bc6c..b52fea3b7219 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4044,6 +4044,14 @@ ext4_ext_handle_unwritten_extents(handle_t *handle, struct inode *inode,
}
/* IO end_io complete, convert the filled extent to written */
if (flags & EXT4_GET_BLOCKS_CONVERT) {
+ if (flags & EXT4_GET_BLOCKS_ZERO) {
+ if (allocated > map->m_len)
+ allocated = map->m_len;
+ err = ext4_issue_zeroout(inode, map->m_lblk, newblock,
+ allocated);
+ if (err < 0)
+ goto out2;
+ }
ret = ext4_convert_unwritten_extents_endio(handle, inode, map,
ppath);
if (ret >= 0) {
OpenPOWER on IntegriCloud