From: David Sterba <dsterba@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.com>
Subject: [PATCH 09/10] btrfs: open code trivial btrfs_lru_cache_size()
Date: Mon, 19 Feb 2024 12:13:06 +0100 [thread overview]
Message-ID: <dc3826c9bcd92cf8caafc62f079d6f0df7d2cb3e.1708339010.git.dsterba@suse.com> (raw)
In-Reply-To: <cover.1708339010.git.dsterba@suse.com>
The helper is really trivial, reading a cache size can be done directly.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/lru_cache.h | 5 -----
fs/btrfs/send.c | 7 +++----
2 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/fs/btrfs/lru_cache.h b/fs/btrfs/lru_cache.h
index 390a12b61fd2..e32906ab6faa 100644
--- a/fs/btrfs/lru_cache.h
+++ b/fs/btrfs/lru_cache.h
@@ -52,11 +52,6 @@ struct btrfs_lru_cache {
#define btrfs_lru_cache_for_each_entry_safe(cache, entry, tmp) \
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(
struct btrfs_lru_cache *cache)
{
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index e96d511f9dd9..e6a9e976916c 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -1418,7 +1418,7 @@ static bool lookup_backref_cache(u64 leaf_bytenr, void *ctx,
struct btrfs_lru_cache_entry *raw_entry;
struct backref_cache_entry *entry;
- if (btrfs_lru_cache_size(&sctx->backref_cache) == 0)
+ if (sctx->backref_cache.size == 0)
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
* 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;
}
@@ -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)
{
- while (btrfs_lru_cache_size(&sctx->dir_utimes_cache) >
- SEND_MAX_DIR_UTIMES_CACHE_SIZE) {
+ while (sctx->dir_utimes_cache.size > SEND_MAX_DIR_UTIMES_CACHE_SIZE) {
struct btrfs_lru_cache_entry *lru;
int ret;
--
2.42.1
next prev parent reply other threads:[~2024-02-19 11:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-19 11:12 [PATCH 00/10] Static inline cleanups David Sterba
2024-02-19 11:12 ` [PATCH 01/10] btrfs: move balance args conversion helpers to volumes.c David Sterba
2024-02-19 11:12 ` [PATCH 02/10] btrfs: open code btrfs_backref_iter_free() David Sterba
2024-02-19 11:12 ` [PATCH 03/10] btrfs: open code btrfs_backref_get_eb() David Sterba
2024-02-19 11:12 ` [PATCH 04/10] btrfs: uninline some static inline helpers from backref.h David Sterba
2024-02-19 11:12 ` [PATCH 05/10] btrfs: uninline btrfs_init_delayed_root() David Sterba
2024-02-19 11:12 ` [PATCH 06/10] btrfs: drop static inline specifiers from tree-mod-log.c David Sterba
2024-02-19 11:13 ` [PATCH 07/10] btrfs: uninline some static inline helpers from tree-log.h David Sterba
2024-02-19 11:13 ` [PATCH 08/10] btrfs: simplify conditions in btrfs_free_chunk_map() David Sterba
2024-02-19 12:27 ` Filipe Manana
2024-02-19 14:41 ` David Sterba
2024-02-26 8:31 ` kernel test robot
2024-02-19 11:13 ` David Sterba [this message]
2024-02-19 11:13 ` [PATCH 10/10] btrfs: uninline some static inline helpers from delayed-ref.h David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dc3826c9bcd92cf8caafc62f079d6f0df7d2cb3e.1708339010.git.dsterba@suse.com \
--to=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox