aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/fscache/object.c40
-rw-r--r--include/linux/fscache-cache.h38
2 files changed, 40 insertions, 38 deletions
diff --git a/fs/fscache/object.c b/fs/fscache/object.c
index 50d41c180211..0133699f74ee 100644
--- a/fs/fscache/object.c
+++ b/fs/fscache/object.c
@@ -363,7 +363,7 @@ unsupported_event:
363/* 363/*
364 * execute an object 364 * execute an object
365 */ 365 */
366void fscache_object_work_func(struct work_struct *work) 366static void fscache_object_work_func(struct work_struct *work)
367{ 367{
368 struct fscache_object *object = 368 struct fscache_object *object =
369 container_of(work, struct fscache_object, work); 369 container_of(work, struct fscache_object, work);
@@ -379,7 +379,43 @@ void fscache_object_work_func(struct work_struct *work)
379 clear_bit(FSCACHE_OBJECT_EV_REQUEUE, &object->events); 379 clear_bit(FSCACHE_OBJECT_EV_REQUEUE, &object->events);
380 fscache_put_object(object); 380 fscache_put_object(object);
381} 381}
382EXPORT_SYMBOL(fscache_object_work_func); 382
383/**
384 * fscache_object_init - Initialise a cache object description
385 * @object: Object description
386 * @cookie: Cookie object will be attached to
387 * @cache: Cache in which backing object will be found
388 *
389 * Initialise a cache object description to its basic values.
390 *
391 * See Documentation/filesystems/caching/backend-api.txt for a complete
392 * description.
393 */
394void fscache_object_init(struct fscache_object *object,
395 struct fscache_cookie *cookie,
396 struct fscache_cache *cache)
397{
398 atomic_inc(&cache->object_count);
399
400 object->state = FSCACHE_OBJECT_INIT;
401 spin_lock_init(&object->lock);
402 INIT_LIST_HEAD(&object->cache_link);
403 INIT_HLIST_NODE(&object->cookie_link);
404 INIT_WORK(&object->work, fscache_object_work_func);
405 INIT_LIST_HEAD(&object->dependents);
406 INIT_LIST_HEAD(&object->dep_link);
407 INIT_LIST_HEAD(&object->pending_ops);
408 object->n_children = 0;
409 object->n_ops = object->n_in_progress = object->n_exclusive = 0;
410 object->events = object->event_mask = 0;
411 object->flags = 0;
412 object->store_limit = 0;
413 object->store_limit_l = 0;
414 object->cache = cache;
415 object->cookie = cookie;
416 object->parent = NULL;
417}
418EXPORT_SYMBOL(fscache_object_init);
383 419
384/* 420/*
385 * initialise an object 421 * initialise an object
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h
index 5dfa0aa216b6..9b9c1de4a460 100644
--- a/include/linux/fscache-cache.h
+++ b/include/linux/fscache-cache.h
@@ -426,42 +426,8 @@ extern const char *fscache_object_states[];
426 (test_bit(FSCACHE_IOERROR, &(obj)->cache->flags) && \ 426 (test_bit(FSCACHE_IOERROR, &(obj)->cache->flags) && \
427 (obj)->state >= FSCACHE_OBJECT_DYING) 427 (obj)->state >= FSCACHE_OBJECT_DYING)
428 428
429extern void fscache_object_work_func(struct work_struct *work); 429extern void fscache_object_init(struct fscache_object *, struct fscache_cookie *,
430 430 struct fscache_cache *);
431/**
432 * fscache_object_init - Initialise a cache object description
433 * @object: Object description
434 *
435 * Initialise a cache object description to its basic values.
436 *
437 * See Documentation/filesystems/caching/backend-api.txt for a complete
438 * description.
439 */
440static inline
441void fscache_object_init(struct fscache_object *object,
442 struct fscache_cookie *cookie,
443 struct fscache_cache *cache)
444{
445 atomic_inc(&cache->object_count);
446
447 object->state = FSCACHE_OBJECT_INIT;
448 spin_lock_init(&object->lock);
449 INIT_LIST_HEAD(&object->cache_link);
450 INIT_HLIST_NODE(&object->cookie_link);
451 INIT_WORK(&object->work, fscache_object_work_func);
452 INIT_LIST_HEAD(&object->dependents);
453 INIT_LIST_HEAD(&object->dep_link);
454 INIT_LIST_HEAD(&object->pending_ops);
455 object->n_children = 0;
456 object->n_ops = object->n_in_progress = object->n_exclusive = 0;
457 object->events = object->event_mask = 0;
458 object->flags = 0;
459 object->store_limit = 0;
460 object->store_limit_l = 0;
461 object->cache = cache;
462 object->cookie = cookie;
463 object->parent = NULL;
464}
465 431
466extern void fscache_object_lookup_negative(struct fscache_object *object); 432extern void fscache_object_lookup_negative(struct fscache_object *object);
467extern void fscache_obtained_object(struct fscache_object *object); 433extern void fscache_obtained_object(struct fscache_object *object);