From: Christoph Hellwig <hch@infradead.org>
To: Chao Yu <chao@kernel.org>
Cc: jejb@linux.ibm.com, martin.petersen@oracle.com,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] scsi: support packing multi-segment in UNMAP command
Date: Wed, 15 Jun 2022 06:35:36 -0700 [thread overview]
Message-ID: <YqngKHnfVIzq7Pgr@infradead.org> (raw)
In-Reply-To: <20220615132846.2232920-1-chao@kernel.org>
On Wed, Jun 15, 2022 at 09:28:46PM +0800, Chao Yu wrote:
> As SPEC describes that it can support unmapping one or more LBA range
s/SPEC/<insert SPC reference here>/
> {
> struct scsi_device *sdp = cmd->device;
> struct request *rq = scsi_cmd_to_rq(cmd);
> + struct bio *bio;
> struct scsi_disk *sdkp = scsi_disk(rq->q->disk);
> + unsigned short segments = blk_rq_nr_discard_segments(rq);
> + unsigned int data_len = 8 + 16 * segments, i = 0;
> char *buf;
Nit: for readability I'd move the bio declaration just above the buf
line.
> +
> + __rq_for_each_bio(bio, rq) {
> + u64 lba = sectors_to_logical(sdp, bio->bi_iter.bi_sector);
> + u32 nr_blocks = sectors_to_logical(sdp, bio_sectors(bio));
> +
> + put_unaligned_be64(lba, &buf[8 + 16 * i]);
> + put_unaligned_be32(nr_blocks, &buf[8 + 16 * i + 8]);
Can we have a local variable here?
unsigned int data_offset = 8;
....
put_unaligned_be64(lba, &buf[data_offset]);
put_unaligned_be64(lba, &buf[data_offset + 8]);
data_offset += 16;
}
next prev parent reply other threads:[~2022-06-15 13:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-15 13:28 [PATCH v2] scsi: support packing multi-segment in UNMAP command Chao Yu
2022-06-15 13:35 ` Christoph Hellwig [this message]
2022-06-16 1:37 ` Chao Yu
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=YqngKHnfVIzq7Pgr@infradead.org \
--to=hch@infradead.org \
--cc=chao@kernel.org \
--cc=jejb@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.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