From: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
To: pbonzini@redhat.com, fam@euphon.net, dillaman@redhat.com,
kwolf@redhat.com, mreitz@redhat.com
Cc: baiyaowei@cmss.chinamobile.com, yangjun@cmss.chinamobile.com,
qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: [PATCH 0/4 V2] SCSI COMPARE_AND_WRITE command support
Date: Fri, 8 Nov 2019 17:35:37 +0800 [thread overview]
Message-ID: <1573205741-2094-1-git-send-email-baiyaowei@cmss.chinamobile.com> (raw)
Recently ceph/librbd added several interfaces to handle SCSI commands like
COMPARE_AND_WRITE directly. However they were only be used in special
scenarios, i.e. ISCSI. That involves more software components which makes
the IO path longer and could bring more potential issues. Actually we're
maintaining several ceph clusters with ISCSI protocal being used which,
i have to say, is not an easy job.
So supporting COMPARE_AND_WRITE in scsi-disk would be a reasonable solution
and easy to implement with the help of the SCSI handlers in librbd, which
could leave alone the ISCSI stuff and make the IO path shorter.
This patchset implements it by reusing the blk_aio_pwritev interface and
introducing a new BDRV_REQ_COMPARE_AND_WRITE element into BdrvRequestFlags
to indicate a COMPARE_AND_WRITE request, rather than adding a new interface
into block-backend.c.
The FUA support is implemented in the blk_aio_pwritev's callback function
similar to its emulation in scsi_write_do_fua function, maybe through
BDRV_REQ_FUA is another doable way.
This patchset is tested with the method of sg_compare_and_write.txt from
sg3_utils. Link below:
https://github.com/hreinecke/sg3_utils/blob/master/examples/sg_compare_and_write.txt
v1->v2: fix checkpatch script complaints and cleanup
Yaowei Bai (4):
block: add SCSI COMPARE_AND_WRITE support
block/rbd: implement bdrv_aio_compare_and_write interface
hw/scsi: add SCSI COMPARE_AND_WRITE support
scsi-disk: add FUA support for COMPARE_AND_WRITE
block/io.c | 20 +++++++++
block/raw-format.c | 3 +-
block/rbd.c | 45 ++++++++++++++++++++-
hw/scsi/emulation.c | 1 +
hw/scsi/scsi-bus.c | 4 ++
hw/scsi/scsi-disk.c | 98 +++++++++++++++++++++++++++++++++++++++++++++
hw/scsi/trace-events | 1 +
include/block/block.h | 5 ++-
include/block/block_int.h | 3 ++
include/hw/scsi/emulation.h | 3 ++
include/scsi/utils.h | 2 +
scsi/utils.c | 5 +++
12 files changed, 185 insertions(+), 5 deletions(-)
--
1.8.3.1
next reply other threads:[~2019-11-08 9:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-08 9:35 Yaowei Bai [this message]
2019-11-08 9:35 ` [PATCH 1/4 V2] block: add SCSI COMPARE_AND_WRITE support Yaowei Bai
2019-11-08 9:35 ` [PATCH 2/4 V2] block/rbd: implement bdrv_aio_compare_and_write interface Yaowei Bai
2019-11-08 9:35 ` [PATCH 3/4 V2] hw/scsi: add SCSI COMPARE_AND_WRITE support Yaowei Bai
2019-11-08 9:35 ` [PATCH 4/4 V2] scsi-disk: add FUA support for COMPARE_AND_WRITE Yaowei Bai
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=1573205741-2094-1-git-send-email-baiyaowei@cmss.chinamobile.com \
--to=baiyaowei@cmss.chinamobile.com \
--cc=dillaman@redhat.com \
--cc=fam@euphon.net \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=yangjun@cmss.chinamobile.com \
/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).