[PATCH 09/10] staging: lustre: simplfy lov_finish_set()
When deleting everything from a list, a while loop is cleaner than list_for_each_safe(). Signed-off-by: NeilBrown--- drivers/staging/lustre/lustre/lov/lov_request.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c b/drivers/staging/lustre/lustre/lov/lov_request.c index 9d3b3f3e9f10..54f883e359ce 100644 --- a/drivers/staging/lustre/lustre/lov/lov_request.c +++ b/drivers/staging/lustre/lustre/lov/lov_request.c @@ -48,15 +48,13 @@ static void lov_init_set(struct lov_request_set *set) static void lov_finish_set(struct lov_request_set *set) { - struct list_head *pos, *n; + struct lov_request *req; LASSERT(set); - list_for_each_safe(pos, n, >set_list) { - struct lov_request *req = list_entry(pos, -struct lov_request, -rq_link); + while ((req = list_first_entry_or_null(>set_list, + struct lov_request, + rq_link)) != NULL) { list_del_init(>rq_link); - kfree(req->rq_oi.oi_osfs); kfree(req); }
[PATCH 09/10] staging: lustre: simplfy lov_finish_set()
When deleting everything from a list, a while loop is cleaner than list_for_each_safe(). Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/lov/lov_request.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c b/drivers/staging/lustre/lustre/lov/lov_request.c index 9d3b3f3e9f10..54f883e359ce 100644 --- a/drivers/staging/lustre/lustre/lov/lov_request.c +++ b/drivers/staging/lustre/lustre/lov/lov_request.c @@ -48,15 +48,13 @@ static void lov_init_set(struct lov_request_set *set) static void lov_finish_set(struct lov_request_set *set) { - struct list_head *pos, *n; + struct lov_request *req; LASSERT(set); - list_for_each_safe(pos, n, >set_list) { - struct lov_request *req = list_entry(pos, -struct lov_request, -rq_link); + while ((req = list_first_entry_or_null(>set_list, + struct lov_request, + rq_link)) != NULL) { list_del_init(>rq_link); - kfree(req->rq_oi.oi_osfs); kfree(req); }