From: Christoph Hellwig <hch@lst.de>
To: Ming Lei <ming.lei@redhat.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>,
linux-scsi@vger.kernel.org,
"Martin K . Petersen" <martin.petersen@oracle.com>,
linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
Bart Van Assche <bvanassche@acm.org>,
"Ewan D . Milne" <emilne@redhat.com>,
Hannes Reinecke <hare@suse.com>
Subject: Re: [PATCH V2 1/2] scsi: core: avoid to pre-allocate big chunk for protection meta data
Date: Wed, 24 Apr 2019 16:37:04 +0200 [thread overview]
Message-ID: <20190424143704.GC21209@lst.de> (raw)
In-Reply-To: <20190424093540.15526-2-ming.lei@redhat.com>
> - 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))
> + 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?
If we'd also pass it to sg_free_table_chained we could also simplify
those checks in all callers.
next prev parent reply other threads:[~2019-04-24 14:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-24 9:35 [PATCH V2 0/2] scis: core: avoid big pre-allocation for sg list Ming Lei
2019-04-24 9:35 ` [PATCH V2 1/2] scsi: core: avoid to pre-allocate big chunk for protection meta data Ming Lei
2019-04-24 14:37 ` Christoph Hellwig [this message]
2019-04-25 9:37 ` Ming Lei
2019-04-25 11:20 ` Ming Lei
2019-04-24 9:35 ` [PATCH V2 2/2] scsi: core: avoid to pre-allocate big chunk for sg list Ming Lei
2019-04-24 14:33 ` [PATCH V2 0/2] scis: core: avoid big pre-allocation " Christoph Hellwig
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=20190424143704.GC21209@lst.de \
--to=hch@lst.de \
--cc=James.Bottomley@HansenPartnership.com \
--cc=bvanassche@acm.org \
--cc=emilne@redhat.com \
--cc=hare@suse.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=ming.lei@redhat.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).