Skip to content

Commit

Permalink
fscache: Add a function for a cache backend to note an I/O error
Browse files Browse the repository at this point in the history
  • Loading branch information
dhowells committed Jan 7, 2022
1 parent bfa22da commit 29f18e7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
20 changes: 20 additions & 0 deletions fs/fscache/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,26 @@ void fscache_end_cache_access(struct fscache_cache *cache, enum fscache_access_t
wake_up_var(&cache->n_accesses);
}

/**
* fscache_io_error - Note a cache I/O error
* @cache: The record describing the cache
*
* Note that an I/O error occurred in a cache and that it should no longer be
* used for anything. This also reports the error into the kernel log.
*
* See Documentation/filesystems/caching/backend-api.rst for a complete
* description.
*/
void fscache_io_error(struct fscache_cache *cache)
{
if (fscache_set_cache_state_maybe(cache,
FSCACHE_CACHE_IS_ACTIVE,
FSCACHE_CACHE_GOT_IOERROR))
pr_err("Cache '%s' stopped due to I/O error\n",
cache->name);
}
EXPORT_SYMBOL(fscache_io_error);

/**
* fscache_withdraw_cache - Withdraw a cache from the active service
* @cache: The cache cookie
Expand Down
2 changes: 2 additions & 0 deletions include/linux/fscache-cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ extern int fscache_add_cache(struct fscache_cache *cache,
extern void fscache_withdraw_cache(struct fscache_cache *cache);
extern void fscache_withdraw_volume(struct fscache_volume *volume);

extern void fscache_io_error(struct fscache_cache *cache);

extern void fscache_end_volume_access(struct fscache_volume *volume,
struct fscache_cookie *cookie,
enum fscache_access_trace why);
Expand Down

0 comments on commit 29f18e7

Please sign in to comment.