diff options
Diffstat (limited to 'fs/9p/cache.h')
-rw-r--r-- | fs/9p/cache.h | 64 |
1 files changed, 18 insertions, 46 deletions
diff --git a/fs/9p/cache.h b/fs/9p/cache.h index a94192bfaee8..049507a5b01c 100644 --- a/fs/9p/cache.h +++ b/fs/9p/cache.h | |||
@@ -25,20 +25,6 @@ | |||
25 | #include <linux/fscache.h> | 25 | #include <linux/fscache.h> |
26 | #include <linux/spinlock.h> | 26 | #include <linux/spinlock.h> |
27 | 27 | ||
28 | extern struct kmem_cache *vcookie_cache; | ||
29 | |||
30 | struct v9fs_cookie { | ||
31 | spinlock_t lock; | ||
32 | struct inode inode; | ||
33 | struct fscache_cookie *fscache; | ||
34 | struct p9_qid *qid; | ||
35 | }; | ||
36 | |||
37 | static inline struct v9fs_cookie *v9fs_inode2cookie(const struct inode *inode) | ||
38 | { | ||
39 | return container_of(inode, struct v9fs_cookie, inode); | ||
40 | } | ||
41 | |||
42 | extern struct fscache_netfs v9fs_cache_netfs; | 28 | extern struct fscache_netfs v9fs_cache_netfs; |
43 | extern const struct fscache_cookie_def v9fs_cache_session_index_def; | 29 | extern const struct fscache_cookie_def v9fs_cache_session_index_def; |
44 | extern const struct fscache_cookie_def v9fs_cache_inode_index_def; | 30 | extern const struct fscache_cookie_def v9fs_cache_inode_index_def; |
@@ -64,23 +50,8 @@ extern int __v9fs_readpages_from_fscache(struct inode *inode, | |||
64 | struct list_head *pages, | 50 | struct list_head *pages, |
65 | unsigned *nr_pages); | 51 | unsigned *nr_pages); |
66 | extern void __v9fs_readpage_to_fscache(struct inode *inode, struct page *page); | 52 | extern void __v9fs_readpage_to_fscache(struct inode *inode, struct page *page); |
67 | 53 | extern void __v9fs_fscache_wait_on_page_write(struct inode *inode, | |
68 | 54 | struct page *page); | |
69 | /** | ||
70 | * v9fs_cache_register - Register v9fs file system with the cache | ||
71 | */ | ||
72 | static inline int v9fs_cache_register(void) | ||
73 | { | ||
74 | return __v9fs_cache_register(); | ||
75 | } | ||
76 | |||
77 | /** | ||
78 | * v9fs_cache_unregister - Unregister v9fs from the cache | ||
79 | */ | ||
80 | static inline void v9fs_cache_unregister(void) | ||
81 | { | ||
82 | __v9fs_cache_unregister(); | ||
83 | } | ||
84 | 55 | ||
85 | static inline int v9fs_fscache_release_page(struct page *page, | 56 | static inline int v9fs_fscache_release_page(struct page *page, |
86 | gfp_t gfp) | 57 | gfp_t gfp) |
@@ -117,28 +88,27 @@ static inline void v9fs_readpage_to_fscache(struct inode *inode, | |||
117 | 88 | ||
118 | static inline void v9fs_uncache_page(struct inode *inode, struct page *page) | 89 | static inline void v9fs_uncache_page(struct inode *inode, struct page *page) |
119 | { | 90 | { |
120 | struct v9fs_cookie *vcookie = v9fs_inode2cookie(inode); | 91 | struct v9fs_inode *v9inode = V9FS_I(inode); |
121 | fscache_uncache_page(vcookie->fscache, page); | 92 | fscache_uncache_page(v9inode->fscache, page); |
122 | BUG_ON(PageFsCache(page)); | 93 | BUG_ON(PageFsCache(page)); |
123 | } | 94 | } |
124 | 95 | ||
125 | static inline void v9fs_vcookie_set_qid(struct inode *inode, | 96 | static inline void v9fs_fscache_set_key(struct inode *inode, |
126 | struct p9_qid *qid) | 97 | struct p9_qid *qid) |
127 | { | 98 | { |
128 | struct v9fs_cookie *vcookie = v9fs_inode2cookie(inode); | 99 | struct v9fs_inode *v9inode = V9FS_I(inode); |
129 | spin_lock(&vcookie->lock); | 100 | spin_lock(&v9inode->fscache_lock); |
130 | vcookie->qid = qid; | 101 | v9inode->fscache_key = qid; |
131 | spin_unlock(&vcookie->lock); | 102 | spin_unlock(&v9inode->fscache_lock); |
132 | } | 103 | } |
133 | 104 | ||
134 | #else /* CONFIG_9P_FSCACHE */ | 105 | static inline void v9fs_fscache_wait_on_page_write(struct inode *inode, |
135 | 106 | struct page *page) | |
136 | static inline int v9fs_cache_register(void) | ||
137 | { | 107 | { |
138 | return 1; | 108 | return __v9fs_fscache_wait_on_page_write(inode, page); |
139 | } | 109 | } |
140 | 110 | ||
141 | static inline void v9fs_cache_unregister(void) {} | 111 | #else /* CONFIG_9P_FSCACHE */ |
142 | 112 | ||
143 | static inline int v9fs_fscache_release_page(struct page *page, | 113 | static inline int v9fs_fscache_release_page(struct page *page, |
144 | gfp_t gfp) { | 114 | gfp_t gfp) { |
@@ -168,9 +138,11 @@ static inline void v9fs_readpage_to_fscache(struct inode *inode, | |||
168 | static inline void v9fs_uncache_page(struct inode *inode, struct page *page) | 138 | static inline void v9fs_uncache_page(struct inode *inode, struct page *page) |
169 | {} | 139 | {} |
170 | 140 | ||
171 | static inline void v9fs_vcookie_set_qid(struct inode *inode, | 141 | static inline void v9fs_fscache_wait_on_page_write(struct inode *inode, |
172 | struct p9_qid *qid) | 142 | struct page *page) |
173 | {} | 143 | { |
144 | return; | ||
145 | } | ||
174 | 146 | ||
175 | #endif /* CONFIG_9P_FSCACHE */ | 147 | #endif /* CONFIG_9P_FSCACHE */ |
176 | #endif /* _9P_CACHE_H */ | 148 | #endif /* _9P_CACHE_H */ |