From: Douglas Gilbert <dgilbert@interlog.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: "Nicholas A. Bellinger" <nab@linux-iscsi.org>,
target-devel <target-devel@vger.kernel.org>,
linux-scsi <linux-scsi@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Christoph Hellwig <hch@lst.de>,
"Martin K. Petersen" <martin.petersen@oracle.com>
Subject: Re: [PATCH 3/3] target/iblock: Add WRITE_SAME w/ UNMAP=0 emulation support
Date: Thu, 15 Nov 2012 10:03:26 -0500 [thread overview]
Message-ID: <50A5043E.1030301@interlog.com> (raw)
In-Reply-To: <20121115110432.GD28956@infradead.org>
On 12-11-15 06:04 AM, Christoph Hellwig wrote:
>> + /*
>> + * Enable WRITE_SAME emulation for IBLOCK, use scsi_debug.c default
>> + */
>
> Why would we care what scsi_debug.c uses?
Would you prefer no hint of where the magic number came
from? At least somebody who cares when they see that comment
might contact Martin Petersen and ask why he chose that
value.
t10.org documents are not big on sensible default values;
my favourite is where "0" means vendor specific.
Doug Gilbert
>> + dev->dev_attrib.max_write_same_len = 0xFFFF;
>>
>> if (blk_queue_nonrot(q))
>> dev->dev_attrib.is_nonrot = 1;
>> @@ -375,22 +379,80 @@ err:
>> return ret;
>> }
>
>> +static struct bio *iblock_get_bio(struct se_cmd *, sector_t, u32);
>> +static void iblock_submit_bios(struct bio_list *, int);
>> +static void iblock_complete_cmd(struct se_cmd *);
>
> I'd suggest moving the write_same callback below these to avoid
> forward declarations.
>
>> + if (cmd->se_cmd_flags & SCF_WRITE_SAME_DISCARD) {
>
> I'd probably add separate write_same and write_same_unmap members to
> the sbc_ops structure. That'll keep decoding which one is used in the
> SBC code, and it'll keep the implementations nicely separated.
>
>> + if (sectors > cmd->se_dev->dev_attrib.max_write_same_len) {
>
> This sort of check should stay in the SBC code.
>
>> + sg = &cmd->t_data_sg[0];
>
> Btw, it seems like we don't bother to ensure the S/G list length
> is just one sector for WRITE SAME with either the unmap bit set or not.
>
> Also please add testcases for WRITE SAME including corner cases like
> incorrect transfer length to the scsi testsuite to ensure this code
> has proper QA coverage.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2012-11-15 15:03 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-08 20:07 [PATCH 0/3] target/iblock: Add WRITE_SAME w/ UNMAP=0 emulation Nicholas A. Bellinger
2012-11-08 20:07 ` [PATCH 1/3] target/sbc: Make WRITE_SAME check differentiate between UNMAP=[1,0] Nicholas A. Bellinger
2012-11-15 10:52 ` Christoph Hellwig
2012-11-08 20:07 ` [PATCH 2/3] target: Add max_write_same_len device attribute Nicholas A. Bellinger
2012-11-15 10:53 ` Christoph Hellwig
2012-11-15 19:23 ` Nicholas A. Bellinger
2012-11-16 13:05 ` Paolo Bonzini
2012-11-08 20:07 ` [PATCH 3/3] target/iblock: Add WRITE_SAME w/ UNMAP=0 emulation support Nicholas A. Bellinger
2012-11-15 11:04 ` Christoph Hellwig
2012-11-15 15:03 ` Douglas Gilbert [this message]
2012-11-15 15:25 ` Martin K. Petersen
2012-11-15 19:29 ` Nicholas A. Bellinger
2012-11-15 19:32 ` Christoph Hellwig
2012-11-15 20:01 ` Elliott, Robert (Server Storage)
2012-11-15 20:31 ` Nicholas A. Bellinger
2012-11-19 11:38 ` Paolo Bonzini
2012-11-19 23:19 ` Elliott, Robert (Server Storage)
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=50A5043E.1030301@interlog.com \
--to=dgilbert@interlog.com \
--cc=hch@infradead.org \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=nab@linux-iscsi.org \
--cc=target-devel@vger.kernel.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).