Skip to content

Commit 0fbc3e0

Browse files
Christoph Hellwigaxboe
authored andcommitted
scsi: remove gfp_flags member in scsi_host_cmd_pool
When using the slab allocator we already decide at cache creation time if an allocation comes from a GFP_DMA pool using the SLAB_CACHE_DMA flag, and there is no point passing the kmalloc-family only GFP_DMA flag to kmem_cache_alloc. Drop all the infrastructure for doing so. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Acked-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Jens Axboe <axboe@fb.com>
1 parent 80e1836 commit 0fbc3e0

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

drivers/scsi/scsi.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ struct scsi_host_cmd_pool {
105105
char *cmd_name;
106106
char *sense_name;
107107
unsigned int slab_flags;
108-
gfp_t gfp_mask;
109108
};
110109

111110
static struct scsi_host_cmd_pool scsi_cmd_pool = {
@@ -118,7 +117,6 @@ static struct scsi_host_cmd_pool scsi_cmd_dma_pool = {
118117
.cmd_name = "scsi_cmd_cache(DMA)",
119118
.sense_name = "scsi_sense_cache(DMA)",
120119
.slab_flags = SLAB_HWCACHE_ALIGN|SLAB_CACHE_DMA,
121-
.gfp_mask = __GFP_DMA,
122120
};
123121

124122
static DEFINE_MUTEX(host_cmd_pool_mutex);
@@ -156,12 +154,11 @@ scsi_host_alloc_command(struct Scsi_Host *shost, gfp_t gfp_mask)
156154
struct scsi_host_cmd_pool *pool = shost->cmd_pool;
157155
struct scsi_cmnd *cmd;
158156

159-
cmd = kmem_cache_zalloc(pool->cmd_slab, gfp_mask | pool->gfp_mask);
157+
cmd = kmem_cache_zalloc(pool->cmd_slab, gfp_mask);
160158
if (!cmd)
161159
goto fail;
162160

163-
cmd->sense_buffer = kmem_cache_alloc(pool->sense_slab,
164-
gfp_mask | pool->gfp_mask);
161+
cmd->sense_buffer = kmem_cache_alloc(pool->sense_slab, gfp_mask);
165162
if (!cmd->sense_buffer)
166163
goto fail_free_cmd;
167164

@@ -327,10 +324,8 @@ scsi_alloc_host_cmd_pool(struct Scsi_Host *shost)
327324
}
328325

329326
pool->slab_flags = SLAB_HWCACHE_ALIGN;
330-
if (shost->unchecked_isa_dma) {
327+
if (shost->unchecked_isa_dma)
331328
pool->slab_flags |= SLAB_CACHE_DMA;
332-
pool->gfp_mask = __GFP_DMA;
333-
}
334329

335330
if (hostt->cmd_size)
336331
hostt->cmd_pool = pool;
@@ -424,7 +419,6 @@ static void scsi_put_host_cmd_pool(struct Scsi_Host *shost)
424419
*/
425420
int scsi_setup_command_freelist(struct Scsi_Host *shost)
426421
{
427-
const gfp_t gfp_mask = shost->unchecked_isa_dma ? GFP_DMA : GFP_KERNEL;
428422
struct scsi_cmnd *cmd;
429423

430424
spin_lock_init(&shost->free_list_lock);
@@ -437,7 +431,7 @@ int scsi_setup_command_freelist(struct Scsi_Host *shost)
437431
/*
438432
* Get one backup command for this host.
439433
*/
440-
cmd = scsi_host_alloc_command(shost, gfp_mask);
434+
cmd = scsi_host_alloc_command(shost, GFP_KERNEL);
441435
if (!cmd) {
442436
scsi_put_host_cmd_pool(shost);
443437
shost->cmd_pool = NULL;

0 commit comments

Comments
 (0)