All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fs/ceph/mds_client: use detach_cap_releases() in ceph_send_cap_releases()
@ 2026-07-09 10:48 Max Kellermann
  2026-07-14  4:45 ` Xiubo Li
  0 siblings, 1 reply; 2+ messages in thread
From: Max Kellermann @ 2026-07-09 10:48 UTC (permalink / raw)
  To: idryomov, amarkuze, ceph-devel, linux-kernel; +Cc: Max Kellermann

Eliminate some redundant code.

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
---
 fs/ceph/mds_client.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 853bf698b356..578c1909e18f 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -1799,16 +1799,19 @@ static void __open_export_target_sessions(struct ceph_mds_client *mdsc,
  * session caps
  */
 
-static void detach_cap_releases(struct ceph_mds_session *session,
-				struct list_head *target)
+static int detach_cap_releases(struct ceph_mds_session *session,
+			       struct list_head *target)
 {
 	struct ceph_client *cl = session->s_mdsc->fsc->client;
+	const int num_cap_releases = session->s_num_cap_releases;
 
 	lockdep_assert_held(&session->s_cap_lock);
 
 	list_splice_init(&session->s_cap_releases, target);
 	session->s_num_cap_releases = 0;
 	doutc(cl, "mds%d\n", session->s_mds);
+
+	return num_cap_releases;
 }
 
 static void dispose_cap_releases(struct ceph_mds_client *mdsc,
@@ -2464,9 +2467,7 @@ static void ceph_send_cap_releases(struct ceph_mds_client *mdsc,
 
 	spin_lock(&session->s_cap_lock);
 again:
-	list_splice_init(&session->s_cap_releases, &tmp_list);
-	num_cap_releases = session->s_num_cap_releases;
-	session->s_num_cap_releases = 0;
+	num_cap_releases = detach_cap_releases(session, &tmp_list);
 	spin_unlock(&session->s_cap_lock);
 
 	while (!list_empty(&tmp_list)) {
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fs/ceph/mds_client: use detach_cap_releases() in ceph_send_cap_releases()
  2026-07-09 10:48 [PATCH] fs/ceph/mds_client: use detach_cap_releases() in ceph_send_cap_releases() Max Kellermann
@ 2026-07-14  4:45 ` Xiubo Li
  0 siblings, 0 replies; 2+ messages in thread
From: Xiubo Li @ 2026-07-14  4:45 UTC (permalink / raw)
  To: Max Kellermann; +Cc: idryomov, amarkuze, ceph-devel, linux-kernel

LGTM.

Reviewed-by: Xiubo Li <xiubo.li@clyso.com>

Max Kellermann <max.kellermann@ionos.com> 于2026年7月9日周四 18:49写道:
>
> Eliminate some redundant code.
>
> Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
> ---
>  fs/ceph/mds_client.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> index 853bf698b356..578c1909e18f 100644
> --- a/fs/ceph/mds_client.c
> +++ b/fs/ceph/mds_client.c
> @@ -1799,16 +1799,19 @@ static void __open_export_target_sessions(struct ceph_mds_client *mdsc,
>   * session caps
>   */
>
> -static void detach_cap_releases(struct ceph_mds_session *session,
> -                               struct list_head *target)
> +static int detach_cap_releases(struct ceph_mds_session *session,
> +                              struct list_head *target)
>  {
>         struct ceph_client *cl = session->s_mdsc->fsc->client;
> +       const int num_cap_releases = session->s_num_cap_releases;
>
>         lockdep_assert_held(&session->s_cap_lock);
>
>         list_splice_init(&session->s_cap_releases, target);
>         session->s_num_cap_releases = 0;
>         doutc(cl, "mds%d\n", session->s_mds);
> +
> +       return num_cap_releases;
>  }
>
>  static void dispose_cap_releases(struct ceph_mds_client *mdsc,
> @@ -2464,9 +2467,7 @@ static void ceph_send_cap_releases(struct ceph_mds_client *mdsc,
>
>         spin_lock(&session->s_cap_lock);
>  again:
> -       list_splice_init(&session->s_cap_releases, &tmp_list);
> -       num_cap_releases = session->s_num_cap_releases;
> -       session->s_num_cap_releases = 0;
> +       num_cap_releases = detach_cap_releases(session, &tmp_list);
>         spin_unlock(&session->s_cap_lock);
>
>         while (!list_empty(&tmp_list)) {
> --
> 2.47.3
>
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-14  4:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-09 10:48 [PATCH] fs/ceph/mds_client: use detach_cap_releases() in ceph_send_cap_releases() Max Kellermann
2026-07-14  4:45 ` Xiubo Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.