aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_lib.c
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2007-09-18 06:14:37 -0400
committerJens Axboe <jens.axboe@oracle.com>2007-10-16 05:24:44 -0400
commitfd820f405574a30aacf9a859886e173d641f080b (patch)
treefe257fa1705363bca29c9ad605b90f827c9d6e13 /drivers/scsi/scsi_lib.c
parent7530c20f2ab2f55b99c666b03728df7d8b59a80c (diff)
revert sg segment size ifdefs
This reverts sg segment size ifdefs that the current code has in order to provide a way to reduce sgpool memory consumption. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
-rw-r--r--drivers/scsi/scsi_lib.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index b6e6d801768..1a7e8d811a0 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -34,6 +34,13 @@
34#define SG_MEMPOOL_NR ARRAY_SIZE(scsi_sg_pools) 34#define SG_MEMPOOL_NR ARRAY_SIZE(scsi_sg_pools)
35#define SG_MEMPOOL_SIZE 2 35#define SG_MEMPOOL_SIZE 2
36 36
37/*
38 * The maximum number of SG segments that we will put inside a scatterlist
39 * (unless chaining is used). Should ideally fit inside a single page, to
40 * avoid a higher order allocation.
41 */
42#define SCSI_MAX_SG_SEGMENTS 128
43
37struct scsi_host_sg_pool { 44struct scsi_host_sg_pool {
38 size_t size; 45 size_t size;
39 char *name; 46 char *name;
@@ -45,9 +52,15 @@ struct scsi_host_sg_pool {
45static struct scsi_host_sg_pool scsi_sg_pools[] = { 52static struct scsi_host_sg_pool scsi_sg_pools[] = {
46 SP(8), 53 SP(8),
47 SP(16), 54 SP(16),
55#if (SCSI_MAX_SG_SEGMENTS > 16)
48 SP(32), 56 SP(32),
57#if (SCSI_MAX_SG_SEGMENTS > 32)
49 SP(64), 58 SP(64),
59#if (SCSI_MAX_SG_SEGMENTS > 64)
50 SP(128), 60 SP(128),
61#endif
62#endif
63#endif
51}; 64};
52#undef SP 65#undef SP
53 66
@@ -685,13 +698,6 @@ static struct scsi_cmnd *scsi_end_request(struct scsi_cmnd *cmd, int uptodate,
685} 698}
686 699
687/* 700/*
688 * The maximum number of SG segments that we will put inside a scatterlist
689 * (unless chaining is used). Should ideally fit inside a single page, to
690 * avoid a higher order allocation.
691 */
692#define SCSI_MAX_SG_SEGMENTS 128
693
694/*
695 * Like SCSI_MAX_SG_SEGMENTS, but for archs that have sg chaining. This limit 701 * Like SCSI_MAX_SG_SEGMENTS, but for archs that have sg chaining. This limit
696 * is totally arbitrary, a setting of 2048 will get you at least 8mb ios. 702 * is totally arbitrary, a setting of 2048 will get you at least 8mb ios.
697 */ 703 */
@@ -708,15 +714,21 @@ static inline unsigned int scsi_sgtable_index(unsigned short nents)
708 case 9 ... 16: 714 case 9 ... 16:
709 index = 1; 715 index = 1;
710 break; 716 break;
717#if (SCSI_MAX_SG_SEGMENTS > 16)
711 case 17 ... 32: 718 case 17 ... 32:
712 index = 2; 719 index = 2;
713 break; 720 break;
721#if (SCSI_MAX_SG_SEGMENTS > 32)
714 case 33 ... 64: 722 case 33 ... 64:
715 index = 3; 723 index = 3;
716 break; 724 break;
717 case 65 ... SCSI_MAX_SG_SEGMENTS: 725#if (SCSI_MAX_SG_SEGMENTS > 64)
726 case 65 ... 128:
718 index = 4; 727 index = 4;
719 break; 728 break;
729#endif
730#endif
731#endif
720 default: 732 default:
721 printk(KERN_ERR "scsi: bad segment count=%d\n", nents); 733 printk(KERN_ERR "scsi: bad segment count=%d\n", nents);
722 BUG(); 734 BUG();