summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeliang Tang <geliangtang@163.com>2015-12-18 23:33:30 +0800
committerIlya Dryomov <idryomov@gmail.com>2016-01-21 19:36:08 +0100
commit10bcee149f62e7c5122f79aefc30d610b413280b (patch)
treec90919e73cc145128f8640730a603b4ff1f14533
parent99c88e6900fb05d267ae9f6d5e15dc7192ba6f8d (diff)
downloadlinux-10bcee149f62e7c5122f79aefc30d610b413280b.tar.bz2
libceph: use list_for_each_entry_safe
Use list_for_each_entry_safe() instead of list_for_each_safe() to simplify the code. Signed-off-by: Geliang Tang <geliangtang@163.com> [idryomov@gmail.com: nuke call to list_splice_init() as well] Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
-rw-r--r--net/ceph/messenger.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index b1d1489543b1..de3eb19a6968 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -3358,9 +3358,7 @@ 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;
+ struct ceph_msg_data *data, *next;
dout("%s %p\n", __func__, m);
WARN_ON(!list_empty(&m->list_head));
@@ -3373,12 +3371,8 @@ 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_for_each_entry_safe(data, next, &m->data, links) {
+ list_del_init(&data->links);
ceph_msg_data_destroy(data);
}
m->data_length = 0;