lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 16 Jun 2022 09:37:15 +0800
From:   Chao Yu <chao@...nel.org>
To:     Christoph Hellwig <hch@...radead.org>
Cc:     jejb@...ux.ibm.com, martin.petersen@...cle.com,
        linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] scsi: support packing multi-segment in UNMAP command

On 2022/6/15 21:35, Christoph Hellwig wrote:
> 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;
> 
> 	....
> 

Thanks for the review, I've updated the patch.

Thanks,

> 		put_unaligned_be64(lba, &buf[data_offset]);
> 		put_unaligned_be64(lba, &buf[data_offset + 8]);
> 		data_offset += 16;
> 	}
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ