Lines Matching refs:cookie

25 #define fscache_cookie_valid(cookie) (cookie)
27 #define fscache_cookie_enabled(cookie) (cookie && !test_bit(FSCACHE_COOKIE_DISABLED, &cookie->flags))
32 #define fscache_cookie_valid(cookie) (0)
34 #define fscache_cookie_enabled(cookie) (0)
56 FSCACHE_COOKIE_STATE_QUIESCENT, /* The cookie is uncached */
62 FSCACHE_COOKIE_STATE_LRU_DISCARDING, /* The cookie is being discarded by the LRU */
63 FSCACHE_COOKIE_STATE_WITHDRAWING, /* The cookie is being withdrawn */
64 FSCACHE_COOKIE_STATE_RELINQUISHING, /* The cookie is being relinquished */
65 FSCACHE_COOKIE_STATE_DROPPED, /* The cookie has been dropped */
70 * Volume representation cookie.
96 * Data file representation cookie.
104 atomic_t n_active; /* number of active users of cookie */
118 #define FSCACHE_COOKIE_RELINQUISHED 0 /* T if cookie has been relinquished */
119 #define FSCACHE_COOKIE_RETIRED 1 /* T if this cookie has retired on relinq */
120 #define FSCACHE_COOKIE_IS_CACHING 2 /* T if this cookie is cached */
121 #define FSCACHE_COOKIE_NO_DATA_TO_READ 3 /* T if this cookie has nothing to read */
123 #define FSCACHE_COOKIE_HAS_BEEN_CACHED 5 /* T if cookie needs withdraw-on-relinq */
124 #define FSCACHE_COOKIE_DISABLED 6 /* T if cookie has been disabled */
125 #define FSCACHE_COOKIE_LOCAL_WRITE 7 /* T if cookie has been modified locally */
127 #define FSCACHE_COOKIE_DO_RELINQUISH 9 /* T if this cookie needs relinquishment */
128 #define FSCACHE_COOKIE_DO_WITHDRAW 10 /* T if this cookie needs withdrawing */
129 #define FSCACHE_COOKIE_DO_LRU_DISCARD 11 /* T if this cookie needs LRU discard */
130 #define FSCACHE_COOKIE_DO_PREP_TO_WRITE 12 /* T if cookie needs write preparation */
131 #define FSCACHE_COOKIE_HAVE_DATA 13 /* T if this cookie has data stored */
132 #define FSCACHE_COOKIE_IS_HASHED 14 /* T if this cookie is hashed */
133 #define FSCACHE_COOKIE_DO_INVALIDATE 15 /* T if cookie needs invalidation */
192 * Returns a cookie pointer on success, -ENOMEM if out of memory or -EBUSY if a
194 * cookie pointer and can be returned if caching is refused.
210 * @volume: The volume cookie
228 * fscache_acquire_cookie - Acquire a cookie to represent a cache object
229 * @volume: The volume in which to locate/create this cookie
231 * @index_key: The index key for this cookie
233 * @aux_data: The auxiliary data for the cookie (may be NULL)
237 * Acquire a cookie to represent a data file within the given cache volume.
260 * fscache_use_cookie - Request usage of cookie attached to an object
261 * @cookie: The cookie representing the cache object
264 * Request usage of the cookie attached to an object. The caller should tell
268 static inline void fscache_use_cookie(struct fscache_cookie *cookie,
271 if (fscache_cookie_valid(cookie))
272 __fscache_use_cookie(cookie, will_modify);
276 * fscache_unuse_cookie - Cease usage of cookie attached to an object
277 * @cookie: The cookie representing the cache object
281 * Cease usage of the cookie attached to an object. When the users count
282 * reaches zero then the cookie relinquishment will be permitted to proceed.
284 static inline void fscache_unuse_cookie(struct fscache_cookie *cookie,
288 if (fscache_cookie_valid(cookie))
289 __fscache_unuse_cookie(cookie, aux_data, object_size);
293 * fscache_relinquish_cookie - Return the cookie to the cache, maybe discarding
295 * @cookie: The cookie being returned
296 * @retire: True if the cache object the cookie represents is to be discarded
298 * This function returns a cookie to the cache, forcibly discarding the
305 void fscache_relinquish_cookie(struct fscache_cookie *cookie, bool retire)
307 if (fscache_cookie_valid(cookie))
308 __fscache_relinquish_cookie(cookie, retire);
312 * Find the auxiliary data on a cookie.
314 static inline void *fscache_get_aux(struct fscache_cookie *cookie)
316 if (cookie->aux_len <= sizeof(cookie->inline_aux))
317 return cookie->inline_aux;
319 return cookie->aux;
323 * Update the auxiliary data on a cookie.
326 void fscache_update_aux(struct fscache_cookie *cookie,
329 void *p = fscache_get_aux(cookie);
332 memcpy(p, aux_data, cookie->aux_len);
334 cookie->object_size = *object_size;
342 void __fscache_update_cookie(struct fscache_cookie *cookie, const void *aux_data,
348 fscache_update_aux(cookie, aux_data, object_size);
350 set_bit(FSCACHE_COOKIE_NEEDS_UPDATE, &cookie->flags);
355 * @cookie: The cookie representing the cache object
356 * @aux_data: The updated auxiliary data for the cookie (may be NULL)
360 * cookie. The auxiliary data on the cookie will be updated first if @aux_data
368 void fscache_update_cookie(struct fscache_cookie *cookie, const void *aux_data,
371 if (fscache_cookie_enabled(cookie))
372 __fscache_update_cookie(cookie, aux_data, object_size);
377 * @cookie: The cookie representing the cache object
386 void fscache_resize_cookie(struct fscache_cookie *cookie, loff_t new_size)
388 if (fscache_cookie_enabled(cookie))
389 __fscache_resize_cookie(cookie, new_size);
394 * @cookie: The cookie representing the cache object
395 * @aux_data: The updated auxiliary data for the cookie (may be NULL)
401 * increments inval_counter on the cookie which can be used by the caller to
405 * to a direct I/O write and will cause caching to be disabled on this cookie
412 void fscache_invalidate(struct fscache_cookie *cookie,
415 if (fscache_cookie_enabled(cookie))
416 __fscache_invalidate(cookie, aux_data, size, flags);
434 * @cookie: The cookie representing the cache object
438 * attached; @cookie indicates the cache object that will be accessed.
440 * @cres->inval_counter is set from @cookie->inval_counter for comparison at
451 struct fscache_cookie *cookie)
453 if (fscache_cookie_enabled(cookie))
454 return __fscache_begin_read_operation(cres, cookie);
519 * @cookie: The cookie representing the cache object
523 * attached; @cookie indicates the cache object that will be accessed.
525 * @cres->inval_counter is set from @cookie->inval_counter for comparison at
536 struct fscache_cookie *cookie)
538 if (fscache_cookie_enabled(cookie))
539 return __fscache_begin_write_operation(cres, cookie);
593 * @cookie: The cookie representing the cache object
614 static inline void fscache_write_to_cache(struct fscache_cookie *cookie,
622 __fscache_write_to_cache(cookie, mapping, start, len, i_size,
631 * @cookie: The cookie corresponding to the file
637 void fscache_note_page_release(struct fscache_cookie *cookie)
644 if (cookie &&
645 test_bit(FSCACHE_COOKIE_HAVE_DATA, &cookie->flags) &&
646 test_bit(FSCACHE_COOKIE_NO_DATA_TO_READ, &cookie->flags))
647 clear_bit(FSCACHE_COOKIE_NO_DATA_TO_READ, &cookie->flags);