Lines Matching +full:cache +full:- +full:op +full:- +full:block +full:- +full:size

1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /* General netfs cache on cache files internal defs
15 #include <linux/fscache-cache.h>
40 struct cachefiles_cache *cache; member
41 struct list_head cache_link; /* Link in cache->volumes */
67 struct cachefiles_volume *volume; /* Cache volume that holds this object */
68 struct list_head cache_link; /* Link in cache->*_list */
83 #define CACHEFILES_ONDEMAND_ID_CLOSED -1
86 * Cache files cache definition
89 struct fscache_cache *cache; /* Cache cookie */ member
90 struct vfsmount *mnt; /* mountpoint holding the cache */
97 const struct cred *cache_cred; /* security override for accessing cache */
110 unsigned bsize; /* cache's block size */
119 #define CACHEFILES_READY 0 /* T if cache prepared */
120 #define CACHEFILES_DEAD 1 /* T if cache dead */
123 #define CACHEFILES_ONDEMAND_MODE 4 /* T if in on-demand read mode */
124 char *rootdirname; /* name of cache root directory */
125 char *tag; /* cache binding tag */
127 struct xarray reqs; /* xarray of pending on-demand requests */
136 static inline bool cachefiles_in_ondemand_mode(struct cachefiles_cache *cache) in cachefiles_in_ondemand_mode() argument
139 test_bit(CACHEFILES_ONDEMAND_MODE, &cache->flags); in cachefiles_in_ondemand_mode()
157 return cres->cache_priv2; in cachefiles_cres_file()
163 return fscache_cres_cookie(cres)->cache_priv; in cachefiles_cres_object()
169 static inline void cachefiles_state_changed(struct cachefiles_cache *cache) in cachefiles_state_changed() argument
171 set_bit(CACHEFILES_STATE_CHANGED, &cache->flags); in cachefiles_state_changed()
172 wake_up_all(&cache->daemon_pollwq); in cachefiles_state_changed()
176 * cache.c
178 extern int cachefiles_add_cache(struct cachefiles_cache *cache);
179 extern void cachefiles_withdraw_cache(struct cachefiles_cache *cache);
186 extern int cachefiles_has_space(struct cachefiles_cache *cache,
194 extern void cachefiles_flush_reqs(struct cachefiles_cache *cache);
195 extern void cachefiles_get_unbind_pincount(struct cachefiles_cache *cache);
196 extern void cachefiles_put_unbind_pincount(struct cachefiles_cache *cache);
222 return cachefiles_error_injection_state & 2 ? -EIO : 0; in cachefiles_inject_read_error()
227 return cachefiles_error_injection_state & 2 ? -EIO : in cachefiles_inject_write_error()
228 cachefiles_error_injection_state & 1 ? -ENOSPC : in cachefiles_inject_write_error()
234 return cachefiles_error_injection_state & 2 ? -EIO : 0; in cachefiles_inject_remove_error()
279 extern int cachefiles_bury_object(struct cachefiles_cache *cache,
287 extern struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache,
293 extern int cachefiles_cull(struct cachefiles_cache *cache, struct dentry *dir,
296 extern int cachefiles_check_in_use(struct cachefiles_cache *cache,
299 extern bool cachefiles_commit_tmpfile(struct cachefiles_cache *cache,
306 extern ssize_t cachefiles_ondemand_daemon_read(struct cachefiles_cache *cache,
309 extern int cachefiles_ondemand_copen(struct cachefiles_cache *cache,
312 extern int cachefiles_ondemand_restore(struct cachefiles_cache *cache,
329 return object->ondemand->state == CACHEFILES_ONDEMAND_OBJSTATE_##_STATE; \
335 object->ondemand->state = CACHEFILES_ONDEMAND_OBJSTATE_##_STATE; \
345 return cachefiles_ondemand_object_is_reopening(req->object) && in cachefiles_ondemand_is_reopening_read()
346 req->msg.opcode == CACHEFILES_OP_READ; in cachefiles_ondemand_is_reopening_read()
350 static inline ssize_t cachefiles_ondemand_daemon_read(struct cachefiles_cache *cache, in cachefiles_ondemand_daemon_read() argument
353 return -EOPNOTSUPP; in cachefiles_ondemand_daemon_read()
368 return -EOPNOTSUPP; in cachefiles_ondemand_read()
389 extern int cachefiles_get_security_ID(struct cachefiles_cache *cache);
390 extern int cachefiles_determine_cache_security(struct cachefiles_cache *cache,
394 static inline void cachefiles_begin_secure(struct cachefiles_cache *cache, in cachefiles_begin_secure() argument
397 *_saved_cred = override_creds(cache->cache_cred); in cachefiles_begin_secure()
400 static inline void cachefiles_end_secure(struct cachefiles_cache *cache, in cachefiles_end_secure() argument
419 extern int cachefiles_remove_object_xattr(struct cachefiles_cache *cache,
432 fscache_io_error((___cache)->cache); \
433 set_bit(CACHEFILES_DEAD, &(___cache)->flags); \
442 ___cache = (object)->volume->cache; \
444 (object)->debug_id); \
457 printk(KERN_DEBUG "[%-6.6s] "FMT"\n", current->comm, ##__VA_ARGS__)
505 #define ASSERTCMP(X, OP, Y) \ argument
507 if (unlikely(!((X) OP (Y)))) { \
510 pr_err("%lx " #OP " %lx is false\n", \
525 #define ASSERTIFCMP(C, X, OP, Y) \ argument
527 if (unlikely((C) && !((X) OP (Y)))) { \
530 pr_err("%lx " #OP " %lx is false\n", \
539 #define ASSERTCMP(X, OP, Y) do {} while (0) argument
541 #define ASSERTIFCMP(C, X, OP, Y) do {} while (0) argument