btrfs: open code trivial btrfs_lru_cache_size()
The helper is really trivial, reading a cache size can be done directly. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
c207adc147
commit
e925671666
|
@ -52,11 +52,6 @@ struct btrfs_lru_cache {
|
||||||
#define btrfs_lru_cache_for_each_entry_safe(cache, entry, tmp) \
|
#define btrfs_lru_cache_for_each_entry_safe(cache, entry, tmp) \
|
||||||
list_for_each_entry_safe_reverse((entry), (tmp), &(cache)->lru_list, lru_list)
|
list_for_each_entry_safe_reverse((entry), (tmp), &(cache)->lru_list, lru_list)
|
||||||
|
|
||||||
static inline unsigned int btrfs_lru_cache_size(const struct btrfs_lru_cache *cache)
|
|
||||||
{
|
|
||||||
return cache->size;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline struct btrfs_lru_cache_entry *btrfs_lru_cache_lru_entry(
|
static inline struct btrfs_lru_cache_entry *btrfs_lru_cache_lru_entry(
|
||||||
struct btrfs_lru_cache *cache)
|
struct btrfs_lru_cache *cache)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1418,7 +1418,7 @@ static bool lookup_backref_cache(u64 leaf_bytenr, void *ctx,
|
||||||
struct btrfs_lru_cache_entry *raw_entry;
|
struct btrfs_lru_cache_entry *raw_entry;
|
||||||
struct backref_cache_entry *entry;
|
struct backref_cache_entry *entry;
|
||||||
|
|
||||||
if (btrfs_lru_cache_size(&sctx->backref_cache) == 0)
|
if (sctx->backref_cache.size == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1516,7 +1516,7 @@ static void store_backref_cache(u64 leaf_bytenr, const struct ulist *root_ids,
|
||||||
* transaction handle or holding fs_info->commit_root_sem, so no need
|
* transaction handle or holding fs_info->commit_root_sem, so no need
|
||||||
* to take any lock here.
|
* to take any lock here.
|
||||||
*/
|
*/
|
||||||
if (btrfs_lru_cache_size(&sctx->backref_cache) == 1)
|
if (sctx->backref_cache.size == 1)
|
||||||
sctx->backref_cache_last_reloc_trans = fs_info->last_reloc_trans;
|
sctx->backref_cache_last_reloc_trans = fs_info->last_reloc_trans;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2821,8 +2821,7 @@ static int cache_dir_utimes(struct send_ctx *sctx, u64 dir, u64 gen)
|
||||||
|
|
||||||
static int trim_dir_utimes_cache(struct send_ctx *sctx)
|
static int trim_dir_utimes_cache(struct send_ctx *sctx)
|
||||||
{
|
{
|
||||||
while (btrfs_lru_cache_size(&sctx->dir_utimes_cache) >
|
while (sctx->dir_utimes_cache.size > SEND_MAX_DIR_UTIMES_CACHE_SIZE) {
|
||||||
SEND_MAX_DIR_UTIMES_CACHE_SIZE) {
|
|
||||||
struct btrfs_lru_cache_entry *lru;
|
struct btrfs_lru_cache_entry *lru;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue