Skip to content

Commit e925671

Browse files
committed
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>
1 parent c207adc commit e925671

2 files changed

Lines changed: 3 additions & 9 deletions

File tree

fs/btrfs/lru_cache.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ struct btrfs_lru_cache {
5252
#define btrfs_lru_cache_for_each_entry_safe(cache, entry, tmp) \
5353
list_for_each_entry_safe_reverse((entry), (tmp), &(cache)->lru_list, lru_list)
5454

55-
static inline unsigned int btrfs_lru_cache_size(const struct btrfs_lru_cache *cache)
56-
{
57-
return cache->size;
58-
}
59-
6055
static inline struct btrfs_lru_cache_entry *btrfs_lru_cache_lru_entry(
6156
struct btrfs_lru_cache *cache)
6257
{

fs/btrfs/send.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,7 +1418,7 @@ static bool lookup_backref_cache(u64 leaf_bytenr, void *ctx,
14181418
struct btrfs_lru_cache_entry *raw_entry;
14191419
struct backref_cache_entry *entry;
14201420

1421-
if (btrfs_lru_cache_size(&sctx->backref_cache) == 0)
1421+
if (sctx->backref_cache.size == 0)
14221422
return false;
14231423

14241424
/*
@@ -1516,7 +1516,7 @@ static void store_backref_cache(u64 leaf_bytenr, const struct ulist *root_ids,
15161516
* transaction handle or holding fs_info->commit_root_sem, so no need
15171517
* to take any lock here.
15181518
*/
1519-
if (btrfs_lru_cache_size(&sctx->backref_cache) == 1)
1519+
if (sctx->backref_cache.size == 1)
15201520
sctx->backref_cache_last_reloc_trans = fs_info->last_reloc_trans;
15211521
}
15221522

@@ -2821,8 +2821,7 @@ static int cache_dir_utimes(struct send_ctx *sctx, u64 dir, u64 gen)
28212821

28222822
static int trim_dir_utimes_cache(struct send_ctx *sctx)
28232823
{
2824-
while (btrfs_lru_cache_size(&sctx->dir_utimes_cache) >
2825-
SEND_MAX_DIR_UTIMES_CACHE_SIZE) {
2824+
while (sctx->dir_utimes_cache.size > SEND_MAX_DIR_UTIMES_CACHE_SIZE) {
28262825
struct btrfs_lru_cache_entry *lru;
28272826
int ret;
28282827

0 commit comments

Comments
 (0)