1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Ceph cache definitions.
5 * Copyright (C) 2013 by Adfin Solutions, Inc. All Rights Reserved.
12 #include <linux/netfs.h>
14 #ifdef CONFIG_CEPH_FSCACHE
16 extern struct fscache_netfs ceph_cache_netfs;
18 int ceph_fscache_register(void);
19 void ceph_fscache_unregister(void);
21 int ceph_fscache_register_fs(struct ceph_fs_client* fsc, struct fs_context *fc);
22 void ceph_fscache_unregister_fs(struct ceph_fs_client* fsc);
24 void ceph_fscache_register_inode_cookie(struct inode *inode);
25 void ceph_fscache_unregister_inode_cookie(struct ceph_inode_info* ci);
26 void ceph_fscache_file_set_cookie(struct inode *inode, struct file *filp);
27 void ceph_fscache_revalidate_cookie(struct ceph_inode_info *ci);
29 int ceph_readpage_from_fscache(struct inode *inode, struct page *page);
30 int ceph_readpages_from_fscache(struct inode *inode,
31 struct address_space *mapping,
32 struct list_head *pages,
35 static inline void ceph_fscache_inode_init(struct ceph_inode_info *ci)
40 static inline struct fscache_cookie *ceph_fscache_cookie(struct ceph_inode_info *ci)
45 static inline void ceph_fscache_invalidate(struct inode *inode)
47 fscache_invalidate(ceph_inode(inode)->fscache);
50 static inline bool ceph_is_cache_enabled(struct inode *inode)
52 struct fscache_cookie *cookie = ceph_fscache_cookie(ceph_inode(inode));
56 return fscache_cookie_enabled(cookie);
59 static inline int ceph_begin_cache_operation(struct netfs_read_request *rreq)
61 struct fscache_cookie *cookie = ceph_fscache_cookie(ceph_inode(rreq->inode));
63 return fscache_begin_read_operation(rreq, cookie);
67 static inline int ceph_fscache_register(void)
72 static inline void ceph_fscache_unregister(void)
76 static inline int ceph_fscache_register_fs(struct ceph_fs_client* fsc,
77 struct fs_context *fc)
82 static inline void ceph_fscache_unregister_fs(struct ceph_fs_client* fsc)
86 static inline void ceph_fscache_inode_init(struct ceph_inode_info *ci)
90 static inline struct fscache_cookie *ceph_fscache_cookie(struct ceph_inode_info *ci)
95 static inline void ceph_fscache_register_inode_cookie(struct inode *inode)
99 static inline void ceph_fscache_unregister_inode_cookie(struct ceph_inode_info* ci)
103 static inline void ceph_fscache_file_set_cookie(struct inode *inode,
108 static inline void ceph_fscache_invalidate(struct inode *inode)
112 static inline bool ceph_is_cache_enabled(struct inode *inode)
117 static inline int ceph_begin_cache_operation(struct netfs_read_request *rreq)
123 #endif /* _CEPH_CACHE_H */