Modify ext4_block_truncate_page() to return the zeroed length. This is prepared for the move out of ordered data handling in __ext4_block_zero_page_range(), which is prepared for the conversion of block zero range to the iomap infrastructure. Signed-off-by: Zhang Yi --- fs/ext4/inode.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 759a2a031a9d..f856ea015263 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4163,6 +4163,7 @@ static int ext4_block_zero_page_range(handle_t *handle, * up to the end of the block which corresponds to `from'. * This required during truncate. We need to physically zero the tail end * of that block so it doesn't yield old data if the file is later grown. + * Return the zeroed length on success. */ static int ext4_block_truncate_page(handle_t *handle, struct address_space *mapping, loff_t from) @@ -4170,6 +4171,8 @@ static int ext4_block_truncate_page(handle_t *handle, unsigned length; unsigned blocksize; struct inode *inode = mapping->host; + bool did_zero = false; + int err; /* If we are processing an encrypted inode during orphan list handling */ if (IS_ENCRYPTED(inode) && !fscrypt_has_encryption_key(inode)) @@ -4178,7 +4181,12 @@ static int ext4_block_truncate_page(handle_t *handle, blocksize = i_blocksize(inode); length = blocksize - (from & (blocksize - 1)); - return ext4_block_zero_page_range(handle, mapping, from, length, NULL); + err = ext4_block_zero_page_range(handle, mapping, from, length, + &did_zero); + if (err) + return err; + + return did_zero ? length : 0; } int ext4_zero_partial_blocks(handle_t *handle, struct inode *inode, -- 2.52.0