* [PATCH] remove sglist_len
@ 2007-09-06 8:19 FUJITA Tomonori
2007-09-06 12:25 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: FUJITA Tomonori @ 2007-09-06 8:19 UTC (permalink / raw)
To: linux-scsi, jens.axboe, James.Bottomley; +Cc: fujita.tomonori
This is against Jens' sg chaining branch.
http://git.kernel.org/?p=linux/kernel/git/axboe/linux-2.6-block.git;a=commitdiff;h=d6beb57f48231f5c012fb7d55b369bc0af6b0c41
The sg chaining patchset adds __use_sg to save the length of sg list
before dma mapping. The sg chaining patchset also uses sglist_len but
we can live without it. So let's remove sglist_len since we can add
something to scsi_cmnd structure only when we definitely need to do.
Now the sg chaining provides a way to decrease memory consumption and
doesn't add anything to scsi_cmnd structure.
James, do you want to change more about the sg chaining's scsi_lib.c?
--
>From b887de7c48a674ace622544addd70ebc8ae31fd2 Mon Sep 17 00:00:00 2001
From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Date: Thu, 6 Sep 2007 08:41:33 +0100
Subject: [PATCH] remove sglist_len
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
---
drivers/scsi/scsi_lib.c | 11 ++++-------
include/scsi/scsi_cmnd.h | 1 -
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 2fc2380..1e0f691 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -774,10 +774,8 @@ struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *cmd, gfp_t gfp_mask)
/*
* first loop through, set initial index and return value
*/
- if (!ret) {
- cmd->sglist_len = index;
+ if (!ret)
ret = sgl;
- }
/*
* chain previous sglist, if any. we know the previous
@@ -830,8 +828,6 @@ void scsi_free_sgtable(struct scsi_cmnd *cmd)
struct scatterlist *sgl = cmd->request_buffer;
struct scsi_host_sg_pool *sgp;
- BUG_ON(cmd->sglist_len >= SG_MEMPOOL_NR);
-
/*
* if this is the biggest size sglist, check if we have
* chained parts we need to free
@@ -866,9 +862,10 @@ void scsi_free_sgtable(struct scsi_cmnd *cmd)
* Restore original, will be freed below
*/
sgl = cmd->request_buffer;
- }
+ sgp = scsi_sg_pools + SG_MEMPOOL_NR - 1;
+ } else
+ sgp = scsi_sg_pools + scsi_sgtable_index(cmd->__use_sg);
- sgp = scsi_sg_pools + cmd->sglist_len;
mempool_free(sgl, sgp->pool);
}
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 6263c4e..bb6358a 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -72,7 +72,6 @@ struct scsi_cmnd {
/* These elements define the operation we ultimately want to perform */
unsigned short use_sg; /* Number of pieces of scatter-gather */
- unsigned short sglist_len; /* size of malloc'd scatter-gather list */
unsigned short __use_sg;
unsigned underflow; /* Return error if less than
--
1.5.2.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] remove sglist_len
2007-09-06 8:19 [PATCH] remove sglist_len FUJITA Tomonori
@ 2007-09-06 12:25 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2007-09-06 12:25 UTC (permalink / raw)
To: FUJITA Tomonori; +Cc: linux-scsi, James.Bottomley, fujita.tomonori
On Thu, Sep 06 2007, FUJITA Tomonori wrote:
> This is against Jens' sg chaining branch.
>
> http://git.kernel.org/?p=linux/kernel/git/axboe/linux-2.6-block.git;a=commitdiff;h=d6beb57f48231f5c012fb7d55b369bc0af6b0c41
>
> The sg chaining patchset adds __use_sg to save the length of sg list
> before dma mapping. The sg chaining patchset also uses sglist_len but
> we can live without it. So let's remove sglist_len since we can add
> something to scsi_cmnd structure only when we definitely need to do.
>
> Now the sg chaining provides a way to decrease memory consumption and
> doesn't add anything to scsi_cmnd structure.
>
> James, do you want to change more about the sg chaining's scsi_lib.c?
Looks good to me!
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-09-06 12:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-06 8:19 [PATCH] remove sglist_len FUJITA Tomonori
2007-09-06 12:25 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox