Re: [PATCH V2 1/2] scsi: core: avoid to pre-allocate big chunk for protection meta data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 24, 2019 at 04:37:04PM +0200, Christoph Hellwig wrote:
> > -	if (scsi_prot_sg_count(cmd))
> > -		sg_free_table_chained(&cmd->prot_sdb->table, true);
> > +	if (scsi_prot_sg_count(cmd) && cmd->prot_sdb->table.sgl !=
> > +			scsi_prot_inline_sg(cmd))
> > +		sg_free_table_chained(&cmd->prot_sdb->table, false);
> 
> Nipick: I usually find it easier to read if we break around conditions
> instead of inside them:
> 
> 	if (scsi_prot_sg_count(cmd) &&
> 	    cmd->prot_sdb->table.sgl != scsi_prot_inline_sg(cmd))

OK.

> 
> > +		if (ivecs <= SCSI_INLINE_PROT_SG_CNT) {
> > +			scsi_init_inline_sg_table(&prot_sdb->table,
> > +						  scsi_prot_inline_sg(cmd),
> > +						  SCSI_INLINE_PROT_SG_CNT);
> > +		} else if (sg_alloc_table_chained(&prot_sdb->table,
> > +						  ivecs, NULL)) {
> 
> Hmm.  Maybe we just need to pass an nr_inline_vecs argument
> to sg_alloc_table_chained to replace the SG_CHUNK_SIZE argument instead
> of open coding this logic?

We can do that, however the current scatterlist code assumes that size
of each SGL is fixed. We may change the logic to support this feature,
seems not too difficult to do that.

Please let us know if you are fine to change the scatterlist code for
supporting customized size of the 1st SGL.


Thanks,
Ming



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux