diff options
author | Matthew Wilcox <willy@infradead.org> | 2023-03-24 18:01:02 +0000 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2023-04-06 13:39:50 -0400 |
commit | c76e14dc13bcf89f3b55fd9dcd036a453a822d79 (patch) | |
tree | 0750efb3c684015640b19d7e061c5a6d0f51862e /include/linux/fscrypt.h | |
parent | e999a5c5a19cf3b679f3d93c49ad5f5c04e4806c (diff) | |
download | linux-stable-c76e14dc13bcf89f3b55fd9dcd036a453a822d79.tar.gz linux-stable-c76e14dc13bcf89f3b55fd9dcd036a453a822d79.tar.bz2 linux-stable-c76e14dc13bcf89f3b55fd9dcd036a453a822d79.zip |
fscrypt: Add some folio helper functions
fscrypt_is_bounce_folio() is the equivalent of fscrypt_is_bounce_page()
and fscrypt_pagecache_folio() is the equivalent of fscrypt_pagecache_page().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Link: https://lore.kernel.org/r/20230324180129.1220691-3-willy@infradead.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'include/linux/fscrypt.h')
-rw-r--r-- | include/linux/fscrypt.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/linux/fscrypt.h b/include/linux/fscrypt.h index e0a49c3125eb..c068cb487aaa 100644 --- a/include/linux/fscrypt.h +++ b/include/linux/fscrypt.h @@ -273,6 +273,16 @@ static inline struct page *fscrypt_pagecache_page(struct page *bounce_page) return (struct page *)page_private(bounce_page); } +static inline bool fscrypt_is_bounce_folio(struct folio *folio) +{ + return folio->mapping == NULL; +} + +static inline struct folio *fscrypt_pagecache_folio(struct folio *bounce_folio) +{ + return bounce_folio->private; +} + void fscrypt_free_bounce_page(struct page *bounce_page); /* policy.c */ @@ -445,6 +455,17 @@ static inline struct page *fscrypt_pagecache_page(struct page *bounce_page) return ERR_PTR(-EINVAL); } +static inline bool fscrypt_is_bounce_folio(struct folio *folio) +{ + return false; +} + +static inline struct folio *fscrypt_pagecache_folio(struct folio *bounce_folio) +{ + WARN_ON_ONCE(1); + return ERR_PTR(-EINVAL); +} + static inline void fscrypt_free_bounce_page(struct page *bounce_page) { } |