Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netfs, fscache: Combine fscache with netfs

Now that the fscache code is moved to be colocated with the netfslib code
so that they combined into one module, do the combining.

Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
cc: Christian Brauner <christian@brauner.io>
cc: linux-fsdevel@vger.kernel.org
cc: linux-cachefs@redhat.com
cc: linux-nfs@vger.kernel.org,
cc: linux-erofs@lists.ozlabs.org

+237 -311
+2 -1
arch/arm/configs/mxs_defconfig
··· 138 138 CONFIG_NVMEM_MXS_OCOTP=y 139 139 CONFIG_EXT4_FS=y 140 140 # CONFIG_DNOTIFY is not set 141 - CONFIG_FSCACHE=m 141 + CONFIG_NETFS_SUPPORT=m 142 + CONFIG_FSCACHE=y 142 143 CONFIG_FSCACHE_STATS=y 143 144 CONFIG_CACHEFILES=m 144 145 CONFIG_VFAT_FS=y
+2 -1
arch/csky/configs/defconfig
··· 34 34 CONFIG_EXT4_FS=y 35 35 CONFIG_FANOTIFY=y 36 36 CONFIG_QUOTA=y 37 - CONFIG_FSCACHE=m 37 + CONFIG_NETFS_SUPPORT=m 38 + CONFIG_FSCACHE=y 38 39 CONFIG_FSCACHE_STATS=y 39 40 CONFIG_CACHEFILES=m 40 41 CONFIG_MSDOS_FS=y
+2 -1
arch/mips/configs/ip27_defconfig
··· 287 287 CONFIG_QUOTA_NETLINK_INTERFACE=y 288 288 CONFIG_FUSE_FS=m 289 289 CONFIG_CUSE=m 290 - CONFIG_FSCACHE=m 290 + CONFIG_NETFS_SUPPORT=m 291 + CONFIG_FSCACHE=y 291 292 CONFIG_FSCACHE_STATS=y 292 293 CONFIG_CACHEFILES=m 293 294 CONFIG_PROC_KCORE=y
+2 -1
arch/mips/configs/lemote2f_defconfig
··· 238 238 CONFIG_QUOTA=y 239 239 CONFIG_QFMT_V2=m 240 240 CONFIG_AUTOFS_FS=m 241 - CONFIG_FSCACHE=m 241 + CONFIG_NETFS_SUPPORT=m 242 + CONFIG_FSCACHE=y 242 243 CONFIG_CACHEFILES=m 243 244 CONFIG_ISO9660_FS=m 244 245 CONFIG_JOLIET=y
+2 -1
arch/mips/configs/loongson3_defconfig
··· 356 356 CONFIG_AUTOFS_FS=y 357 357 CONFIG_FUSE_FS=m 358 358 CONFIG_VIRTIO_FS=m 359 - CONFIG_FSCACHE=m 359 + CONFIG_NETFS_SUPPORT=m 360 + CONFIG_FSCACHE=y 360 361 CONFIG_ISO9660_FS=m 361 362 CONFIG_JOLIET=y 362 363 CONFIG_MSDOS_FS=m
+2 -1
arch/mips/configs/pic32mzda_defconfig
··· 68 68 CONFIG_EXT4_FS_SECURITY=y 69 69 CONFIG_AUTOFS_FS=m 70 70 CONFIG_FUSE_FS=m 71 - CONFIG_FSCACHE=m 71 + CONFIG_NETFS_SUPPORT=m 72 + CONFIG_FSCACHE=y 72 73 CONFIG_ISO9660_FS=m 73 74 CONFIG_JOLIET=y 74 75 CONFIG_ZISOFS=y
+2 -1
arch/s390/configs/debug_defconfig
··· 637 637 CONFIG_CUSE=m 638 638 CONFIG_VIRTIO_FS=m 639 639 CONFIG_OVERLAY_FS=m 640 + CONFIG_NETFS_SUPPORT=m 640 641 CONFIG_NETFS_STATS=y 641 - CONFIG_FSCACHE=m 642 + CONFIG_FSCACHE=y 642 643 CONFIG_CACHEFILES=m 643 644 CONFIG_ISO9660_FS=y 644 645 CONFIG_JOLIET=y
+2 -1
arch/s390/configs/defconfig
··· 622 622 CONFIG_CUSE=m 623 623 CONFIG_VIRTIO_FS=m 624 624 CONFIG_OVERLAY_FS=m 625 + CONFIG_NETFS_SUPPORT=m 625 626 CONFIG_NETFS_STATS=y 626 - CONFIG_FSCACHE=m 627 + CONFIG_FSCACHE=y 627 628 CONFIG_CACHEFILES=m 628 629 CONFIG_ISO9660_FS=y 629 630 CONFIG_JOLIET=y
+2 -1
arch/sh/configs/sdk7786_defconfig
··· 171 171 CONFIG_AUTOFS_FS=m 172 172 CONFIG_FUSE_FS=y 173 173 CONFIG_CUSE=m 174 - CONFIG_FSCACHE=m 174 + CONFIG_NETFS_SUPPORT=m 175 + CONFIG_FSCACHE=y 175 176 CONFIG_CACHEFILES=m 176 177 CONFIG_ISO9660_FS=m 177 178 CONFIG_JOLIET=y
+1 -1
fs/cachefiles/Kconfig
··· 2 2 3 3 config CACHEFILES 4 4 tristate "Filesystem caching on files" 5 - depends on FSCACHE && BLOCK 5 + depends on NETFS_SUPPORT && FSCACHE && BLOCK 6 6 help 7 7 This permits use of a mounted filesystem as a cache for other 8 8 filesystems - primarily networking filesystems - thus allowing fast
+5 -2
fs/erofs/Kconfig
··· 114 114 115 115 config EROFS_FS_ONDEMAND 116 116 bool "EROFS fscache-based on-demand read support" 117 - depends on CACHEFILES_ONDEMAND && (EROFS_FS=m && FSCACHE || EROFS_FS=y && FSCACHE=y) 118 - default n 117 + depends on EROFS_FS 118 + select NETFS_SUPPORT 119 + select FSCACHE 120 + select CACHEFILES 121 + select CACHEFILES_ONDEMAND 119 122 help 120 123 This permits EROFS to use fscache-backed data blobs with on-demand 121 124 read support.
+2 -2
fs/netfs/Kconfig
··· 23 23 debugging purposes. Saying 'Y' here is recommended. 24 24 25 25 config FSCACHE 26 - tristate "General filesystem local caching manager" 27 - select NETFS_SUPPORT 26 + bool "General filesystem local caching manager" 27 + depends on NETFS_SUPPORT 28 28 help 29 29 This option enables a generic filesystem caching manager that can be 30 30 used by various network and other filesystems to cache data locally.
+12 -12
fs/netfs/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 3 - fscache-y := \ 4 - fscache_cache.o \ 5 - fscache_cookie.o \ 6 - fscache_io.o \ 7 - fscache_main.o \ 8 - fscache_volume.o 9 - 10 - fscache-$(CONFIG_PROC_FS) += fscache_proc.o 11 - fscache-$(CONFIG_FSCACHE_STATS) += fscache_stats.o 12 - 13 - obj-$(CONFIG_FSCACHE) := fscache.o 14 - 15 3 netfs-y := \ 16 4 buffered_read.o \ 17 5 io.o \ ··· 8 20 objects.o 9 21 10 22 netfs-$(CONFIG_NETFS_STATS) += stats.o 23 + 24 + netfs-$(CONFIG_FSCACHE) += \ 25 + fscache_cache.o \ 26 + fscache_cookie.o \ 27 + fscache_io.o \ 28 + fscache_main.o \ 29 + fscache_volume.o 30 + 31 + ifeq ($(CONFIG_PROC_FS),y) 32 + netfs-$(CONFIG_FSCACHE) += fscache_proc.o 33 + endif 34 + netfs-$(CONFIG_FSCACHE_STATS) += fscache_stats.o 11 35 12 36 obj-$(CONFIG_NETFS_SUPPORT) += netfs.o
+2 -265
fs/netfs/fscache_internal.h
··· 5 5 * Written by David Howells (dhowells@redhat.com) 6 6 */ 7 7 8 + #include "internal.h" 9 + 8 10 #ifdef pr_fmt 9 11 #undef pr_fmt 10 12 #endif 11 13 12 14 #define pr_fmt(fmt) "FS-Cache: " fmt 13 - 14 - #include <linux/slab.h> 15 - #include <linux/fscache-cache.h> 16 - #include <trace/events/fscache.h> 17 - #include <linux/sched.h> 18 - #include <linux/seq_file.h> 19 - 20 - /* 21 - * cache.c 22 - */ 23 - #ifdef CONFIG_PROC_FS 24 - extern const struct seq_operations fscache_caches_seq_ops; 25 - #endif 26 - bool fscache_begin_cache_access(struct fscache_cache *cache, enum fscache_access_trace why); 27 - void fscache_end_cache_access(struct fscache_cache *cache, enum fscache_access_trace why); 28 - struct fscache_cache *fscache_lookup_cache(const char *name, bool is_cache); 29 - void fscache_put_cache(struct fscache_cache *cache, enum fscache_cache_trace where); 30 - 31 - static inline enum fscache_cache_state fscache_cache_state(const struct fscache_cache *cache) 32 - { 33 - return smp_load_acquire(&cache->state); 34 - } 35 - 36 - static inline bool fscache_cache_is_live(const struct fscache_cache *cache) 37 - { 38 - return fscache_cache_state(cache) == FSCACHE_CACHE_IS_ACTIVE; 39 - } 40 - 41 - static inline void fscache_set_cache_state(struct fscache_cache *cache, 42 - enum fscache_cache_state new_state) 43 - { 44 - smp_store_release(&cache->state, new_state); 45 - 46 - } 47 - 48 - static inline bool fscache_set_cache_state_maybe(struct fscache_cache *cache, 49 - enum fscache_cache_state old_state, 50 - enum fscache_cache_state new_state) 51 - { 52 - return try_cmpxchg_release(&cache->state, &old_state, new_state); 53 - } 54 - 55 - /* 56 - * cookie.c 57 - */ 58 - extern struct kmem_cache *fscache_cookie_jar; 59 - #ifdef CONFIG_PROC_FS 60 - extern const struct seq_operations fscache_cookies_seq_ops; 61 - #endif 62 - extern struct timer_list fscache_cookie_lru_timer; 63 - 64 - extern void fscache_print_cookie(struct fscache_cookie *cookie, char prefix); 65 - extern bool fscache_begin_cookie_access(struct fscache_cookie *cookie, 66 - enum fscache_access_trace why); 67 - 68 - static inline void fscache_see_cookie(struct fscache_cookie *cookie, 69 - enum fscache_cookie_trace where) 70 - { 71 - trace_fscache_cookie(cookie->debug_id, refcount_read(&cookie->ref), 72 - where); 73 - } 74 - 75 - /* 76 - * main.c 77 - */ 78 - extern unsigned fscache_debug; 79 - 80 - extern unsigned int fscache_hash(unsigned int salt, const void *data, size_t len); 81 - 82 - /* 83 - * proc.c 84 - */ 85 - #ifdef CONFIG_PROC_FS 86 - extern int __init fscache_proc_init(void); 87 - extern void fscache_proc_cleanup(void); 88 - #else 89 - #define fscache_proc_init() (0) 90 - #define fscache_proc_cleanup() do {} while (0) 91 - #endif 92 - 93 - /* 94 - * stats.c 95 - */ 96 - #ifdef CONFIG_FSCACHE_STATS 97 - extern atomic_t fscache_n_volumes; 98 - extern atomic_t fscache_n_volumes_collision; 99 - extern atomic_t fscache_n_volumes_nomem; 100 - extern atomic_t fscache_n_cookies; 101 - extern atomic_t fscache_n_cookies_lru; 102 - extern atomic_t fscache_n_cookies_lru_expired; 103 - extern atomic_t fscache_n_cookies_lru_removed; 104 - extern atomic_t fscache_n_cookies_lru_dropped; 105 - 106 - extern atomic_t fscache_n_acquires; 107 - extern atomic_t fscache_n_acquires_ok; 108 - extern atomic_t fscache_n_acquires_oom; 109 - 110 - extern atomic_t fscache_n_invalidates; 111 - 112 - extern atomic_t fscache_n_relinquishes; 113 - extern atomic_t fscache_n_relinquishes_retire; 114 - extern atomic_t fscache_n_relinquishes_dropped; 115 - 116 - extern atomic_t fscache_n_resizes; 117 - extern atomic_t fscache_n_resizes_null; 118 - 119 - static inline void fscache_stat(atomic_t *stat) 120 - { 121 - atomic_inc(stat); 122 - } 123 - 124 - static inline void fscache_stat_d(atomic_t *stat) 125 - { 126 - atomic_dec(stat); 127 - } 128 - 129 - #define __fscache_stat(stat) (stat) 130 - 131 - int fscache_stats_show(struct seq_file *m, void *v); 132 - #else 133 - 134 - #define __fscache_stat(stat) (NULL) 135 - #define fscache_stat(stat) do {} while (0) 136 - #define fscache_stat_d(stat) do {} while (0) 137 - #endif 138 - 139 - /* 140 - * volume.c 141 - */ 142 - #ifdef CONFIG_PROC_FS 143 - extern const struct seq_operations fscache_volumes_seq_ops; 144 - #endif 145 - 146 - struct fscache_volume *fscache_get_volume(struct fscache_volume *volume, 147 - enum fscache_volume_trace where); 148 - void fscache_put_volume(struct fscache_volume *volume, 149 - enum fscache_volume_trace where); 150 - bool fscache_begin_volume_access(struct fscache_volume *volume, 151 - struct fscache_cookie *cookie, 152 - enum fscache_access_trace why); 153 - void fscache_create_volume(struct fscache_volume *volume, bool wait); 154 - 155 - 156 - /*****************************************************************************/ 157 - /* 158 - * debug tracing 159 - */ 160 - #define dbgprintk(FMT, ...) \ 161 - printk("[%-6.6s] "FMT"\n", current->comm, ##__VA_ARGS__) 162 - 163 - #define kenter(FMT, ...) dbgprintk("==> %s("FMT")", __func__, ##__VA_ARGS__) 164 - #define kleave(FMT, ...) dbgprintk("<== %s()"FMT"", __func__, ##__VA_ARGS__) 165 - #define kdebug(FMT, ...) dbgprintk(FMT, ##__VA_ARGS__) 166 - 167 - #define kjournal(FMT, ...) no_printk(FMT, ##__VA_ARGS__) 168 - 169 - #ifdef __KDEBUG 170 - #define _enter(FMT, ...) kenter(FMT, ##__VA_ARGS__) 171 - #define _leave(FMT, ...) kleave(FMT, ##__VA_ARGS__) 172 - #define _debug(FMT, ...) kdebug(FMT, ##__VA_ARGS__) 173 - 174 - #elif defined(CONFIG_FSCACHE_DEBUG) 175 - #define _enter(FMT, ...) \ 176 - do { \ 177 - if (__do_kdebug(ENTER)) \ 178 - kenter(FMT, ##__VA_ARGS__); \ 179 - } while (0) 180 - 181 - #define _leave(FMT, ...) \ 182 - do { \ 183 - if (__do_kdebug(LEAVE)) \ 184 - kleave(FMT, ##__VA_ARGS__); \ 185 - } while (0) 186 - 187 - #define _debug(FMT, ...) \ 188 - do { \ 189 - if (__do_kdebug(DEBUG)) \ 190 - kdebug(FMT, ##__VA_ARGS__); \ 191 - } while (0) 192 - 193 - #else 194 - #define _enter(FMT, ...) no_printk("==> %s("FMT")", __func__, ##__VA_ARGS__) 195 - #define _leave(FMT, ...) no_printk("<== %s()"FMT"", __func__, ##__VA_ARGS__) 196 - #define _debug(FMT, ...) no_printk(FMT, ##__VA_ARGS__) 197 - #endif 198 - 199 - /* 200 - * determine whether a particular optional debugging point should be logged 201 - * - we need to go through three steps to persuade cpp to correctly join the 202 - * shorthand in FSCACHE_DEBUG_LEVEL with its prefix 203 - */ 204 - #define ____do_kdebug(LEVEL, POINT) \ 205 - unlikely((fscache_debug & \ 206 - (FSCACHE_POINT_##POINT << (FSCACHE_DEBUG_ ## LEVEL * 3)))) 207 - #define ___do_kdebug(LEVEL, POINT) \ 208 - ____do_kdebug(LEVEL, POINT) 209 - #define __do_kdebug(POINT) \ 210 - ___do_kdebug(FSCACHE_DEBUG_LEVEL, POINT) 211 - 212 - #define FSCACHE_DEBUG_CACHE 0 213 - #define FSCACHE_DEBUG_COOKIE 1 214 - #define FSCACHE_DEBUG_OBJECT 2 215 - #define FSCACHE_DEBUG_OPERATION 3 216 - 217 - #define FSCACHE_POINT_ENTER 1 218 - #define FSCACHE_POINT_LEAVE 2 219 - #define FSCACHE_POINT_DEBUG 4 220 - 221 - #ifndef FSCACHE_DEBUG_LEVEL 222 - #define FSCACHE_DEBUG_LEVEL CACHE 223 - #endif 224 - 225 - /* 226 - * assertions 227 - */ 228 - #if 1 /* defined(__KDEBUGALL) */ 229 - 230 - #define ASSERT(X) \ 231 - do { \ 232 - if (unlikely(!(X))) { \ 233 - pr_err("\n"); \ 234 - pr_err("Assertion failed\n"); \ 235 - BUG(); \ 236 - } \ 237 - } while (0) 238 - 239 - #define ASSERTCMP(X, OP, Y) \ 240 - do { \ 241 - if (unlikely(!((X) OP (Y)))) { \ 242 - pr_err("\n"); \ 243 - pr_err("Assertion failed\n"); \ 244 - pr_err("%lx " #OP " %lx is false\n", \ 245 - (unsigned long)(X), (unsigned long)(Y)); \ 246 - BUG(); \ 247 - } \ 248 - } while (0) 249 - 250 - #define ASSERTIF(C, X) \ 251 - do { \ 252 - if (unlikely((C) && !(X))) { \ 253 - pr_err("\n"); \ 254 - pr_err("Assertion failed\n"); \ 255 - BUG(); \ 256 - } \ 257 - } while (0) 258 - 259 - #define ASSERTIFCMP(C, X, OP, Y) \ 260 - do { \ 261 - if (unlikely((C) && !((X) OP (Y)))) { \ 262 - pr_err("\n"); \ 263 - pr_err("Assertion failed\n"); \ 264 - pr_err("%lx " #OP " %lx is false\n", \ 265 - (unsigned long)(X), (unsigned long)(Y)); \ 266 - BUG(); \ 267 - } \ 268 - } while (0) 269 - 270 - #else 271 - 272 - #define ASSERT(X) do {} while (0) 273 - #define ASSERTCMP(X, OP, Y) do {} while (0) 274 - #define ASSERTIF(C, X) do {} while (0) 275 - #define ASSERTIFCMP(C, X, OP, Y) do {} while (0) 276 - 277 - #endif /* assert or not */
+4 -13
fs/netfs/fscache_main.c
··· 8 8 #define FSCACHE_DEBUG_LEVEL CACHE 9 9 #include <linux/module.h> 10 10 #include <linux/init.h> 11 - #define CREATE_TRACE_POINTS 12 11 #include "internal.h" 13 - 14 - MODULE_DESCRIPTION("FS Cache Manager"); 15 - MODULE_AUTHOR("Red Hat, Inc."); 16 - MODULE_LICENSE("GPL"); 17 - 18 - unsigned fscache_debug; 19 - module_param_named(debug, fscache_debug, uint, 20 - S_IWUSR | S_IRUGO); 21 - MODULE_PARM_DESC(fscache_debug, 22 - "FS-Cache debugging mask"); 12 + #define CREATE_TRACE_POINTS 13 + #include <trace/events/fscache.h> 23 14 24 15 EXPORT_TRACEPOINT_SYMBOL(fscache_access_cache); 25 16 EXPORT_TRACEPOINT_SYMBOL(fscache_access_volume); ··· 83 92 goto error_cookie_jar; 84 93 } 85 94 86 - pr_notice("Loaded\n"); 95 + pr_notice("FS-Cache loaded\n"); 87 96 return 0; 88 97 89 98 error_cookie_jar: ··· 106 115 kmem_cache_destroy(fscache_cookie_jar); 107 116 fscache_proc_cleanup(); 108 117 destroy_workqueue(fscache_wq); 109 - pr_notice("Unloaded\n"); 118 + pr_notice("FS-Cache unloaded\n"); 110 119 } 111 120 112 121 module_exit(fscache_exit);
+189 -3
fs/netfs/internal.h
··· 9 9 #include <linux/seq_file.h> 10 10 #include <linux/netfs.h> 11 11 #include <linux/fscache.h> 12 + #include <linux/fscache-cache.h> 12 13 #include <trace/events/netfs.h> 13 - #include "fscache_internal.h" 14 + #include <trace/events/fscache.h> 14 15 15 16 #ifdef pr_fmt 16 17 #undef pr_fmt ··· 107 106 #endif 108 107 } 109 108 109 + /* 110 + * fscache-cache.c 111 + */ 112 + #ifdef CONFIG_PROC_FS 113 + extern const struct seq_operations fscache_caches_seq_ops; 114 + #endif 115 + bool fscache_begin_cache_access(struct fscache_cache *cache, enum fscache_access_trace why); 116 + void fscache_end_cache_access(struct fscache_cache *cache, enum fscache_access_trace why); 117 + struct fscache_cache *fscache_lookup_cache(const char *name, bool is_cache); 118 + void fscache_put_cache(struct fscache_cache *cache, enum fscache_cache_trace where); 119 + 120 + static inline enum fscache_cache_state fscache_cache_state(const struct fscache_cache *cache) 121 + { 122 + return smp_load_acquire(&cache->state); 123 + } 124 + 125 + static inline bool fscache_cache_is_live(const struct fscache_cache *cache) 126 + { 127 + return fscache_cache_state(cache) == FSCACHE_CACHE_IS_ACTIVE; 128 + } 129 + 130 + static inline void fscache_set_cache_state(struct fscache_cache *cache, 131 + enum fscache_cache_state new_state) 132 + { 133 + smp_store_release(&cache->state, new_state); 134 + 135 + } 136 + 137 + static inline bool fscache_set_cache_state_maybe(struct fscache_cache *cache, 138 + enum fscache_cache_state old_state, 139 + enum fscache_cache_state new_state) 140 + { 141 + return try_cmpxchg_release(&cache->state, &old_state, new_state); 142 + } 143 + 144 + /* 145 + * fscache-cookie.c 146 + */ 147 + extern struct kmem_cache *fscache_cookie_jar; 148 + #ifdef CONFIG_PROC_FS 149 + extern const struct seq_operations fscache_cookies_seq_ops; 150 + #endif 151 + extern struct timer_list fscache_cookie_lru_timer; 152 + 153 + extern void fscache_print_cookie(struct fscache_cookie *cookie, char prefix); 154 + extern bool fscache_begin_cookie_access(struct fscache_cookie *cookie, 155 + enum fscache_access_trace why); 156 + 157 + static inline void fscache_see_cookie(struct fscache_cookie *cookie, 158 + enum fscache_cookie_trace where) 159 + { 160 + trace_fscache_cookie(cookie->debug_id, refcount_read(&cookie->ref), 161 + where); 162 + } 163 + 164 + /* 165 + * fscache-main.c 166 + */ 167 + extern unsigned int fscache_hash(unsigned int salt, const void *data, size_t len); 168 + 169 + /* 170 + * fscache-proc.c 171 + */ 172 + #ifdef CONFIG_PROC_FS 173 + extern int __init fscache_proc_init(void); 174 + extern void fscache_proc_cleanup(void); 175 + #else 176 + #define fscache_proc_init() (0) 177 + #define fscache_proc_cleanup() do {} while (0) 178 + #endif 179 + 180 + /* 181 + * fscache-stats.c 182 + */ 183 + #ifdef CONFIG_FSCACHE_STATS 184 + extern atomic_t fscache_n_volumes; 185 + extern atomic_t fscache_n_volumes_collision; 186 + extern atomic_t fscache_n_volumes_nomem; 187 + extern atomic_t fscache_n_cookies; 188 + extern atomic_t fscache_n_cookies_lru; 189 + extern atomic_t fscache_n_cookies_lru_expired; 190 + extern atomic_t fscache_n_cookies_lru_removed; 191 + extern atomic_t fscache_n_cookies_lru_dropped; 192 + 193 + extern atomic_t fscache_n_acquires; 194 + extern atomic_t fscache_n_acquires_ok; 195 + extern atomic_t fscache_n_acquires_oom; 196 + 197 + extern atomic_t fscache_n_invalidates; 198 + 199 + extern atomic_t fscache_n_relinquishes; 200 + extern atomic_t fscache_n_relinquishes_retire; 201 + extern atomic_t fscache_n_relinquishes_dropped; 202 + 203 + extern atomic_t fscache_n_resizes; 204 + extern atomic_t fscache_n_resizes_null; 205 + 206 + static inline void fscache_stat(atomic_t *stat) 207 + { 208 + atomic_inc(stat); 209 + } 210 + 211 + static inline void fscache_stat_d(atomic_t *stat) 212 + { 213 + atomic_dec(stat); 214 + } 215 + 216 + #define __fscache_stat(stat) (stat) 217 + 218 + int fscache_stats_show(struct seq_file *m, void *v); 219 + #else 220 + 221 + #define __fscache_stat(stat) (NULL) 222 + #define fscache_stat(stat) do {} while (0) 223 + #define fscache_stat_d(stat) do {} while (0) 224 + #endif 225 + 226 + /* 227 + * fscache-volume.c 228 + */ 229 + #ifdef CONFIG_PROC_FS 230 + extern const struct seq_operations fscache_volumes_seq_ops; 231 + #endif 232 + 233 + struct fscache_volume *fscache_get_volume(struct fscache_volume *volume, 234 + enum fscache_volume_trace where); 235 + void fscache_put_volume(struct fscache_volume *volume, 236 + enum fscache_volume_trace where); 237 + bool fscache_begin_volume_access(struct fscache_volume *volume, 238 + struct fscache_cookie *cookie, 239 + enum fscache_access_trace why); 240 + void fscache_create_volume(struct fscache_volume *volume, bool wait); 241 + 110 242 /*****************************************************************************/ 111 243 /* 112 244 * debug tracing 113 245 */ 114 - #if 0 115 246 #define dbgprintk(FMT, ...) \ 116 247 printk("[%-6.6s] "FMT"\n", current->comm, ##__VA_ARGS__) 117 248 ··· 280 147 #define _leave(FMT, ...) no_printk("<== %s()"FMT"", __func__, ##__VA_ARGS__) 281 148 #define _debug(FMT, ...) no_printk(FMT, ##__VA_ARGS__) 282 149 #endif 283 - #endif 150 + 151 + /* 152 + * assertions 153 + */ 154 + #if 1 /* defined(__KDEBUGALL) */ 155 + 156 + #define ASSERT(X) \ 157 + do { \ 158 + if (unlikely(!(X))) { \ 159 + pr_err("\n"); \ 160 + pr_err("Assertion failed\n"); \ 161 + BUG(); \ 162 + } \ 163 + } while (0) 164 + 165 + #define ASSERTCMP(X, OP, Y) \ 166 + do { \ 167 + if (unlikely(!((X) OP (Y)))) { \ 168 + pr_err("\n"); \ 169 + pr_err("Assertion failed\n"); \ 170 + pr_err("%lx " #OP " %lx is false\n", \ 171 + (unsigned long)(X), (unsigned long)(Y)); \ 172 + BUG(); \ 173 + } \ 174 + } while (0) 175 + 176 + #define ASSERTIF(C, X) \ 177 + do { \ 178 + if (unlikely((C) && !(X))) { \ 179 + pr_err("\n"); \ 180 + pr_err("Assertion failed\n"); \ 181 + BUG(); \ 182 + } \ 183 + } while (0) 184 + 185 + #define ASSERTIFCMP(C, X, OP, Y) \ 186 + do { \ 187 + if (unlikely((C) && !((X) OP (Y)))) { \ 188 + pr_err("\n"); \ 189 + pr_err("Assertion failed\n"); \ 190 + pr_err("%lx " #OP " %lx is false\n", \ 191 + (unsigned long)(X), (unsigned long)(Y)); \ 192 + BUG(); \ 193 + } \ 194 + } while (0) 195 + 196 + #else 197 + 198 + #define ASSERT(X) do {} while (0) 199 + #define ASSERTCMP(X, OP, Y) do {} while (0) 200 + #define ASSERTIF(C, X) do {} while (0) 201 + #define ASSERTIFCMP(C, X, OP, Y) do {} while (0) 202 + 203 + #endif /* assert or not */
+2 -2
fs/netfs/main.c
··· 8 8 #include <linux/module.h> 9 9 #include <linux/export.h> 10 10 #include "internal.h" 11 - //#define CREATE_TRACE_POINTS 12 - //#include <trace/events/netfs.h> 11 + #define CREATE_TRACE_POINTS 12 + #include <trace/events/netfs.h> 13 13 14 14 MODULE_DESCRIPTION("Network fs support"); 15 15 MODULE_AUTHOR("Red Hat, Inc.");
+2 -2
fs/nfs/Kconfig
··· 169 169 170 170 config NFS_FSCACHE 171 171 bool "Provide NFS client caching support" 172 - depends on NFS_FS=m && FSCACHE || NFS_FS=y && FSCACHE=y 173 - select NETFS_SUPPORT 172 + depends on NFS_FS=m && NETFS_SUPPORT || NFS_FS=y && NETFS_SUPPORT=y 173 + select FSCACHE 174 174 help 175 175 Say Y here if you want NFS data to be cached locally on disc through 176 176 the general filesystem cache manager