From: Andy Grover <agrover@xxxxxxxxxx> Since the caller is just passing PAGE_SIZE for dma_size, we can just use PAGE_SIZE in the function (since we're allocating pages) and omit the parameter. (hch: Add __GFP_ZERO usage to zero page) Signed-off-by: Andy Grover <agrover@xxxxxxxxxx> Signed-off-by: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx> --- drivers/target/target_core_transport.c | 20 +++++--------------- 1 files changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index da6bd74..9bbc626 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -210,8 +210,7 @@ static u32 transport_generic_get_cdb_count(struct se_cmd *cmd, unsigned long long starting_lba, u32 sectors, enum dma_data_direction data_direction, struct list_head *mem_list, int set_counts); -static int transport_generic_get_mem(struct se_cmd *cmd, u32 length, - u32 dma_size); +static int transport_generic_get_mem(struct se_cmd *cmd, u32 length); static int transport_generic_remove(struct se_cmd *cmd, int release_to_pool, int session_reinstatement); static int transport_get_sectors(struct se_cmd *cmd); @@ -2896,7 +2895,7 @@ static int transport_allocate_resources(struct se_cmd *cmd) if ((cmd->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB) || (cmd->se_cmd_flags & SCF_SCSI_CONTROL_SG_IO_CDB)) - return transport_generic_get_mem(cmd, length, PAGE_SIZE); + return transport_generic_get_mem(cmd, length); else if (cmd->se_cmd_flags & SCF_SCSI_CONTROL_NONSG_IO_CDB) return transport_generic_allocate_buf(cmd, length); else @@ -4070,9 +4069,8 @@ static int transport_new_cmd_obj(struct se_cmd *cmd) } static int -transport_generic_get_mem(struct se_cmd *cmd, u32 length, u32 dma_size) +transport_generic_get_mem(struct se_cmd *cmd, u32 length) { - unsigned char *buf; struct se_mem *se_mem; /* @@ -4089,22 +4087,14 @@ transport_generic_get_mem(struct se_cmd *cmd, u32 length, u32 dma_size) } /* #warning FIXME Allocate contigous pages for struct se_mem elements */ - se_mem->se_page = alloc_pages(GFP_KERNEL, 0); + se_mem->se_page = alloc_pages(GFP_KERNEL | __GFP_ZERO, 0); if (!(se_mem->se_page)) { printk(KERN_ERR "alloc_pages() failed\n"); goto out; } - buf = kmap_atomic(se_mem->se_page, KM_IRQ0); - if (!(buf)) { - printk(KERN_ERR "kmap_atomic() failed\n"); - goto out; - } INIT_LIST_HEAD(&se_mem->se_list); - se_mem->se_len = (length > dma_size) ? dma_size : length; - memset(buf, 0, se_mem->se_len); - kunmap_atomic(buf, KM_IRQ0); - + se_mem->se_len = min_t(u32, length, PAGE_SIZE); list_add_tail(&se_mem->se_list, &cmd->t_task.t_mem_list); cmd->t_task.t_tasks_se_num++; -- 1.7.6 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html