aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/target_core_tpg.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-15 17:25:10 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-15 17:25:10 -0500
commit5bd665f28db2b04a8d6fe277342479906fc60b62 (patch)
tree4f9f63120fed3a61b44bbb7ec4ebaaa4dc4fc571 /drivers/target/target_core_tpg.c
parent115b1cc2ef0f43ecb42bdbf55f06e9d2231d5a7e (diff)
parent79e62fc3827bd437c304c1810f36896fc1e717b1 (diff)
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Pull target updates from Nicholas Bellinger: "It has been a very busy development cycle this time around in target land, with the highlights including: - Kill struct se_subsystem_dev, in favor of direct se_device usage (hch) - Simplify reservations code by combining SPC-3 + SCSI-2 support for virtual backends only (hch) - Simplify ALUA code for virtual only backends, and remove left over abstractions (hch) - Pass sense_reason_t as return value for I/O submission path (hch) - Refactor MODE_SENSE emulation to allow for easier addition of new mode pages. (roland) - Add emulation of MODE_SELECT (roland) - Fix bug in handling of ExpStatSN wrap-around (steve) - Fix bug in TMR ABORT_TASK lookup in qla2xxx target (steve) - Add WRITE_SAME w/ UNMAP=0 support for IBLOCK backends (nab) - Convert ib_srpt to use modern target_submit_cmd caller + drop legacy ioctx->kref usage (nab) - Convert ib_srpt to use modern target_submit_tmr caller (nab) - Add link_magic for fabric allow_link destination target_items for symlinks within target_core_fabric_configfs.c code (nab) - Allocate pointers in instead of full structs for config_group->default_groups (sebastian) - Fix 32-bit highmem breakage for FILEIO (sebastian) All told, hch was able to shave off another ~1K LOC by killing the se_subsystem_dev abstraction, along with a number of PR + ALUA simplifications. Also, a nice patch by Roland is the refactoring of MODE_SENSE handling, along with the addition of initial MODE_SELECT emulation support for virtual backends. Sebastian found a long-standing issue wrt to allocation of full config_group instead of pointers for config_group->default_group[] setup in a number of areas, which ends up saving memory with big configurations. He also managed to fix another long-standing BUG wrt to broken 32-bit highmem support within the FILEIO backend driver. Thank you again to everyone who contributed this round!" * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (50 commits) target/iscsi_target: Add NodeACL tags for initiator group support target/tcm_fc: fix the lockdep warning due to inconsistent lock state sbp-target: fix error path in sbp_make_tpg() sbp-target: use simple assignment in tgt_agent_rw_agent_state() iscsi-target: use kstrdup() for iscsi_param target/file: merge fd_do_readv() and fd_do_writev() target/file: Fix 32-bit highmem breakage for SGL -> iovec mapping target: Add link_magic for fabric allow_link destination target_items ib_srpt: Convert TMR path to target_submit_tmr ib_srpt: Convert I/O path to target_submit_cmd + drop legacy ioctx->kref target: Make spc_get_write_same_sectors return sector_t target/configfs: use kmalloc() instead of kzalloc() for default groups target/configfs: allocate only 6 slots for dev_cg->default_groups target/configfs: allocate pointers instead of full struct for default_groups target: update error handling for sbc_setup_write_same() iscsit: use GFP_ATOMIC under spin lock iscsi_target: Remove redundant null check before kfree target/iblock: Forward declare bio helpers target: Clean up flow in transport_check_aborted_status() target: Clean up logic in transport_put_cmd() ...
Diffstat (limited to 'drivers/target/target_core_tpg.c')
-rw-r--r--drivers/target/target_core_tpg.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c
index a531fe282b1..5192ac0337f 100644
--- a/drivers/target/target_core_tpg.c
+++ b/drivers/target/target_core_tpg.c
@@ -3,10 +3,7 @@
3 * 3 *
4 * This file contains generic Target Portal Group related functions. 4 * This file contains generic Target Portal Group related functions.
5 * 5 *
6 * Copyright (c) 2002, 2003, 2004, 2005 PyX Technologies, Inc. 6 * (c) Copyright 2002-2012 RisingTide Systems LLC.
7 * Copyright (c) 2005, 2006, 2007 SBE, Inc.
8 * Copyright (c) 2007-2010 Rising Tide Systems
9 * Copyright (c) 2008-2010 Linux-iSCSI.org
10 * 7 *
11 * Nicholas A. Bellinger <nab@kernel.org> 8 * Nicholas A. Bellinger <nab@kernel.org>
12 * 9 *
@@ -619,6 +616,29 @@ int core_tpg_set_initiator_node_queue_depth(
619} 616}
620EXPORT_SYMBOL(core_tpg_set_initiator_node_queue_depth); 617EXPORT_SYMBOL(core_tpg_set_initiator_node_queue_depth);
621 618
619/* core_tpg_set_initiator_node_tag():
620 *
621 * Initiator nodeacl tags are not used internally, but may be used by
622 * userspace to emulate aliases or groups.
623 * Returns length of newly-set tag or -EINVAL.
624 */
625int core_tpg_set_initiator_node_tag(
626 struct se_portal_group *tpg,
627 struct se_node_acl *acl,
628 const char *new_tag)
629{
630 if (strlen(new_tag) >= MAX_ACL_TAG_SIZE)
631 return -EINVAL;
632
633 if (!strncmp("NULL", new_tag, 4)) {
634 acl->acl_tag[0] = '\0';
635 return 0;
636 }
637
638 return snprintf(acl->acl_tag, MAX_ACL_TAG_SIZE, "%s", new_tag);
639}
640EXPORT_SYMBOL(core_tpg_set_initiator_node_tag);
641
622static int core_tpg_setup_virtual_lun0(struct se_portal_group *se_tpg) 642static int core_tpg_setup_virtual_lun0(struct se_portal_group *se_tpg)
623{ 643{
624 /* Set in core_dev_setup_virtual_lun0() */ 644 /* Set in core_dev_setup_virtual_lun0() */
@@ -672,6 +692,7 @@ int core_tpg_register(
672 for (i = 0; i < TRANSPORT_MAX_LUNS_PER_TPG; i++) { 692 for (i = 0; i < TRANSPORT_MAX_LUNS_PER_TPG; i++) {
673 lun = se_tpg->tpg_lun_list[i]; 693 lun = se_tpg->tpg_lun_list[i];
674 lun->unpacked_lun = i; 694 lun->unpacked_lun = i;
695 lun->lun_link_magic = SE_LUN_LINK_MAGIC;
675 lun->lun_status = TRANSPORT_LUN_STATUS_FREE; 696 lun->lun_status = TRANSPORT_LUN_STATUS_FREE;
676 atomic_set(&lun->lun_acl_count, 0); 697 atomic_set(&lun->lun_acl_count, 0);
677 init_completion(&lun->lun_shutdown_comp); 698 init_completion(&lun->lun_shutdown_comp);