diff options
author | Geliang Tang <geliangtang@163.com> | 2015-12-18 10:33:30 -0500 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2016-01-21 13:36:08 -0500 |
commit | 10bcee149f62e7c5122f79aefc30d610b413280b (patch) | |
tree | c90919e73cc145128f8640730a603b4ff1f14533 | |
parent | 99c88e6900fb05d267ae9f6d5e15dc7192ba6f8d (diff) |
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.c | 12 |
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) | |||
3358 | static void ceph_msg_release(struct kref *kref) | 3358 | static void ceph_msg_release(struct kref *kref) |
3359 | { | 3359 | { |
3360 | struct ceph_msg *m = container_of(kref, struct ceph_msg, kref); | 3360 | struct ceph_msg *m = container_of(kref, struct ceph_msg, kref); |
3361 | LIST_HEAD(data); | 3361 | struct ceph_msg_data *data, *next; |
3362 | struct list_head *links; | ||
3363 | struct list_head *next; | ||
3364 | 3362 | ||
3365 | dout("%s %p\n", __func__, m); | 3363 | dout("%s %p\n", __func__, m); |
3366 | WARN_ON(!list_empty(&m->list_head)); | 3364 | WARN_ON(!list_empty(&m->list_head)); |
@@ -3373,12 +3371,8 @@ static void ceph_msg_release(struct kref *kref) | |||
3373 | m->middle = NULL; | 3371 | m->middle = NULL; |
3374 | } | 3372 | } |
3375 | 3373 | ||
3376 | list_splice_init(&m->data, &data); | 3374 | list_for_each_entry_safe(data, next, &m->data, links) { |
3377 | list_for_each_safe(links, next, &data) { | 3375 | list_del_init(&data->links); |
3378 | struct ceph_msg_data *data; | ||
3379 | |||
3380 | data = list_entry(links, struct ceph_msg_data, links); | ||
3381 | list_del_init(links); | ||
3382 | ceph_msg_data_destroy(data); | 3376 | ceph_msg_data_destroy(data); |
3383 | } | 3377 | } |
3384 | m->data_length = 0; | 3378 | m->data_length = 0; |