aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fscache-cache.h
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2009-11-19 13:11:04 -0500
committerDavid Howells <dhowells@redhat.com>2009-11-19 13:11:04 -0500
commit4fbf4291aa15926cd4fdca0ffe9122e89d0459db (patch)
treeec2195c39ef8117acea598af4a5c20c77f67aa0b /include/linux/fscache-cache.h
parent440f0affe247e9990c8f8778f1861da4fd7d5e50 (diff)
FS-Cache: Allow the current state of all objects to be dumped
Allow the current state of all fscache objects to be dumped by doing: cat /proc/fs/fscache/objects By default, all objects and all fields will be shown. This can be restricted by adding a suitable key to one of the caller's keyrings (such as the session keyring): keyctl add user fscache:objlist "<restrictions>" @s The <restrictions> are: K Show hexdump of object key (don't show if not given) A Show hexdump of object aux data (don't show if not given) And paired restrictions: C Show objects that have a cookie c Show objects that don't have a cookie B Show objects that are busy b Show objects that aren't busy W Show objects that have pending writes w Show objects that don't have pending writes R Show objects that have outstanding reads r Show objects that don't have outstanding reads S Show objects that have slow work queued s Show objects that don't have slow work queued If neither side of a restriction pair is given, then both are implied. For example: keyctl add user fscache:objlist KB @s shows objects that are busy, and lists their object keys, but does not dump their auxiliary data. It also implies "CcWwRrSs", but as 'B' is given, 'b' is not implied. Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'include/linux/fscache-cache.h')
-rw-r--r--include/linux/fscache-cache.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h
index 7a9847ccd192..184cbdfbcc99 100644
--- a/include/linux/fscache-cache.h
+++ b/include/linux/fscache-cache.h
@@ -91,6 +91,8 @@ struct fscache_operation {
91#define FSCACHE_OP_WAITING 4 /* cleared when op is woken */ 91#define FSCACHE_OP_WAITING 4 /* cleared when op is woken */
92#define FSCACHE_OP_EXCLUSIVE 5 /* exclusive op, other ops must wait */ 92#define FSCACHE_OP_EXCLUSIVE 5 /* exclusive op, other ops must wait */
93#define FSCACHE_OP_DEAD 6 /* op is now dead */ 93#define FSCACHE_OP_DEAD 6 /* op is now dead */
94#define FSCACHE_OP_DEC_READ_CNT 7 /* decrement object->n_reads on destruction */
95#define FSCACHE_OP_KEEP_FLAGS 0xc0 /* flags to keep when repurposing an op */
94 96
95 atomic_t usage; 97 atomic_t usage;
96 unsigned debug_id; /* debugging ID */ 98 unsigned debug_id; /* debugging ID */
@@ -357,6 +359,7 @@ struct fscache_object {
357 int n_obj_ops; /* number of object ops outstanding on object */ 359 int n_obj_ops; /* number of object ops outstanding on object */
358 int n_in_progress; /* number of ops in progress */ 360 int n_in_progress; /* number of ops in progress */
359 int n_exclusive; /* number of exclusive ops queued */ 361 int n_exclusive; /* number of exclusive ops queued */
362 atomic_t n_reads; /* number of read ops in progress */
360 spinlock_t lock; /* state and operations lock */ 363 spinlock_t lock; /* state and operations lock */
361 364
362 unsigned long lookup_jif; /* time at which lookup started */ 365 unsigned long lookup_jif; /* time at which lookup started */
@@ -370,6 +373,7 @@ struct fscache_object {
370#define FSCACHE_OBJECT_EV_RELEASE 4 /* T if netfs requested object release */ 373#define FSCACHE_OBJECT_EV_RELEASE 4 /* T if netfs requested object release */
371#define FSCACHE_OBJECT_EV_RETIRE 5 /* T if netfs requested object retirement */ 374#define FSCACHE_OBJECT_EV_RETIRE 5 /* T if netfs requested object retirement */
372#define FSCACHE_OBJECT_EV_WITHDRAW 6 /* T if cache requested object withdrawal */ 375#define FSCACHE_OBJECT_EV_WITHDRAW 6 /* T if cache requested object withdrawal */
376#define FSCACHE_OBJECT_EVENTS_MASK 0x7f /* mask of all events*/
373 377
374 unsigned long flags; 378 unsigned long flags;
375#define FSCACHE_OBJECT_LOCK 0 /* T if object is busy being processed */ 379#define FSCACHE_OBJECT_LOCK 0 /* T if object is busy being processed */
@@ -385,6 +389,9 @@ struct fscache_object {
385 struct list_head dependents; /* FIFO of dependent objects */ 389 struct list_head dependents; /* FIFO of dependent objects */
386 struct list_head dep_link; /* link in parent's dependents list */ 390 struct list_head dep_link; /* link in parent's dependents list */
387 struct list_head pending_ops; /* unstarted operations on this object */ 391 struct list_head pending_ops; /* unstarted operations on this object */
392#ifdef CONFIG_FSCACHE_OBJECT_LIST
393 struct rb_node objlist_link; /* link in global object list */
394#endif
388 pgoff_t store_limit; /* current storage limit */ 395 pgoff_t store_limit; /* current storage limit */
389}; 396};
390 397
@@ -434,6 +441,12 @@ void fscache_object_init(struct fscache_object *object,
434extern void fscache_object_lookup_negative(struct fscache_object *object); 441extern void fscache_object_lookup_negative(struct fscache_object *object);
435extern void fscache_obtained_object(struct fscache_object *object); 442extern void fscache_obtained_object(struct fscache_object *object);
436 443
444#ifdef CONFIG_FSCACHE_OBJECT_LIST
445extern void fscache_object_destroy(struct fscache_object *object);
446#else
447#define fscache_object_destroy(object) do {} while(0)
448#endif
449
437/** 450/**
438 * fscache_object_destroyed - Note destruction of an object in a cache 451 * fscache_object_destroyed - Note destruction of an object in a cache
439 * @cache: The cache from which the object came 452 * @cache: The cache from which the object came