On Thu, Feb 26, 2026 at 06:49:32AM -0800, Christoph Hellwig wrote:
>  static int fscrypt_zeroout_range_inline_crypt(const struct inode *inode,
>                                             loff_t pos, sector_t sector,
> -                                           unsigned int len)
> +                                           u64 len)

This hunk should go in the "pass a byte length to
fscrypt_zeroout_range_inline_crypt" patch.

>   * @inode: the file's inode
>   * @pos: the first file position (in bytes) to zero out
>   * @pblk: the first filesystem physical block to zero out
> - * @len: number of blocks to zero out
> + * @len: bytes to zero out

Should document that 'len' must be a multiple of the filesystem block
size

> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 945613c95ffa..675ef741cb30 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -406,7 +406,8 @@ int ext4_issue_zeroout(struct inode *inode, ext4_lblk_t 
> lblk, ext4_fsblk_t pblk,
>  
>       if (IS_ENCRYPTED(inode) && S_ISREG(inode->i_mode))
>               return fscrypt_zeroout_range(inode,
> -                             (loff_t)lblk << inode->i_blkbits, pblk, len);
> +                             (loff_t)lblk << inode->i_blkbits, pblk,
> +                             len << inode->i_blkbits);
>  
>       ret = sb_issue_zeroout(inode->i_sb, pblk, len, GFP_NOFS);
>       if (ret > 0)
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 239c2666ceb5..5b7013f7f6a1 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -4164,7 +4164,7 @@ static int f2fs_secure_erase(struct block_device *bdev, 
> struct inode *inode,
>               if (IS_ENCRYPTED(inode))
>                       ret = fscrypt_zeroout_range(inode,
>                                       (loff_t)off << inode->i_blkbits, block,
> -                                     len);
> +                                     len << inode->i_blkbits);

The two callers should cast len to u64 before shifting it by i_blkbits.

- Eric


_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to