diff options
author | David Howells <dhowells@redhat.com> | 2013-08-21 17:29:21 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2013-09-06 09:17:30 +0100 |
commit | 5002d7bef81c9646bbb06fb57db4a100aa5a57c5 (patch) | |
tree | 7894e28d5f50756b655acf46dbed6cdd41deccec /fs/cachefiles/interface.c | |
parent | da9803bc8812f5bd3b26baaa90e515b843c65ff7 (diff) | |
download | op-kernel-dev-5002d7bef81c9646bbb06fb57db4a100aa5a57c5.zip op-kernel-dev-5002d7bef81c9646bbb06fb57db4a100aa5a57c5.tar.gz |
CacheFiles: Implement interface to check cache consistency
Implement the FS-Cache interface to check the consistency of a cache object in
CacheFiles.
Original-author: Hongyi Jia <jiayisuse@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Hongyi Jia <jiayisuse@gmail.com>
cc: Milosz Tanski <milosz@adfin.com>
Diffstat (limited to 'fs/cachefiles/interface.c')
-rw-r--r-- | fs/cachefiles/interface.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/fs/cachefiles/interface.c b/fs/cachefiles/interface.c index d4c1206..43eb559 100644 --- a/fs/cachefiles/interface.c +++ b/fs/cachefiles/interface.c @@ -378,6 +378,31 @@ static void cachefiles_sync_cache(struct fscache_cache *_cache) } /* + * check if the backing cache is updated to FS-Cache + * - called by FS-Cache when evaluates if need to invalidate the cache + */ +static bool cachefiles_check_consistency(struct fscache_operation *op) +{ + struct cachefiles_object *object; + struct cachefiles_cache *cache; + const struct cred *saved_cred; + int ret; + + _enter("{OBJ%x}", op->object->debug_id); + + object = container_of(op->object, struct cachefiles_object, fscache); + cache = container_of(object->fscache.cache, + struct cachefiles_cache, cache); + + cachefiles_begin_secure(cache, &saved_cred); + ret = cachefiles_check_auxdata(object); + cachefiles_end_secure(cache, saved_cred); + + _leave(" = %d", ret); + return ret; +} + +/* * notification the attributes on an object have changed * - called with reads/writes excluded by FS-Cache */ @@ -522,4 +547,5 @@ const struct fscache_cache_ops cachefiles_cache_ops = { .write_page = cachefiles_write_page, .uncache_page = cachefiles_uncache_page, .dissociate_pages = cachefiles_dissociate_pages, + .check_consistency = cachefiles_check_consistency, }; |