From: Ming Lin <mlin@kernel.org>
To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org
Cc: Christoph Hellwig <hch@lst.de>
Subject: [PATCH v2 2/5] scsi: replace "mq" with "first_chunk" in SG functions
Date: Tue, 22 Mar 2016 15:03:13 -0700 [thread overview]
Message-ID: <1458684196-15923-3-git-send-email-mlin@kernel.org> (raw)
In-Reply-To: <1458684196-15923-1-git-send-email-mlin@kernel.org>
From: Ming Lin <ming.l@ssi.samsung.com>
Parameter "bool mq" is block driver specific.
Change it to "first_chunk" to make it more generic.
Signed-off-by: Ming Lin <ming.l@ssi.samsung.com>
---
drivers/scsi/scsi_lib.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 5eaddc7..ab3dd09 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -583,33 +583,32 @@ static struct scatterlist *scsi_sg_alloc(unsigned int nents, gfp_t gfp_mask)
return mempool_alloc(sgp->pool, gfp_mask);
}
-static void scsi_free_sgtable(struct sg_table *table, bool mq)
+static void scsi_free_sgtable(struct sg_table *table, bool first_chunk)
{
- if (mq && table->orig_nents <= SCSI_MAX_SG_SEGMENTS)
+ if (first_chunk && table->orig_nents <= SCSI_MAX_SG_SEGMENTS)
return;
- __sg_free_table(table, SCSI_MAX_SG_SEGMENTS, mq, scsi_sg_free);
+ __sg_free_table(table, SCSI_MAX_SG_SEGMENTS, first_chunk, scsi_sg_free);
}
-static int scsi_alloc_sgtable(struct sg_table *table, int nents, bool mq)
+static int scsi_alloc_sgtable(struct sg_table *table, int nents,
+ struct scatterlist *first_chunk)
{
- struct scatterlist *first_chunk = NULL;
int ret;
BUG_ON(!nents);
- if (mq) {
+ if (first_chunk) {
if (nents <= SCSI_MAX_SG_SEGMENTS) {
table->nents = table->orig_nents = nents;
sg_init_table(table->sgl, nents);
return 0;
}
- first_chunk = table->sgl;
}
ret = __sg_alloc_table(table, nents, SCSI_MAX_SG_SEGMENTS,
first_chunk, GFP_ATOMIC, scsi_sg_alloc);
if (unlikely(ret))
- scsi_free_sgtable(table, mq);
+ scsi_free_sgtable(table, (bool)first_chunk);
return ret;
}
@@ -1091,7 +1090,7 @@ static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb)
* If sg table allocation fails, requeue request later.
*/
if (unlikely(scsi_alloc_sgtable(&sdb->table, req->nr_phys_segments,
- req->mq_ctx != NULL)))
+ sdb->table.sgl)))
return BLKPREP_DEFER;
/*
@@ -1163,7 +1162,8 @@ int scsi_init_io(struct scsi_cmnd *cmd)
ivecs = blk_rq_count_integrity_sg(rq->q, rq->bio);
- if (scsi_alloc_sgtable(&prot_sdb->table, ivecs, is_mq)) {
+ if (scsi_alloc_sgtable(&prot_sdb->table, ivecs,
+ prot_sdb->table.sgl)) {
error = BLKPREP_DEFER;
goto err_exit;
}
--
1.9.1
next prev parent reply other threads:[~2016-03-22 22:03 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-22 22:03 [PATCH v2 0/5] mempool based chained scatterlist alloc/free api Ming Lin
2016-03-22 22:03 ` [PATCH v2 1/5] scsi: replace "scsi_data_buffer" with "sg_table" in SG functions Ming Lin
2016-03-22 22:03 ` Ming Lin [this message]
2016-03-22 22:03 ` [PATCH v2 3/5] scsi: rename SG related struct and functions Ming Lin
2016-03-22 22:03 ` [PATCH v2 4/5] scsi: rename SCSI_MAX_{SG, SG_CHAIN}_SEGMENTS Ming Lin
2016-04-04 14:22 ` Bart Van Assche
2016-04-04 14:22 ` Bart Van Assche
2016-04-04 20:24 ` Ming Lin
2016-04-04 21:22 ` Tejun Heo
2016-03-22 22:03 ` [PATCH v2 5/5] lib: scatterlist: move SG pool code from SCSI driver to lib/sg_pool.c Ming Lin
2016-03-23 2:38 ` kbuild test robot
2016-04-04 20:15 ` Ming Lin
2016-04-04 20:17 ` Christoph Hellwig
2016-04-04 20:29 ` Ming Lin
2016-03-23 2:38 ` [PATCH] lib: scatterlist: fix ifnullfree.cocci warnings kbuild test robot
2016-03-23 7:40 ` [PATCH v2 0/5] mempool based chained scatterlist alloc/free api Christoph Hellwig
2016-03-24 15:09 ` Ming Lin
2016-03-24 15:09 ` Ming Lin
2016-03-24 15:46 ` James Bottomley
2016-03-24 15:46 ` James Bottomley
2016-03-28 14:48 ` Ming Lin
2016-04-04 6:07 ` Ming Lin
2016-04-04 14:01 ` James Bottomley
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=1458684196-15923-3-git-send-email-mlin@kernel.org \
--to=mlin@kernel.org \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.