lkml.org 
[lkml]   [2011]   [May]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 2/6] scsi: warn and avoid creating dma caches if DMA support is disabled
__GFP_DMA may not be passed to scsi_{get,put}_host_cmd_pool() if
CONFIG_ZONE_DMA is disabled, which is now possible on x86. If passed,
emit a warning and return.

Signed-off-by: David Rientjes <rientjes@google.com>
---
drivers/scsi/scsi.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -359,6 +359,11 @@ EXPORT_SYMBOL(scsi_put_command);
static struct scsi_host_cmd_pool *scsi_get_host_cmd_pool(gfp_t gfp_mask)
{
struct scsi_host_cmd_pool *retval = NULL, *pool;
+
+#ifndef CONFIG_ZONE_DMA
+ if (WARN_ON_ONCE(gfp_mask & __GFP_DMA))
+ return NULL;
+#endif
/*
* Select a command slab for this host and create it if not
* yet existent.
@@ -393,6 +398,10 @@ static void scsi_put_host_cmd_pool(gfp_t gfp_mask)
{
struct scsi_host_cmd_pool *pool;

+#ifndef CONFIG_ZONE_DMA
+ if (WARN_ON_ONCE(gfp_mask & __GFP_DMA))
+ return;
+#endif
mutex_lock(&host_cmd_pool_mutex);
pool = (gfp_mask & __GFP_DMA) ? &scsi_cmd_dma_pool :
&scsi_cmd_pool;

\
 
 \ /
  Last update: 2011-05-25 01:57    [W:0.155 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site