diff options
Diffstat (limited to 'fs/btrfs/lru_cache.c')
-rw-r--r-- | fs/btrfs/lru_cache.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/lru_cache.c b/fs/btrfs/lru_cache.c index 38722dc07676..0fe0ae54ac67 100644 --- a/fs/btrfs/lru_cache.c +++ b/fs/btrfs/lru_cache.c @@ -9,6 +9,8 @@ * * @cache: The cache. * @max_size: Maximum size (number of entries) for the cache. + * Use 0 for unlimited size, it's the user's responsability to + * trim the cache in that case. */ void btrfs_lru_cache_init(struct btrfs_lru_cache *cache, unsigned int max_size) { @@ -129,7 +131,7 @@ int btrfs_lru_cache_store(struct btrfs_lru_cache *cache, return ret; } - if (cache->size == cache->max_size) { + if (cache->max_size > 0 && cache->size == cache->max_size) { struct btrfs_lru_cache_entry *lru_entry; lru_entry = list_first_entry(&cache->lru_list, |