mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
iscsi/iser-target: Convert to command priv_size usage
This command converts iscsi/isert-target to use allocations based on iscsit_transport->priv_size within iscsit_allocate_cmd(), instead of using an embedded isert_cmd->iscsi_cmd. This includes removing iscsit_transport->alloc_cmd() usage, along with updating isert-target code to use iscsit_priv_cmd(). Also, remove left-over iscsit_transport->release_cmd() usage for direct calls to iscsit_release_cmd(), and drop the now unused lio_cmd_cache and isert_cmd_cache. Cc: Or Gerlitz <[email protected]> Cc: Kent Overstreet <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
This commit is contained in:
parent
3aee26b4ae
commit
d703ce2f7f
8 changed files with 55 additions and 109 deletions
|
|
@ -63,7 +63,6 @@ spinlock_t sess_idr_lock;
|
|||
|
||||
struct iscsit_global *iscsit_global;
|
||||
|
||||
struct kmem_cache *lio_cmd_cache;
|
||||
struct kmem_cache *lio_qr_cache;
|
||||
struct kmem_cache *lio_dr_cache;
|
||||
struct kmem_cache *lio_ooo_cache;
|
||||
|
|
@ -500,7 +499,6 @@ static struct iscsit_transport iscsi_target_transport = {
|
|||
.iscsit_setup_np = iscsit_setup_np,
|
||||
.iscsit_accept_np = iscsit_accept_np,
|
||||
.iscsit_free_np = iscsit_free_np,
|
||||
.iscsit_alloc_cmd = iscsit_alloc_cmd,
|
||||
.iscsit_get_login_rx = iscsit_get_login_rx,
|
||||
.iscsit_put_login_tx = iscsit_put_login_tx,
|
||||
.iscsit_get_dataout = iscsit_build_r2ts_for_cmd,
|
||||
|
|
@ -541,22 +539,13 @@ static int __init iscsi_target_init_module(void)
|
|||
goto ts_out1;
|
||||
}
|
||||
|
||||
lio_cmd_cache = kmem_cache_create("lio_cmd_cache",
|
||||
sizeof(struct iscsi_cmd), __alignof__(struct iscsi_cmd),
|
||||
0, NULL);
|
||||
if (!lio_cmd_cache) {
|
||||
pr_err("Unable to kmem_cache_create() for"
|
||||
" lio_cmd_cache\n");
|
||||
goto ts_out2;
|
||||
}
|
||||
|
||||
lio_qr_cache = kmem_cache_create("lio_qr_cache",
|
||||
sizeof(struct iscsi_queue_req),
|
||||
__alignof__(struct iscsi_queue_req), 0, NULL);
|
||||
if (!lio_qr_cache) {
|
||||
pr_err("nable to kmem_cache_create() for"
|
||||
" lio_qr_cache\n");
|
||||
goto cmd_out;
|
||||
goto ts_out2;
|
||||
}
|
||||
|
||||
lio_dr_cache = kmem_cache_create("lio_dr_cache",
|
||||
|
|
@ -600,8 +589,6 @@ dr_out:
|
|||
kmem_cache_destroy(lio_dr_cache);
|
||||
qr_out:
|
||||
kmem_cache_destroy(lio_qr_cache);
|
||||
cmd_out:
|
||||
kmem_cache_destroy(lio_cmd_cache);
|
||||
ts_out2:
|
||||
iscsi_deallocate_thread_sets();
|
||||
ts_out1:
|
||||
|
|
@ -619,7 +606,6 @@ static void __exit iscsi_target_cleanup_module(void)
|
|||
iscsi_thread_set_free();
|
||||
iscsit_release_discovery_tpg();
|
||||
iscsit_unregister_transport(&iscsi_target_transport);
|
||||
kmem_cache_destroy(lio_cmd_cache);
|
||||
kmem_cache_destroy(lio_qr_cache);
|
||||
kmem_cache_destroy(lio_dr_cache);
|
||||
kmem_cache_destroy(lio_ooo_cache);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ extern struct target_fabric_configfs *lio_target_fabric_configfs;
|
|||
|
||||
extern struct kmem_cache *lio_dr_cache;
|
||||
extern struct kmem_cache *lio_ooo_cache;
|
||||
extern struct kmem_cache *lio_cmd_cache;
|
||||
extern struct kmem_cache *lio_qr_cache;
|
||||
extern struct kmem_cache *lio_r2t_cache;
|
||||
|
||||
|
|
|
|||
|
|
@ -1925,7 +1925,7 @@ static void lio_release_cmd(struct se_cmd *se_cmd)
|
|||
struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd);
|
||||
|
||||
pr_debug("Entering lio_release_cmd for se_cmd: %p\n", se_cmd);
|
||||
cmd->release_cmd(cmd);
|
||||
iscsit_release_cmd(cmd);
|
||||
}
|
||||
|
||||
/* End functions for target_core_fabric_ops */
|
||||
|
|
|
|||
|
|
@ -489,7 +489,6 @@ struct iscsi_cmd {
|
|||
u32 first_data_sg_off;
|
||||
u32 kmapped_nents;
|
||||
sense_reason_t sense_reason;
|
||||
void (*release_cmd)(struct iscsi_cmd *);
|
||||
} ____cacheline_aligned;
|
||||
|
||||
struct iscsi_tmr_req {
|
||||
|
|
|
|||
|
|
@ -149,18 +149,6 @@ void iscsit_free_r2ts_from_list(struct iscsi_cmd *cmd)
|
|||
spin_unlock_bh(&cmd->r2t_lock);
|
||||
}
|
||||
|
||||
struct iscsi_cmd *iscsit_alloc_cmd(struct iscsi_conn *conn, gfp_t gfp_mask)
|
||||
{
|
||||
struct iscsi_cmd *cmd;
|
||||
|
||||
cmd = kmem_cache_zalloc(lio_cmd_cache, gfp_mask);
|
||||
if (!cmd)
|
||||
return NULL;
|
||||
|
||||
cmd->release_cmd = &iscsit_release_cmd;
|
||||
return cmd;
|
||||
}
|
||||
|
||||
/*
|
||||
* May be called from software interrupt (timer) context for allocating
|
||||
* iSCSI NopINs.
|
||||
|
|
@ -168,8 +156,9 @@ struct iscsi_cmd *iscsit_alloc_cmd(struct iscsi_conn *conn, gfp_t gfp_mask)
|
|||
struct iscsi_cmd *iscsit_allocate_cmd(struct iscsi_conn *conn, gfp_t gfp_mask)
|
||||
{
|
||||
struct iscsi_cmd *cmd;
|
||||
int priv_size = conn->conn_transport->priv_size;
|
||||
|
||||
cmd = conn->conn_transport->iscsit_alloc_cmd(conn, gfp_mask);
|
||||
cmd = kzalloc(sizeof(struct iscsi_cmd) + priv_size, gfp_mask);
|
||||
if (!cmd) {
|
||||
pr_err("Unable to allocate memory for struct iscsi_cmd.\n");
|
||||
return NULL;
|
||||
|
|
@ -696,8 +685,9 @@ void iscsit_release_cmd(struct iscsi_cmd *cmd)
|
|||
kfree(cmd->iov_data);
|
||||
kfree(cmd->text_in_ptr);
|
||||
|
||||
kmem_cache_free(lio_cmd_cache, cmd);
|
||||
kfree(cmd);
|
||||
}
|
||||
EXPORT_SYMBOL(iscsit_release_cmd);
|
||||
|
||||
static void __iscsit_free_cmd(struct iscsi_cmd *cmd, bool scsi_cmd,
|
||||
bool check_queues)
|
||||
|
|
@ -761,7 +751,7 @@ void iscsit_free_cmd(struct iscsi_cmd *cmd, bool shutdown)
|
|||
/* Fall-through */
|
||||
default:
|
||||
__iscsit_free_cmd(cmd, false, shutdown);
|
||||
cmd->release_cmd(cmd);
|
||||
iscsit_release_cmd(cmd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue