diff options
| -rw-r--r-- | fs/ext4/inode.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index f346302709b9..d914f612da10 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -3812,17 +3812,19 @@ static int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t length, if (offset + length <= i_size_read(inode)) { ret = ext4_map_blocks(NULL, inode, &map, 0); /* - * For atomic writes the entire requested length should - * be mapped. For DAX we convert extents to initialized - * ones before copying the data, otherwise we do it - * after I/O so there's no need to call into - * ext4_iomap_alloc(). + * For DAX we convert extents to initialized ones before + * copying the data, otherwise we do it after I/O so + * there's no need to call into ext4_iomap_alloc(). */ if ((map.m_flags & EXT4_MAP_MAPPED) || (!(flags & IOMAP_DAX) && (map.m_flags & EXT4_MAP_UNWRITTEN))) { - if ((!(flags & IOMAP_ATOMIC) && ret > 0) || - (flags & IOMAP_ATOMIC && ret >= orig_mlen)) + /* + * For atomic writes the entire requested + * length should be mapped. + */ + if (ret == orig_mlen || + (!(flags & IOMAP_ATOMIC) && ret > 0)) goto out; } map.m_len = orig_mlen; |
