aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorAndy Grover <agrover@redhat.com>2013-05-16 13:40:59 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2013-06-14 03:04:46 -0400
commit4e529be27d0ec4b9c6e4fd1b2908fa21b28539b1 (patch)
tree249bd30f568a42c3dcaaa681043daad25b3b359f /drivers/target
parent3c8a6228d078553e32bffc59ed180d01ab1d998a (diff)
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: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/target_core_device.c1
-rw-r--r--drivers/target/target_core_pr.c31
2 files changed, 11 insertions, 21 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)
1410 INIT_LIST_HEAD(&dev->t10_alua.tg_pt_gps_list); 1410 INIT_LIST_HEAD(&dev->t10_alua.tg_pt_gps_list);
1411 spin_lock_init(&dev->t10_alua.tg_pt_gps_lock); 1411 spin_lock_init(&dev->t10_alua.tg_pt_gps_lock);
1412 1412
1413 dev->t10_pr.pr_aptpl_buf_len = PR_APTPL_BUF_LEN;
1414 dev->t10_wwn.t10_dev = dev; 1413 dev->t10_wwn.t10_dev = dev;
1415 dev->t10_alua.t10_dev = dev; 1414 dev->t10_alua.t10_dev = dev;
1416 1415
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(
606 return NULL; 606 return NULL;
607 } 607 }
608 608
609 pr_reg->pr_aptpl_buf = kzalloc(dev->t10_pr.pr_aptpl_buf_len, 609 pr_reg->pr_aptpl_buf = kzalloc(PR_APTPL_BUF_LEN, GFP_ATOMIC);
610 GFP_ATOMIC);
611 if (!pr_reg->pr_aptpl_buf) { 610 if (!pr_reg->pr_aptpl_buf) {
612 pr_err("Unable to allocate pr_reg->pr_aptpl_buf\n"); 611 pr_err("Unable to allocate pr_reg->pr_aptpl_buf\n");
613 kmem_cache_free(t10_pr_reg_cache, pr_reg); 612 kmem_cache_free(t10_pr_reg_cache, pr_reg);
@@ -804,7 +803,7 @@ int core_scsi3_alloc_aptpl_registration(
804 pr_err("Unable to allocate struct t10_pr_registration\n"); 803 pr_err("Unable to allocate struct t10_pr_registration\n");
805 return -ENOMEM; 804 return -ENOMEM;
806 } 805 }
807 pr_reg->pr_aptpl_buf = kzalloc(pr_tmpl->pr_aptpl_buf_len, GFP_KERNEL); 806 pr_reg->pr_aptpl_buf = kzalloc(PR_APTPL_BUF_LEN, GFP_KERNEL);
808 807
809 INIT_LIST_HEAD(&pr_reg->pr_reg_list); 808 INIT_LIST_HEAD(&pr_reg->pr_reg_list);
810 INIT_LIST_HEAD(&pr_reg->pr_reg_abort_list); 809 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 se_sess->se_node_acl, se_sess); 2089 se_sess->se_node_acl, se_sess);
2091 2090
2092 if (core_scsi3_update_and_write_aptpl(cmd->se_dev, 2091 if (core_scsi3_update_and_write_aptpl(cmd->se_dev,
2093 &pr_reg->pr_aptpl_buf[0], 2092 pr_reg->pr_aptpl_buf, PR_APTPL_BUF_LEN)) {
2094 pr_tmpl->pr_aptpl_buf_len)) {
2095 pr_tmpl->pr_aptpl_active = 1; 2093 pr_tmpl->pr_aptpl_active = 1;
2096 pr_debug("SPC-3 PR: Set APTPL Bit Activated for REGISTER\n"); 2094 pr_debug("SPC-3 PR: Set APTPL Bit Activated for REGISTER\n");
2097 } 2095 }
@@ -2140,8 +2138,7 @@ core_scsi3_emulate_pro_register(struct se_cmd *cmd, u64 res_key, u64 sa_res_key,
2140 * Allocate APTPL metadata buffer used for UNREGISTER ops 2138 * Allocate APTPL metadata buffer used for UNREGISTER ops
2141 */ 2139 */
2142 if (aptpl) { 2140 if (aptpl) {
2143 pr_aptpl_buf = kzalloc(pr_tmpl->pr_aptpl_buf_len, 2141 pr_aptpl_buf = kzalloc(PR_APTPL_BUF_LEN, GFP_KERNEL);
2144 GFP_KERNEL);
2145 if (!pr_aptpl_buf) { 2142 if (!pr_aptpl_buf) {
2146 pr_err("Unable to allocate" 2143 pr_err("Unable to allocate"
2147 " pr_aptpl_buf\n"); 2144 " 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 return 0; 2226 return 0;
2230 } 2227 }
2231 2228
2232 if (!core_scsi3_update_and_write_aptpl(dev, &pr_aptpl_buf[0], 2229 if (!core_scsi3_update_and_write_aptpl(dev, pr_aptpl_buf, PR_APTPL_BUF_LEN)) {
2233 pr_tmpl->pr_aptpl_buf_len)) {
2234 pr_tmpl->pr_aptpl_active = 1; 2230 pr_tmpl->pr_aptpl_active = 1;
2235 pr_debug("SPC-3 PR: Set APTPL Bit Activated" 2231 pr_debug("SPC-3 PR: Set APTPL Bit Activated"
2236 " for UNREGISTER\n"); 2232 " for UNREGISTER\n");
@@ -2262,8 +2258,7 @@ core_scsi3_emulate_pro_register(struct se_cmd *cmd, u64 res_key, u64 sa_res_key,
2262 goto out_put_pr_reg; 2258 goto out_put_pr_reg;
2263 } 2259 }
2264 2260
2265 if (!core_scsi3_update_and_write_aptpl(dev, &pr_aptpl_buf[0], 2261 if (!core_scsi3_update_and_write_aptpl(dev, pr_aptpl_buf, PR_APTPL_BUF_LEN)) {
2266 pr_tmpl->pr_aptpl_buf_len)) {
2267 pr_tmpl->pr_aptpl_active = 1; 2262 pr_tmpl->pr_aptpl_active = 1;
2268 pr_debug("SPC-3 PR: Set APTPL Bit Activated" 2263 pr_debug("SPC-3 PR: Set APTPL Bit Activated"
2269 " for REGISTER\n"); 2264 " for REGISTER\n");
@@ -2448,8 +2443,7 @@ core_scsi3_pro_reserve(struct se_cmd *cmd, int type, int scope, u64 res_key)
2448 2443
2449 if (pr_tmpl->pr_aptpl_active) { 2444 if (pr_tmpl->pr_aptpl_active) {
2450 if (!core_scsi3_update_and_write_aptpl(cmd->se_dev, 2445 if (!core_scsi3_update_and_write_aptpl(cmd->se_dev,
2451 &pr_reg->pr_aptpl_buf[0], 2446 pr_reg->pr_aptpl_buf, PR_APTPL_BUF_LEN)) {
2452 pr_tmpl->pr_aptpl_buf_len)) {
2453 pr_debug("SPC-3 PR: Updated APTPL metadata" 2447 pr_debug("SPC-3 PR: Updated APTPL metadata"
2454 " for RESERVE\n"); 2448 " for RESERVE\n");
2455 } 2449 }
@@ -2669,7 +2663,7 @@ core_scsi3_emulate_pro_release(struct se_cmd *cmd, int type, int scope,
2669write_aptpl: 2663write_aptpl:
2670 if (pr_tmpl->pr_aptpl_active) { 2664 if (pr_tmpl->pr_aptpl_active) {
2671 if (!core_scsi3_update_and_write_aptpl(cmd->se_dev, 2665 if (!core_scsi3_update_and_write_aptpl(cmd->se_dev,
2672 &pr_reg->pr_aptpl_buf[0], pr_tmpl->pr_aptpl_buf_len)) { 2666 pr_reg->pr_aptpl_buf, PR_APTPL_BUF_LEN)) {
2673 pr_debug("SPC-3 PR: Updated APTPL metadata for RELEASE\n"); 2667 pr_debug("SPC-3 PR: Updated APTPL metadata for RELEASE\n");
2674 } 2668 }
2675 } 2669 }
@@ -2996,8 +2990,7 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key,
2996 2990
2997 if (pr_tmpl->pr_aptpl_active) { 2991 if (pr_tmpl->pr_aptpl_active) {
2998 if (!core_scsi3_update_and_write_aptpl(cmd->se_dev, 2992 if (!core_scsi3_update_and_write_aptpl(cmd->se_dev,
2999 &pr_reg_n->pr_aptpl_buf[0], 2993 pr_reg_n->pr_aptpl_buf, PR_APTPL_BUF_LEN)) {
3000 pr_tmpl->pr_aptpl_buf_len)) {
3001 pr_debug("SPC-3 PR: Updated APTPL" 2994 pr_debug("SPC-3 PR: Updated APTPL"
3002 " metadata for PREEMPT%s\n", (preempt_type == PREEMPT_AND_ABORT) ? 2995 " metadata for PREEMPT%s\n", (preempt_type == PREEMPT_AND_ABORT) ?
3003 "_AND_ABORT" : ""); 2996 "_AND_ABORT" : "");
@@ -3132,8 +3125,7 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key,
3132 3125
3133 if (pr_tmpl->pr_aptpl_active) { 3126 if (pr_tmpl->pr_aptpl_active) {
3134 if (!core_scsi3_update_and_write_aptpl(cmd->se_dev, 3127 if (!core_scsi3_update_and_write_aptpl(cmd->se_dev,
3135 &pr_reg_n->pr_aptpl_buf[0], 3128 pr_reg_n->pr_aptpl_buf, PR_APTPL_BUF_LEN)) {
3136 pr_tmpl->pr_aptpl_buf_len)) {
3137 pr_debug("SPC-3 PR: Updated APTPL metadata for PREEMPT" 3129 pr_debug("SPC-3 PR: Updated APTPL metadata for PREEMPT"
3138 "%s\n", (preempt_type == PREEMPT_AND_ABORT) ? "_AND_ABORT" : ""); 3130 "%s\n", (preempt_type == PREEMPT_AND_ABORT) ? "_AND_ABORT" : "");
3139 } 3131 }
@@ -3576,8 +3568,7 @@ after_iport_check:
3576 } else { 3568 } else {
3577 pr_tmpl->pr_aptpl_active = 1; 3569 pr_tmpl->pr_aptpl_active = 1;
3578 if (!core_scsi3_update_and_write_aptpl(cmd->se_dev, 3570 if (!core_scsi3_update_and_write_aptpl(cmd->se_dev,
3579 &dest_pr_reg->pr_aptpl_buf[0], 3571 dest_pr_reg->pr_aptpl_buf, PR_APTPL_BUF_LEN)) {
3580 pr_tmpl->pr_aptpl_buf_len)) {
3581 pr_debug("SPC-3 PR: Set APTPL Bit Activated for" 3572 pr_debug("SPC-3 PR: Set APTPL Bit Activated for"
3582 " REGISTER_AND_MOVE\n"); 3573 " REGISTER_AND_MOVE\n");
3583 } 3574 }