Commit a39bb9a0 authored by Chen Gang's avatar Chen Gang Committed by Konrad Rzeszutek Wilk

include/linux/cleancache.h: Clean up code

Let cleancache_fs_enabled() call cleancache_fs_enabled_mapping()
directly.

Remove redundant variable ret in cleancache_get_page().
Signed-off-by: default avatarChen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
parent b3c6de49
...@@ -48,14 +48,14 @@ extern void __cleancache_invalidate_fs(struct super_block *); ...@@ -48,14 +48,14 @@ extern void __cleancache_invalidate_fs(struct super_block *);
#ifdef CONFIG_CLEANCACHE #ifdef CONFIG_CLEANCACHE
#define cleancache_enabled (1) #define cleancache_enabled (1)
static inline bool cleancache_fs_enabled(struct page *page)
{
return page->mapping->host->i_sb->cleancache_poolid >= 0;
}
static inline bool cleancache_fs_enabled_mapping(struct address_space *mapping) static inline bool cleancache_fs_enabled_mapping(struct address_space *mapping)
{ {
return mapping->host->i_sb->cleancache_poolid >= 0; return mapping->host->i_sb->cleancache_poolid >= 0;
} }
static inline bool cleancache_fs_enabled(struct page *page)
{
return cleancache_fs_enabled_mapping(page->mapping);
}
#else #else
#define cleancache_enabled (0) #define cleancache_enabled (0)
#define cleancache_fs_enabled(_page) (0) #define cleancache_fs_enabled(_page) (0)
...@@ -89,11 +89,9 @@ static inline void cleancache_init_shared_fs(struct super_block *sb) ...@@ -89,11 +89,9 @@ static inline void cleancache_init_shared_fs(struct super_block *sb)
static inline int cleancache_get_page(struct page *page) static inline int cleancache_get_page(struct page *page)
{ {
int ret = -1;
if (cleancache_enabled && cleancache_fs_enabled(page)) if (cleancache_enabled && cleancache_fs_enabled(page))
ret = __cleancache_get_page(page); return __cleancache_get_page(page);
return ret; return -1;
} }
static inline void cleancache_put_page(struct page *page) static inline void cleancache_put_page(struct page *page)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment