diff options
| -rw-r--r-- | fs/crypto/crypto.c | 9 | ||||
| -rw-r--r-- | fs/crypto/fscrypt_private.h | 2 | ||||
| -rw-r--r-- | fs/crypto/keyinfo.c | 2 | ||||
| -rw-r--r-- | include/linux/fscrypto.h | 1 |
4 files changed, 9 insertions, 5 deletions
diff --git a/fs/crypto/crypto.c b/fs/crypto/crypto.c index 5ffc59436397..bc1d4781b9ec 100644 --- a/fs/crypto/crypto.c +++ b/fs/crypto/crypto.c | |||
| @@ -525,17 +525,22 @@ static void fscrypt_destroy(void) | |||
| 525 | 525 | ||
| 526 | /** | 526 | /** |
| 527 | * fscrypt_initialize() - allocate major buffers for fs encryption. | 527 | * fscrypt_initialize() - allocate major buffers for fs encryption. |
| 528 | * @cop_flags: fscrypt operations flags | ||
| 528 | * | 529 | * |
| 529 | * We only call this when we start accessing encrypted files, since it | 530 | * We only call this when we start accessing encrypted files, since it |
| 530 | * results in memory getting allocated that wouldn't otherwise be used. | 531 | * results in memory getting allocated that wouldn't otherwise be used. |
| 531 | * | 532 | * |
| 532 | * Return: Zero on success, non-zero otherwise. | 533 | * Return: Zero on success, non-zero otherwise. |
| 533 | */ | 534 | */ |
| 534 | int fscrypt_initialize(void) | 535 | int fscrypt_initialize(unsigned int cop_flags) |
| 535 | { | 536 | { |
| 536 | int i, res = -ENOMEM; | 537 | int i, res = -ENOMEM; |
| 537 | 538 | ||
| 538 | if (fscrypt_bounce_page_pool) | 539 | /* |
| 540 | * No need to allocate a bounce page pool if there already is one or | ||
| 541 | * this FS won't use it. | ||
| 542 | */ | ||
| 543 | if (cop_flags & FS_CFLG_OWN_PAGES || fscrypt_bounce_page_pool) | ||
| 539 | return 0; | 544 | return 0; |
| 540 | 545 | ||
| 541 | mutex_lock(&fscrypt_init_mutex); | 546 | mutex_lock(&fscrypt_init_mutex); |
diff --git a/fs/crypto/fscrypt_private.h b/fs/crypto/fscrypt_private.h index c98b2a7fb6d3..7ba10cd45a2e 100644 --- a/fs/crypto/fscrypt_private.h +++ b/fs/crypto/fscrypt_private.h | |||
| @@ -85,7 +85,7 @@ struct fscrypt_completion_result { | |||
| 85 | 85 | ||
| 86 | 86 | ||
| 87 | /* crypto.c */ | 87 | /* crypto.c */ |
| 88 | int fscrypt_initialize(void); | 88 | int fscrypt_initialize(unsigned int cop_flags); |
| 89 | 89 | ||
| 90 | /* keyinfo.c */ | 90 | /* keyinfo.c */ |
| 91 | extern int fscrypt_get_crypt_info(struct inode *); | 91 | extern int fscrypt_get_crypt_info(struct inode *); |
diff --git a/fs/crypto/keyinfo.c b/fs/crypto/keyinfo.c index 35d3317a27b3..6eeea1dcba41 100644 --- a/fs/crypto/keyinfo.c +++ b/fs/crypto/keyinfo.c | |||
| @@ -188,7 +188,7 @@ int fscrypt_get_crypt_info(struct inode *inode) | |||
| 188 | u8 *raw_key = NULL; | 188 | u8 *raw_key = NULL; |
| 189 | int res; | 189 | int res; |
| 190 | 190 | ||
| 191 | res = fscrypt_initialize(); | 191 | res = fscrypt_initialize(inode->i_sb->s_cop->flags); |
| 192 | if (res) | 192 | if (res) |
| 193 | return res; | 193 | return res; |
| 194 | 194 | ||
diff --git a/include/linux/fscrypto.h b/include/linux/fscrypto.h index 188b4fa59cbf..1adc1c758d31 100644 --- a/include/linux/fscrypto.h +++ b/include/linux/fscrypto.h | |||
| @@ -168,7 +168,6 @@ static inline void fscrypt_set_d_op(struct dentry *dentry) | |||
| 168 | #if IS_ENABLED(CONFIG_FS_ENCRYPTION) | 168 | #if IS_ENABLED(CONFIG_FS_ENCRYPTION) |
| 169 | /* crypto.c */ | 169 | /* crypto.c */ |
| 170 | extern struct kmem_cache *fscrypt_info_cachep; | 170 | extern struct kmem_cache *fscrypt_info_cachep; |
| 171 | |||
| 172 | extern struct fscrypt_ctx *fscrypt_get_ctx(const struct inode *, gfp_t); | 171 | extern struct fscrypt_ctx *fscrypt_get_ctx(const struct inode *, gfp_t); |
| 173 | extern void fscrypt_release_ctx(struct fscrypt_ctx *); | 172 | extern void fscrypt_release_ctx(struct fscrypt_ctx *); |
| 174 | extern struct page *fscrypt_encrypt_page(const struct inode *, struct page *, | 173 | extern struct page *fscrypt_encrypt_page(const struct inode *, struct page *, |
