Linux Audio

Check our new training course

Loading...
v6.9.4
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/*
 3 * V9FS cache definitions.
 4 *
 5 *  Copyright (C) 2009 by Abhishek Kulkarni <adkulkar@umail.iu.edu>
 6 */
 7
 8#ifndef _9P_CACHE_H
 9#define _9P_CACHE_H
10
11#ifdef CONFIG_9P_FSCACHE
12#include <linux/fscache.h>
 
 
 
 
 
13
14extern int v9fs_cache_session_get_cookie(struct v9fs_session_info *v9ses,
15					  const char *dev_name);
16
17extern void v9fs_cache_inode_get_cookie(struct inode *inode);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
19#else /* CONFIG_9P_FSCACHE */
20
21static inline void v9fs_cache_inode_get_cookie(struct inode *inode)
22{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23}
24
25#endif /* CONFIG_9P_FSCACHE */
26#endif /* _9P_CACHE_H */
v5.9
  1/* SPDX-License-Identifier: GPL-2.0-only */
  2/*
  3 * V9FS cache definitions.
  4 *
  5 *  Copyright (C) 2009 by Abhishek Kulkarni <adkulkar@umail.iu.edu>
  6 */
  7
  8#ifndef _9P_CACHE_H
  9#define _9P_CACHE_H
 
 10#ifdef CONFIG_9P_FSCACHE
 11#include <linux/fscache.h>
 12#include <linux/spinlock.h>
 13
 14extern struct fscache_netfs v9fs_cache_netfs;
 15extern const struct fscache_cookie_def v9fs_cache_session_index_def;
 16extern const struct fscache_cookie_def v9fs_cache_inode_index_def;
 17
 18extern void v9fs_cache_session_get_cookie(struct v9fs_session_info *v9ses);
 19extern void v9fs_cache_session_put_cookie(struct v9fs_session_info *v9ses);
 20
 21extern void v9fs_cache_inode_get_cookie(struct inode *inode);
 22extern void v9fs_cache_inode_put_cookie(struct inode *inode);
 23extern void v9fs_cache_inode_flush_cookie(struct inode *inode);
 24extern void v9fs_cache_inode_set_cookie(struct inode *inode, struct file *filp);
 25extern void v9fs_cache_inode_reset_cookie(struct inode *inode);
 26
 27extern int __v9fs_cache_register(void);
 28extern void __v9fs_cache_unregister(void);
 29
 30extern int __v9fs_fscache_release_page(struct page *page, gfp_t gfp);
 31extern void __v9fs_fscache_invalidate_page(struct page *page);
 32extern int __v9fs_readpage_from_fscache(struct inode *inode,
 33					struct page *page);
 34extern int __v9fs_readpages_from_fscache(struct inode *inode,
 35					 struct address_space *mapping,
 36					 struct list_head *pages,
 37					 unsigned *nr_pages);
 38extern void __v9fs_readpage_to_fscache(struct inode *inode, struct page *page);
 39extern void __v9fs_fscache_wait_on_page_write(struct inode *inode,
 40					      struct page *page);
 41
 42static inline int v9fs_fscache_release_page(struct page *page,
 43					    gfp_t gfp)
 44{
 45	return __v9fs_fscache_release_page(page, gfp);
 46}
 47
 48static inline void v9fs_fscache_invalidate_page(struct page *page)
 49{
 50	__v9fs_fscache_invalidate_page(page);
 51}
 52
 53static inline int v9fs_readpage_from_fscache(struct inode *inode,
 54					     struct page *page)
 55{
 56	return __v9fs_readpage_from_fscache(inode, page);
 57}
 58
 59static inline int v9fs_readpages_from_fscache(struct inode *inode,
 60					      struct address_space *mapping,
 61					      struct list_head *pages,
 62					      unsigned *nr_pages)
 63{
 64	return __v9fs_readpages_from_fscache(inode, mapping, pages,
 65					     nr_pages);
 66}
 67
 68static inline void v9fs_readpage_to_fscache(struct inode *inode,
 69					    struct page *page)
 70{
 71	if (PageFsCache(page))
 72		__v9fs_readpage_to_fscache(inode, page);
 73}
 74
 75static inline void v9fs_uncache_page(struct inode *inode, struct page *page)
 76{
 77	struct v9fs_inode *v9inode = V9FS_I(inode);
 78	fscache_uncache_page(v9inode->fscache, page);
 79	BUG_ON(PageFsCache(page));
 80}
 81
 82static inline void v9fs_fscache_wait_on_page_write(struct inode *inode,
 83						   struct page *page)
 84{
 85	return __v9fs_fscache_wait_on_page_write(inode, page);
 86}
 87
 88#else /* CONFIG_9P_FSCACHE */
 89
 90static inline void v9fs_cache_inode_get_cookie(struct inode *inode)
 91{
 92}
 93
 94static inline void v9fs_cache_inode_put_cookie(struct inode *inode)
 95{
 96}
 97
 98static inline void v9fs_cache_inode_set_cookie(struct inode *inode, struct file *file)
 99{
100}
101
102static inline int v9fs_fscache_release_page(struct page *page,
103					    gfp_t gfp) {
104	return 1;
105}
106
107static inline void v9fs_fscache_invalidate_page(struct page *page) {}
108
109static inline int v9fs_readpage_from_fscache(struct inode *inode,
110					     struct page *page)
111{
112	return -ENOBUFS;
113}
114
115static inline int v9fs_readpages_from_fscache(struct inode *inode,
116					      struct address_space *mapping,
117					      struct list_head *pages,
118					      unsigned *nr_pages)
119{
120	return -ENOBUFS;
121}
122
123static inline void v9fs_readpage_to_fscache(struct inode *inode,
124					    struct page *page)
125{}
126
127static inline void v9fs_uncache_page(struct inode *inode, struct page *page)
128{}
129
130static inline void v9fs_fscache_wait_on_page_write(struct inode *inode,
131						   struct page *page)
132{
133	return;
134}
135
136#endif /* CONFIG_9P_FSCACHE */
137#endif /* _9P_CACHE_H */