Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1294983
| From | Geliang Tang <geliangtang@163.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 06/14] libceph: use list_for_each_entry_safe |
| Date | 2015-12-18 16:50 +0100 |
| Message-ID | <qH5s5-7vm-7@gated-at.bofh.it> (permalink) |
| References | <qH5ip-7rE-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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;
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 01/14] Bluetooth: use list_for_each_entry* Geliang Tang <geliangtang@163.com> - 2015-12-18 16:40 +0100
[PATCH 07/14] batman-adv: use list_for_each_entry_safe Geliang Tang <geliangtang@163.com> - 2015-12-18 16:40 +0100
Re: [PATCH 07/14] batman-adv: use list_for_each_entry_safe Antonio Quartulli <a@unstable.cc> - 2015-12-21 16:10 +0100
[PATCH 02/14] sctp: use list_for_each_entry* Geliang Tang <geliangtang@163.com> - 2015-12-18 16:40 +0100
Re: [PATCH 02/14] sctp: use list_for_each_entry* Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> - 2015-12-18 17:00 +0100
[PATCH 08/14] caif: use list_for_each_entry_safe Geliang Tang <geliangtang@163.com> - 2015-12-18 16:40 +0100
[PATCH 10/14] lapb: use list_for_each_entry Geliang Tang <geliangtang@163.com> - 2015-12-18 16:40 +0100
[PATCH 12/14] net: sched: use list_for_each_entry Geliang Tang <geliangtang@163.com> - 2015-12-18 16:40 +0100
[PATCH 06/14] libceph: use list_for_each_entry_safe Geliang Tang <geliangtang@163.com> - 2015-12-18 16:50 +0100
[PATCH 05/14] atm: use list_for_each_entry Geliang Tang <geliangtang@163.com> - 2015-12-18 16:50 +0100
Re: [PATCH 01/14] Bluetooth: use list_for_each_entry* Marcel Holtmann <marcel@holtmann.org> - 2015-12-20 08:20 +0100
csiph-web