From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: akpm@linux-foundation.org, hughd@google.com
Cc: david@redhat.com, baolin.wang@linux.alibaba.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH 4/6] mm: shmem: change the return value of shmem_find_swap_entries()
Date: Fri, 7 Feb 2025 17:44:20 +0800 [thread overview]
Message-ID: <070489b5946b8379b2a2d25f78115cef167cd145.1738918357.git.baolin.wang@linux.alibaba.com> (raw)
In-Reply-To: <cover.1738918357.git.baolin.wang@linux.alibaba.com>
The shmem_find_swap_entries() originally returned the index corresponding to
the swap entry, but no callers used this return value. It should return the
number of entries that were found like other functions, which can be used by
the callers.
No functional changes.
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
mm/shmem.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index b764ad336598..c243d814f2b0 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1379,9 +1379,9 @@ static void shmem_evict_inode(struct inode *inode)
#endif
}
-static int shmem_find_swap_entries(struct address_space *mapping,
- pgoff_t start, struct folio_batch *fbatch,
- pgoff_t *indices, unsigned int type)
+static unsigned int shmem_find_swap_entries(struct address_space *mapping,
+ pgoff_t start, struct folio_batch *fbatch,
+ pgoff_t *indices, unsigned int type)
{
XA_STATE(xas, &mapping->i_pages, start);
struct folio *folio;
@@ -1414,7 +1414,7 @@ static int shmem_find_swap_entries(struct address_space *mapping,
}
rcu_read_unlock();
- return xas.xa_index;
+ return folio_batch_count(fbatch);
}
/*
@@ -1461,8 +1461,8 @@ static int shmem_unuse_inode(struct inode *inode, unsigned int type)
do {
folio_batch_init(&fbatch);
- shmem_find_swap_entries(mapping, start, &fbatch, indices, type);
- if (folio_batch_count(&fbatch) == 0) {
+ if (!shmem_find_swap_entries(mapping, start, &fbatch,
+ indices, type)) {
ret = 0;
break;
}
--
2.39.3
next prev parent reply other threads:[~2025-02-07 9:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-07 9:44 [PATCH 0/6] Some trivial cleanups for shmem Baolin Wang
2025-02-07 9:44 ` [PATCH 1/6] mm: shmem: drop the unused macro Baolin Wang
2025-02-07 9:44 ` [PATCH 2/6] mm: shmem: remove 'fadvise()' comments Baolin Wang
2025-02-07 9:44 ` [PATCH 3/6] mm: shmem: remove duplicate error validation Baolin Wang
2025-02-07 9:44 ` Baolin Wang [this message]
2025-02-07 9:44 ` [PATCH 5/6] mm: shmem: factor out the within_size logic into a new helper Baolin Wang
2025-02-07 9:44 ` [PATCH 6/6] MAINTAINERS: add myself as shmem reviewer Baolin Wang
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=070489b5946b8379b2a2d25f78115cef167cd145.1738918357.git.baolin.wang@linux.alibaba.com \
--to=baolin.wang@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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