Linux Audio

Check our new training course

Loading...
v4.6
 
  1/*
  2 * V9FS cache definitions.
  3 *
  4 *  Copyright (C) 2009 by Abhishek Kulkarni <adkulkar@umail.iu.edu>
  5 *
  6 *  This program is free software; you can redistribute it and/or modify
  7 *  it under the terms of the GNU General Public License version 2
  8 *  as published by the Free Software Foundation.
  9 *
 10 *  This program is distributed in the hope that it will be useful,
 11 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 12 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13 *  GNU General Public License for more details.
 14 *
 15 *  You should have received a copy of the GNU General Public License
 16 *  along with this program; if not, write to:
 17 *  Free Software Foundation
 18 *  51 Franklin Street, Fifth Floor
 19 *  Boston, MA  02111-1301  USA
 20 *
 21 */
 22
 23#ifndef _9P_CACHE_H
 24#define _9P_CACHE_H
 
 25#ifdef CONFIG_9P_FSCACHE
 26#include <linux/fscache.h>
 27#include <linux/spinlock.h>
 28
 29extern struct fscache_netfs v9fs_cache_netfs;
 30extern const struct fscache_cookie_def v9fs_cache_session_index_def;
 31extern const struct fscache_cookie_def v9fs_cache_inode_index_def;
 32
 33extern void v9fs_cache_session_get_cookie(struct v9fs_session_info *v9ses);
 34extern void v9fs_cache_session_put_cookie(struct v9fs_session_info *v9ses);
 35
 36extern void v9fs_cache_inode_get_cookie(struct inode *inode);
 37extern void v9fs_cache_inode_put_cookie(struct inode *inode);
 38extern void v9fs_cache_inode_flush_cookie(struct inode *inode);
 39extern void v9fs_cache_inode_set_cookie(struct inode *inode, struct file *filp);
 40extern void v9fs_cache_inode_reset_cookie(struct inode *inode);
 41
 42extern int __v9fs_cache_register(void);
 43extern void __v9fs_cache_unregister(void);
 44
 45extern int __v9fs_fscache_release_page(struct page *page, gfp_t gfp);
 46extern void __v9fs_fscache_invalidate_page(struct page *page);
 47extern int __v9fs_readpage_from_fscache(struct inode *inode,
 48					struct page *page);
 49extern int __v9fs_readpages_from_fscache(struct inode *inode,
 50					 struct address_space *mapping,
 51					 struct list_head *pages,
 52					 unsigned *nr_pages);
 53extern void __v9fs_readpage_to_fscache(struct inode *inode, struct page *page);
 54extern void __v9fs_fscache_wait_on_page_write(struct inode *inode,
 55					      struct page *page);
 56
 57static inline int v9fs_fscache_release_page(struct page *page,
 58					    gfp_t gfp)
 59{
 60	return __v9fs_fscache_release_page(page, gfp);
 61}
 62
 63static inline void v9fs_fscache_invalidate_page(struct page *page)
 64{
 65	__v9fs_fscache_invalidate_page(page);
 66}
 67
 68static inline int v9fs_readpage_from_fscache(struct inode *inode,
 69					     struct page *page)
 70{
 71	return __v9fs_readpage_from_fscache(inode, page);
 72}
 73
 74static inline int v9fs_readpages_from_fscache(struct inode *inode,
 75					      struct address_space *mapping,
 76					      struct list_head *pages,
 77					      unsigned *nr_pages)
 78{
 79	return __v9fs_readpages_from_fscache(inode, mapping, pages,
 80					     nr_pages);
 81}
 82
 83static inline void v9fs_readpage_to_fscache(struct inode *inode,
 84					    struct page *page)
 85{
 86	if (PageFsCache(page))
 87		__v9fs_readpage_to_fscache(inode, page);
 88}
 89
 90static inline void v9fs_uncache_page(struct inode *inode, struct page *page)
 91{
 92	struct v9fs_inode *v9inode = V9FS_I(inode);
 93	fscache_uncache_page(v9inode->fscache, page);
 94	BUG_ON(PageFsCache(page));
 95}
 96
 97static inline void v9fs_fscache_wait_on_page_write(struct inode *inode,
 98						   struct page *page)
 99{
100	return __v9fs_fscache_wait_on_page_write(inode, page);
101}
102
103#else /* CONFIG_9P_FSCACHE */
104
105static inline void v9fs_cache_inode_get_cookie(struct inode *inode)
106{
107}
108
109static inline void v9fs_cache_inode_put_cookie(struct inode *inode)
110{
111}
112
113static inline void v9fs_cache_inode_set_cookie(struct inode *inode, struct file *file)
114{
115}
116
117static inline int v9fs_fscache_release_page(struct page *page,
118					    gfp_t gfp) {
119	return 1;
120}
121
122static inline void v9fs_fscache_invalidate_page(struct page *page) {}
123
124static inline int v9fs_readpage_from_fscache(struct inode *inode,
125					     struct page *page)
126{
127	return -ENOBUFS;
128}
129
130static inline int v9fs_readpages_from_fscache(struct inode *inode,
131					      struct address_space *mapping,
132					      struct list_head *pages,
133					      unsigned *nr_pages)
134{
135	return -ENOBUFS;
136}
137
138static inline void v9fs_readpage_to_fscache(struct inode *inode,
139					    struct page *page)
140{}
141
142static inline void v9fs_uncache_page(struct inode *inode, struct page *page)
143{}
144
145static inline void v9fs_fscache_wait_on_page_write(struct inode *inode,
146						   struct page *page)
147{
148	return;
149}
150
151#endif /* CONFIG_9P_FSCACHE */
152#endif /* _9P_CACHE_H */
v6.13.7
 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 */