Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Ceph cache definitions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *  Copyright (C) 2013 by Adfin Solutions, Inc. All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *  Written by Milosz Tanski (milosz@adfin.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #ifndef _CEPH_CACHE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #define _CEPH_CACHE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #ifdef CONFIG_CEPH_FSCACHE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) extern struct fscache_netfs ceph_cache_netfs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) int ceph_fscache_register(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) void ceph_fscache_unregister(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) int ceph_fscache_register_fs(struct ceph_fs_client* fsc, struct fs_context *fc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) void ceph_fscache_unregister_fs(struct ceph_fs_client* fsc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) void ceph_fscache_register_inode_cookie(struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) void ceph_fscache_unregister_inode_cookie(struct ceph_inode_info* ci);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) void ceph_fscache_file_set_cookie(struct inode *inode, struct file *filp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) void ceph_fscache_revalidate_cookie(struct ceph_inode_info *ci);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) int ceph_readpage_from_fscache(struct inode *inode, struct page *page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) int ceph_readpages_from_fscache(struct inode *inode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 				struct address_space *mapping,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 				struct list_head *pages,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 				unsigned *nr_pages);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) void ceph_readpage_to_fscache(struct inode *inode, struct page *page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) void ceph_invalidate_fscache_page(struct inode* inode, struct page *page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) static inline void ceph_fscache_inode_init(struct ceph_inode_info *ci)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	ci->fscache = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	ci->i_fscache_gen = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) static inline void ceph_fscache_invalidate(struct inode *inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	fscache_invalidate(ceph_inode(inode)->fscache);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) static inline void ceph_fscache_uncache_page(struct inode *inode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 					     struct page *page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	struct ceph_inode_info *ci = ceph_inode(inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	return fscache_uncache_page(ci->fscache, page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) static inline int ceph_release_fscache_page(struct page *page, gfp_t gfp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	struct inode* inode = page->mapping->host;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	struct ceph_inode_info *ci = ceph_inode(inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	return fscache_maybe_release_page(ci->fscache, page, gfp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) static inline void ceph_fscache_readpage_cancel(struct inode *inode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 						struct page *page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	struct ceph_inode_info *ci = ceph_inode(inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	if (fscache_cookie_valid(ci->fscache) && PageFsCache(page))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 		__fscache_uncache_page(ci->fscache, page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) static inline void ceph_fscache_readpages_cancel(struct inode *inode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 						 struct list_head *pages)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	struct ceph_inode_info *ci = ceph_inode(inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	return fscache_readpages_cancel(ci->fscache, pages);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) static inline void ceph_disable_fscache_readpage(struct ceph_inode_info *ci)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	ci->i_fscache_gen = ci->i_rdcache_gen - 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) static inline int ceph_fscache_register(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) static inline void ceph_fscache_unregister(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) static inline int ceph_fscache_register_fs(struct ceph_fs_client* fsc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 					   struct fs_context *fc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) static inline void ceph_fscache_unregister_fs(struct ceph_fs_client* fsc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) static inline void ceph_fscache_inode_init(struct ceph_inode_info *ci)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) static inline void ceph_fscache_register_inode_cookie(struct inode *inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) static inline void ceph_fscache_unregister_inode_cookie(struct ceph_inode_info* ci)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) static inline void ceph_fscache_file_set_cookie(struct inode *inode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 						struct file *filp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) static inline void ceph_fscache_revalidate_cookie(struct ceph_inode_info *ci)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) static inline void ceph_fscache_uncache_page(struct inode *inode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 					     struct page *pages)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) static inline int ceph_readpage_from_fscache(struct inode* inode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 					     struct page *page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	return -ENOBUFS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) static inline int ceph_readpages_from_fscache(struct inode *inode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 					      struct address_space *mapping,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 					      struct list_head *pages,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 					      unsigned *nr_pages)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	return -ENOBUFS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) static inline void ceph_readpage_to_fscache(struct inode *inode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 					    struct page *page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) static inline void ceph_fscache_invalidate(struct inode *inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) static inline void ceph_invalidate_fscache_page(struct inode *inode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 						struct page *page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) static inline int ceph_release_fscache_page(struct page *page, gfp_t gfp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) static inline void ceph_fscache_readpage_cancel(struct inode *inode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 						struct page *page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) static inline void ceph_fscache_readpages_cancel(struct inode *inode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 						 struct list_head *pages)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) static inline void ceph_disable_fscache_readpage(struct ceph_inode_info *ci)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) #endif