diff options
-rw-r--r-- | drivers/target/target_core_device.c | 1 | ||||
-rw-r--r-- | drivers/target/target_core_pr.c | 31 | ||||
-rw-r--r-- | include/target/target_core_base.h | 2 |
3 files changed, 11 insertions, 23 deletions
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 4630481b6043..ed679c9420c5 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -1410,7 +1410,6 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name) INIT_LIST_HEAD(&dev->t10_alua.tg_pt_gps_list); spin_lock_init(&dev->t10_alua.tg_pt_gps_lock); - dev->t10_pr.pr_aptpl_buf_len = PR_APTPL_BUF_LEN; dev->t10_wwn.t10_dev = dev; dev->t10_alua.t10_dev = dev; diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index 548fc2a4a7bf..157368429a51 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c @@ -606,8 +606,7 @@ static struct t10_pr_registration *__core_scsi3_do_alloc_registration( return NULL; } - pr_reg->pr_aptpl_buf = kzalloc(dev->t10_pr.pr_aptpl_buf_len, - GFP_ATOMIC); + pr_reg->pr_aptpl_buf = kzalloc(PR_APTPL_BUF_LEN, GFP_ATOMIC); if (!pr_reg->pr_aptpl_buf) { pr_err("Unable to allocate pr_reg->pr_aptpl_buf\n"); kmem_cache_free(t10_pr_reg_cache, pr_reg); @@ -804,7 +803,7 @@ int core_scsi3_alloc_aptpl_registration( pr_err("Unable to allocate struct t10_pr_registration\n"); return -ENOMEM; } - pr_reg->pr_aptpl_buf = kzalloc(pr_tmpl->pr_aptpl_buf_len, GFP_KERNEL); + pr_reg->pr_aptpl_buf = kzalloc(PR_APTPL_BUF_LEN, GFP_KERNEL); INIT_LIST_HEAD(&pr_reg->pr_reg_list); INIT_LIST_HEAD(&pr_reg->pr_reg_abort_list); @@ -2090,8 +2089,7 @@ core_scsi3_emulate_pro_register(struct se_cmd *cmd, u64 res_key, u64 sa_res_key, se_sess->se_node_acl, se_sess); if (core_scsi3_update_and_write_aptpl(cmd->se_dev, - &pr_reg->pr_aptpl_buf[0], - pr_tmpl->pr_aptpl_buf_len)) { + pr_reg->pr_aptpl_buf, PR_APTPL_BUF_LEN)) { pr_tmpl->pr_aptpl_active = 1; pr_debug("SPC-3 PR: Set APTPL Bit Activated for REGISTER\n"); } @@ -2140,8 +2138,7 @@ core_scsi3_emulate_pro_register(struct se_cmd *cmd, u64 res_key, u64 sa_res_key, * Allocate APTPL metadata buffer used for UNREGISTER ops */ if (aptpl) { - pr_aptpl_buf = kzalloc(pr_tmpl->pr_aptpl_buf_len, - GFP_KERNEL); + pr_aptpl_buf = kzalloc(PR_APTPL_BUF_LEN, GFP_KERNEL); if (!pr_aptpl_buf) { pr_err("Unable to allocate" " pr_aptpl_buf\n"); @@ -2229,8 +2226,7 @@ core_scsi3_emulate_pro_register(struct se_cmd *cmd, u64 res_key, u64 sa_res_key, return 0; } - if (!core_scsi3_update_and_write_aptpl(dev, &pr_aptpl_buf[0], - pr_tmpl->pr_aptpl_buf_len)) { + if (!core_scsi3_update_and_write_aptpl(dev, pr_aptpl_buf, PR_APTPL_BUF_LEN)) { pr_tmpl->pr_aptpl_active = 1; pr_debug("SPC-3 PR: Set APTPL Bit Activated" " for UNREGISTER\n"); @@ -2262,8 +2258,7 @@ core_scsi3_emulate_pro_register(struct se_cmd *cmd, u64 res_key, u64 sa_res_key, goto out_put_pr_reg; } - if (!core_scsi3_update_and_write_aptpl(dev, &pr_aptpl_buf[0], - pr_tmpl->pr_aptpl_buf_len)) { + if (!core_scsi3_update_and_write_aptpl(dev, pr_aptpl_buf, PR_APTPL_BUF_LEN)) { pr_tmpl->pr_aptpl_active = 1; pr_debug("SPC-3 PR: Set APTPL Bit Activated" " for REGISTER\n"); @@ -2448,8 +2443,7 @@ core_scsi3_pro_reserve(struct se_cmd *cmd, int type, int scope, u64 res_key) if (pr_tmpl->pr_aptpl_active) { if (!core_scsi3_update_and_write_aptpl(cmd->se_dev, - &pr_reg->pr_aptpl_buf[0], - pr_tmpl->pr_aptpl_buf_len)) { + pr_reg->pr_aptpl_buf, PR_APTPL_BUF_LEN)) { pr_debug("SPC-3 PR: Updated APTPL metadata" " for RESERVE\n"); } @@ -2669,7 +2663,7 @@ core_scsi3_emulate_pro_release(struct se_cmd *cmd, int type, int scope, write_aptpl: if (pr_tmpl->pr_aptpl_active) { if (!core_scsi3_update_and_write_aptpl(cmd->se_dev, - &pr_reg->pr_aptpl_buf[0], pr_tmpl->pr_aptpl_buf_len)) { + pr_reg->pr_aptpl_buf, PR_APTPL_BUF_LEN)) { pr_debug("SPC-3 PR: Updated APTPL metadata for RELEASE\n"); } } @@ -2996,8 +2990,7 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key, if (pr_tmpl->pr_aptpl_active) { if (!core_scsi3_update_and_write_aptpl(cmd->se_dev, - &pr_reg_n->pr_aptpl_buf[0], - pr_tmpl->pr_aptpl_buf_len)) { + pr_reg_n->pr_aptpl_buf, PR_APTPL_BUF_LEN)) { pr_debug("SPC-3 PR: Updated APTPL" " metadata for PREEMPT%s\n", (preempt_type == PREEMPT_AND_ABORT) ? "_AND_ABORT" : ""); @@ -3132,8 +3125,7 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key, if (pr_tmpl->pr_aptpl_active) { if (!core_scsi3_update_and_write_aptpl(cmd->se_dev, - &pr_reg_n->pr_aptpl_buf[0], - pr_tmpl->pr_aptpl_buf_len)) { + pr_reg_n->pr_aptpl_buf, PR_APTPL_BUF_LEN)) { pr_debug("SPC-3 PR: Updated APTPL metadata for PREEMPT" "%s\n", (preempt_type == PREEMPT_AND_ABORT) ? "_AND_ABORT" : ""); } @@ -3576,8 +3568,7 @@ after_iport_check: } else { pr_tmpl->pr_aptpl_active = 1; if (!core_scsi3_update_and_write_aptpl(cmd->se_dev, - &dest_pr_reg->pr_aptpl_buf[0], - pr_tmpl->pr_aptpl_buf_len)) { + dest_pr_reg->pr_aptpl_buf, PR_APTPL_BUF_LEN)) { pr_debug("SPC-3 PR: Set APTPL Bit Activated for" " REGISTER_AND_MOVE\n"); } diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 4ea4f985f394..5976dc3e4066 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -374,9 +374,7 @@ struct t10_reservation { /* Activate Persistence across Target Power Loss enabled * for SCSI device */ int pr_aptpl_active; - /* Used by struct t10_reservation->pr_aptpl_buf_len */ #define PR_APTPL_BUF_LEN 8192 - u32 pr_aptpl_buf_len; u32 pr_generation; spinlock_t registration_lock; spinlock_t aptpl_reg_lock; |