fscrypt: remove struct fscrypt_ctx
Eric Biggers
maintainerPATCH 1/1 fscrypt: remove struct fscrypt_ctx
From: Eric Biggers <[email protected]>
Now that ext4 and f2fs implement their own post-read workflow that supports both fscrypt and fsverity, the fscrypt-only workflow based around struct fscrypt_ctx is no longer used. So remove the unused code.
This is based on a patch from Chandan Rajendra's "Consolidate FS read I/O callbacks code" patchset, but rebased onto the latest kernel, folded __fscrypt_decrypt_bio() into fscrypt_decrypt_bio(), cleaned up fscrypt_initialize(), and updated the commit message.
Originally-from: Chandan Rajendra <[email protected]>
--- fs/crypto/bio.c | 29 +--------- fs/crypto/crypto.c | 110 +++--------------------------------- fs/crypto/fscrypt_private.h | 2 - include/linux/fscrypt.h | 32 ----------- 4 files changed, 10 insertions(+), 163 deletions(-)
fs/crypto/bio.c +1 -28
@@ -26,7 +26,7 @@#include <linux/namei.h> #include "fscrypt_private.h" -static void __fscrypt_decrypt_bio (struct bio *bio,bool done) +void fscrypt_decrypt_bio (struct bio *bio) {struct bio_vec *bv;struct bvec_iter_all iter_all;
@@ -37,37 +37,10 @@ static void __fscrypt_decrypt_bio(struct bio *bio, bool done) bv->bv_offset);if (ret)SetPageError (page); -else if (done) -SetPageUptodate (page); -if (done) -unlock_page (page); } } - -void fscrypt_decrypt_bio (struct bio *bio) -{ -__fscrypt_decrypt_bio (bio, false); -}EXPORT_SYMBOL (fscrypt_decrypt_bio); -static void completion_pages (struct work_struct *work) -{ - struct fscrypt_ctx *ctx = container_of(work, struct fscrypt_ctx, work); -struct bio *bio = ctx->bio; - -__fscrypt_decrypt_bio (bio, true); -fscrypt_release_ctx (ctx); -bio_put (bio); -} - -void fscrypt_enqueue_decrypt_bio (struct fscrypt_ctx *ctx,struct bio *bio) -{ -INIT_WORK (&ctx->work, completion_pages); - ctx->bio = bio; -fscrypt_enqueue_decrypt_work (&ctx->work); -} -EXPORT_SYMBOL (fscrypt_enqueue_decrypt_bio); -int fscrypt_zeroout_range (const struct inode *inode,pgoff_t lblk,sector_t pblk,unsigned int len) {
fs/crypto/crypto.c +9 -101
173 lines not on this page · raw message
fs/crypto/fscrypt_private.h +0 -2
@@ -203,8 +203,6 @@ typedef enum {FS_ENCRYPT , } fscrypt_direction_t; -#define FS_CTX_REQUIRES_FREE_ENCRYPT_FL 0x00000001 -static inline bool fscrypt_valid_enc_modes (u32 contents_mode,u32 filenames_mode) {
include/linux/fscrypt.h +0 -32
@@ -20,7 +20,6 @@#define FS_CRYPTO_BLOCK_SIZE 16 -struct fscrypt_ctx ;struct fscrypt_info ;struct fscrypt_str {
@@ -64,18 +63,6 @@ struct fscrypt_operations {unsigned int max_namelen; }; -/* Decryption work */ -struct fscrypt_ctx { -union { -struct { -struct bio *bio; -struct work_struct work; - }; -struct list_head free_list;/* Free list */ - }; -u8 flags;/* Flags */ -}; -static inline bool fscrypt_has_encryption_key (const struct inode *inode) {/* pairs with cmpxchg_release() in fscrypt_get_encryption_info() */
@@ -102,8 +89,6 @@ static inline void fscrypt_handle_d_move(struct dentry *dentry)/* crypto.c */ extern void fscrypt_enqueue_decrypt_work (struct work_struct *); -extern struct fscrypt_ctx *fscrypt_get_ctx (gfp_t ); -extern void fscrypt_release_ctx (struct fscrypt_ctx *); extern struct page *fscrypt_encrypt_pagecache_blocks(struct page *page, unsigned int len,
@@ -244,8 +229,6 @@ static inline bool fscrypt_match_name(const struct fscrypt_name *fname,/* bio.c */ extern void fscrypt_decrypt_bio (struct bio *); -extern void fscrypt_enqueue_decrypt_bio (struct fscrypt_ctx *ctx, -struct bio *bio);extern int fscrypt_zeroout_range (const struct inode *,pgoff_t ,sector_t ,unsigned int );
@@ -295,16 +278,6 @@ static inline void fscrypt_enqueue_decrypt_work(struct work_struct *work) { } -static inline struct fscrypt_ctx *fscrypt_get_ctx (gfp_t gfp_flags) -{ -return ERR_PTR (-EOPNOTSUPP ); -} - -static inline void fscrypt_release_ctx (struct fscrypt_ctx *ctx) -{ -return ; -} - static inline struct page *fscrypt_encrypt_pagecache_blocks(struct page *page, unsigned int len, unsigned int offs,
@@ -484,11 +457,6 @@ static inline void fscrypt_decrypt_bio(struct bio *bio) { } -static inline void fscrypt_enqueue_decrypt_bio (struct fscrypt_ctx *ctx, -struct bio *bio) -{ -} -static inline int fscrypt_zeroout_range (const struct inode *inode,pgoff_t lblk,sector_t pblk,unsigned int len) {
Signature · 1 line
2.23.0.581.g78d2f28ef7-goog
Quoted 6 lines · Eric Biggers
From: Eric Biggers <[email protected]>
Now that ext4 and f2fs implement their own post-read workflow that supports both fscrypt and fsverity, the fscrypt-only workflow based around struct
fscrypt_ctxis no longer used. So remove the unused code.
Quoted 7 lines
This is based on a patch from Chandan Rajendra's "Consolidate FS read I/O callbacks code" patchset, but rebased onto the latest kernel, folded
__fscrypt_decrypt_bio()intofscrypt_decrypt_bio(), cleaned upfscrypt_initialize(), and updated the commit message.Originally-from: Chandan Rajendra <[email protected]>
Signed-off-by Eric Biggers <[email protected]>
Applied to fscrypt.git for 5.5.
- Eric
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel