All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilya Dryomov <idryomov@gmail.com>
To: Geliang Tang <geliangtang@163.com>
Cc: "Yan, Zheng" <zyan@redhat.com>, Sage Weil <sage@redhat.com>,
	"David S. Miller" <davem@davemloft.net>,
	Ceph Development <ceph-devel@vger.kernel.org>,
	netdev <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 06/14] libceph: use list_for_each_entry_safe
Date: Mon, 11 Jan 2016 23:06:07 +0100	[thread overview]
Message-ID: <CAOi1vP_sZgBz+Xb0o-NX-4o4BveQ6LKJsu_RC6OozjkehM=1UQ@mail.gmail.com> (raw)
In-Reply-To: <40510e6829654a5a4726650c63bf00d88c037593.1450451516.git.geliangtang@163.com>

On Fri, Dec 18, 2015 at 4:33 PM, Geliang Tang <geliangtang@163.com> wrote:
> Use list_for_each_entry_safe() instead of list_for_each_safe() to
> simplify the code.
>
> Signed-off-by: Geliang Tang <geliangtang@163.com>
> ---
>  net/ceph/messenger.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
> index 9981039..c664b7f 100644
> --- a/net/ceph/messenger.c
> +++ b/net/ceph/messenger.c
> @@ -3361,9 +3361,8 @@ static void ceph_msg_free(struct ceph_msg *m)
>  static void ceph_msg_release(struct kref *kref)
>  {
>         struct ceph_msg *m = container_of(kref, struct ceph_msg, kref);
> -       LIST_HEAD(data);
> -       struct list_head *links;
> -       struct list_head *next;
> +       LIST_HEAD(head);
> +       struct ceph_msg_data *data, *next;
>
>         dout("%s %p\n", __func__, m);
>         WARN_ON(!list_empty(&m->list_head));
> @@ -3376,12 +3375,9 @@ static void ceph_msg_release(struct kref *kref)
>                 m->middle = NULL;
>         }
>
> -       list_splice_init(&m->data, &data);
> -       list_for_each_safe(links, next, &data) {
> -               struct ceph_msg_data *data;
> -
> -               data = list_entry(links, struct ceph_msg_data, links);
> -               list_del_init(links);
> +       list_splice_init(&m->data, &head);
> +       list_for_each_entry_safe(data, next, &head, links) {
> +               list_del_init(&data->links);
>                 ceph_msg_data_destroy(data);
>         }
>         m->data_length = 0;

Applied.  I killed the call to list_splice_init() along with its
list_head while at it.

Thanks,

                Ilya

  reply	other threads:[~2016-01-11 22:06 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-18 15:33 [PATCH 01/14] Bluetooth: use list_for_each_entry* Geliang Tang
2015-12-18 15:33 ` [PATCH 02/14] sctp: " Geliang Tang
2015-12-18 15:33   ` Geliang Tang
2015-12-18 15:52   ` Marcelo Ricardo Leitner
2015-12-18 15:52     ` Marcelo Ricardo Leitner
2015-12-18 15:33 ` [PATCH 03/14] ipv4, ipv6: " Geliang Tang
2015-12-18 15:33 ` [PATCH 04/14] x25: " Geliang Tang
2015-12-18 15:33 ` [PATCH 05/14] atm: use list_for_each_entry Geliang Tang
2015-12-18 15:33 ` [PATCH 06/14] libceph: use list_for_each_entry_safe Geliang Tang
2016-01-11 22:06   ` Ilya Dryomov [this message]
2015-12-18 15:33 ` [PATCH 07/14] batman-adv: " Geliang Tang
2015-12-18 15:33   ` [B.A.T.M.A.N.] " Geliang Tang
2015-12-21 14:42   ` Antonio Quartulli
2015-12-21 14:42   ` Antonio Quartulli
2015-12-21 14:42   ` Antonio Quartulli
2015-12-21 14:42     ` [B.A.T.M.A.N.] " Antonio Quartulli
2016-03-10 19:37   ` Sven Eckelmann
2016-03-28 15:02   ` Marek Lindner
2016-03-28 15:02   ` Marek Lindner
2016-03-28 15:02     ` Marek Lindner
2015-12-18 15:33 ` [PATCH 08/14] caif: " Geliang Tang
2015-12-18 15:33 ` [PATCH 09/14] net: dsa: use list_for_each_entry Geliang Tang
2015-12-18 15:33 ` [PATCH 10/14] lapb: " Geliang Tang
2015-12-18 15:33 ` [PATCH 11/14] openvswitch: " Geliang Tang
2015-12-18 15:33   ` Geliang Tang
2015-12-18 15:33 ` [PATCH 12/14] net: sched: " Geliang Tang
2015-12-18 15:33 ` [PATCH 13/14] sunrpc: use list_for_each_entry_safe Geliang Tang
2015-12-18 15:33 ` [PATCH 14/14] net: pktgen: " Geliang Tang
2015-12-20  7:13 ` [PATCH 01/14] Bluetooth: use list_for_each_entry* Marcel Holtmann

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='CAOi1vP_sZgBz+Xb0o-NX-4o4BveQ6LKJsu_RC6OozjkehM=1UQ@mail.gmail.com' \
    --to=idryomov@gmail.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=davem@davemloft.net \
    --cc=geliangtang@163.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sage@redhat.com \
    --cc=zyan@redhat.com \
    /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 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.