Skip to contentSkip to conversation

qemu/xendisk: properly update stats in ioreq_release()

PATCH In review Jan Beulich 3 participants 11 messages May 14, 2012 – May 15, 2012

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 qemu/xendisk: properly update stats in ioreq_release()

While for the "normal" case (called from blk_send_response_all()) decrementing requests_finished is correct, doing so in the parse error case is wrong; requests_inflight needs to be decremented instead.

Change in v2: Adjust coding style.

hw/xen_disk.c +8 -4
@@ -154,7 +154,7 @@ static void ioreq_finish(struct ioreq *i
     blkdev->requests_finished++;
 }
 
-static void ioreq_release(struct ioreq *ioreq)
+static void ioreq_release(struct ioreq *ioreq, bool finish)
 {
     struct XenBlkDev *blkdev = ioreq->blkdev;
 
@@ -162,7 +162,11 @@ static void ioreq_release(struct ioreq *
     memset(ioreq, 0, sizeof(*ioreq));
     ioreq->blkdev = blkdev;
     QLIST_INSERT_HEAD(&blkdev->freelist, ioreq, list);
-    blkdev->requests_finished--;
+    if (finish) {
+        blkdev->requests_finished--;
+    } else {
+        blkdev->requests_inflight--;
+    }
 }
 
 /*
@@ -449,7 +453,7 @@ static void blk_send_response_all(struct
     while (!QLIST_EMPTY(&blkdev->finished)) {
         ioreq = QLIST_FIRST(&blkdev->finished);
         send_notify += blk_send_response_one(ioreq);
-        ioreq_release(ioreq);
+        ioreq_release(ioreq, true);
     }
     if (send_notify) {
         xen_be_send_notify(&blkdev->xendev);
@@ -505,7 +509,7 @@ static void blk_handle_requests(struct X
             if (blk_send_response_one(ioreq)) {
                 xen_be_send_notify(&blkdev->xendev);
             }
-            ioreq_release(ioreq);
+            ioreq_release(ioreq, false);
             continue;
         }
 

qemu/xendisk: properly update stats in ioreq_release()

While for the "normal" case (called from blk_send_response_all()) decrementing requests_finished is correct, doing so in the parse error case is wrong; requests_inflight needs to be decremented instead.

Change in v2: Adjust coding style.

hw/xen_disk.c +8 -4
@@ -154,7 +154,7 @@ static void ioreq_finish(struct ioreq *i
     blkdev->requests_finished++;
 }
 
-static void ioreq_release(struct ioreq *ioreq)
+static void ioreq_release(struct ioreq *ioreq, bool finish)
 {
     struct XenBlkDev *blkdev = ioreq->blkdev;
 
@@ -162,7 +162,11 @@ static void ioreq_release(struct ioreq *
     memset(ioreq, 0, sizeof(*ioreq));
     ioreq->blkdev = blkdev;
     QLIST_INSERT_HEAD(&blkdev->freelist, ioreq, list);
-    blkdev->requests_finished--;
+    if (finish) {
+        blkdev->requests_finished--;
+    } else {
+        blkdev->requests_inflight--;
+    }
 }
 
 /*
@@ -449,7 +453,7 @@ static void blk_send_response_all(struct
     while (!QLIST_EMPTY(&blkdev->finished)) {
         ioreq = QLIST_FIRST(&blkdev->finished);
         send_notify += blk_send_response_one(ioreq);
-        ioreq_release(ioreq);
+        ioreq_release(ioreq, true);
     }
     if (send_notify) {
         xen_be_send_notify(&blkdev->xendev);
@@ -505,7 +509,7 @@ static void blk_handle_requests(struct X
             if (blk_send_response_one(ioreq)) {
                 xen_be_send_notify(&blkdev->xendev);
             }
-            ioreq_release(ioreq);
+            ioreq_release(ioreq, false);
             continue;
         }
 
Reviewed-by on v2 1/1
#1 lore raw

Am 14.05.2012 12:30, schrieb Jan Beulich:

Quoted 7 lines

While for the "normal" case (called from blk_send_response_all()) decrementing requests_finished is correct, doing so in the parse error case is wrong; requests_inflight needs to be decremented instead.

Change in v2: Adjust coding style.

I think it would be nicer if a struct ioreq had an explicit state so that you don't have to pass the right state when releasing it. But anyway, the patch looks correct to me:

Reviewed-by on v2 1/1
#2 lore raw
In reply to Jan Beulich

Am 14.05.2012 12:30, schrieb Jan Beulich:

Quoted 7 lines

While for the "normal" case (called from blk_send_response_all()) decrementing requests_finished is correct, doing so in the parse error case is wrong; requests_inflight needs to be decremented instead.

Change in v2: Adjust coding style.

I think it would be nicer if a struct ioreq had an explicit state so that you don't have to pass the right state when releasing it. But anyway, the patch looks correct to me:

#5 lore raw

Am 14.05.2012 16:57, schrieb Stefano Stabellini:

Quoted 10 lines · Jan Beulich
Quoted 7 lines

While for the "normal" case (called from blk_send_response_all()) decrementing requests_finished is correct, doing so in the parse error case is wrong; requests_inflight needs to be decremented instead.

Change in v2: Adjust coding style.

Aren't you going to send a pull request yourself, Stefano?

Kevin

#6 lore raw
In reply to Stefano Stabellini

Am 14.05.2012 16:57, schrieb Stefano Stabellini:

Quoted 10 lines · Jan Beulich
Quoted 7 lines

While for the "normal" case (called from blk_send_response_all()) decrementing requests_finished is correct, doing so in the parse error case is wrong; requests_inflight needs to be decremented instead.

Change in v2: Adjust coding style.

Aren't you going to send a pull request yourself, Stefano?

Kevin

#7 lore raw
Quoted 6 lines · Kevin Wolf

Am 14.05.2012 16:57, schrieb Stefano Stabellini:

Quoted 5 lines · Jan Beulich
Quoted 4 lines

While for the "normal" case (called from blk_send_response_all()) decrementing requests_finished is correct, doing so in the parse error case is wrong; requests_inflight needs to be decremented instead.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Change in v2: Adjust coding style.

Aren't you going to send a pull request yourself, Stefano?

Yes, I am: I am collecting a series of Xen patches for 1.1 and I am aiming at sending a single pull request by the end of the week.

http://marc.info/?l=qemu-devel&m=133701567429388&w=2

#8 lore raw
In reply to Kevin Wolf
Quoted 6 lines · Kevin Wolf

Am 14.05.2012 16:57, schrieb Stefano Stabellini:

Quoted 5 lines · Jan Beulich
Quoted 4 lines

While for the "normal" case (called from blk_send_response_all()) decrementing requests_finished is correct, doing so in the parse error case is wrong; requests_inflight needs to be decremented instead.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Change in v2: Adjust coding style.

Aren't you going to send a pull request yourself, Stefano?

Yes, I am: I am collecting a series of Xen patches for 1.1 and I am aiming at sending a single pull request by the end of the week.

http://marc.info/?l=qemu-devel&m=133701567429388&w=2

#9 lore raw

Am 15.05.2012 12:16, schrieb Stefano Stabellini:

Quoted 11 lines · Kevin Wolf
Quoted 10 lines

Am 14.05.2012 16:57, schrieb Stefano Stabellini:

Quoted 9 lines · Jan Beulich
Quoted 7 lines

While for the "normal" case (called from blk_send_response_all()) decrementing requests_finished is correct, doing so in the parse error case is wrong; requests_inflight needs to be decremented instead.

Change in v2: Adjust coding style.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Aren't you going to send a pull request yourself, Stefano?

Yes, I am: I am collecting a series of Xen patches for 1.1 and I am aiming at sending a single pull request by the end of the week.

http://marc.info/?l=qemu-devel&m=133701567429388&w=2

Ok, great.

I was just wondering because I always understood an Acked-by as a message to the maintainer who picks the patch up, so I wasn't sure if you expected me to do it and the patch would fall through the cracks.

Kevin

#10 lore raw
In reply to Stefano Stabellini

Am 15.05.2012 12:16, schrieb Stefano Stabellini:

Quoted 11 lines · Kevin Wolf
Quoted 10 lines

Am 14.05.2012 16:57, schrieb Stefano Stabellini:

Quoted 9 lines · Jan Beulich
Quoted 7 lines

While for the "normal" case (called from blk_send_response_all()) decrementing requests_finished is correct, doing so in the parse error case is wrong; requests_inflight needs to be decremented instead.

Change in v2: Adjust coding style.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Aren't you going to send a pull request yourself, Stefano?

Yes, I am: I am collecting a series of Xen patches for 1.1 and I am aiming at sending a single pull request by the end of the week.

http://marc.info/?l=qemu-devel&m=133701567429388&w=2

Ok, great.

I was just wondering because I always understood an Acked-by as a message to the maintainer who picks the patch up, so I wasn't sure if you expected me to do it and the patch would fall through the cracks.

Kevin