diff options
author | Steven Clark <sclark@crossbeam.com> | 2012-03-09 17:50:30 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-03-28 04:33:04 -0400 |
commit | 011a9008b11604b12e8386fa6ac3433ab3175dc2 (patch) | |
tree | 6da856d1343c3f3806265b0a1ae56e29a7212828 /drivers | |
parent | 20dc3811a2adfac65d5974e3b022a85fdbb9e205 (diff) |
[SCSI] libfc: fcoe_transport_create fails in single-CPU environment
Starting fcoe fails at fcoe_transport_create when attempting to allocate a
pool of 4K exchanges on a 64-bit single-CPU environment because the call to
__alloc_percpu() is greater than the max of 32K. This patch reduces the
number of exchanges to fit within the maximum allowed space.
[ Whitespace problems fixed by Robert Love to satisfy chechpatch.pl ]
Signed-off-by: Steven Clark <sclark@crossbeam.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/libfc/fc_exch.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c index 630291f01826..aceffadb21c7 100644 --- a/drivers/scsi/libfc/fc_exch.c +++ b/drivers/scsi/libfc/fc_exch.c | |||
@@ -2263,7 +2263,18 @@ struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *lport, | |||
2263 | mp->class = class; | 2263 | mp->class = class; |
2264 | /* adjust em exch xid range for offload */ | 2264 | /* adjust em exch xid range for offload */ |
2265 | mp->min_xid = min_xid; | 2265 | mp->min_xid = min_xid; |
2266 | mp->max_xid = max_xid; | 2266 | |
2267 | /* reduce range so per cpu pool fits into PCPU_MIN_UNIT_SIZE pool */ | ||
2268 | pool_exch_range = (PCPU_MIN_UNIT_SIZE - sizeof(*pool)) / | ||
2269 | sizeof(struct fc_exch *); | ||
2270 | if ((max_xid - min_xid + 1) / (fc_cpu_mask + 1) > pool_exch_range) { | ||
2271 | mp->max_xid = pool_exch_range * (fc_cpu_mask + 1) + | ||
2272 | min_xid - 1; | ||
2273 | } else { | ||
2274 | mp->max_xid = max_xid; | ||
2275 | pool_exch_range = (mp->max_xid - mp->min_xid + 1) / | ||
2276 | (fc_cpu_mask + 1); | ||
2277 | } | ||
2267 | 2278 | ||
2268 | mp->ep_pool = mempool_create_slab_pool(2, fc_em_cachep); | 2279 | mp->ep_pool = mempool_create_slab_pool(2, fc_em_cachep); |
2269 | if (!mp->ep_pool) | 2280 | if (!mp->ep_pool) |
@@ -2274,7 +2285,6 @@ struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *lport, | |||
2274 | * divided across all cpus. The exch pointers array memory is | 2285 | * divided across all cpus. The exch pointers array memory is |
2275 | * allocated for exch range per pool. | 2286 | * allocated for exch range per pool. |
2276 | */ | 2287 | */ |
2277 | pool_exch_range = (mp->max_xid - mp->min_xid + 1) / (fc_cpu_mask + 1); | ||
2278 | mp->pool_max_index = pool_exch_range - 1; | 2288 | mp->pool_max_index = pool_exch_range - 1; |
2279 | 2289 | ||
2280 | /* | 2290 | /* |