Commit 57219682 authored by Zhang Yi's avatar Zhang Yi
Browse files

ext4: implement zero_range iomap path

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I9DN5Z


CVE: NA

--------------------------------

Add ext4_iomap_zero_range() for the zero_range iomap path, it zero out
the mapped blocks, all work have been done in iomap_zero_range(), so
call it directly.

Signed-off-by: default avatarZhang Yi <yi.zhang@huawei.com>
parent f7616782
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -4175,6 +4175,13 @@ static int __ext4_block_zero_page_range(handle_t *handle,
	return err;
}

static int ext4_iomap_zero_range(struct inode *inode,
				 loff_t from, loff_t length)
{
	return iomap_zero_range(inode, from, length, NULL,
				&ext4_iomap_buffered_read_ops);
}

/*
 * ext4_block_zero_page_range() zeros out a mapping of length 'length'
 * starting from file offset 'from'.  The range to be zero'd must
@@ -4200,6 +4207,8 @@ static int ext4_block_zero_page_range(handle_t *handle,
	if (IS_DAX(inode)) {
		return dax_zero_range(inode, from, length, NULL,
				      &ext4_iomap_ops);
	} else if (ext4_test_inode_state(inode, EXT4_STATE_BUFFERED_IOMAP)) {
		return ext4_iomap_zero_range(inode, from, length);
	}
	return __ext4_block_zero_page_range(handle, mapping, from, length);
}