Skip to content

Commit 610be24

Browse files
committed
FS-Cache: Uninline fscache_object_init()
Uninline fscache_object_init() so as not to expose some of the FS-Cache internals to the cache backend. Signed-off-by: David Howells <dhowells@redhat.com> Tested-By: Milosz Tanski <milosz@adfin.com> Acked-by: Jeff Layton <jlayton@redhat.com>
1 parent 0c59a95 commit 610be24

2 files changed

Lines changed: 40 additions & 38 deletions

File tree

‎fs/fscache/object.c‎

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ static void fscache_object_state_machine(struct fscache_object *object)
363363
/*
364364
* execute an object
365365
*/
366-
void fscache_object_work_func(struct work_struct *work)
366+
static void fscache_object_work_func(struct work_struct *work)
367367
{
368368
struct fscache_object *object =
369369
container_of(work, struct fscache_object, work);
@@ -379,7 +379,43 @@ void fscache_object_work_func(struct work_struct *work)
379379
clear_bit(FSCACHE_OBJECT_EV_REQUEUE, &object->events);
380380
fscache_put_object(object);
381381
}
382-
EXPORT_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+
*/
394+
void 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+
}
418+
EXPORT_SYMBOL(fscache_object_init);
383419

384420
/*
385421
* initialise an object

‎include/linux/fscache-cache.h‎

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -426,42 +426,8 @@ extern const char *fscache_object_states[];
426426
(test_bit(FSCACHE_IOERROR, &(obj)->cache->flags) && \
427427
(obj)->state >= FSCACHE_OBJECT_DYING)
428428

429-
extern void fscache_object_work_func(struct work_struct *work);
430-
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-
*/
440-
static inline
441-
void 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-
}
429+
extern void fscache_object_init(struct fscache_object *, struct fscache_cookie *,
430+
struct fscache_cache *);
465431

466432
extern void fscache_object_lookup_negative(struct fscache_object *object);
467433
extern void fscache_obtained_object(struct fscache_object *object);

0 commit comments

Comments
 (0)