Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fscrypt: pass a byte length to fscrypt_zeroout_range_inline_crypt

Range lengths are usually expressed as bytes in the VFS, switch
fscrypt_zeroout_range_inline_crypt to this convention.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20260302141922.370070-11-hch@lst.de
Signed-off-by: Eric Biggers <ebiggers@kernel.org>

authored by

Christoph Hellwig and committed by
Eric Biggers
90950ee5 090c5c15

+4 -8
+4 -8
fs/crypto/bio.c
··· 71 71 72 72 static int fscrypt_zeroout_range_inline_crypt(const struct inode *inode, 73 73 loff_t pos, sector_t sector, 74 - unsigned int len) 74 + u64 len) 75 75 { 76 - const unsigned int blockbits = inode->i_blkbits; 77 - const unsigned int blocks_per_page = 1 << (PAGE_SHIFT - blockbits); 78 76 struct fscrypt_zero_done done = { 79 77 .pending = ATOMIC_INIT(1), 80 78 .done = COMPLETION_INITIALIZER_ONSTACK(done.done), ··· 90 92 fscrypt_set_bio_crypt_ctx(bio, inode, pos, GFP_NOFS); 91 93 92 94 for (n = 0; n < BIO_MAX_VECS; n++) { 93 - unsigned int blocks_this_page = 94 - min(len, blocks_per_page); 95 - unsigned int bytes_this_page = blocks_this_page << blockbits; 95 + unsigned int bytes_this_page = min(len, PAGE_SIZE); 96 96 97 97 __bio_add_page(bio, ZERO_PAGE(0), bytes_this_page, 0); 98 - len -= blocks_this_page; 98 + len -= bytes_this_page; 99 99 pos += bytes_this_page; 100 100 sector += (bytes_this_page >> SECTOR_SHIFT); 101 101 if (!len || !fscrypt_mergeable_bio(bio, inode, pos)) ··· 151 155 152 156 if (fscrypt_inode_uses_inline_crypto(inode)) 153 157 return fscrypt_zeroout_range_inline_crypt(inode, pos, sector, 154 - len); 158 + (u64)len << inode->i_blkbits); 155 159 156 160 BUILD_BUG_ON(ARRAY_SIZE(pages) > BIO_MAX_VECS); 157 161 nr_pages = min_t(u64, ARRAY_SIZE(pages),