From: Christoph Hellwig <hch@lst.de>
To: Asias He <asias@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>,
kvm@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org,
Tejun Heo <tj@kernel.org>, Shaohua Li <shli@kernel.org>,
Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH V6 2/2] virtio-blk: Add REQ_FLUSH and REQ_FUA support to bio path
Date: Tue, 7 Aug 2012 11:15:10 +0200 [thread overview]
Message-ID: <20120807091510.GA2651@lst.de> (raw)
In-Reply-To: <1344329235-17449-3-git-send-email-asias@redhat.com>
At least after review is done I really think this patch sopuld be folded
into the previous one.
Some more comments below:
> @@ -58,6 +58,12 @@ struct virtblk_req
> struct bio *bio;
> struct virtio_blk_outhdr out_hdr;
> struct virtio_scsi_inhdr in_hdr;
> + struct work_struct work;
> + struct virtio_blk *vblk;
I think using bio->bi_private for the virtio_blk pointer would
be cleaner.
> + bool is_flush;
> + bool req_flush;
> + bool req_data;
> + bool req_fua;
This could be a bitmap, or better even a single state field.
> +static int virtblk_bio_send_flush(struct virtio_blk *vblk,
> + struct virtblk_req *vbr)
> +static int virtblk_bio_send_data(struct virtio_blk *vblk,
> + struct virtblk_req *vbr)
These should only get the struct virtblk_req * argument as the virtio_blk
structure is easily derivable from it.
> +static inline void virtblk_bio_done_flush(struct virtio_blk *vblk,
> + struct virtblk_req *vbr)
> {
> + if (vbr->req_data) {
> + /* Send out the actual write data */
> + struct virtblk_req *_vbr;
> + _vbr = virtblk_alloc_req(vblk, GFP_NOIO);
> + if (!_vbr) {
> + bio_endio(vbr->bio, -ENOMEM);
> + goto out;
> + }
> + _vbr->req_fua = vbr->req_fua;
> + _vbr->bio = vbr->bio;
> + _vbr->vblk = vblk;
> + INIT_WORK(&_vbr->work, virtblk_bio_send_data_work);
> + queue_work(virtblk_wq, &_vbr->work);
The _vbr naming isn't too nice. Also can you explain why the original
request can't be reused in a comment here?
Also if using a state variable I think the whole code would be
a bit cleaner if the bio_done helpers are combined.
> - if (writeback && !use_bio)
> + if (writeback)
> blk_queue_flush(vblk->disk->queue, REQ_FLUSH);
Shouldn't this be REQ_FLUSH | REQ_FUA for the bio case?
Btw, did you verify that flushes really work correctly for all cases
using tracing in qemu?
next prev parent reply other threads:[~2012-08-07 9:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-07 8:47 [PATCH V6 0/2] Improve virtio-blk performance Asias He
2012-08-07 8:47 ` [PATCH V6 1/2] virtio-blk: Add bio-based IO path for virtio-blk Asias He
2012-08-07 8:47 ` [PATCH V6 2/2] virtio-blk: Add REQ_FLUSH and REQ_FUA support to bio path Asias He
2012-08-07 9:15 ` Christoph Hellwig [this message]
2012-08-08 6:20 ` Asias He
2012-08-07 9:16 ` [PATCH V6 0/2] Improve virtio-blk performance Christoph Hellwig
[not found] ` <5021D87C.4050400@redhat.com>
2012-08-08 6:24 ` Asias He
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=20120807091510.GA2651@lst.de \
--to=hch@lst.de \
--cc=asias@redhat.com \
--cc=axboe@kernel.dk \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=shli@kernel.org \
--cc=tj@kernel.org \
--cc=virtualization@lists.linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).