All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	xen-devel <xen-devel@lists.xen.org>
Subject: Re: [Qemu-devel] qemu/xendisk: properly update stats in ioreq_release()
Date: Mon, 14 May 2012 08:39:03 +0100	[thread overview]
Message-ID: <4FB0D2B70200007800083547@nat28.tlf.novell.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1205111658570.26786@kaball-desktop>

>>> On 11.05.12 at 18:01, Stefano Stabellini <stefano.stabellini@eu.citrix.com>
wrote:
> On Thu, 10 May 2012, Jan Beulich wrote:
>> 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.
>> 
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> 
>> --- a/hw/xen_disk.c
>> +++ b/hw/xen_disk.c
>> @@ -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,10 @@ 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 +452,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 +508,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;
>>          }
> 
> In case of an error returned by ioreq_parse requests_finished should
> also be decremented.

I don't think so - it gets incremented in ioreq_finish(), and that gets
called only when I/O was at least attempted (which isn't the case
when parse failed).

Jan

  parent reply	other threads:[~2012-05-14  7:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-10 15:37 [Qemu-devel] qemu/xendisk: properly update stats in ioreq_release() Jan Beulich
2012-05-11 16:01 ` Stefano Stabellini
2012-05-14  7:39   ` Jan Beulich
2012-05-14  7:39   ` Jan Beulich [this message]
2012-05-14  9:39     ` [Qemu-devel] " Stefano Stabellini
2012-05-14  9:39     ` Stefano Stabellini
2012-05-11 16:01 ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FB0D2B70200007800083547@nat28.tlf.novell.com \
    --to=jbeulich@suse.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.