Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1580359 > unrolled thread

[PATCH v3 4/9] vhost/scsi: Don't reinvent the wheel but use existing llist API

Started byByungchul Park <byungchul.park@lge.com>
First post2017-02-14 08:30 +0100
Last post2017-02-19 07:00 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v3 4/9] vhost/scsi: Don't reinvent the wheel but use existing llist API Byungchul Park <byungchul.park@lge.com> - 2017-02-14 08:30 +0100
    Re: [PATCH v3 4/9] vhost/scsi: Don't reinvent the wheel but use  existing llist API "Nicholas A. Bellinger" <nab@linux-iscsi.org> - 2017-02-19 07:00 +0100

#1580359 — [PATCH v3 4/9] vhost/scsi: Don't reinvent the wheel but use existing llist API

FromByungchul Park <byungchul.park@lge.com>
Date2017-02-14 08:30 +0100
Subject[PATCH v3 4/9] vhost/scsi: Don't reinvent the wheel but use existing llist API
Message-ID<taFIJ-759-9@gated-at.bofh.it>
Although llist provides proper APIs, they are not used. Make them used.

Signed-off-by: Byungchul Park <byungchul.park@lge.com>
---
 drivers/vhost/scsi.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index 253310c..a4cb966 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -496,14 +496,12 @@ static void vhost_scsi_evt_work(struct vhost_work *work)
 	struct vhost_scsi *vs = container_of(work, struct vhost_scsi,
 					vs_event_work);
 	struct vhost_virtqueue *vq = &vs->vqs[VHOST_SCSI_VQ_EVT].vq;
-	struct vhost_scsi_evt *evt;
+	struct vhost_scsi_evt *evt, *t;
 	struct llist_node *llnode;
 
 	mutex_lock(&vq->mutex);
 	llnode = llist_del_all(&vs->vs_event_list);
-	while (llnode) {
-		evt = llist_entry(llnode, struct vhost_scsi_evt, list);
-		llnode = llist_next(llnode);
+	llist_for_each_entry_safe(evt, t, llnode, list) {
 		vhost_scsi_do_evt_work(vs, evt);
 		vhost_scsi_free_evt(vs, evt);
 	}
@@ -529,10 +527,7 @@ static void vhost_scsi_complete_cmd_work(struct vhost_work *work)
 
 	bitmap_zero(signal, VHOST_SCSI_MAX_VQ);
 	llnode = llist_del_all(&vs->vs_completion_list);
-	while (llnode) {
-		cmd = llist_entry(llnode, struct vhost_scsi_cmd,
-				     tvc_completion_list);
-		llnode = llist_next(llnode);
+	llist_for_each_entry(cmd, llnode, tvc_completion_list) {
 		se_cmd = &cmd->tvc_se_cmd;
 
 		pr_debug("%s tv_cmd %p resid %u status %#02x\n", __func__,
-- 
1.9.1

[toc] | [next] | [standalone]


#1584068 — Re: [PATCH v3 4/9] vhost/scsi: Don't reinvent the wheel but use existing llist API

From"Nicholas A. Bellinger" <nab@linux-iscsi.org>
Date2017-02-19 07:00 +0100
SubjectRe: [PATCH v3 4/9] vhost/scsi: Don't reinvent the wheel but use existing llist API
Message-ID<tcsHn-3us-1@gated-at.bofh.it>
In reply to#1580359
Hi Byungchul,

On Tue, 2017-02-14 at 16:26 +0900, Byungchul Park wrote:
> Although llist provides proper APIs, they are not used. Make them used.
> 
> Signed-off-by: Byungchul Park <byungchul.park@lge.com>
> ---
>  drivers/vhost/scsi.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)

Acked-by: Nicholas Bellinger <nab@linux-iscsi.org>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web