From: Hannes Reinecke <hare@suse.de>
To: Christoph Hellwig <hch@lst.de>
Cc: stefanha@gmail.com, qemu-devel@nongnu.org, nab@linux-iscsi.org,
kraxel@redhat.com
Subject: Re: [Qemu-devel] [PATCH 13/15] scsi: Implement alloc_req_iov callback
Date: Thu, 25 Nov 2010 09:53:25 +0100 [thread overview]
Message-ID: <4CEE2405.3080906@suse.de> (raw)
In-Reply-To: <20101124165250.GE31124@lst.de>
On 11/24/2010 05:52 PM, Christoph Hellwig wrote:
> On Wed, Nov 24, 2010 at 12:16:08PM +0100, Hannes Reinecke wrote:
>> Add callback to create a request with a predefined iovec.
>> This is required for drivers which can use the iovec
>> of a command directly.
>
> What happend to my comment that the iov and non-iov case should share
> code? Also what happened to the other comment about not naming the
> method implementation different from the method name.
>
Looked into it.
Sure I could be doing it for scsi-disk; for scsi-generic it won't
work, though. And it's not much of a code-share to have from it;
you'll end up with something like:
static SCSIRequest *scsi_new_request(SCSIDevice *d, uint32_t tag,
uint32_t lun)
{
struct iovec *iov;
uint8_t *buf;
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, d);
SCSIRequest *req;
SCSIDiskReq *r;
buf = qemu_blockalign(s->bs, SCSI_DMA_BUF_SIZE);
iov = qemu_mallocz(sizeof(struct iovec));
iov[0].iov_base = buf;
req = scsi_new_request_iovec(d, tag, lun, iov, 1);
r = DO_UPCAST(SCSIDiskReq, req, req);
r->iov_buf = buf;
return req;
}
which doesn't look better than the original:
static SCSIRequest *scsi_new_request(SCSIDevice *d, uint32_t tag,
uint32_t lun)
{
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, d);
SCSIRequest *req;
SCSIDiskReq *r;
req = scsi_req_alloc(sizeof(SCSIDiskReq), d, tag, lun);
r = DO_UPCAST(SCSIDiskReq, req, req);
r->iov_buf = qemu_blockalign(s->bs, SCSI_DMA_BUF_SIZE);
r->iov = qemu_mallocz(sizeof(struct iovec));
r->iov[0].iov_base = r->iov_buf;
r->iov_num = 1;
return req;
}
But I'm open to suggestions.
And for the naming:
The SCSI stack is using 'req' for every function accepting
SCSIRequest as an argument:
hw/scsi.h:
SCSIRequest *scsi_req_alloc(size_t size, SCSIDevice *d,
uint32_t tag, uint32_t lun);
void scsi_req_free(SCSIRequest *req);
int scsi_req_parse(SCSIRequest *req, uint8_t *buf);
void scsi_req_print(SCSIRequest *req);
void scsi_req_complete(SCSIRequest *req);
So using 'alloc_req' and 'free_req' is in line with this naming
scheme. Using 'alloc_request' and 'free_request' really looked odd
in the light of the general usage.
Hence I didn't do it.
But again, I'm open to suggestions here.
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.de +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)
next prev parent reply other threads:[~2010-11-25 8:50 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-24 11:15 [Qemu-devel] [PATCH 00/15] Megasas HBA emulation and SCSI update v.3 Hannes Reinecke
2010-11-24 11:15 ` [Qemu-devel] [PATCH 01/15] scsi: Increase the number of possible devices Hannes Reinecke
2010-11-24 11:15 ` [Qemu-devel] [PATCH 02/15] scsi: Return SAM status codes Hannes Reinecke
2010-11-24 16:51 ` Christoph Hellwig
2010-11-24 11:15 ` [Qemu-devel] [PATCH 03/15] scsi: INQUIRY VPD fixes Hannes Reinecke
2010-11-24 11:15 ` [Qemu-devel] [PATCH 04/15] scsi: Move sense handling into the driver Hannes Reinecke
2010-11-24 11:16 ` [Qemu-devel] [PATCH 05/15] scsi-disk: Remove duplicate cdb parsing Hannes Reinecke
2010-11-24 11:16 ` [Qemu-devel] [PATCH 06/15] scsi: Update sense code handling Hannes Reinecke
2010-11-25 14:33 ` Kevin Wolf
2010-12-21 11:56 ` Hannes Reinecke
2010-11-24 11:16 ` [Qemu-devel] [PATCH 07/15] lsi53c895a: Rename 'sense' to 'status' Hannes Reinecke
2010-11-24 11:16 ` [Qemu-devel] [PATCH 08/15] scsi-disk: Allocate iovec dynamically Hannes Reinecke
2010-11-24 11:16 ` [Qemu-devel] [PATCH 09/15] scsi: Use 'SCSIRequest' directly Hannes Reinecke
2010-11-24 11:16 ` [Qemu-devel] [PATCH 10/15] scsi-disk: add data direction checking Hannes Reinecke
2010-11-24 11:16 ` [Qemu-devel] [PATCH 11/15] Remove 'bus' argument from SCSI command completion callbacks Hannes Reinecke
2010-11-24 11:16 ` [Qemu-devel] [PATCH 12/15] scsi: Implement 'get_sense' callback Hannes Reinecke
2010-11-24 11:16 ` [Qemu-devel] [PATCH 13/15] scsi: Implement alloc_req_iov callback Hannes Reinecke
2010-11-24 16:52 ` Christoph Hellwig
2010-11-25 8:53 ` Hannes Reinecke [this message]
2010-11-25 15:29 ` Christoph Hellwig
2010-11-25 16:21 ` Hannes Reinecke
2010-11-26 0:06 ` Paul Brook
2010-11-24 11:16 ` [Qemu-devel] [PATCH 14/15] megasas: LSI Megaraid SAS emulation Hannes Reinecke
2010-11-25 14:36 ` [Qemu-devel] " Stefan Hajnoczi
2010-11-25 14:50 ` Hannes Reinecke
2010-11-25 14:52 ` Stefan Hajnoczi
2010-11-25 20:47 ` Sebastian Herbszt
2010-12-21 12:06 ` Hannes Reinecke
2010-11-24 11:16 ` [Qemu-devel] [PATCH 15/15] Make SCSI HBA configurable Hannes Reinecke
2010-11-24 16:50 ` [Qemu-devel] [PATCH 00/15] Megasas HBA emulation and SCSI update v.3 Christoph Hellwig
2010-12-10 22:14 ` [Qemu-devel] " Paolo Bonzini
2010-12-13 7:32 ` Hannes Reinecke
2010-12-16 1:45 ` Benjamin Herrenschmidt
2010-12-16 1:48 ` Benjamin Herrenschmidt
2010-12-16 8:34 ` Stefan Hajnoczi
2010-12-16 14:58 ` Kevin Wolf
2010-12-20 14:59 ` [Qemu-devel] " Christoph Hellwig
2010-12-20 15:25 ` Hannes Reinecke
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=4CEE2405.3080906@suse.de \
--to=hare@suse.de \
--cc=hch@lst.de \
--cc=kraxel@redhat.com \
--cc=nab@linux-iscsi.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.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).