Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions | Variables
fscache-cache.h File Reference
#include <linux/fscache.h>
#include <linux/sched.h>
#include <linux/workqueue.h>

Go to the source code of this file.

Data Structures

struct  fscache_cache_tag
 
struct  fscache_cache
 
struct  fscache_operation
 
struct  fscache_retrieval
 
struct  fscache_storage
 
struct  fscache_cache_ops
 
struct  fscache_cookie
 
struct  fscache_object
 

Macros

#define NR_MAXCACHES   BITS_PER_LONG
 
#define FSCACHE_TAG_RESERVED   0 /* T if tag is reserved for a cache */
 
#define FSCACHE_IOERROR   0 /* cache stopped on I/O error */
 
#define FSCACHE_CACHE_WITHDRAWN   1 /* cache has been withdrawn */
 
#define FSCACHE_OP_TYPE   0x000f /* operation type */
 
#define FSCACHE_OP_ASYNC   0x0001 /* - async op, processor may sleep for disk */
 
#define FSCACHE_OP_MYTHREAD   0x0002 /* - processing is done be issuing thread, not pool */
 
#define FSCACHE_OP_WAITING   4 /* cleared when op is woken */
 
#define FSCACHE_OP_EXCLUSIVE   5 /* exclusive op, other ops must wait */
 
#define FSCACHE_OP_DEAD   6 /* op is now dead */
 
#define FSCACHE_OP_DEC_READ_CNT   7 /* decrement object->n_reads on destruction */
 
#define FSCACHE_OP_KEEP_FLAGS   0xc0 /* flags to keep when repurposing an op */
 
#define FSCACHE_COOKIE_PENDING_TAG   0 /* pages tag: pending write to cache */
 
#define FSCACHE_COOKIE_STORING_TAG   1 /* pages tag: writing to cache */
 
#define FSCACHE_COOKIE_LOOKING_UP   0 /* T if non-index cookie being looked up still */
 
#define FSCACHE_COOKIE_CREATING   1 /* T if non-index object being created still */
 
#define FSCACHE_COOKIE_NO_DATA_YET   2 /* T if new object with no cached data yet */
 
#define FSCACHE_COOKIE_PENDING_FILL   3 /* T if pending initial fill on object */
 
#define FSCACHE_COOKIE_FILLING   4 /* T if filling object incrementally */
 
#define FSCACHE_COOKIE_UNAVAILABLE   5 /* T if cookie is unavailable (error, etc) */
 
#define FSCACHE_OBJECT_EV_REQUEUE   0 /* T if object should be requeued */
 
#define FSCACHE_OBJECT_EV_UPDATE   1 /* T if object should be updated */
 
#define FSCACHE_OBJECT_EV_CLEARED   2 /* T if accessors all gone */
 
#define FSCACHE_OBJECT_EV_ERROR   3 /* T if fatal error occurred during processing */
 
#define FSCACHE_OBJECT_EV_RELEASE   4 /* T if netfs requested object release */
 
#define FSCACHE_OBJECT_EV_RETIRE   5 /* T if netfs requested object retirement */
 
#define FSCACHE_OBJECT_EV_WITHDRAW   6 /* T if cache requested object withdrawal */
 
#define FSCACHE_OBJECT_EVENTS_MASK   0x7f /* mask of all events*/
 
#define FSCACHE_OBJECT_LOCK   0 /* T if object is busy being processed */
 
#define FSCACHE_OBJECT_PENDING_WRITE   1 /* T if object has pending write */
 
#define FSCACHE_OBJECT_WAITING   2 /* T if object is waiting on its parent */
 
#define fscache_object_is_active(obj)
 
#define fscache_object_is_dead(obj)
 
#define fscache_object_destroy(object)   do {} while(0)
 

Typedefs

typedef void(* fscache_operation_release_t )(struct fscache_operation *op)
 
typedef void(* fscache_operation_processor_t )(struct fscache_operation *op)
 
typedef int(* fscache_page_retrieval_func_t )(struct fscache_retrieval *op, struct page *page, gfp_t gfp)
 
typedef int(* fscache_pages_retrieval_func_t )(struct fscache_retrieval *op, struct list_head *pages, unsigned *nr_pages, gfp_t gfp)
 

Functions

void fscache_op_work_func (struct work_struct *work)
 
void fscache_enqueue_operation (struct fscache_operation *)
 
void fscache_put_operation (struct fscache_operation *)
 
void fscache_object_work_func (struct work_struct *work)
 
void fscache_object_lookup_negative (struct fscache_object *object)
 
void fscache_obtained_object (struct fscache_object *object)
 
 __printf (3, 4) void fscache_init_cache(struct fscache_cache *cache
 
struct fscache_cache_ops const
char int 
fscache_add_cache (struct fscache_cache *cache, struct fscache_object *fsdef, const char *tagname)
 
void fscache_withdraw_cache (struct fscache_cache *cache)
 
void fscache_io_error (struct fscache_cache *cache)
 
void fscache_mark_pages_cached (struct fscache_retrieval *op, struct pagevec *pagevec)
 
bool fscache_object_sleep_till_congested (signed long *timeoutp)
 
enum fscache_checkaux fscache_check_aux (struct fscache_object *object, const void *data, uint16_t datalen)
 

Variables

wait_queue_head_t fscache_cache_cleared_wq
 
atomic_t fscache_op_debug_id
 
struct fscache_cookie fscache_fsdef_index
 
const charfscache_object_states []
 
struct fscache_cache_opsops
 
struct fscache_cache_ops const
char
idfmt
 

Macro Definition Documentation

#define FSCACHE_CACHE_WITHDRAWN   1 /* cache has been withdrawn */

Definition at line 65 of file fscache-cache.h.

#define FSCACHE_COOKIE_CREATING   1 /* T if non-index object being created still */

Definition at line 299 of file fscache-cache.h.

#define FSCACHE_COOKIE_FILLING   4 /* T if filling object incrementally */

Definition at line 302 of file fscache-cache.h.

#define FSCACHE_COOKIE_LOOKING_UP   0 /* T if non-index cookie being looked up still */

Definition at line 298 of file fscache-cache.h.

#define FSCACHE_COOKIE_NO_DATA_YET   2 /* T if new object with no cached data yet */

Definition at line 300 of file fscache-cache.h.

#define FSCACHE_COOKIE_PENDING_FILL   3 /* T if pending initial fill on object */

Definition at line 301 of file fscache-cache.h.

#define FSCACHE_COOKIE_PENDING_TAG   0 /* pages tag: pending write to cache */

Definition at line 294 of file fscache-cache.h.

#define FSCACHE_COOKIE_STORING_TAG   1 /* pages tag: writing to cache */

Definition at line 295 of file fscache-cache.h.

#define FSCACHE_COOKIE_UNAVAILABLE   5 /* T if cookie is unavailable (error, etc) */

Definition at line 303 of file fscache-cache.h.

#define FSCACHE_IOERROR   0 /* cache stopped on I/O error */

Definition at line 64 of file fscache-cache.h.

#define fscache_object_destroy (   object)    do {} while(0)

Definition at line 430 of file fscache-cache.h.

#define FSCACHE_OBJECT_EV_CLEARED   2 /* T if accessors all gone */

Definition at line 348 of file fscache-cache.h.

#define FSCACHE_OBJECT_EV_ERROR   3 /* T if fatal error occurred during processing */

Definition at line 349 of file fscache-cache.h.

#define FSCACHE_OBJECT_EV_RELEASE   4 /* T if netfs requested object release */

Definition at line 350 of file fscache-cache.h.

#define FSCACHE_OBJECT_EV_REQUEUE   0 /* T if object should be requeued */

Definition at line 346 of file fscache-cache.h.

#define FSCACHE_OBJECT_EV_RETIRE   5 /* T if netfs requested object retirement */

Definition at line 351 of file fscache-cache.h.

#define FSCACHE_OBJECT_EV_UPDATE   1 /* T if object should be updated */

Definition at line 347 of file fscache-cache.h.

#define FSCACHE_OBJECT_EV_WITHDRAW   6 /* T if cache requested object withdrawal */

Definition at line 352 of file fscache-cache.h.

#define FSCACHE_OBJECT_EVENTS_MASK   0x7f /* mask of all events*/

Definition at line 353 of file fscache-cache.h.

#define fscache_object_is_active (   obj)
Value:
(!test_bit(FSCACHE_IOERROR, &(obj)->cache->flags) && \
(obj)->state >= FSCACHE_OBJECT_AVAILABLE && \
(obj)->state < FSCACHE_OBJECT_DYING)

Definition at line 378 of file fscache-cache.h.

#define fscache_object_is_dead (   obj)
Value:
(test_bit(FSCACHE_IOERROR, &(obj)->cache->flags) && \
(obj)->state >= FSCACHE_OBJECT_DYING)

Definition at line 383 of file fscache-cache.h.

#define FSCACHE_OBJECT_LOCK   0 /* T if object is busy being processed */

Definition at line 356 of file fscache-cache.h.

#define FSCACHE_OBJECT_PENDING_WRITE   1 /* T if object has pending write */

Definition at line 357 of file fscache-cache.h.

#define FSCACHE_OBJECT_WAITING   2 /* T if object is waiting on its parent */

Definition at line 358 of file fscache-cache.h.

#define FSCACHE_OP_ASYNC   0x0001 /* - async op, processor may sleep for disk */

Definition at line 85 of file fscache-cache.h.

#define FSCACHE_OP_DEAD   6 /* op is now dead */

Definition at line 89 of file fscache-cache.h.

#define FSCACHE_OP_DEC_READ_CNT   7 /* decrement object->n_reads on destruction */

Definition at line 90 of file fscache-cache.h.

#define FSCACHE_OP_EXCLUSIVE   5 /* exclusive op, other ops must wait */

Definition at line 88 of file fscache-cache.h.

#define FSCACHE_OP_KEEP_FLAGS   0xc0 /* flags to keep when repurposing an op */

Definition at line 91 of file fscache-cache.h.

#define FSCACHE_OP_MYTHREAD   0x0002 /* - processing is done be issuing thread, not pool */

Definition at line 86 of file fscache-cache.h.

#define FSCACHE_OP_TYPE   0x000f /* operation type */

Definition at line 84 of file fscache-cache.h.

#define FSCACHE_OP_WAITING   4 /* cleared when op is woken */

Definition at line 87 of file fscache-cache.h.

#define FSCACHE_TAG_RESERVED   0 /* T if tag is reserved for a cache */

Definition at line 39 of file fscache-cache.h.

#define NR_MAXCACHES   BITS_PER_LONG

Definition at line 25 of file fscache-cache.h.

Typedef Documentation

typedef void(* fscache_operation_processor_t)(struct fscache_operation *op)

Definition at line 76 of file fscache-cache.h.

typedef void(* fscache_operation_release_t)(struct fscache_operation *op)

Definition at line 75 of file fscache-cache.h.

typedef int(* fscache_page_retrieval_func_t)(struct fscache_retrieval *op, struct page *page, gfp_t gfp)

Definition at line 143 of file fscache-cache.h.

typedef int(* fscache_pages_retrieval_func_t)(struct fscache_retrieval *op, struct list_head *pages, unsigned *nr_pages, gfp_t gfp)

Definition at line 147 of file fscache-cache.h.

Function Documentation

__printf ( ,
 
)
struct fscache_cache_ops const char int fscache_add_cache ( struct fscache_cache cache,
struct fscache_object ifsdef,
const char tagname 
)

fscache_add_cache - Declare a cache as being open for business : The record describing the cache : The record of the cache object describing the top-level index : The tag describing this cache

Add a cache to the system, making it available for netfs's to use.

See Documentation/filesystems/caching/backend-api.txt for a complete description.

Definition at line 217 of file cache.c.

enum fscache_checkaux fscache_check_aux ( struct fscache_object object,
const void data,
uint16_t  datalen 
)

fscache_check_aux - Ask the netfs whether an object on disk is still valid : The object to ask about : The auxiliary data for the object : The size of the auxiliary data

This function consults the netfs about the coherency state of an object

Definition at line 858 of file object.c.

void fscache_enqueue_operation ( struct fscache_operation op)

fscache_enqueue_operation - Enqueue an operation for processing : The operation to enqueue

Enqueue an operation for processing by the FS-Cache thread pool.

This will get its own ref on the object.

Definition at line 31 of file operation.c.

void fscache_io_error ( struct fscache_cache cache)

fscache_io_error - Note a cache I/O error : The record describing the cache

Note that an I/O error occurred in a cache and that it should no longer be used for anything. This also reports the error into the kernel log.

See Documentation/filesystems/caching/backend-api.txt for a complete description.

Definition at line 315 of file cache.c.

void fscache_mark_pages_cached ( struct fscache_retrieval op,
struct pagevec pagevec 
)

fscache_mark_pages_cached - Mark pages as being cached : The retrieval op pages are being marked for : The pages to be marked

Mark a bunch of netfs pages as being cached. After this is called, the netfs must call fscache_uncache_page() to remove the mark.

Definition at line 925 of file page.c.

void fscache_object_lookup_negative ( struct fscache_object object)

fscache_object_lookup_negative - Note negative cookie lookup : Object pointing to cookie to mark

Note negative lookup, permitting those waiting to read data from an already existing backing object to continue as there's no data for them to read.

Definition at line 489 of file object.c.

bool fscache_object_sleep_till_congested ( signed long timeoutp)

fscache_object_sleep_till_congested - Sleep until object wq is congested : Scheduler sleep timeout

Allow an object handler to sleep until the object workqueue is congested.

The caller must set up a wake up event before calling this and must have set the appropriate sleep mode (such as TASK_UNINTERRUPTIBLE) and tested its own condition before calling this function as no test is made here.

true is returned if the object wq is congested, false otherwise.

Definition at line 783 of file object.c.

void fscache_object_work_func ( struct work_struct work)

Definition at line 332 of file object.c.

void fscache_obtained_object ( struct fscache_object object)

fscache_obtained_object - Note successful object lookup or creation : Object pointing to cookie to mark

Note successful lookup and/or creation, permitting those waiting to write data to a backing object to continue.

Note that after calling this, an object's cookie may be relinquished by the netfs, and so must be accessed with object lock held.

Definition at line 533 of file object.c.

void fscache_op_work_func ( struct work_struct work)

Definition at line 447 of file operation.c.

void fscache_put_operation ( struct fscache_operation )

Definition at line 317 of file operation.c.

void fscache_withdraw_cache ( struct fscache_cache cache)

fscache_withdraw_cache - Withdraw a cache from the active service : The record describing the cache

Withdraw a cache from service, unbinding all its cache objects from the netfs cookies they're currently representing.

See Documentation/filesystems/caching/backend-api.txt for a complete description.

Definition at line 364 of file cache.c.

Variable Documentation

wait_queue_head_t fscache_cache_cleared_wq
struct fscache_cookie fscache_fsdef_index

Definition at line 56 of file fsdef.c.

const char* fscache_object_states[]

Definition at line 19 of file object.c.

atomic_t fscache_op_debug_id

Definition at line 20 of file operation.c.

Definition at line 497 of file fscache-cache.h.

Definition at line 497 of file fscache-cache.h.