Commit 4e529be2 authored by Andy Grover's avatar Andy Grover Committed by Nicholas Bellinger

target: Remove t10_reservation.pr_aptpl_buf_len

It's only ever set to PR_APTPL_BUF_LEN, so we don't need a variable.
Signed-off-by: default avatarAndy Grover <agrover@redhat.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 3c8a6228
...@@ -1410,7 +1410,6 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name) ...@@ -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); INIT_LIST_HEAD(&dev->t10_alua.tg_pt_gps_list);
spin_lock_init(&dev->t10_alua.tg_pt_gps_lock); 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_wwn.t10_dev = dev;
dev->t10_alua.t10_dev = dev; dev->t10_alua.t10_dev = dev;
......
...@@ -606,8 +606,7 @@ static struct t10_pr_registration *__core_scsi3_do_alloc_registration( ...@@ -606,8 +606,7 @@ static struct t10_pr_registration *__core_scsi3_do_alloc_registration(
return NULL; return NULL;
} }
pr_reg->pr_aptpl_buf = kzalloc(dev->t10_pr.pr_aptpl_buf_len, pr_reg->pr_aptpl_buf = kzalloc(PR_APTPL_BUF_LEN, GFP_ATOMIC);
GFP_ATOMIC);
if (!pr_reg->pr_aptpl_buf) { if (!pr_reg->pr_aptpl_buf) {
pr_err("Unable to allocate pr_reg->pr_aptpl_buf\n"); pr_err("Unable to allocate pr_reg->pr_aptpl_buf\n");
kmem_cache_free(t10_pr_reg_cache, pr_reg); kmem_cache_free(t10_pr_reg_cache, pr_reg);
...@@ -804,7 +803,7 @@ int core_scsi3_alloc_aptpl_registration( ...@@ -804,7 +803,7 @@ int core_scsi3_alloc_aptpl_registration(
pr_err("Unable to allocate struct t10_pr_registration\n"); pr_err("Unable to allocate struct t10_pr_registration\n");
return -ENOMEM; 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_list);
INIT_LIST_HEAD(&pr_reg->pr_reg_abort_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, ...@@ -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); se_sess->se_node_acl, se_sess);
if (core_scsi3_update_and_write_aptpl(cmd->se_dev, if (core_scsi3_update_and_write_aptpl(cmd->se_dev,
&pr_reg->pr_aptpl_buf[0], pr_reg->pr_aptpl_buf, PR_APTPL_BUF_LEN)) {
pr_tmpl->pr_aptpl_buf_len)) {
pr_tmpl->pr_aptpl_active = 1; pr_tmpl->pr_aptpl_active = 1;
pr_debug("SPC-3 PR: Set APTPL Bit Activated for REGISTER\n"); 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, ...@@ -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 * Allocate APTPL metadata buffer used for UNREGISTER ops
*/ */
if (aptpl) { if (aptpl) {
pr_aptpl_buf = kzalloc(pr_tmpl->pr_aptpl_buf_len, pr_aptpl_buf = kzalloc(PR_APTPL_BUF_LEN, GFP_KERNEL);
GFP_KERNEL);
if (!pr_aptpl_buf) { if (!pr_aptpl_buf) {
pr_err("Unable to allocate" pr_err("Unable to allocate"
" pr_aptpl_buf\n"); " pr_aptpl_buf\n");
...@@ -2229,8 +2226,7 @@ core_scsi3_emulate_pro_register(struct se_cmd *cmd, u64 res_key, u64 sa_res_key, ...@@ -2229,8 +2226,7 @@ core_scsi3_emulate_pro_register(struct se_cmd *cmd, u64 res_key, u64 sa_res_key,
return 0; return 0;
} }
if (!core_scsi3_update_and_write_aptpl(dev, &pr_aptpl_buf[0], if (!core_scsi3_update_and_write_aptpl(dev, pr_aptpl_buf, PR_APTPL_BUF_LEN)) {
pr_tmpl->pr_aptpl_buf_len)) {
pr_tmpl->pr_aptpl_active = 1; pr_tmpl->pr_aptpl_active = 1;
pr_debug("SPC-3 PR: Set APTPL Bit Activated" pr_debug("SPC-3 PR: Set APTPL Bit Activated"
" for UNREGISTER\n"); " for UNREGISTER\n");
...@@ -2262,8 +2258,7 @@ core_scsi3_emulate_pro_register(struct se_cmd *cmd, u64 res_key, u64 sa_res_key, ...@@ -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; goto out_put_pr_reg;
} }
if (!core_scsi3_update_and_write_aptpl(dev, &pr_aptpl_buf[0], if (!core_scsi3_update_and_write_aptpl(dev, pr_aptpl_buf, PR_APTPL_BUF_LEN)) {
pr_tmpl->pr_aptpl_buf_len)) {
pr_tmpl->pr_aptpl_active = 1; pr_tmpl->pr_aptpl_active = 1;
pr_debug("SPC-3 PR: Set APTPL Bit Activated" pr_debug("SPC-3 PR: Set APTPL Bit Activated"
" for REGISTER\n"); " for REGISTER\n");
...@@ -2448,8 +2443,7 @@ core_scsi3_pro_reserve(struct se_cmd *cmd, int type, int scope, u64 res_key) ...@@ -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 (pr_tmpl->pr_aptpl_active) {
if (!core_scsi3_update_and_write_aptpl(cmd->se_dev, if (!core_scsi3_update_and_write_aptpl(cmd->se_dev,
&pr_reg->pr_aptpl_buf[0], pr_reg->pr_aptpl_buf, PR_APTPL_BUF_LEN)) {
pr_tmpl->pr_aptpl_buf_len)) {
pr_debug("SPC-3 PR: Updated APTPL metadata" pr_debug("SPC-3 PR: Updated APTPL metadata"
" for RESERVE\n"); " for RESERVE\n");
} }
...@@ -2669,7 +2663,7 @@ core_scsi3_emulate_pro_release(struct se_cmd *cmd, int type, int scope, ...@@ -2669,7 +2663,7 @@ core_scsi3_emulate_pro_release(struct se_cmd *cmd, int type, int scope,
write_aptpl: write_aptpl:
if (pr_tmpl->pr_aptpl_active) { if (pr_tmpl->pr_aptpl_active) {
if (!core_scsi3_update_and_write_aptpl(cmd->se_dev, 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"); 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, ...@@ -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 (pr_tmpl->pr_aptpl_active) {
if (!core_scsi3_update_and_write_aptpl(cmd->se_dev, if (!core_scsi3_update_and_write_aptpl(cmd->se_dev,
&pr_reg_n->pr_aptpl_buf[0], pr_reg_n->pr_aptpl_buf, PR_APTPL_BUF_LEN)) {
pr_tmpl->pr_aptpl_buf_len)) {
pr_debug("SPC-3 PR: Updated APTPL" pr_debug("SPC-3 PR: Updated APTPL"
" metadata for PREEMPT%s\n", (preempt_type == PREEMPT_AND_ABORT) ? " metadata for PREEMPT%s\n", (preempt_type == PREEMPT_AND_ABORT) ?
"_AND_ABORT" : ""); "_AND_ABORT" : "");
...@@ -3132,8 +3125,7 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key, ...@@ -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 (pr_tmpl->pr_aptpl_active) {
if (!core_scsi3_update_and_write_aptpl(cmd->se_dev, if (!core_scsi3_update_and_write_aptpl(cmd->se_dev,
&pr_reg_n->pr_aptpl_buf[0], pr_reg_n->pr_aptpl_buf, PR_APTPL_BUF_LEN)) {
pr_tmpl->pr_aptpl_buf_len)) {
pr_debug("SPC-3 PR: Updated APTPL metadata for PREEMPT" pr_debug("SPC-3 PR: Updated APTPL metadata for PREEMPT"
"%s\n", (preempt_type == PREEMPT_AND_ABORT) ? "_AND_ABORT" : ""); "%s\n", (preempt_type == PREEMPT_AND_ABORT) ? "_AND_ABORT" : "");
} }
...@@ -3576,8 +3568,7 @@ core_scsi3_emulate_pro_register_and_move(struct se_cmd *cmd, u64 res_key, ...@@ -3576,8 +3568,7 @@ core_scsi3_emulate_pro_register_and_move(struct se_cmd *cmd, u64 res_key,
} else { } else {
pr_tmpl->pr_aptpl_active = 1; pr_tmpl->pr_aptpl_active = 1;
if (!core_scsi3_update_and_write_aptpl(cmd->se_dev, if (!core_scsi3_update_and_write_aptpl(cmd->se_dev,
&dest_pr_reg->pr_aptpl_buf[0], dest_pr_reg->pr_aptpl_buf, PR_APTPL_BUF_LEN)) {
pr_tmpl->pr_aptpl_buf_len)) {
pr_debug("SPC-3 PR: Set APTPL Bit Activated for" pr_debug("SPC-3 PR: Set APTPL Bit Activated for"
" REGISTER_AND_MOVE\n"); " REGISTER_AND_MOVE\n");
} }
......
...@@ -374,9 +374,7 @@ struct t10_reservation { ...@@ -374,9 +374,7 @@ struct t10_reservation {
/* Activate Persistence across Target Power Loss enabled /* Activate Persistence across Target Power Loss enabled
* for SCSI device */ * for SCSI device */
int pr_aptpl_active; int pr_aptpl_active;
/* Used by struct t10_reservation->pr_aptpl_buf_len */
#define PR_APTPL_BUF_LEN 8192 #define PR_APTPL_BUF_LEN 8192
u32 pr_aptpl_buf_len;
u32 pr_generation; u32 pr_generation;
spinlock_t registration_lock; spinlock_t registration_lock;
spinlock_t aptpl_reg_lock; spinlock_t aptpl_reg_lock;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment