]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commit
fscache: Count data storage objects in a cache
authorDavid Howells <dhowells@redhat.com>
Thu, 11 Nov 2021 23:14:29 +0000 (23:14 +0000)
committerDavid Howells <dhowells@redhat.com>
Fri, 26 Nov 2021 14:28:53 +0000 (14:28 +0000)
commit875acb173b6fde65e064e7cccd3d6a53f7ec6b58
tree4815ebc87a9a6420f63f7efd9cd4224714a3a1ec
parentb9420b4f3136ad10241fa83eacd1c18330946e9e
fscache: Count data storage objects in a cache

Count the data storage objects that are currently allocated in a cache.
This is used to pin certain cache structures until cache withdrawal is
complete.

Three helpers are provided to manage and make use of the count:

 (1) void fscache_count_object(struct fscache_cache *cache);

     This should be called by the cache backend to note that an object has
     been allocated and attached to the cache.

 (2) void fscache_uncount_object(struct fscache_cache *cache);

     This should be called by the backend to note that an object has been
     destroyed.  This sends a wakeup event that allows cache withdrawal to
     proceed if it was waiting for that object.

 (3) void fscache_wait_for_objects(struct fscache_cache *cache);

     This can be used by the backend to wait for all outstanding cache
     object to be destroyed.

Each cache's counter is displayed as part of /proc/fs/fscache/caches.

Signed-off-by: David Howells <dhowells@redhat.com>
fs/fscache/cache.c
include/linux/fscache-cache.h