summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2026-03-02 17:18:14 +0300
committerEric Biggers <ebiggers@kernel.org>2026-03-09 23:31:51 +0300
commit090c5c1597491e66097ccd21612e3ab9dcfcb231 (patch)
treecbc92442dacaeaf6e29f14a7c6787ef2f9e227f9
parent3c7eaa775d8e008135646bd4b7aa7db7c5e40a0e (diff)
downloadlinux-090c5c1597491e66097ccd21612e3ab9dcfcb231.tar.xz
fscrypt: pass a byte offset to fscrypt_zeroout_range_inline_crypt
Logical offsets into an inode are usually expressed as bytes in the VFS. Switch fscrypt_zeroout_range_inline_crypt to that convention. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20260302141922.370070-10-hch@lst.de Signed-off-by: Eric Biggers <ebiggers@kernel.org>
-rw-r--r--fs/crypto/bio.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/crypto/bio.c b/fs/crypto/bio.c
index e7fb2fdd9728..7558b3e69701 100644
--- a/fs/crypto/bio.c
+++ b/fs/crypto/bio.c
@@ -70,12 +70,11 @@ static void fscrypt_zeroout_range_end_io(struct bio *bio)
}
static int fscrypt_zeroout_range_inline_crypt(const struct inode *inode,
- pgoff_t lblk, sector_t sector,
+ loff_t pos, sector_t sector,
unsigned int len)
{
const unsigned int blockbits = inode->i_blkbits;
const unsigned int blocks_per_page = 1 << (PAGE_SHIFT - blockbits);
- loff_t pos = (loff_t)lblk << blockbits;
struct fscrypt_zero_done done = {
.pending = ATOMIC_INIT(1),
.done = COMPLETION_INITIALIZER_ONSTACK(done.done),
@@ -142,6 +141,7 @@ int fscrypt_zeroout_range(const struct inode *inode, pgoff_t lblk,
const unsigned int du_per_page = 1U << du_per_page_bits;
u64 du_index = (u64)lblk << (inode->i_blkbits - du_bits);
u64 du_remaining = (u64)len << (inode->i_blkbits - du_bits);
+ loff_t pos = (loff_t)lblk << inode->i_blkbits;
sector_t sector = pblk << (inode->i_blkbits - SECTOR_SHIFT);
struct page *pages[16]; /* write up to 16 pages at a time */
unsigned int nr_pages;
@@ -154,7 +154,7 @@ int fscrypt_zeroout_range(const struct inode *inode, pgoff_t lblk,
return 0;
if (fscrypt_inode_uses_inline_crypto(inode))
- return fscrypt_zeroout_range_inline_crypt(inode, lblk, sector,
+ return fscrypt_zeroout_range_inline_crypt(inode, pos, sector,
len);
BUILD_BUG_ON(ARRAY_SIZE(pages) > BIO_MAX_VECS);