summaryrefslogtreecommitdiffstats
path: root/fs/ceph/crypto.h
diff options
context:
space:
mode:
authorJeff Layton <jlayton@kernel.org>2022-08-25 09:31:25 -0400
committerIlya Dryomov <idryomov@gmail.com>2023-08-24 11:24:36 +0200
commitd55207717ded95c8f2760a30e93319fa313186e6 (patch)
tree53f13dc3d3a34346edf4e01a0eff646421a27f5a /fs/ceph/crypto.h
parent33a5f1709a44efa7253b84832fe4a49fccf4924b (diff)
downloadlinux-stable-d55207717ded95c8f2760a30e93319fa313186e6.tar.gz
linux-stable-d55207717ded95c8f2760a30e93319fa313186e6.tar.bz2
linux-stable-d55207717ded95c8f2760a30e93319fa313186e6.zip
ceph: add encryption support to writepage and writepages
Allow writepage to issue encrypted writes. Extend out the requested size and offset to cover complete blocks, and then encrypt and write them to the OSDs. Add the appropriate machinery to write back dirty data with encryption. Signed-off-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: Xiubo Li <xiubli@redhat.com> Reviewed-and-tested-by: Luís Henriques <lhenriques@suse.de> Reviewed-by: Milind Changire <mchangir@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/crypto.h')
-rw-r--r--fs/ceph/crypto.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/fs/ceph/crypto.h b/fs/ceph/crypto.h
index b735b3f144a7..6afa6d888fe0 100644
--- a/fs/ceph/crypto.h
+++ b/fs/ceph/crypto.h
@@ -164,6 +164,12 @@ int ceph_fscrypt_decrypt_extents(struct inode *inode, struct page **page,
u32 ext_cnt);
int ceph_fscrypt_encrypt_pages(struct inode *inode, struct page **page, u64 off,
int len, gfp_t gfp);
+
+static inline struct page *ceph_fscrypt_pagecache_page(struct page *page)
+{
+ return fscrypt_is_bounce_page(page) ? fscrypt_pagecache_page(page) : page;
+}
+
#else /* CONFIG_FS_ENCRYPTION */
static inline void ceph_fscrypt_set_ops(struct super_block *sb)
@@ -267,6 +273,16 @@ static inline int ceph_fscrypt_encrypt_pages(struct inode *inode,
{
return 0;
}
+
+static inline struct page *ceph_fscrypt_pagecache_page(struct page *page)
+{
+ return page;
+}
#endif /* CONFIG_FS_ENCRYPTION */
-#endif
+static inline loff_t ceph_fscrypt_page_offset(struct page *page)
+{
+ return page_offset(ceph_fscrypt_pagecache_page(page));
+}
+
+#endif /* _CEPH_CRYPTO_H */