| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | /*******************************************************************************
 | 
					
						
							|  |  |  |  * Filename:  target_core_alua.c | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This file contains SPC-3 compliant asymmetric logical unit assigntment (ALUA) | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2013-09-05 15:29:12 -07:00
										 |  |  |  * (c) Copyright 2009-2013 Datera, Inc. | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  |  * | 
					
						
							|  |  |  |  * Nicholas A. Bellinger <nab@kernel.org> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is free software; you can redistribute it and/or modify | 
					
						
							|  |  |  |  * it under the terms of the GNU General Public License as published by | 
					
						
							|  |  |  |  * the Free Software Foundation; either version 2 of the License, or | 
					
						
							|  |  |  |  * (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  |  * along with this program; if not, write to the Free Software | 
					
						
							|  |  |  |  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  ******************************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <linux/slab.h>
 | 
					
						
							|  |  |  | #include <linux/spinlock.h>
 | 
					
						
							|  |  |  | #include <linux/configfs.h>
 | 
					
						
							| 
									
										
										
										
											2011-08-30 18:16:43 -04:00
										 |  |  | #include <linux/export.h>
 | 
					
						
							| 
									
										
										
										
											2013-02-23 15:22:43 -05:00
										 |  |  | #include <linux/file.h>
 | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | #include <scsi/scsi.h>
 | 
					
						
							|  |  |  | #include <scsi/scsi_cmnd.h>
 | 
					
						
							| 
									
										
										
										
											2012-02-23 17:22:12 -08:00
										 |  |  | #include <asm/unaligned.h>
 | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <target/target_core_base.h>
 | 
					
						
							| 
									
										
										
										
											2011-11-16 09:46:48 -05:00
										 |  |  | #include <target/target_core_backend.h>
 | 
					
						
							|  |  |  | #include <target/target_core_fabric.h>
 | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | #include <target/target_core_configfs.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-11-14 12:30:30 -05:00
										 |  |  | #include "target_core_internal.h"
 | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | #include "target_core_alua.h"
 | 
					
						
							|  |  |  | #include "target_core_ua.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:43 +01:00
										 |  |  | static sense_reason_t core_alua_check_transition(int state, int valid, | 
					
						
							|  |  |  | 						 int *primary); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | static int core_alua_set_tg_pt_secondary_state( | 
					
						
							|  |  |  | 		struct t10_alua_tg_pt_gp_member *tg_pt_gp_mem, | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  | 		struct se_port *port, int explicit, int offline); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:43 +01:00
										 |  |  | static char *core_alua_dump_state(int state); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | static u16 alua_lu_gps_counter; | 
					
						
							|  |  |  | static u32 alua_lu_gps_count; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static DEFINE_SPINLOCK(lu_gps_lock); | 
					
						
							|  |  |  | static LIST_HEAD(lu_gps_list); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct t10_alua_lu_gp *default_lu_gp; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:49 +01:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * REPORT REFERRALS | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * See sbc3r35 section 5.23 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | sense_reason_t | 
					
						
							|  |  |  | target_emulate_report_referrals(struct se_cmd *cmd) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct se_device *dev = cmd->se_dev; | 
					
						
							|  |  |  | 	struct t10_alua_lba_map *map; | 
					
						
							|  |  |  | 	struct t10_alua_lba_map_member *map_mem; | 
					
						
							|  |  |  | 	unsigned char *buf; | 
					
						
							|  |  |  | 	u32 rd_len = 0, off; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (cmd->data_length < 4) { | 
					
						
							|  |  |  | 		pr_warn("REPORT REFERRALS allocation length %u too" | 
					
						
							|  |  |  | 			" small\n", cmd->data_length); | 
					
						
							|  |  |  | 		return TCM_INVALID_CDB_FIELD; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	buf = transport_kmap_data_sg(cmd); | 
					
						
							|  |  |  | 	if (!buf) | 
					
						
							|  |  |  | 		return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	off = 4; | 
					
						
							|  |  |  | 	spin_lock(&dev->t10_alua.lba_map_lock); | 
					
						
							|  |  |  | 	if (list_empty(&dev->t10_alua.lba_map_list)) { | 
					
						
							|  |  |  | 		spin_unlock(&dev->t10_alua.lba_map_lock); | 
					
						
							|  |  |  | 		transport_kunmap_data_sg(cmd); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		return TCM_UNSUPPORTED_SCSI_OPCODE; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	list_for_each_entry(map, &dev->t10_alua.lba_map_list, | 
					
						
							|  |  |  | 			    lba_map_list) { | 
					
						
							|  |  |  | 		int desc_num = off + 3; | 
					
						
							|  |  |  | 		int pg_num; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		off += 4; | 
					
						
							| 
									
										
										
										
											2013-12-19 14:36:11 +01:00
										 |  |  | 		if (cmd->data_length > off) | 
					
						
							|  |  |  | 			put_unaligned_be64(map->lba_map_first_lba, &buf[off]); | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:49 +01:00
										 |  |  | 		off += 8; | 
					
						
							| 
									
										
										
										
											2013-12-19 14:36:11 +01:00
										 |  |  | 		if (cmd->data_length > off) | 
					
						
							|  |  |  | 			put_unaligned_be64(map->lba_map_last_lba, &buf[off]); | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:49 +01:00
										 |  |  | 		off += 8; | 
					
						
							|  |  |  | 		rd_len += 20; | 
					
						
							|  |  |  | 		pg_num = 0; | 
					
						
							|  |  |  | 		list_for_each_entry(map_mem, &map->lba_map_mem_list, | 
					
						
							|  |  |  | 				    lba_map_mem_list) { | 
					
						
							| 
									
										
										
										
											2013-12-19 14:36:11 +01:00
										 |  |  | 			int alua_state = map_mem->lba_map_mem_alua_state; | 
					
						
							|  |  |  | 			int alua_pg_id = map_mem->lba_map_mem_alua_pg_id; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			if (cmd->data_length > off) | 
					
						
							|  |  |  | 				buf[off] = alua_state & 0x0f; | 
					
						
							|  |  |  | 			off += 2; | 
					
						
							|  |  |  | 			if (cmd->data_length > off) | 
					
						
							|  |  |  | 				buf[off] = (alua_pg_id >> 8) & 0xff; | 
					
						
							|  |  |  | 			off++; | 
					
						
							|  |  |  | 			if (cmd->data_length > off) | 
					
						
							|  |  |  | 				buf[off] = (alua_pg_id & 0xff); | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:49 +01:00
										 |  |  | 			off++; | 
					
						
							|  |  |  | 			rd_len += 4; | 
					
						
							|  |  |  | 			pg_num++; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2013-12-19 14:36:11 +01:00
										 |  |  | 		if (cmd->data_length > desc_num) | 
					
						
							|  |  |  | 			buf[desc_num] = pg_num; | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:49 +01:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	spin_unlock(&dev->t10_alua.lba_map_lock); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Set the RETURN DATA LENGTH set in the header of the DataIN Payload | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	put_unaligned_be16(rd_len, &buf[2]); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	transport_kunmap_data_sg(cmd); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	target_complete_cmd(cmd, GOOD); | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * REPORT_TARGET_PORT_GROUPS | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * See spc4r17 section 6.27 | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2012-11-06 12:24:09 -08:00
										 |  |  | sense_reason_t | 
					
						
							|  |  |  | target_emulate_report_target_port_groups(struct se_cmd *cmd) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 	struct se_device *dev = cmd->se_dev; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	struct se_port *port; | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp; | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp_member *tg_pt_gp_mem; | 
					
						
							| 
									
										
										
										
											2011-07-20 19:13:28 +00:00
										 |  |  | 	unsigned char *buf; | 
					
						
							| 
									
										
										
										
											2012-05-16 22:02:34 -07:00
										 |  |  | 	u32 rd_len = 0, off; | 
					
						
							|  |  |  | 	int ext_hdr = (cmd->t_task_cdb[1] & 0x20); | 
					
						
							| 
									
										
										
										
											2012-11-06 12:24:09 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-10-18 23:48:04 -07:00
										 |  |  | 	/*
 | 
					
						
							| 
									
										
										
										
											2012-05-16 22:02:34 -07:00
										 |  |  | 	 * Skip over RESERVED area to first Target port group descriptor | 
					
						
							|  |  |  | 	 * depending on the PARAMETER DATA FORMAT type.. | 
					
						
							| 
									
										
										
										
											2011-10-18 23:48:04 -07:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2012-05-16 22:02:34 -07:00
										 |  |  | 	if (ext_hdr != 0) | 
					
						
							|  |  |  | 		off = 8; | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 		off = 4; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (cmd->data_length < off) { | 
					
						
							|  |  |  | 		pr_warn("REPORT TARGET PORT GROUPS allocation length %u too" | 
					
						
							|  |  |  | 			" small for %s header\n", cmd->data_length, | 
					
						
							|  |  |  | 			(ext_hdr) ? "extended" : "normal"); | 
					
						
							| 
									
										
										
										
											2012-11-06 12:24:09 -08:00
										 |  |  | 		return TCM_INVALID_CDB_FIELD; | 
					
						
							| 
									
										
										
										
											2011-10-18 23:48:04 -07:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2012-01-16 16:57:08 -08:00
										 |  |  | 	buf = transport_kmap_data_sg(cmd); | 
					
						
							| 
									
										
										
										
											2012-11-06 12:24:09 -08:00
										 |  |  | 	if (!buf) | 
					
						
							|  |  |  | 		return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 
					
						
							| 
									
										
										
										
											2011-07-20 19:13:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 	spin_lock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							|  |  |  | 	list_for_each_entry(tg_pt_gp, &dev->t10_alua.tg_pt_gps_list, | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			tg_pt_gp_list) { | 
					
						
							| 
									
										
										
										
											2011-10-18 23:48:04 -07:00
										 |  |  | 		/*
 | 
					
						
							|  |  |  | 		 * Check if the Target port group and Target port descriptor list | 
					
						
							|  |  |  | 		 * based on tg_pt_gp_members count will fit into the response payload. | 
					
						
							|  |  |  | 		 * Otherwise, bump rd_len to let the initiator know we have exceeded | 
					
						
							|  |  |  | 		 * the allocation length and the response is truncated. | 
					
						
							|  |  |  | 		 */ | 
					
						
							|  |  |  | 		if ((off + 8 + (tg_pt_gp->tg_pt_gp_members * 4)) > | 
					
						
							|  |  |  | 		     cmd->data_length) { | 
					
						
							|  |  |  | 			rd_len += 8 + (tg_pt_gp->tg_pt_gp_members * 4); | 
					
						
							|  |  |  | 			continue; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		/*
 | 
					
						
							|  |  |  | 		 * PREF: Preferred target port bit, determine if this | 
					
						
							|  |  |  | 		 * bit should be set for port group. | 
					
						
							|  |  |  | 		 */ | 
					
						
							|  |  |  | 		if (tg_pt_gp->tg_pt_gp_pref) | 
					
						
							|  |  |  | 			buf[off] = 0x80; | 
					
						
							|  |  |  | 		/*
 | 
					
						
							|  |  |  | 		 * Set the ASYMMETRIC ACCESS State | 
					
						
							|  |  |  | 		 */ | 
					
						
							|  |  |  | 		buf[off++] |= (atomic_read( | 
					
						
							|  |  |  | 			&tg_pt_gp->tg_pt_gp_alua_access_state) & 0xff); | 
					
						
							|  |  |  | 		/*
 | 
					
						
							|  |  |  | 		 * Set supported ASYMMETRIC ACCESS State bits | 
					
						
							|  |  |  | 		 */ | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:49 +01:00
										 |  |  | 		buf[off++] |= tg_pt_gp->tg_pt_gp_alua_supported_states; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		/*
 | 
					
						
							|  |  |  | 		 * TARGET PORT GROUP | 
					
						
							|  |  |  | 		 */ | 
					
						
							|  |  |  | 		buf[off++] = ((tg_pt_gp->tg_pt_gp_id >> 8) & 0xff); | 
					
						
							|  |  |  | 		buf[off++] = (tg_pt_gp->tg_pt_gp_id & 0xff); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		off++; /* Skip over Reserved */ | 
					
						
							|  |  |  | 		/*
 | 
					
						
							|  |  |  | 		 * STATUS CODE | 
					
						
							|  |  |  | 		 */ | 
					
						
							|  |  |  | 		buf[off++] = (tg_pt_gp->tg_pt_gp_alua_access_status & 0xff); | 
					
						
							|  |  |  | 		/*
 | 
					
						
							|  |  |  | 		 * Vendor Specific field | 
					
						
							|  |  |  | 		 */ | 
					
						
							|  |  |  | 		buf[off++] = 0x00; | 
					
						
							|  |  |  | 		/*
 | 
					
						
							|  |  |  | 		 * TARGET PORT COUNT | 
					
						
							|  |  |  | 		 */ | 
					
						
							|  |  |  | 		buf[off++] = (tg_pt_gp->tg_pt_gp_members & 0xff); | 
					
						
							|  |  |  | 		rd_len += 8; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		spin_lock(&tg_pt_gp->tg_pt_gp_lock); | 
					
						
							|  |  |  | 		list_for_each_entry(tg_pt_gp_mem, &tg_pt_gp->tg_pt_gp_mem_list, | 
					
						
							|  |  |  | 				tg_pt_gp_mem_list) { | 
					
						
							|  |  |  | 			port = tg_pt_gp_mem->tg_pt; | 
					
						
							|  |  |  | 			/*
 | 
					
						
							|  |  |  | 			 * Start Target Port descriptor format | 
					
						
							|  |  |  | 			 * | 
					
						
							|  |  |  | 			 * See spc4r17 section 6.2.7 Table 247 | 
					
						
							|  |  |  | 			 */ | 
					
						
							|  |  |  | 			off += 2; /* Skip over Obsolete */ | 
					
						
							|  |  |  | 			/*
 | 
					
						
							|  |  |  | 			 * Set RELATIVE TARGET PORT IDENTIFIER | 
					
						
							|  |  |  | 			 */ | 
					
						
							|  |  |  | 			buf[off++] = ((port->sep_rtpi >> 8) & 0xff); | 
					
						
							|  |  |  | 			buf[off++] = (port->sep_rtpi & 0xff); | 
					
						
							|  |  |  | 			rd_len += 4; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		spin_unlock(&tg_pt_gp->tg_pt_gp_lock); | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 	spin_unlock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Set the RETURN DATA LENGTH set in the header of the DataIN Payload | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2012-05-16 22:02:34 -07:00
										 |  |  | 	put_unaligned_be32(rd_len, &buf[0]); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-16 22:02:34 -07:00
										 |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Fill in the Extended header parameter data format if requested | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	if (ext_hdr != 0) { | 
					
						
							|  |  |  | 		buf[4] = 0x10; | 
					
						
							|  |  |  | 		/*
 | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  | 		 * Set the implicit transition time (in seconds) for the application | 
					
						
							| 
									
										
										
										
											2012-05-16 22:02:34 -07:00
										 |  |  | 		 * client to use as a base for it's transition timeout value. | 
					
						
							|  |  |  | 		 * | 
					
						
							|  |  |  | 		 * Use the current tg_pt_gp_mem -> tg_pt_gp membership from the LUN | 
					
						
							|  |  |  | 		 * this CDB was received upon to determine this value individually | 
					
						
							|  |  |  | 		 * for ALUA target port group. | 
					
						
							|  |  |  | 		 */ | 
					
						
							|  |  |  | 		port = cmd->se_lun->lun_sep; | 
					
						
							|  |  |  | 		tg_pt_gp_mem = port->sep_alua_tg_pt_gp_mem; | 
					
						
							|  |  |  | 		if (tg_pt_gp_mem) { | 
					
						
							|  |  |  | 			spin_lock(&tg_pt_gp_mem->tg_pt_gp_mem_lock); | 
					
						
							|  |  |  | 			tg_pt_gp = tg_pt_gp_mem->tg_pt_gp; | 
					
						
							|  |  |  | 			if (tg_pt_gp) | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  | 				buf[5] = tg_pt_gp->tg_pt_gp_implicit_trans_secs; | 
					
						
							| 
									
										
										
										
											2012-05-16 22:02:34 -07:00
										 |  |  | 			spin_unlock(&tg_pt_gp_mem->tg_pt_gp_mem_lock); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2012-01-16 16:57:08 -08:00
										 |  |  | 	transport_kunmap_data_sg(cmd); | 
					
						
							| 
									
										
										
										
											2011-07-20 19:13:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-23 11:35:33 -04:00
										 |  |  | 	target_complete_cmd(cmd, GOOD); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  |  * SET_TARGET_PORT_GROUPS for explicit ALUA operation. | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  |  * | 
					
						
							|  |  |  |  * See spc4r17 section 6.35 | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2012-11-06 12:24:09 -08:00
										 |  |  | sense_reason_t | 
					
						
							|  |  |  | target_emulate_set_target_port_groups(struct se_cmd *cmd) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-07-19 10:26:37 +00:00
										 |  |  | 	struct se_device *dev = cmd->se_dev; | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 	struct se_port *port, *l_port = cmd->se_lun->lun_sep; | 
					
						
							|  |  |  | 	struct se_node_acl *nacl = cmd->se_sess->se_node_acl; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp = NULL, *l_tg_pt_gp; | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp_member *tg_pt_gp_mem, *l_tg_pt_gp_mem; | 
					
						
							| 
									
										
										
										
											2011-07-20 19:13:28 +00:00
										 |  |  | 	unsigned char *buf; | 
					
						
							|  |  |  | 	unsigned char *ptr; | 
					
						
							| 
									
										
										
										
											2012-12-17 09:53:34 +01:00
										 |  |  | 	sense_reason_t rc = TCM_NO_SENSE; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	u32 len = 4; /* Skip over RESERVED area in header */ | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:43 +01:00
										 |  |  | 	int alua_access_state, primary = 0, valid_states; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	u16 tg_pt_id, rtpi; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-11-06 12:24:09 -08:00
										 |  |  | 	if (!l_port) | 
					
						
							|  |  |  | 		return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-07 17:30:33 +02:00
										 |  |  | 	if (cmd->data_length < 4) { | 
					
						
							|  |  |  | 		pr_warn("SET TARGET PORT GROUPS parameter list length %u too" | 
					
						
							|  |  |  | 			" small\n", cmd->data_length); | 
					
						
							| 
									
										
										
										
											2012-11-06 12:24:09 -08:00
										 |  |  | 		return TCM_INVALID_PARAMETER_LIST; | 
					
						
							| 
									
										
										
										
											2012-09-07 17:30:33 +02:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-16 16:57:08 -08:00
										 |  |  | 	buf = transport_kmap_data_sg(cmd); | 
					
						
							| 
									
										
										
										
											2012-11-06 12:24:09 -08:00
										 |  |  | 	if (!buf) | 
					
						
							|  |  |  | 		return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 
					
						
							| 
									
										
										
										
											2011-07-20 19:13:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	/*
 | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  | 	 * Determine if explicit ALUA via SET_TARGET_PORT_GROUPS is allowed | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	 * for the local tg_pt_gp. | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	l_tg_pt_gp_mem = l_port->sep_alua_tg_pt_gp_mem; | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 	if (!l_tg_pt_gp_mem) { | 
					
						
							|  |  |  | 		pr_err("Unable to access l_port->sep_alua_tg_pt_gp_mem\n"); | 
					
						
							| 
									
										
										
										
											2012-11-06 12:24:09 -08:00
										 |  |  | 		rc = TCM_UNSUPPORTED_SCSI_OPCODE; | 
					
						
							| 
									
										
										
										
											2011-07-20 19:13:28 +00:00
										 |  |  | 		goto out; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	spin_lock(&l_tg_pt_gp_mem->tg_pt_gp_mem_lock); | 
					
						
							|  |  |  | 	l_tg_pt_gp = l_tg_pt_gp_mem->tg_pt_gp; | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 	if (!l_tg_pt_gp) { | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		spin_unlock(&l_tg_pt_gp_mem->tg_pt_gp_mem_lock); | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		pr_err("Unable to access *l_tg_pt_gp_mem->tg_pt_gp\n"); | 
					
						
							| 
									
										
										
										
											2012-11-06 12:24:09 -08:00
										 |  |  | 		rc = TCM_UNSUPPORTED_SCSI_OPCODE; | 
					
						
							| 
									
										
										
										
											2011-07-20 19:13:28 +00:00
										 |  |  | 		goto out; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	spin_unlock(&l_tg_pt_gp_mem->tg_pt_gp_mem_lock); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  | 	if (!(l_tg_pt_gp->tg_pt_gp_alua_access_type & TPGS_EXPLICIT_ALUA)) { | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		pr_debug("Unable to process SET_TARGET_PORT_GROUPS" | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  | 				" while TPGS_EXPLICIT_ALUA is disabled\n"); | 
					
						
							| 
									
										
										
										
											2012-11-06 12:24:09 -08:00
										 |  |  | 		rc = TCM_UNSUPPORTED_SCSI_OPCODE; | 
					
						
							| 
									
										
										
										
											2011-07-20 19:13:28 +00:00
										 |  |  | 		goto out; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:43 +01:00
										 |  |  | 	valid_states = l_tg_pt_gp->tg_pt_gp_alua_supported_states; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-20 19:13:28 +00:00
										 |  |  | 	ptr = &buf[4]; /* Skip over RESERVED area in header */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	while (len < cmd->data_length) { | 
					
						
							| 
									
										
										
										
											2012-11-06 12:24:09 -08:00
										 |  |  | 		bool found = false; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		alua_access_state = (ptr[0] & 0x0f); | 
					
						
							|  |  |  | 		/*
 | 
					
						
							|  |  |  | 		 * Check the received ALUA access state, and determine if | 
					
						
							|  |  |  | 		 * the state is a primary or secondary target port asymmetric | 
					
						
							|  |  |  | 		 * access state. | 
					
						
							|  |  |  | 		 */ | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:43 +01:00
										 |  |  | 		rc = core_alua_check_transition(alua_access_state, | 
					
						
							|  |  |  | 						valid_states, &primary); | 
					
						
							| 
									
										
										
										
											2012-11-06 12:24:09 -08:00
										 |  |  | 		if (rc) { | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			/*
 | 
					
						
							|  |  |  | 			 * If the SET TARGET PORT GROUPS attempts to establish | 
					
						
							|  |  |  | 			 * an invalid combination of target port asymmetric | 
					
						
							|  |  |  | 			 * access states or attempts to establish an | 
					
						
							|  |  |  | 			 * unsupported target port asymmetric access state, | 
					
						
							|  |  |  | 			 * then the command shall be terminated with CHECK | 
					
						
							|  |  |  | 			 * CONDITION status, with the sense key set to ILLEGAL | 
					
						
							|  |  |  | 			 * REQUEST, and the additional sense code set to INVALID | 
					
						
							|  |  |  | 			 * FIELD IN PARAMETER LIST. | 
					
						
							|  |  |  | 			 */ | 
					
						
							| 
									
										
										
										
											2011-07-20 19:13:28 +00:00
										 |  |  | 			goto out; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2012-11-06 12:24:09 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		/*
 | 
					
						
							|  |  |  | 		 * If the ASYMMETRIC ACCESS STATE field (see table 267) | 
					
						
							|  |  |  | 		 * specifies a primary target port asymmetric access state, | 
					
						
							|  |  |  | 		 * then the TARGET PORT GROUP OR TARGET PORT field specifies | 
					
						
							|  |  |  | 		 * a primary target port group for which the primary target | 
					
						
							|  |  |  | 		 * port asymmetric access state shall be changed. If the | 
					
						
							|  |  |  | 		 * ASYMMETRIC ACCESS STATE field specifies a secondary target | 
					
						
							|  |  |  | 		 * port asymmetric access state, then the TARGET PORT GROUP OR | 
					
						
							|  |  |  | 		 * TARGET PORT field specifies the relative target port | 
					
						
							|  |  |  | 		 * identifier (see 3.1.120) of the target port for which the | 
					
						
							|  |  |  | 		 * secondary target port asymmetric access state shall be | 
					
						
							|  |  |  | 		 * changed. | 
					
						
							|  |  |  | 		 */ | 
					
						
							|  |  |  | 		if (primary) { | 
					
						
							| 
									
										
										
										
											2012-02-23 17:22:12 -08:00
										 |  |  | 			tg_pt_id = get_unaligned_be16(ptr + 2); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			/*
 | 
					
						
							|  |  |  | 			 * Locate the matching target port group ID from | 
					
						
							|  |  |  | 			 * the global tg_pt_gp list | 
					
						
							|  |  |  | 			 */ | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 			spin_lock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			list_for_each_entry(tg_pt_gp, | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 					&dev->t10_alua.tg_pt_gps_list, | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 					tg_pt_gp_list) { | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 				if (!tg_pt_gp->tg_pt_gp_valid_id) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 					continue; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				if (tg_pt_id != tg_pt_gp->tg_pt_gp_id) | 
					
						
							|  |  |  | 					continue; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				atomic_inc(&tg_pt_gp->tg_pt_gp_ref_cnt); | 
					
						
							| 
									
										
										
										
											2014-03-17 18:06:10 +01:00
										 |  |  | 				smp_mb__after_atomic(); | 
					
						
							| 
									
										
										
										
											2012-11-06 12:24:09 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 				spin_unlock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-11-06 12:24:09 -08:00
										 |  |  | 				if (!core_alua_do_port_transition(tg_pt_gp, | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 						dev, l_port, nacl, | 
					
						
							| 
									
										
										
										
											2012-11-06 12:24:09 -08:00
										 |  |  | 						alua_access_state, 1)) | 
					
						
							|  |  |  | 					found = true; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 				spin_lock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 				atomic_dec(&tg_pt_gp->tg_pt_gp_ref_cnt); | 
					
						
							| 
									
										
										
										
											2014-03-17 18:06:10 +01:00
										 |  |  | 				smp_mb__after_atomic(); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 				break; | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 			spin_unlock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		} else { | 
					
						
							|  |  |  | 			/*
 | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:47 +01:00
										 |  |  | 			 * Extract the RELATIVE TARGET PORT IDENTIFIER to identify | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			 * the Target Port in question for the the incoming | 
					
						
							|  |  |  | 			 * SET_TARGET_PORT_GROUPS op. | 
					
						
							|  |  |  | 			 */ | 
					
						
							| 
									
										
										
										
											2012-02-23 17:22:12 -08:00
										 |  |  | 			rtpi = get_unaligned_be16(ptr + 2); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			/*
 | 
					
						
							| 
									
										
										
										
											2012-08-16 22:43:13 +09:00
										 |  |  | 			 * Locate the matching relative target port identifier | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			 * for the struct se_device storage object. | 
					
						
							|  |  |  | 			 */ | 
					
						
							|  |  |  | 			spin_lock(&dev->se_port_lock); | 
					
						
							|  |  |  | 			list_for_each_entry(port, &dev->dev_sep_list, | 
					
						
							|  |  |  | 							sep_list) { | 
					
						
							|  |  |  | 				if (port->sep_rtpi != rtpi) | 
					
						
							|  |  |  | 					continue; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				tg_pt_gp_mem = port->sep_alua_tg_pt_gp_mem; | 
					
						
							| 
									
										
										
										
											2012-11-06 12:24:09 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 				spin_unlock(&dev->se_port_lock); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-11-06 12:24:09 -08:00
										 |  |  | 				if (!core_alua_set_tg_pt_secondary_state( | 
					
						
							|  |  |  | 						tg_pt_gp_mem, port, 1, 1)) | 
					
						
							|  |  |  | 					found = true; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 				spin_lock(&dev->se_port_lock); | 
					
						
							|  |  |  | 				break; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			spin_unlock(&dev->se_port_lock); | 
					
						
							| 
									
										
										
										
											2012-11-06 12:24:09 -08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if (!found) { | 
					
						
							|  |  |  | 			rc = TCM_INVALID_PARAMETER_LIST; | 
					
						
							|  |  |  | 			goto out; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		ptr += 4; | 
					
						
							|  |  |  | 		len += 4; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-20 19:13:28 +00:00
										 |  |  | out: | 
					
						
							| 
									
										
										
										
											2012-01-16 16:57:08 -08:00
										 |  |  | 	transport_kunmap_data_sg(cmd); | 
					
						
							| 
									
										
										
										
											2012-06-04 23:24:51 -07:00
										 |  |  | 	if (!rc) | 
					
						
							|  |  |  | 		target_complete_cmd(cmd, GOOD); | 
					
						
							|  |  |  | 	return rc; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-20 09:07:52 +01:00
										 |  |  | static inline void set_ascq(struct se_cmd *cmd, u8 alua_ascq) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Set SCSI additional sense code (ASC) to 'LUN Not Accessible'; | 
					
						
							|  |  |  | 	 * The ALUA additional sense code qualifier (ASCQ) is determined | 
					
						
							|  |  |  | 	 * by the ALUA primary or secondary access state.. | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	pr_debug("[%s]: ALUA TG Port not available, " | 
					
						
							|  |  |  | 		"SenseKey: NOT_READY, ASC/ASCQ: " | 
					
						
							|  |  |  | 		"0x04/0x%02x\n", | 
					
						
							|  |  |  | 		cmd->se_tfo->get_fabric_name(), alua_ascq); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	cmd->scsi_asc = 0x04; | 
					
						
							|  |  |  | 	cmd->scsi_ascq = alua_ascq; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static inline void core_alua_state_nonoptimized( | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	struct se_cmd *cmd, | 
					
						
							|  |  |  | 	unsigned char *cdb, | 
					
						
							| 
									
										
										
										
											2014-02-20 09:07:52 +01:00
										 |  |  | 	int nonop_delay_msecs) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | { | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Set SCF_ALUA_NON_OPTIMIZED here, this value will be checked | 
					
						
							|  |  |  | 	 * later to determine if processing of this cmd needs to be | 
					
						
							|  |  |  | 	 * temporarily delayed for the Active/NonOptimized primary access state. | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	cmd->se_cmd_flags |= SCF_ALUA_NON_OPTIMIZED; | 
					
						
							|  |  |  | 	cmd->alua_nonop_delay = nonop_delay_msecs; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:49 +01:00
										 |  |  | static inline int core_alua_state_lba_dependent( | 
					
						
							|  |  |  | 	struct se_cmd *cmd, | 
					
						
							| 
									
										
										
										
											2014-02-20 09:07:52 +01:00
										 |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp) | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:49 +01:00
										 |  |  | { | 
					
						
							|  |  |  | 	struct se_device *dev = cmd->se_dev; | 
					
						
							|  |  |  | 	u64 segment_size, segment_mult, sectors, lba; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Only need to check for cdb actually containing LBAs */ | 
					
						
							|  |  |  | 	if (!(cmd->se_cmd_flags & SCF_SCSI_DATA_CDB)) | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	spin_lock(&dev->t10_alua.lba_map_lock); | 
					
						
							|  |  |  | 	segment_size = dev->t10_alua.lba_map_segment_size; | 
					
						
							|  |  |  | 	segment_mult = dev->t10_alua.lba_map_segment_multiplier; | 
					
						
							|  |  |  | 	sectors = cmd->data_length / dev->dev_attrib.block_size; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	lba = cmd->t_task_lba; | 
					
						
							|  |  |  | 	while (lba < cmd->t_task_lba + sectors) { | 
					
						
							|  |  |  | 		struct t10_alua_lba_map *cur_map = NULL, *map; | 
					
						
							|  |  |  | 		struct t10_alua_lba_map_member *map_mem; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		list_for_each_entry(map, &dev->t10_alua.lba_map_list, | 
					
						
							|  |  |  | 				    lba_map_list) { | 
					
						
							|  |  |  | 			u64 start_lba, last_lba; | 
					
						
							|  |  |  | 			u64 first_lba = map->lba_map_first_lba; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			if (segment_mult) { | 
					
						
							|  |  |  | 				u64 tmp = lba; | 
					
						
							| 
									
										
										
										
											2014-01-30 14:05:16 -08:00
										 |  |  | 				start_lba = do_div(tmp, segment_size * segment_mult); | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:49 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 				last_lba = first_lba + segment_size - 1; | 
					
						
							|  |  |  | 				if (start_lba >= first_lba && | 
					
						
							|  |  |  | 				    start_lba <= last_lba) { | 
					
						
							|  |  |  | 					lba += segment_size; | 
					
						
							|  |  |  | 					cur_map = map; | 
					
						
							|  |  |  | 					break; | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			} else { | 
					
						
							|  |  |  | 				last_lba = map->lba_map_last_lba; | 
					
						
							|  |  |  | 				if (lba >= first_lba && lba <= last_lba) { | 
					
						
							|  |  |  | 					lba = last_lba + 1; | 
					
						
							|  |  |  | 					cur_map = map; | 
					
						
							|  |  |  | 					break; | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		if (!cur_map) { | 
					
						
							|  |  |  | 			spin_unlock(&dev->t10_alua.lba_map_lock); | 
					
						
							| 
									
										
										
										
											2014-02-20 09:07:52 +01:00
										 |  |  | 			set_ascq(cmd, ASCQ_04H_ALUA_TG_PT_UNAVAILABLE); | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:49 +01:00
										 |  |  | 			return 1; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		list_for_each_entry(map_mem, &cur_map->lba_map_mem_list, | 
					
						
							|  |  |  | 				    lba_map_mem_list) { | 
					
						
							|  |  |  | 			if (map_mem->lba_map_mem_alua_pg_id != | 
					
						
							|  |  |  | 			    tg_pt_gp->tg_pt_gp_id) | 
					
						
							|  |  |  | 				continue; | 
					
						
							|  |  |  | 			switch(map_mem->lba_map_mem_alua_state) { | 
					
						
							|  |  |  | 			case ALUA_ACCESS_STATE_STANDBY: | 
					
						
							|  |  |  | 				spin_unlock(&dev->t10_alua.lba_map_lock); | 
					
						
							| 
									
										
										
										
											2014-02-20 09:07:52 +01:00
										 |  |  | 				set_ascq(cmd, ASCQ_04H_ALUA_TG_PT_STANDBY); | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:49 +01:00
										 |  |  | 				return 1; | 
					
						
							|  |  |  | 			case ALUA_ACCESS_STATE_UNAVAILABLE: | 
					
						
							|  |  |  | 				spin_unlock(&dev->t10_alua.lba_map_lock); | 
					
						
							| 
									
										
										
										
											2014-02-20 09:07:52 +01:00
										 |  |  | 				set_ascq(cmd, ASCQ_04H_ALUA_TG_PT_UNAVAILABLE); | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:49 +01:00
										 |  |  | 				return 1; | 
					
						
							|  |  |  | 			default: | 
					
						
							|  |  |  | 				break; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	spin_unlock(&dev->t10_alua.lba_map_lock); | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | static inline int core_alua_state_standby( | 
					
						
							|  |  |  | 	struct se_cmd *cmd, | 
					
						
							| 
									
										
										
										
											2014-02-20 09:07:52 +01:00
										 |  |  | 	unsigned char *cdb) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | { | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Allowed CDBs for ALUA_ACCESS_STATE_STANDBY as defined by | 
					
						
							|  |  |  | 	 * spc4r17 section 5.9.2.4.4 | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	switch (cdb[0]) { | 
					
						
							|  |  |  | 	case INQUIRY: | 
					
						
							|  |  |  | 	case LOG_SELECT: | 
					
						
							|  |  |  | 	case LOG_SENSE: | 
					
						
							|  |  |  | 	case MODE_SELECT: | 
					
						
							|  |  |  | 	case MODE_SENSE: | 
					
						
							|  |  |  | 	case REPORT_LUNS: | 
					
						
							|  |  |  | 	case RECEIVE_DIAGNOSTIC: | 
					
						
							|  |  |  | 	case SEND_DIAGNOSTIC: | 
					
						
							| 
									
										
										
										
											2014-06-05 23:37:00 -07:00
										 |  |  | 	case READ_CAPACITY: | 
					
						
							| 
									
										
										
										
											2013-04-10 15:00:27 -07:00
										 |  |  | 		return 0; | 
					
						
							| 
									
										
										
										
											2014-06-05 23:37:00 -07:00
										 |  |  | 	case SERVICE_ACTION_IN: | 
					
						
							|  |  |  | 		switch (cdb[1] & 0x1f) { | 
					
						
							|  |  |  | 		case SAI_READ_CAPACITY_16: | 
					
						
							|  |  |  | 			return 0; | 
					
						
							|  |  |  | 		default: | 
					
						
							|  |  |  | 			set_ascq(cmd, ASCQ_04H_ALUA_TG_PT_STANDBY); | 
					
						
							|  |  |  | 			return 1; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	case MAINTENANCE_IN: | 
					
						
							| 
									
										
										
										
											2012-05-16 21:52:10 -07:00
										 |  |  | 		switch (cdb[1] & 0x1f) { | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		case MI_REPORT_TARGET_PGS: | 
					
						
							|  |  |  | 			return 0; | 
					
						
							|  |  |  | 		default: | 
					
						
							| 
									
										
										
										
											2014-02-20 09:07:52 +01:00
										 |  |  | 			set_ascq(cmd, ASCQ_04H_ALUA_TG_PT_STANDBY); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			return 1; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	case MAINTENANCE_OUT: | 
					
						
							|  |  |  | 		switch (cdb[1]) { | 
					
						
							|  |  |  | 		case MO_SET_TARGET_PGS: | 
					
						
							|  |  |  | 			return 0; | 
					
						
							|  |  |  | 		default: | 
					
						
							| 
									
										
										
										
											2014-02-20 09:07:52 +01:00
										 |  |  | 			set_ascq(cmd, ASCQ_04H_ALUA_TG_PT_STANDBY); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			return 1; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	case REQUEST_SENSE: | 
					
						
							|  |  |  | 	case PERSISTENT_RESERVE_IN: | 
					
						
							|  |  |  | 	case PERSISTENT_RESERVE_OUT: | 
					
						
							|  |  |  | 	case READ_BUFFER: | 
					
						
							|  |  |  | 	case WRITE_BUFFER: | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 	default: | 
					
						
							| 
									
										
										
										
											2014-02-20 09:07:52 +01:00
										 |  |  | 		set_ascq(cmd, ASCQ_04H_ALUA_TG_PT_STANDBY); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		return 1; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static inline int core_alua_state_unavailable( | 
					
						
							|  |  |  | 	struct se_cmd *cmd, | 
					
						
							| 
									
										
										
										
											2014-02-20 09:07:52 +01:00
										 |  |  | 	unsigned char *cdb) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | { | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Allowed CDBs for ALUA_ACCESS_STATE_UNAVAILABLE as defined by | 
					
						
							|  |  |  | 	 * spc4r17 section 5.9.2.4.5 | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	switch (cdb[0]) { | 
					
						
							|  |  |  | 	case INQUIRY: | 
					
						
							|  |  |  | 	case REPORT_LUNS: | 
					
						
							| 
									
										
										
										
											2013-04-10 15:00:27 -07:00
										 |  |  | 		return 0; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	case MAINTENANCE_IN: | 
					
						
							| 
									
										
										
										
											2012-05-16 21:52:10 -07:00
										 |  |  | 		switch (cdb[1] & 0x1f) { | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		case MI_REPORT_TARGET_PGS: | 
					
						
							|  |  |  | 			return 0; | 
					
						
							|  |  |  | 		default: | 
					
						
							| 
									
										
										
										
											2014-02-20 09:07:52 +01:00
										 |  |  | 			set_ascq(cmd, ASCQ_04H_ALUA_TG_PT_UNAVAILABLE); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			return 1; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	case MAINTENANCE_OUT: | 
					
						
							|  |  |  | 		switch (cdb[1]) { | 
					
						
							|  |  |  | 		case MO_SET_TARGET_PGS: | 
					
						
							|  |  |  | 			return 0; | 
					
						
							|  |  |  | 		default: | 
					
						
							| 
									
										
										
										
											2014-02-20 09:07:52 +01:00
										 |  |  | 			set_ascq(cmd, ASCQ_04H_ALUA_TG_PT_UNAVAILABLE); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			return 1; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	case REQUEST_SENSE: | 
					
						
							|  |  |  | 	case READ_BUFFER: | 
					
						
							|  |  |  | 	case WRITE_BUFFER: | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 	default: | 
					
						
							| 
									
										
										
										
											2014-02-20 09:07:52 +01:00
										 |  |  | 		set_ascq(cmd, ASCQ_04H_ALUA_TG_PT_UNAVAILABLE); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		return 1; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static inline int core_alua_state_transition( | 
					
						
							|  |  |  | 	struct se_cmd *cmd, | 
					
						
							| 
									
										
										
										
											2014-02-20 09:07:52 +01:00
										 |  |  | 	unsigned char *cdb) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | { | 
					
						
							|  |  |  | 	/*
 | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:47 +01:00
										 |  |  | 	 * Allowed CDBs for ALUA_ACCESS_STATE_TRANSITION as defined by | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	 * spc4r17 section 5.9.2.5 | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	switch (cdb[0]) { | 
					
						
							|  |  |  | 	case INQUIRY: | 
					
						
							|  |  |  | 	case REPORT_LUNS: | 
					
						
							| 
									
										
										
										
											2013-04-10 15:00:27 -07:00
										 |  |  | 		return 0; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	case MAINTENANCE_IN: | 
					
						
							| 
									
										
										
										
											2012-05-16 21:52:10 -07:00
										 |  |  | 		switch (cdb[1] & 0x1f) { | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		case MI_REPORT_TARGET_PGS: | 
					
						
							|  |  |  | 			return 0; | 
					
						
							|  |  |  | 		default: | 
					
						
							| 
									
										
										
										
											2014-02-20 09:07:52 +01:00
										 |  |  | 			set_ascq(cmd, ASCQ_04H_ALUA_STATE_TRANSITION); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			return 1; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	case REQUEST_SENSE: | 
					
						
							|  |  |  | 	case READ_BUFFER: | 
					
						
							|  |  |  | 	case WRITE_BUFFER: | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 	default: | 
					
						
							| 
									
										
										
										
											2014-02-20 09:07:52 +01:00
										 |  |  | 		set_ascq(cmd, ASCQ_04H_ALUA_STATE_TRANSITION); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		return 1; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:47 +01:00
										 |  |  |  * return 1: Is used to signal LUN not accessible, and check condition/not ready | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  |  * return 0: Used to signal success | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:47 +01:00
										 |  |  |  * return -1: Used to signal failure, and invalid cdb field | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2012-11-06 12:24:09 -08:00
										 |  |  | sense_reason_t | 
					
						
							|  |  |  | target_alua_state_check(struct se_cmd *cmd) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-10-10 17:37:16 -04:00
										 |  |  | 	struct se_device *dev = cmd->se_dev; | 
					
						
							|  |  |  | 	unsigned char *cdb = cmd->t_task_cdb; | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 	struct se_lun *lun = cmd->se_lun; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	struct se_port *port = lun->lun_sep; | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp; | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp_member *tg_pt_gp_mem; | 
					
						
							|  |  |  | 	int out_alua_state, nonop_delay_msecs; | 
					
						
							| 
									
										
										
										
											2012-10-10 17:37:16 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if (dev->se_hba->hba_flags & HBA_FLAGS_INTERNAL_USE) | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 	if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) | 
					
						
							|  |  |  | 		return 0; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 	if (!port) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		return 0; | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * First, check for a struct se_port specific secondary ALUA target port | 
					
						
							|  |  |  | 	 * access state: OFFLINE | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	if (atomic_read(&port->sep_tg_pt_secondary_offline)) { | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		pr_debug("ALUA: Got secondary offline status for local" | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 				" target port\n"); | 
					
						
							| 
									
										
										
										
											2014-02-20 09:07:52 +01:00
										 |  |  | 		set_ascq(cmd, ASCQ_04H_ALUA_OFFLINE); | 
					
						
							|  |  |  | 		return TCM_CHECK_CONDITION_NOT_READY; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	 /*
 | 
					
						
							|  |  |  | 	 * Second, obtain the struct t10_alua_tg_pt_gp_member pointer to the | 
					
						
							|  |  |  | 	 * ALUA target port group, to obtain current ALUA access state. | 
					
						
							|  |  |  | 	 * Otherwise look for the underlying struct se_device association with | 
					
						
							|  |  |  | 	 * a ALUA logical unit group. | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	tg_pt_gp_mem = port->sep_alua_tg_pt_gp_mem; | 
					
						
							| 
									
										
										
										
											2013-08-22 15:35:45 -07:00
										 |  |  | 	if (!tg_pt_gp_mem) | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	spin_lock(&tg_pt_gp_mem->tg_pt_gp_mem_lock); | 
					
						
							|  |  |  | 	tg_pt_gp = tg_pt_gp_mem->tg_pt_gp; | 
					
						
							|  |  |  | 	out_alua_state = atomic_read(&tg_pt_gp->tg_pt_gp_alua_access_state); | 
					
						
							|  |  |  | 	nonop_delay_msecs = tg_pt_gp->tg_pt_gp_nonop_delay_msecs; | 
					
						
							|  |  |  | 	spin_unlock(&tg_pt_gp_mem->tg_pt_gp_mem_lock); | 
					
						
							|  |  |  | 	/*
 | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:48 +01:00
										 |  |  | 	 * Process ALUA_ACCESS_STATE_ACTIVE_OPTIMIZED in a separate conditional | 
					
						
							| 
									
										
										
										
											2011-03-30 22:57:33 -03:00
										 |  |  | 	 * statement so the compiler knows explicitly to check this case first. | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	 * For the Optimized ALUA access state case, we want to process the | 
					
						
							|  |  |  | 	 * incoming fabric cmd ASAP.. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:48 +01:00
										 |  |  | 	if (out_alua_state == ALUA_ACCESS_STATE_ACTIVE_OPTIMIZED) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		return 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	switch (out_alua_state) { | 
					
						
							|  |  |  | 	case ALUA_ACCESS_STATE_ACTIVE_NON_OPTIMIZED: | 
					
						
							| 
									
										
										
										
											2014-02-20 09:07:52 +01:00
										 |  |  | 		core_alua_state_nonoptimized(cmd, cdb, nonop_delay_msecs); | 
					
						
							| 
									
										
										
										
											2012-10-10 17:37:16 -04:00
										 |  |  | 		break; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	case ALUA_ACCESS_STATE_STANDBY: | 
					
						
							| 
									
										
										
										
											2014-02-20 09:07:52 +01:00
										 |  |  | 		if (core_alua_state_standby(cmd, cdb)) | 
					
						
							|  |  |  | 			return TCM_CHECK_CONDITION_NOT_READY; | 
					
						
							| 
									
										
										
										
											2012-10-10 17:37:16 -04:00
										 |  |  | 		break; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	case ALUA_ACCESS_STATE_UNAVAILABLE: | 
					
						
							| 
									
										
										
										
											2014-02-20 09:07:52 +01:00
										 |  |  | 		if (core_alua_state_unavailable(cmd, cdb)) | 
					
						
							|  |  |  | 			return TCM_CHECK_CONDITION_NOT_READY; | 
					
						
							| 
									
										
										
										
											2012-10-10 17:37:16 -04:00
										 |  |  | 		break; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	case ALUA_ACCESS_STATE_TRANSITION: | 
					
						
							| 
									
										
										
										
											2014-02-20 09:07:52 +01:00
										 |  |  | 		if (core_alua_state_transition(cmd, cdb)) | 
					
						
							|  |  |  | 			return TCM_CHECK_CONDITION_NOT_READY; | 
					
						
							| 
									
										
										
										
											2012-10-10 17:37:16 -04:00
										 |  |  | 		break; | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:49 +01:00
										 |  |  | 	case ALUA_ACCESS_STATE_LBA_DEPENDENT: | 
					
						
							| 
									
										
										
										
											2014-02-20 09:07:52 +01:00
										 |  |  | 		if (core_alua_state_lba_dependent(cmd, tg_pt_gp)) | 
					
						
							|  |  |  | 			return TCM_CHECK_CONDITION_NOT_READY; | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:49 +01:00
										 |  |  | 		break; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * OFFLINE is a secondary ALUA target port group access state, that is | 
					
						
							|  |  |  | 	 * handled above with struct se_port->sep_tg_pt_secondary_offline=1 | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	case ALUA_ACCESS_STATE_OFFLINE: | 
					
						
							|  |  |  | 	default: | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		pr_err("Unknown ALUA access state: 0x%02x\n", | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 				out_alua_state); | 
					
						
							| 
									
										
										
										
											2012-11-06 12:24:09 -08:00
										 |  |  | 		return TCM_INVALID_CDB_FIELD; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-11-06 12:24:09 -08:00
										 |  |  | 	return 0; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  |  * Check implicit and explicit ALUA state change request. | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2012-11-06 12:24:09 -08:00
										 |  |  | static sense_reason_t | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:43 +01:00
										 |  |  | core_alua_check_transition(int state, int valid, int *primary) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:43 +01:00
										 |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * OPTIMIZED, NON-OPTIMIZED, STANDBY and UNAVAILABLE are | 
					
						
							|  |  |  | 	 * defined as primary target port asymmetric access states. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	switch (state) { | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:48 +01:00
										 |  |  | 	case ALUA_ACCESS_STATE_ACTIVE_OPTIMIZED: | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:43 +01:00
										 |  |  | 		if (!(valid & ALUA_AO_SUP)) | 
					
						
							|  |  |  | 			goto not_supported; | 
					
						
							|  |  |  | 		*primary = 1; | 
					
						
							|  |  |  | 		break; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	case ALUA_ACCESS_STATE_ACTIVE_NON_OPTIMIZED: | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:43 +01:00
										 |  |  | 		if (!(valid & ALUA_AN_SUP)) | 
					
						
							|  |  |  | 			goto not_supported; | 
					
						
							|  |  |  | 		*primary = 1; | 
					
						
							|  |  |  | 		break; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	case ALUA_ACCESS_STATE_STANDBY: | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:43 +01:00
										 |  |  | 		if (!(valid & ALUA_S_SUP)) | 
					
						
							|  |  |  | 			goto not_supported; | 
					
						
							|  |  |  | 		*primary = 1; | 
					
						
							|  |  |  | 		break; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	case ALUA_ACCESS_STATE_UNAVAILABLE: | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:43 +01:00
										 |  |  | 		if (!(valid & ALUA_U_SUP)) | 
					
						
							|  |  |  | 			goto not_supported; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		*primary = 1; | 
					
						
							|  |  |  | 		break; | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:49 +01:00
										 |  |  | 	case ALUA_ACCESS_STATE_LBA_DEPENDENT: | 
					
						
							|  |  |  | 		if (!(valid & ALUA_LBD_SUP)) | 
					
						
							|  |  |  | 			goto not_supported; | 
					
						
							|  |  |  | 		*primary = 1; | 
					
						
							|  |  |  | 		break; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	case ALUA_ACCESS_STATE_OFFLINE: | 
					
						
							|  |  |  | 		/*
 | 
					
						
							|  |  |  | 		 * OFFLINE state is defined as a secondary target port | 
					
						
							|  |  |  | 		 * asymmetric access state. | 
					
						
							|  |  |  | 		 */ | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:43 +01:00
										 |  |  | 		if (!(valid & ALUA_O_SUP)) | 
					
						
							|  |  |  | 			goto not_supported; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		*primary = 0; | 
					
						
							|  |  |  | 		break; | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:43 +01:00
										 |  |  | 	case ALUA_ACCESS_STATE_TRANSITION: | 
					
						
							|  |  |  | 		/*
 | 
					
						
							|  |  |  | 		 * Transitioning is set internally, and | 
					
						
							|  |  |  | 		 * cannot be selected manually. | 
					
						
							|  |  |  | 		 */ | 
					
						
							|  |  |  | 		goto not_supported; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	default: | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		pr_err("Unknown ALUA access state: 0x%02x\n", state); | 
					
						
							| 
									
										
										
										
											2012-11-06 12:24:09 -08:00
										 |  |  | 		return TCM_INVALID_PARAMETER_LIST; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:43 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | not_supported: | 
					
						
							|  |  |  | 	pr_err("ALUA access state %s not supported", | 
					
						
							|  |  |  | 	       core_alua_dump_state(state)); | 
					
						
							|  |  |  | 	return TCM_INVALID_PARAMETER_LIST; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static char *core_alua_dump_state(int state) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	switch (state) { | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:48 +01:00
										 |  |  | 	case ALUA_ACCESS_STATE_ACTIVE_OPTIMIZED: | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		return "Active/Optimized"; | 
					
						
							|  |  |  | 	case ALUA_ACCESS_STATE_ACTIVE_NON_OPTIMIZED: | 
					
						
							|  |  |  | 		return "Active/NonOptimized"; | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:49 +01:00
										 |  |  | 	case ALUA_ACCESS_STATE_LBA_DEPENDENT: | 
					
						
							|  |  |  | 		return "LBA Dependent"; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	case ALUA_ACCESS_STATE_STANDBY: | 
					
						
							|  |  |  | 		return "Standby"; | 
					
						
							|  |  |  | 	case ALUA_ACCESS_STATE_UNAVAILABLE: | 
					
						
							|  |  |  | 		return "Unavailable"; | 
					
						
							|  |  |  | 	case ALUA_ACCESS_STATE_OFFLINE: | 
					
						
							|  |  |  | 		return "Offline"; | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:43 +01:00
										 |  |  | 	case ALUA_ACCESS_STATE_TRANSITION: | 
					
						
							|  |  |  | 		return "Transitioning"; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	default: | 
					
						
							|  |  |  | 		return "Unknown"; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return NULL; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | char *core_alua_dump_status(int status) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	switch (status) { | 
					
						
							|  |  |  | 	case ALUA_STATUS_NONE: | 
					
						
							|  |  |  | 		return "None"; | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  | 	case ALUA_STATUS_ALTERED_BY_EXPLICIT_STPG: | 
					
						
							|  |  |  | 		return "Altered by Explicit STPG"; | 
					
						
							|  |  |  | 	case ALUA_STATUS_ALTERED_BY_IMPLICIT_ALUA: | 
					
						
							|  |  |  | 		return "Altered by Implicit ALUA"; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	default: | 
					
						
							|  |  |  | 		return "Unknown"; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return NULL; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * Used by fabric modules to determine when we need to delay processing | 
					
						
							|  |  |  |  * for the Active/NonOptimized paths.. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | int core_alua_check_nonop_delay( | 
					
						
							|  |  |  | 	struct se_cmd *cmd) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if (!(cmd->se_cmd_flags & SCF_ALUA_NON_OPTIMIZED)) | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 	if (in_interrupt()) | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * The ALUA Active/NonOptimized access state delay can be disabled | 
					
						
							|  |  |  | 	 * in via configfs with a value of zero | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 	if (!cmd->alua_nonop_delay) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		return 0; | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * struct se_cmd->alua_nonop_delay gets set by a target port group | 
					
						
							|  |  |  | 	 * defined interval in core_alua_state_nonoptimized() | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	msleep_interruptible(cmd->alua_nonop_delay); | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | EXPORT_SYMBOL(core_alua_check_nonop_delay); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * Called with tg_pt_gp->tg_pt_gp_md_mutex or tg_pt_gp_mem->sep_tg_pt_md_mutex | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | static int core_alua_write_tpg_metadata( | 
					
						
							|  |  |  | 	const char *path, | 
					
						
							|  |  |  | 	unsigned char *md_buf, | 
					
						
							|  |  |  | 	u32 md_buf_len) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2013-02-23 15:22:43 -05:00
										 |  |  | 	struct file *file = filp_open(path, O_RDWR | O_CREAT | O_TRUNC, 0600); | 
					
						
							|  |  |  | 	int ret; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-23 15:22:43 -05:00
										 |  |  | 	if (IS_ERR(file)) { | 
					
						
							|  |  |  | 		pr_err("filp_open(%s) for ALUA metadata failed\n", path); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		return -ENODEV; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2013-02-23 15:22:43 -05:00
										 |  |  | 	ret = kernel_write(file, md_buf, md_buf_len, 0); | 
					
						
							|  |  |  | 	if (ret < 0) | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		pr_err("Error writing ALUA metadata file: %s\n", path); | 
					
						
							| 
									
										
										
										
											2013-02-23 15:22:43 -05:00
										 |  |  | 	fput(file); | 
					
						
							| 
									
										
										
										
											2013-09-09 15:47:06 -07:00
										 |  |  | 	return (ret < 0) ? -EIO : 0; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * Called with tg_pt_gp->tg_pt_gp_md_mutex held | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | static int core_alua_update_tpg_primary_metadata( | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:46 +01:00
										 |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:44 +01:00
										 |  |  | 	unsigned char *md_buf; | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 	struct t10_wwn *wwn = &tg_pt_gp->tg_pt_gp_dev->t10_wwn; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	char path[ALUA_METADATA_PATH_LEN]; | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:44 +01:00
										 |  |  | 	int len, rc; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	md_buf = kzalloc(ALUA_MD_BUF_LEN, GFP_KERNEL); | 
					
						
							|  |  |  | 	if (!md_buf) { | 
					
						
							|  |  |  | 		pr_err("Unable to allocate buf for ALUA metadata\n"); | 
					
						
							|  |  |  | 		return -ENOMEM; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	memset(path, 0, ALUA_METADATA_PATH_LEN); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:44 +01:00
										 |  |  | 	len = snprintf(md_buf, ALUA_MD_BUF_LEN, | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			"tg_pt_gp_id=%hu\n" | 
					
						
							|  |  |  | 			"alua_access_state=0x%02x\n" | 
					
						
							|  |  |  | 			"alua_access_status=0x%02x\n", | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:46 +01:00
										 |  |  | 			tg_pt_gp->tg_pt_gp_id, | 
					
						
							|  |  |  | 			tg_pt_gp->tg_pt_gp_alua_pending_state, | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			tg_pt_gp->tg_pt_gp_alua_access_status); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	snprintf(path, ALUA_METADATA_PATH_LEN, | 
					
						
							|  |  |  | 		"/var/target/alua/tpgs_%s/%s", &wwn->unit_serial[0], | 
					
						
							|  |  |  | 		config_item_name(&tg_pt_gp->tg_pt_gp_group.cg_item)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:44 +01:00
										 |  |  | 	rc = core_alua_write_tpg_metadata(path, md_buf, len); | 
					
						
							|  |  |  | 	kfree(md_buf); | 
					
						
							|  |  |  | 	return rc; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:46 +01:00
										 |  |  | static void core_alua_do_transition_tg_pt_work(struct work_struct *work) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:46 +01:00
										 |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp = container_of(work, | 
					
						
							|  |  |  | 		struct t10_alua_tg_pt_gp, tg_pt_gp_transition_work.work); | 
					
						
							|  |  |  | 	struct se_device *dev = tg_pt_gp->tg_pt_gp_dev; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	struct se_dev_entry *se_deve; | 
					
						
							|  |  |  | 	struct se_lun_acl *lacl; | 
					
						
							|  |  |  | 	struct se_port *port; | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp_member *mem; | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:46 +01:00
										 |  |  | 	bool explicit = (tg_pt_gp->tg_pt_gp_alua_access_status == | 
					
						
							|  |  |  | 			 ALUA_STATUS_ALTERED_BY_EXPLICIT_STPG); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	spin_lock(&tg_pt_gp->tg_pt_gp_lock); | 
					
						
							|  |  |  | 	list_for_each_entry(mem, &tg_pt_gp->tg_pt_gp_mem_list, | 
					
						
							|  |  |  | 				tg_pt_gp_mem_list) { | 
					
						
							|  |  |  | 		port = mem->tg_pt; | 
					
						
							|  |  |  | 		/*
 | 
					
						
							|  |  |  | 		 * After an implicit target port asymmetric access state | 
					
						
							|  |  |  | 		 * change, a device server shall establish a unit attention | 
					
						
							|  |  |  | 		 * condition for the initiator port associated with every I_T | 
					
						
							|  |  |  | 		 * nexus with the additional sense code set to ASYMMETRIC | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:47 +01:00
										 |  |  | 		 * ACCESS STATE CHANGED. | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		 * | 
					
						
							|  |  |  | 		 * After an explicit target port asymmetric access state | 
					
						
							|  |  |  | 		 * change, a device server shall establish a unit attention | 
					
						
							|  |  |  | 		 * condition with the additional sense code set to ASYMMETRIC | 
					
						
							|  |  |  | 		 * ACCESS STATE CHANGED for the initiator port associated with | 
					
						
							|  |  |  | 		 * every I_T nexus other than the I_T nexus on which the SET | 
					
						
							|  |  |  | 		 * TARGET PORT GROUPS command | 
					
						
							|  |  |  | 		 */ | 
					
						
							|  |  |  | 		atomic_inc(&mem->tg_pt_gp_mem_ref_cnt); | 
					
						
							| 
									
										
										
										
											2014-03-17 18:06:10 +01:00
										 |  |  | 		smp_mb__after_atomic(); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		spin_unlock(&tg_pt_gp->tg_pt_gp_lock); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		spin_lock_bh(&port->sep_alua_lock); | 
					
						
							|  |  |  | 		list_for_each_entry(se_deve, &port->sep_alua_list, | 
					
						
							|  |  |  | 					alua_port_list) { | 
					
						
							|  |  |  | 			lacl = se_deve->se_lun_acl; | 
					
						
							|  |  |  | 			/*
 | 
					
						
							|  |  |  | 			 * se_deve->se_lun_acl pointer may be NULL for a | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  | 			 * entry created without explicit Node+MappedLUN ACLs | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			 */ | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 			if (!lacl) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 				continue; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:46 +01:00
										 |  |  | 			if ((tg_pt_gp->tg_pt_gp_alua_access_status == | 
					
						
							|  |  |  | 			     ALUA_STATUS_ALTERED_BY_EXPLICIT_STPG) && | 
					
						
							|  |  |  | 			   (tg_pt_gp->tg_pt_gp_alua_nacl != NULL) && | 
					
						
							|  |  |  | 			    (tg_pt_gp->tg_pt_gp_alua_nacl == lacl->se_lun_nacl) && | 
					
						
							|  |  |  | 			   (tg_pt_gp->tg_pt_gp_alua_port != NULL) && | 
					
						
							|  |  |  | 			    (tg_pt_gp->tg_pt_gp_alua_port == port)) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 				continue; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			core_scsi3_ua_allocate(lacl->se_lun_nacl, | 
					
						
							|  |  |  | 				se_deve->mapped_lun, 0x2A, | 
					
						
							|  |  |  | 				ASCQ_2AH_ASYMMETRIC_ACCESS_STATE_CHANGED); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		spin_unlock_bh(&port->sep_alua_lock); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		spin_lock(&tg_pt_gp->tg_pt_gp_lock); | 
					
						
							|  |  |  | 		atomic_dec(&mem->tg_pt_gp_mem_ref_cnt); | 
					
						
							| 
									
										
										
										
											2014-03-17 18:06:10 +01:00
										 |  |  | 		smp_mb__after_atomic(); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	spin_unlock(&tg_pt_gp->tg_pt_gp_lock); | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Update the ALUA metadata buf that has been allocated in | 
					
						
							|  |  |  | 	 * core_alua_do_port_transition(), this metadata will be written | 
					
						
							|  |  |  | 	 * to struct file. | 
					
						
							|  |  |  | 	 * | 
					
						
							|  |  |  | 	 * Note that there is the case where we do not want to update the | 
					
						
							|  |  |  | 	 * metadata when the saved metadata is being parsed in userspace | 
					
						
							|  |  |  | 	 * when setting the existing port access state and access status. | 
					
						
							|  |  |  | 	 * | 
					
						
							|  |  |  | 	 * Also note that the failure to write out the ALUA metadata to | 
					
						
							|  |  |  | 	 * struct file does NOT affect the actual ALUA transition. | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	if (tg_pt_gp->tg_pt_gp_write_metadata) { | 
					
						
							|  |  |  | 		mutex_lock(&tg_pt_gp->tg_pt_gp_md_mutex); | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:46 +01:00
										 |  |  | 		core_alua_update_tpg_primary_metadata(tg_pt_gp); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		mutex_unlock(&tg_pt_gp->tg_pt_gp_md_mutex); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Set the current primary ALUA access state to the requested new state | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:45 +01:00
										 |  |  | 	atomic_set(&tg_pt_gp->tg_pt_gp_alua_access_state, | 
					
						
							|  |  |  | 		   tg_pt_gp->tg_pt_gp_alua_pending_state); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 	pr_debug("Successful %s ALUA transition TG PT Group: %s ID: %hu" | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  | 		" from primary access state %s to %s\n", (explicit) ? "explicit" : | 
					
						
							|  |  |  | 		"implicit", config_item_name(&tg_pt_gp->tg_pt_gp_group.cg_item), | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:45 +01:00
										 |  |  | 		tg_pt_gp->tg_pt_gp_id, | 
					
						
							|  |  |  | 		core_alua_dump_state(tg_pt_gp->tg_pt_gp_alua_previous_state), | 
					
						
							|  |  |  | 		core_alua_dump_state(tg_pt_gp->tg_pt_gp_alua_pending_state)); | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:46 +01:00
										 |  |  | 	spin_lock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							|  |  |  | 	atomic_dec(&tg_pt_gp->tg_pt_gp_ref_cnt); | 
					
						
							| 
									
										
										
										
											2014-03-17 18:06:10 +01:00
										 |  |  | 	smp_mb__after_atomic(); | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:46 +01:00
										 |  |  | 	spin_unlock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (tg_pt_gp->tg_pt_gp_transition_complete) | 
					
						
							|  |  |  | 		complete(tg_pt_gp->tg_pt_gp_transition_complete); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int core_alua_do_transition_tg_pt( | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp, | 
					
						
							|  |  |  | 	int new_state, | 
					
						
							|  |  |  | 	int explicit) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct se_device *dev = tg_pt_gp->tg_pt_gp_dev; | 
					
						
							|  |  |  | 	DECLARE_COMPLETION_ONSTACK(wait); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Nothing to be done here */ | 
					
						
							|  |  |  | 	if (atomic_read(&tg_pt_gp->tg_pt_gp_alua_access_state) == new_state) | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (new_state == ALUA_ACCESS_STATE_TRANSITION) | 
					
						
							|  |  |  | 		return -EAGAIN; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Flush any pending transitions | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	if (!explicit && tg_pt_gp->tg_pt_gp_implicit_trans_secs && | 
					
						
							|  |  |  | 	    atomic_read(&tg_pt_gp->tg_pt_gp_alua_access_state) == | 
					
						
							|  |  |  | 	    ALUA_ACCESS_STATE_TRANSITION) { | 
					
						
							|  |  |  | 		/* Just in case */ | 
					
						
							|  |  |  | 		tg_pt_gp->tg_pt_gp_alua_pending_state = new_state; | 
					
						
							|  |  |  | 		tg_pt_gp->tg_pt_gp_transition_complete = &wait; | 
					
						
							|  |  |  | 		flush_delayed_work(&tg_pt_gp->tg_pt_gp_transition_work); | 
					
						
							|  |  |  | 		wait_for_completion(&wait); | 
					
						
							|  |  |  | 		tg_pt_gp->tg_pt_gp_transition_complete = NULL; | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Save the old primary ALUA access state, and set the current state | 
					
						
							|  |  |  | 	 * to ALUA_ACCESS_STATE_TRANSITION. | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	tg_pt_gp->tg_pt_gp_alua_previous_state = | 
					
						
							|  |  |  | 		atomic_read(&tg_pt_gp->tg_pt_gp_alua_access_state); | 
					
						
							|  |  |  | 	tg_pt_gp->tg_pt_gp_alua_pending_state = new_state; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	atomic_set(&tg_pt_gp->tg_pt_gp_alua_access_state, | 
					
						
							|  |  |  | 			ALUA_ACCESS_STATE_TRANSITION); | 
					
						
							|  |  |  | 	tg_pt_gp->tg_pt_gp_alua_access_status = (explicit) ? | 
					
						
							|  |  |  | 				ALUA_STATUS_ALTERED_BY_EXPLICIT_STPG : | 
					
						
							|  |  |  | 				ALUA_STATUS_ALTERED_BY_IMPLICIT_ALUA; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Check for the optional ALUA primary state transition delay | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	if (tg_pt_gp->tg_pt_gp_trans_delay_msecs != 0) | 
					
						
							|  |  |  | 		msleep_interruptible(tg_pt_gp->tg_pt_gp_trans_delay_msecs); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Take a reference for workqueue item | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	spin_lock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							|  |  |  | 	atomic_inc(&tg_pt_gp->tg_pt_gp_ref_cnt); | 
					
						
							| 
									
										
										
										
											2014-03-17 18:06:10 +01:00
										 |  |  | 	smp_mb__after_atomic(); | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:46 +01:00
										 |  |  | 	spin_unlock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (!explicit && tg_pt_gp->tg_pt_gp_implicit_trans_secs) { | 
					
						
							|  |  |  | 		unsigned long transition_tmo; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		transition_tmo = tg_pt_gp->tg_pt_gp_implicit_trans_secs * HZ; | 
					
						
							|  |  |  | 		queue_delayed_work(tg_pt_gp->tg_pt_gp_dev->tmr_wq, | 
					
						
							|  |  |  | 				   &tg_pt_gp->tg_pt_gp_transition_work, | 
					
						
							|  |  |  | 				   transition_tmo); | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		tg_pt_gp->tg_pt_gp_transition_complete = &wait; | 
					
						
							|  |  |  | 		queue_delayed_work(tg_pt_gp->tg_pt_gp_dev->tmr_wq, | 
					
						
							|  |  |  | 				   &tg_pt_gp->tg_pt_gp_transition_work, 0); | 
					
						
							|  |  |  | 		wait_for_completion(&wait); | 
					
						
							|  |  |  | 		tg_pt_gp->tg_pt_gp_transition_complete = NULL; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int core_alua_do_port_transition( | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp *l_tg_pt_gp, | 
					
						
							|  |  |  | 	struct se_device *l_dev, | 
					
						
							|  |  |  | 	struct se_port *l_port, | 
					
						
							|  |  |  | 	struct se_node_acl *l_nacl, | 
					
						
							|  |  |  | 	int new_state, | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  | 	int explicit) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | { | 
					
						
							|  |  |  | 	struct se_device *dev; | 
					
						
							|  |  |  | 	struct t10_alua_lu_gp *lu_gp; | 
					
						
							|  |  |  | 	struct t10_alua_lu_gp_member *lu_gp_mem, *local_lu_gp_mem; | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp; | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:46 +01:00
										 |  |  | 	int primary, valid_states, rc = 0; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:43 +01:00
										 |  |  | 	valid_states = l_tg_pt_gp->tg_pt_gp_alua_supported_states; | 
					
						
							|  |  |  | 	if (core_alua_check_transition(new_state, valid_states, &primary) != 0) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		return -EINVAL; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	local_lu_gp_mem = l_dev->dev_alua_lu_gp_mem; | 
					
						
							|  |  |  | 	spin_lock(&local_lu_gp_mem->lu_gp_mem_lock); | 
					
						
							|  |  |  | 	lu_gp = local_lu_gp_mem->lu_gp; | 
					
						
							|  |  |  | 	atomic_inc(&lu_gp->lu_gp_ref_cnt); | 
					
						
							| 
									
										
										
										
											2014-03-17 18:06:10 +01:00
										 |  |  | 	smp_mb__after_atomic(); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	spin_unlock(&local_lu_gp_mem->lu_gp_mem_lock); | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * For storage objects that are members of the 'default_lu_gp', | 
					
						
							|  |  |  | 	 * we only do transition on the passed *l_tp_pt_gp, and not | 
					
						
							|  |  |  | 	 * on all of the matching target port groups IDs in default_lu_gp. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 	if (!lu_gp->lu_gp_id) { | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		/*
 | 
					
						
							|  |  |  | 		 * core_alua_do_transition_tg_pt() will always return | 
					
						
							|  |  |  | 		 * success. | 
					
						
							|  |  |  | 		 */ | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:46 +01:00
										 |  |  | 		l_tg_pt_gp->tg_pt_gp_alua_port = l_port; | 
					
						
							|  |  |  | 		l_tg_pt_gp->tg_pt_gp_alua_nacl = l_nacl; | 
					
						
							|  |  |  | 		rc = core_alua_do_transition_tg_pt(l_tg_pt_gp, | 
					
						
							|  |  |  | 						   new_state, explicit); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		atomic_dec(&lu_gp->lu_gp_ref_cnt); | 
					
						
							| 
									
										
										
										
											2014-03-17 18:06:10 +01:00
										 |  |  | 		smp_mb__after_atomic(); | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:46 +01:00
										 |  |  | 		return rc; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * For all other LU groups aside from 'default_lu_gp', walk all of | 
					
						
							|  |  |  | 	 * the associated storage objects looking for a matching target port | 
					
						
							|  |  |  | 	 * group ID from the local target port group. | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	spin_lock(&lu_gp->lu_gp_lock); | 
					
						
							|  |  |  | 	list_for_each_entry(lu_gp_mem, &lu_gp->lu_gp_mem_list, | 
					
						
							|  |  |  | 				lu_gp_mem_list) { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		dev = lu_gp_mem->lu_gp_mem_dev; | 
					
						
							|  |  |  | 		atomic_inc(&lu_gp_mem->lu_gp_mem_ref_cnt); | 
					
						
							| 
									
										
										
										
											2014-03-17 18:06:10 +01:00
										 |  |  | 		smp_mb__after_atomic(); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		spin_unlock(&lu_gp->lu_gp_lock); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 		spin_lock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		list_for_each_entry(tg_pt_gp, | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 				&dev->t10_alua.tg_pt_gps_list, | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 				tg_pt_gp_list) { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 			if (!tg_pt_gp->tg_pt_gp_valid_id) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 				continue; | 
					
						
							|  |  |  | 			/*
 | 
					
						
							|  |  |  | 			 * If the target behavior port asymmetric access state | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:47 +01:00
										 |  |  | 			 * is changed for any target port group accessible via | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			 * a logical unit within a LU group, the target port | 
					
						
							|  |  |  | 			 * behavior group asymmetric access states for the same | 
					
						
							|  |  |  | 			 * target port group accessible via other logical units | 
					
						
							|  |  |  | 			 * in that LU group will also change. | 
					
						
							|  |  |  | 			 */ | 
					
						
							|  |  |  | 			if (l_tg_pt_gp->tg_pt_gp_id != tg_pt_gp->tg_pt_gp_id) | 
					
						
							|  |  |  | 				continue; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			if (l_tg_pt_gp == tg_pt_gp) { | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:46 +01:00
										 |  |  | 				tg_pt_gp->tg_pt_gp_alua_port = l_port; | 
					
						
							|  |  |  | 				tg_pt_gp->tg_pt_gp_alua_nacl = l_nacl; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			} else { | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:46 +01:00
										 |  |  | 				tg_pt_gp->tg_pt_gp_alua_port = NULL; | 
					
						
							|  |  |  | 				tg_pt_gp->tg_pt_gp_alua_nacl = NULL; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			} | 
					
						
							|  |  |  | 			atomic_inc(&tg_pt_gp->tg_pt_gp_ref_cnt); | 
					
						
							| 
									
										
										
										
											2014-03-17 18:06:10 +01:00
										 |  |  | 			smp_mb__after_atomic(); | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 			spin_unlock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			/*
 | 
					
						
							|  |  |  | 			 * core_alua_do_transition_tg_pt() will always return | 
					
						
							|  |  |  | 			 * success. | 
					
						
							|  |  |  | 			 */ | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:46 +01:00
										 |  |  | 			rc = core_alua_do_transition_tg_pt(tg_pt_gp, | 
					
						
							|  |  |  | 					new_state, explicit); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 			spin_lock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			atomic_dec(&tg_pt_gp->tg_pt_gp_ref_cnt); | 
					
						
							| 
									
										
										
										
											2014-03-17 18:06:10 +01:00
										 |  |  | 			smp_mb__after_atomic(); | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:46 +01:00
										 |  |  | 			if (rc) | 
					
						
							|  |  |  | 				break; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 		spin_unlock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		spin_lock(&lu_gp->lu_gp_lock); | 
					
						
							|  |  |  | 		atomic_dec(&lu_gp_mem->lu_gp_mem_ref_cnt); | 
					
						
							| 
									
										
										
										
											2014-03-17 18:06:10 +01:00
										 |  |  | 		smp_mb__after_atomic(); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	spin_unlock(&lu_gp->lu_gp_lock); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:46 +01:00
										 |  |  | 	if (!rc) { | 
					
						
							|  |  |  | 		pr_debug("Successfully processed LU Group: %s all ALUA TG PT" | 
					
						
							|  |  |  | 			 " Group IDs: %hu %s transition to primary state: %s\n", | 
					
						
							|  |  |  | 			 config_item_name(&lu_gp->lu_gp_group.cg_item), | 
					
						
							|  |  |  | 			 l_tg_pt_gp->tg_pt_gp_id, | 
					
						
							|  |  |  | 			 (explicit) ? "explicit" : "implicit", | 
					
						
							|  |  |  | 			 core_alua_dump_state(new_state)); | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	atomic_dec(&lu_gp->lu_gp_ref_cnt); | 
					
						
							| 
									
										
										
										
											2014-03-17 18:06:10 +01:00
										 |  |  | 	smp_mb__after_atomic(); | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:46 +01:00
										 |  |  | 	return rc; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * Called with tg_pt_gp_mem->sep_tg_pt_md_mutex held | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | static int core_alua_update_tpg_secondary_metadata( | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp_member *tg_pt_gp_mem, | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:44 +01:00
										 |  |  | 	struct se_port *port) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:44 +01:00
										 |  |  | 	unsigned char *md_buf; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	struct se_portal_group *se_tpg = port->sep_tpg; | 
					
						
							|  |  |  | 	char path[ALUA_METADATA_PATH_LEN], wwn[ALUA_SECONDARY_METADATA_WWN_LEN]; | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:44 +01:00
										 |  |  | 	int len, rc; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	md_buf = kzalloc(ALUA_MD_BUF_LEN, GFP_KERNEL); | 
					
						
							|  |  |  | 	if (!md_buf) { | 
					
						
							|  |  |  | 		pr_err("Unable to allocate buf for ALUA metadata\n"); | 
					
						
							|  |  |  | 		return -ENOMEM; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	memset(path, 0, ALUA_METADATA_PATH_LEN); | 
					
						
							|  |  |  | 	memset(wwn, 0, ALUA_SECONDARY_METADATA_WWN_LEN); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	len = snprintf(wwn, ALUA_SECONDARY_METADATA_WWN_LEN, "%s", | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 			se_tpg->se_tpg_tfo->tpg_get_wwn(se_tpg)); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 	if (se_tpg->se_tpg_tfo->tpg_get_tag != NULL) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		snprintf(wwn+len, ALUA_SECONDARY_METADATA_WWN_LEN-len, "+%hu", | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 				se_tpg->se_tpg_tfo->tpg_get_tag(se_tpg)); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:44 +01:00
										 |  |  | 	len = snprintf(md_buf, ALUA_MD_BUF_LEN, "alua_tg_pt_offline=%d\n" | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			"alua_tg_pt_status=0x%02x\n", | 
					
						
							|  |  |  | 			atomic_read(&port->sep_tg_pt_secondary_offline), | 
					
						
							|  |  |  | 			port->sep_tg_pt_secondary_stat); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	snprintf(path, ALUA_METADATA_PATH_LEN, "/var/target/alua/%s/%s/lun_%u", | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 			se_tpg->se_tpg_tfo->get_fabric_name(), wwn, | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			port->sep_lun->unpacked_lun); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:44 +01:00
										 |  |  | 	rc = core_alua_write_tpg_metadata(path, md_buf, len); | 
					
						
							|  |  |  | 	kfree(md_buf); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return rc; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int core_alua_set_tg_pt_secondary_state( | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp_member *tg_pt_gp_mem, | 
					
						
							|  |  |  | 	struct se_port *port, | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  | 	int explicit, | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	int offline) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp; | 
					
						
							|  |  |  | 	int trans_delay_msecs; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	spin_lock(&tg_pt_gp_mem->tg_pt_gp_mem_lock); | 
					
						
							|  |  |  | 	tg_pt_gp = tg_pt_gp_mem->tg_pt_gp; | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 	if (!tg_pt_gp) { | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		spin_unlock(&tg_pt_gp_mem->tg_pt_gp_mem_lock); | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		pr_err("Unable to complete secondary state" | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 				" transition\n"); | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 		return -EINVAL; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	trans_delay_msecs = tg_pt_gp->tg_pt_gp_trans_delay_msecs; | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Set the secondary ALUA target port access state to OFFLINE | 
					
						
							|  |  |  | 	 * or release the previously secondary state for struct se_port | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	if (offline) | 
					
						
							|  |  |  | 		atomic_set(&port->sep_tg_pt_secondary_offline, 1); | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 		atomic_set(&port->sep_tg_pt_secondary_offline, 0); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  | 	port->sep_tg_pt_secondary_stat = (explicit) ? | 
					
						
							|  |  |  | 			ALUA_STATUS_ALTERED_BY_EXPLICIT_STPG : | 
					
						
							|  |  |  | 			ALUA_STATUS_ALTERED_BY_IMPLICIT_ALUA; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 	pr_debug("Successful %s ALUA transition TG PT Group: %s ID: %hu" | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  | 		" to secondary access state: %s\n", (explicit) ? "explicit" : | 
					
						
							|  |  |  | 		"implicit", config_item_name(&tg_pt_gp->tg_pt_gp_group.cg_item), | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		tg_pt_gp->tg_pt_gp_id, (offline) ? "OFFLINE" : "ONLINE"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	spin_unlock(&tg_pt_gp_mem->tg_pt_gp_mem_lock); | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Do the optional transition delay after we set the secondary | 
					
						
							|  |  |  | 	 * ALUA access state. | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	if (trans_delay_msecs != 0) | 
					
						
							|  |  |  | 		msleep_interruptible(trans_delay_msecs); | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * See if we need to update the ALUA fabric port metadata for | 
					
						
							|  |  |  | 	 * secondary state and status | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	if (port->sep_tg_pt_secondary_write_md) { | 
					
						
							|  |  |  | 		mutex_lock(&port->sep_tg_pt_md_mutex); | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:44 +01:00
										 |  |  | 		core_alua_update_tpg_secondary_metadata(tg_pt_gp_mem, port); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		mutex_unlock(&port->sep_tg_pt_md_mutex); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:50 +01:00
										 |  |  | struct t10_alua_lba_map * | 
					
						
							|  |  |  | core_alua_allocate_lba_map(struct list_head *list, | 
					
						
							|  |  |  | 			   u64 first_lba, u64 last_lba) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct t10_alua_lba_map *lba_map; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	lba_map = kmem_cache_zalloc(t10_alua_lba_map_cache, GFP_KERNEL); | 
					
						
							|  |  |  | 	if (!lba_map) { | 
					
						
							|  |  |  | 		pr_err("Unable to allocate struct t10_alua_lba_map\n"); | 
					
						
							|  |  |  | 		return ERR_PTR(-ENOMEM); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	INIT_LIST_HEAD(&lba_map->lba_map_mem_list); | 
					
						
							|  |  |  | 	lba_map->lba_map_first_lba = first_lba; | 
					
						
							|  |  |  | 	lba_map->lba_map_last_lba = last_lba; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	list_add_tail(&lba_map->lba_map_list, list); | 
					
						
							|  |  |  | 	return lba_map; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int | 
					
						
							|  |  |  | core_alua_allocate_lba_map_mem(struct t10_alua_lba_map *lba_map, | 
					
						
							|  |  |  | 			       int pg_id, int state) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct t10_alua_lba_map_member *lba_map_mem; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	list_for_each_entry(lba_map_mem, &lba_map->lba_map_mem_list, | 
					
						
							|  |  |  | 			    lba_map_mem_list) { | 
					
						
							|  |  |  | 		if (lba_map_mem->lba_map_mem_alua_pg_id == pg_id) { | 
					
						
							|  |  |  | 			pr_err("Duplicate pg_id %d in lba_map\n", pg_id); | 
					
						
							|  |  |  | 			return -EINVAL; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	lba_map_mem = kmem_cache_zalloc(t10_alua_lba_map_mem_cache, GFP_KERNEL); | 
					
						
							|  |  |  | 	if (!lba_map_mem) { | 
					
						
							|  |  |  | 		pr_err("Unable to allocate struct t10_alua_lba_map_mem\n"); | 
					
						
							|  |  |  | 		return -ENOMEM; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	lba_map_mem->lba_map_mem_alua_state = state; | 
					
						
							|  |  |  | 	lba_map_mem->lba_map_mem_alua_pg_id = pg_id; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	list_add_tail(&lba_map_mem->lba_map_mem_list, | 
					
						
							|  |  |  | 		      &lba_map->lba_map_mem_list); | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void | 
					
						
							|  |  |  | core_alua_free_lba_map(struct list_head *lba_list) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct t10_alua_lba_map *lba_map, *lba_map_tmp; | 
					
						
							|  |  |  | 	struct t10_alua_lba_map_member *lba_map_mem, *lba_map_mem_tmp; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	list_for_each_entry_safe(lba_map, lba_map_tmp, lba_list, | 
					
						
							|  |  |  | 				 lba_map_list) { | 
					
						
							|  |  |  | 		list_for_each_entry_safe(lba_map_mem, lba_map_mem_tmp, | 
					
						
							|  |  |  | 					 &lba_map->lba_map_mem_list, | 
					
						
							|  |  |  | 					 lba_map_mem_list) { | 
					
						
							|  |  |  | 			list_del(&lba_map_mem->lba_map_mem_list); | 
					
						
							|  |  |  | 			kmem_cache_free(t10_alua_lba_map_mem_cache, | 
					
						
							|  |  |  | 					lba_map_mem); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		list_del(&lba_map->lba_map_list); | 
					
						
							|  |  |  | 		kmem_cache_free(t10_alua_lba_map_cache, lba_map); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void | 
					
						
							|  |  |  | core_alua_set_lba_map(struct se_device *dev, struct list_head *lba_map_list, | 
					
						
							|  |  |  | 		      int segment_size, int segment_mult) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct list_head old_lba_map_list; | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp; | 
					
						
							|  |  |  | 	int activate = 0, supported; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	INIT_LIST_HEAD(&old_lba_map_list); | 
					
						
							|  |  |  | 	spin_lock(&dev->t10_alua.lba_map_lock); | 
					
						
							|  |  |  | 	dev->t10_alua.lba_map_segment_size = segment_size; | 
					
						
							|  |  |  | 	dev->t10_alua.lba_map_segment_multiplier = segment_mult; | 
					
						
							|  |  |  | 	list_splice_init(&dev->t10_alua.lba_map_list, &old_lba_map_list); | 
					
						
							|  |  |  | 	if (lba_map_list) { | 
					
						
							|  |  |  | 		list_splice_init(lba_map_list, &dev->t10_alua.lba_map_list); | 
					
						
							|  |  |  | 		activate = 1; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	spin_unlock(&dev->t10_alua.lba_map_lock); | 
					
						
							|  |  |  | 	spin_lock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							|  |  |  | 	list_for_each_entry(tg_pt_gp, &dev->t10_alua.tg_pt_gps_list, | 
					
						
							|  |  |  | 			    tg_pt_gp_list) { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if (!tg_pt_gp->tg_pt_gp_valid_id) | 
					
						
							|  |  |  | 			continue; | 
					
						
							|  |  |  | 		supported = tg_pt_gp->tg_pt_gp_alua_supported_states; | 
					
						
							|  |  |  | 		if (activate) | 
					
						
							|  |  |  | 			supported |= ALUA_LBD_SUP; | 
					
						
							|  |  |  | 		else | 
					
						
							|  |  |  | 			supported &= ~ALUA_LBD_SUP; | 
					
						
							|  |  |  | 		tg_pt_gp->tg_pt_gp_alua_supported_states = supported; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	spin_unlock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							|  |  |  | 	core_alua_free_lba_map(&old_lba_map_list); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | struct t10_alua_lu_gp * | 
					
						
							|  |  |  | core_alua_allocate_lu_gp(const char *name, int def_group) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct t10_alua_lu_gp *lu_gp; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	lu_gp = kmem_cache_zalloc(t10_alua_lu_gp_cache, GFP_KERNEL); | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 	if (!lu_gp) { | 
					
						
							|  |  |  | 		pr_err("Unable to allocate struct t10_alua_lu_gp\n"); | 
					
						
							| 
									
										
										
										
											2011-04-08 19:49:08 -07:00
										 |  |  | 		return ERR_PTR(-ENOMEM); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 	INIT_LIST_HEAD(&lu_gp->lu_gp_node); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	INIT_LIST_HEAD(&lu_gp->lu_gp_mem_list); | 
					
						
							|  |  |  | 	spin_lock_init(&lu_gp->lu_gp_lock); | 
					
						
							|  |  |  | 	atomic_set(&lu_gp->lu_gp_ref_cnt, 0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (def_group) { | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 		lu_gp->lu_gp_id = alua_lu_gps_counter++; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		lu_gp->lu_gp_valid_id = 1; | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 		alua_lu_gps_count++; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return lu_gp; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int core_alua_set_lu_gp_id(struct t10_alua_lu_gp *lu_gp, u16 lu_gp_id) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct t10_alua_lu_gp *lu_gp_tmp; | 
					
						
							|  |  |  | 	u16 lu_gp_id_tmp; | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * The lu_gp->lu_gp_id may only be set once.. | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	if (lu_gp->lu_gp_valid_id) { | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		pr_warn("ALUA LU Group already has a valid ID," | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			" ignoring request\n"); | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 		return -EINVAL; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 	spin_lock(&lu_gps_lock); | 
					
						
							|  |  |  | 	if (alua_lu_gps_count == 0x0000ffff) { | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		pr_err("Maximum ALUA alua_lu_gps_count:" | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 				" 0x0000ffff reached\n"); | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 		spin_unlock(&lu_gps_lock); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		kmem_cache_free(t10_alua_lu_gp_cache, lu_gp); | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 		return -ENOSPC; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	} | 
					
						
							|  |  |  | again: | 
					
						
							|  |  |  | 	lu_gp_id_tmp = (lu_gp_id != 0) ? lu_gp_id : | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 				alua_lu_gps_counter++; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 	list_for_each_entry(lu_gp_tmp, &lu_gps_list, lu_gp_node) { | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		if (lu_gp_tmp->lu_gp_id == lu_gp_id_tmp) { | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 			if (!lu_gp_id) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 				goto again; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 			pr_warn("ALUA Logical Unit Group ID: %hu" | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 				" already exists, ignoring request\n", | 
					
						
							|  |  |  | 				lu_gp_id); | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 			spin_unlock(&lu_gps_lock); | 
					
						
							|  |  |  | 			return -EINVAL; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	lu_gp->lu_gp_id = lu_gp_id_tmp; | 
					
						
							|  |  |  | 	lu_gp->lu_gp_valid_id = 1; | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 	list_add_tail(&lu_gp->lu_gp_node, &lu_gps_list); | 
					
						
							|  |  |  | 	alua_lu_gps_count++; | 
					
						
							|  |  |  | 	spin_unlock(&lu_gps_lock); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct t10_alua_lu_gp_member * | 
					
						
							|  |  |  | core_alua_allocate_lu_gp_mem(struct se_device *dev) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct t10_alua_lu_gp_member *lu_gp_mem; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	lu_gp_mem = kmem_cache_zalloc(t10_alua_lu_gp_mem_cache, GFP_KERNEL); | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 	if (!lu_gp_mem) { | 
					
						
							|  |  |  | 		pr_err("Unable to allocate struct t10_alua_lu_gp_member\n"); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		return ERR_PTR(-ENOMEM); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	INIT_LIST_HEAD(&lu_gp_mem->lu_gp_mem_list); | 
					
						
							|  |  |  | 	spin_lock_init(&lu_gp_mem->lu_gp_mem_lock); | 
					
						
							|  |  |  | 	atomic_set(&lu_gp_mem->lu_gp_mem_ref_cnt, 0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	lu_gp_mem->lu_gp_mem_dev = dev; | 
					
						
							|  |  |  | 	dev->dev_alua_lu_gp_mem = lu_gp_mem; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return lu_gp_mem; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void core_alua_free_lu_gp(struct t10_alua_lu_gp *lu_gp) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct t10_alua_lu_gp_member *lu_gp_mem, *lu_gp_mem_tmp; | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Once we have reached this point, config_item_put() has | 
					
						
							|  |  |  | 	 * already been called from target_core_alua_drop_lu_gp(). | 
					
						
							|  |  |  | 	 * | 
					
						
							|  |  |  | 	 * Here, we remove the *lu_gp from the global list so that | 
					
						
							|  |  |  | 	 * no associations can be made while we are releasing | 
					
						
							|  |  |  | 	 * struct t10_alua_lu_gp. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 	spin_lock(&lu_gps_lock); | 
					
						
							|  |  |  | 	list_del(&lu_gp->lu_gp_node); | 
					
						
							|  |  |  | 	alua_lu_gps_count--; | 
					
						
							|  |  |  | 	spin_unlock(&lu_gps_lock); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Allow struct t10_alua_lu_gp * referenced by core_alua_get_lu_gp_by_name() | 
					
						
							|  |  |  | 	 * in target_core_configfs.c:target_core_store_alua_lu_gp() to be | 
					
						
							|  |  |  | 	 * released with core_alua_put_lu_gp_from_name() | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	while (atomic_read(&lu_gp->lu_gp_ref_cnt)) | 
					
						
							|  |  |  | 		cpu_relax(); | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Release reference to struct t10_alua_lu_gp * from all associated | 
					
						
							|  |  |  | 	 * struct se_device. | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	spin_lock(&lu_gp->lu_gp_lock); | 
					
						
							|  |  |  | 	list_for_each_entry_safe(lu_gp_mem, lu_gp_mem_tmp, | 
					
						
							|  |  |  | 				&lu_gp->lu_gp_mem_list, lu_gp_mem_list) { | 
					
						
							|  |  |  | 		if (lu_gp_mem->lu_gp_assoc) { | 
					
						
							|  |  |  | 			list_del(&lu_gp_mem->lu_gp_mem_list); | 
					
						
							|  |  |  | 			lu_gp->lu_gp_members--; | 
					
						
							|  |  |  | 			lu_gp_mem->lu_gp_assoc = 0; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		spin_unlock(&lu_gp->lu_gp_lock); | 
					
						
							|  |  |  | 		/*
 | 
					
						
							|  |  |  | 		 * | 
					
						
							| 
									
										
										
										
											2011-03-30 22:57:33 -03:00
										 |  |  | 		 * lu_gp_mem is associated with a single | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		 * struct se_device->dev_alua_lu_gp_mem, and is released when | 
					
						
							|  |  |  | 		 * struct se_device is released via core_alua_free_lu_gp_mem(). | 
					
						
							|  |  |  | 		 * | 
					
						
							|  |  |  | 		 * If the passed lu_gp does NOT match the default_lu_gp, assume | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:47 +01:00
										 |  |  | 		 * we want to re-associate a given lu_gp_mem with default_lu_gp. | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		 */ | 
					
						
							|  |  |  | 		spin_lock(&lu_gp_mem->lu_gp_mem_lock); | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 		if (lu_gp != default_lu_gp) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			__core_alua_attach_lu_gp_mem(lu_gp_mem, | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 					default_lu_gp); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		else | 
					
						
							|  |  |  | 			lu_gp_mem->lu_gp = NULL; | 
					
						
							|  |  |  | 		spin_unlock(&lu_gp_mem->lu_gp_mem_lock); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		spin_lock(&lu_gp->lu_gp_lock); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	spin_unlock(&lu_gp->lu_gp_lock); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	kmem_cache_free(t10_alua_lu_gp_cache, lu_gp); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void core_alua_free_lu_gp_mem(struct se_device *dev) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct t10_alua_lu_gp *lu_gp; | 
					
						
							|  |  |  | 	struct t10_alua_lu_gp_member *lu_gp_mem; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	lu_gp_mem = dev->dev_alua_lu_gp_mem; | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 	if (!lu_gp_mem) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	while (atomic_read(&lu_gp_mem->lu_gp_mem_ref_cnt)) | 
					
						
							|  |  |  | 		cpu_relax(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	spin_lock(&lu_gp_mem->lu_gp_mem_lock); | 
					
						
							|  |  |  | 	lu_gp = lu_gp_mem->lu_gp; | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 	if (lu_gp) { | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		spin_lock(&lu_gp->lu_gp_lock); | 
					
						
							|  |  |  | 		if (lu_gp_mem->lu_gp_assoc) { | 
					
						
							|  |  |  | 			list_del(&lu_gp_mem->lu_gp_mem_list); | 
					
						
							|  |  |  | 			lu_gp->lu_gp_members--; | 
					
						
							|  |  |  | 			lu_gp_mem->lu_gp_assoc = 0; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		spin_unlock(&lu_gp->lu_gp_lock); | 
					
						
							|  |  |  | 		lu_gp_mem->lu_gp = NULL; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	spin_unlock(&lu_gp_mem->lu_gp_mem_lock); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	kmem_cache_free(t10_alua_lu_gp_mem_cache, lu_gp_mem); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct t10_alua_lu_gp *core_alua_get_lu_gp_by_name(const char *name) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct t10_alua_lu_gp *lu_gp; | 
					
						
							|  |  |  | 	struct config_item *ci; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 	spin_lock(&lu_gps_lock); | 
					
						
							|  |  |  | 	list_for_each_entry(lu_gp, &lu_gps_list, lu_gp_node) { | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		if (!lu_gp->lu_gp_valid_id) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			continue; | 
					
						
							|  |  |  | 		ci = &lu_gp->lu_gp_group.cg_item; | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		if (!strcmp(config_item_name(ci), name)) { | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			atomic_inc(&lu_gp->lu_gp_ref_cnt); | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 			spin_unlock(&lu_gps_lock); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			return lu_gp; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 	spin_unlock(&lu_gps_lock); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	return NULL; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void core_alua_put_lu_gp_from_name(struct t10_alua_lu_gp *lu_gp) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 	spin_lock(&lu_gps_lock); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	atomic_dec(&lu_gp->lu_gp_ref_cnt); | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 	spin_unlock(&lu_gps_lock); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * Called with struct t10_alua_lu_gp_member->lu_gp_mem_lock | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | void __core_alua_attach_lu_gp_mem( | 
					
						
							|  |  |  | 	struct t10_alua_lu_gp_member *lu_gp_mem, | 
					
						
							|  |  |  | 	struct t10_alua_lu_gp *lu_gp) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	spin_lock(&lu_gp->lu_gp_lock); | 
					
						
							|  |  |  | 	lu_gp_mem->lu_gp = lu_gp; | 
					
						
							|  |  |  | 	lu_gp_mem->lu_gp_assoc = 1; | 
					
						
							|  |  |  | 	list_add_tail(&lu_gp_mem->lu_gp_mem_list, &lu_gp->lu_gp_mem_list); | 
					
						
							|  |  |  | 	lu_gp->lu_gp_members++; | 
					
						
							|  |  |  | 	spin_unlock(&lu_gp->lu_gp_lock); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * Called with struct t10_alua_lu_gp_member->lu_gp_mem_lock | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | void __core_alua_drop_lu_gp_mem( | 
					
						
							|  |  |  | 	struct t10_alua_lu_gp_member *lu_gp_mem, | 
					
						
							|  |  |  | 	struct t10_alua_lu_gp *lu_gp) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	spin_lock(&lu_gp->lu_gp_lock); | 
					
						
							|  |  |  | 	list_del(&lu_gp_mem->lu_gp_mem_list); | 
					
						
							|  |  |  | 	lu_gp_mem->lu_gp = NULL; | 
					
						
							|  |  |  | 	lu_gp_mem->lu_gp_assoc = 0; | 
					
						
							|  |  |  | 	lu_gp->lu_gp_members--; | 
					
						
							|  |  |  | 	spin_unlock(&lu_gp->lu_gp_lock); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | struct t10_alua_tg_pt_gp *core_alua_allocate_tg_pt_gp(struct se_device *dev, | 
					
						
							|  |  |  | 		const char *name, int def_group) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | { | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	tg_pt_gp = kmem_cache_zalloc(t10_alua_tg_pt_gp_cache, GFP_KERNEL); | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 	if (!tg_pt_gp) { | 
					
						
							|  |  |  | 		pr_err("Unable to allocate struct t10_alua_tg_pt_gp\n"); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		return NULL; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	INIT_LIST_HEAD(&tg_pt_gp->tg_pt_gp_list); | 
					
						
							|  |  |  | 	INIT_LIST_HEAD(&tg_pt_gp->tg_pt_gp_mem_list); | 
					
						
							|  |  |  | 	mutex_init(&tg_pt_gp->tg_pt_gp_md_mutex); | 
					
						
							|  |  |  | 	spin_lock_init(&tg_pt_gp->tg_pt_gp_lock); | 
					
						
							|  |  |  | 	atomic_set(&tg_pt_gp->tg_pt_gp_ref_cnt, 0); | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:46 +01:00
										 |  |  | 	INIT_DELAYED_WORK(&tg_pt_gp->tg_pt_gp_transition_work, | 
					
						
							|  |  |  | 			  core_alua_do_transition_tg_pt_work); | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 	tg_pt_gp->tg_pt_gp_dev = dev; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	atomic_set(&tg_pt_gp->tg_pt_gp_alua_access_state, | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:48 +01:00
										 |  |  | 		ALUA_ACCESS_STATE_ACTIVE_OPTIMIZED); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	/*
 | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  | 	 * Enable both explicit and implicit ALUA support by default | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	tg_pt_gp->tg_pt_gp_alua_access_type = | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  | 			TPGS_EXPLICIT_ALUA | TPGS_IMPLICIT_ALUA; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Set the default Active/NonOptimized Delay in milliseconds | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	tg_pt_gp->tg_pt_gp_nonop_delay_msecs = ALUA_DEFAULT_NONOP_DELAY_MSECS; | 
					
						
							|  |  |  | 	tg_pt_gp->tg_pt_gp_trans_delay_msecs = ALUA_DEFAULT_TRANS_DELAY_MSECS; | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  | 	tg_pt_gp->tg_pt_gp_implicit_trans_secs = ALUA_DEFAULT_IMPLICIT_TRANS_SECS; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:49 +01:00
										 |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Enable all supported states | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	tg_pt_gp->tg_pt_gp_alua_supported_states = | 
					
						
							|  |  |  | 	    ALUA_T_SUP | ALUA_O_SUP | | 
					
						
							|  |  |  | 	    ALUA_U_SUP | ALUA_S_SUP | ALUA_AN_SUP | ALUA_AO_SUP; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	if (def_group) { | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 		spin_lock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		tg_pt_gp->tg_pt_gp_id = | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 				dev->t10_alua.alua_tg_pt_gps_counter++; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		tg_pt_gp->tg_pt_gp_valid_id = 1; | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 		dev->t10_alua.alua_tg_pt_gps_count++; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		list_add_tail(&tg_pt_gp->tg_pt_gp_list, | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 			      &dev->t10_alua.tg_pt_gps_list); | 
					
						
							|  |  |  | 		spin_unlock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return tg_pt_gp; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int core_alua_set_tg_pt_gp_id( | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp, | 
					
						
							|  |  |  | 	u16 tg_pt_gp_id) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 	struct se_device *dev = tg_pt_gp->tg_pt_gp_dev; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp_tmp; | 
					
						
							|  |  |  | 	u16 tg_pt_gp_id_tmp; | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * The tg_pt_gp->tg_pt_gp_id may only be set once.. | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	if (tg_pt_gp->tg_pt_gp_valid_id) { | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		pr_warn("ALUA TG PT Group already has a valid ID," | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			" ignoring request\n"); | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 		return -EINVAL; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 	spin_lock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							|  |  |  | 	if (dev->t10_alua.alua_tg_pt_gps_count == 0x0000ffff) { | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		pr_err("Maximum ALUA alua_tg_pt_gps_count:" | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			" 0x0000ffff reached\n"); | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 		spin_unlock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		kmem_cache_free(t10_alua_tg_pt_gp_cache, tg_pt_gp); | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 		return -ENOSPC; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	} | 
					
						
							|  |  |  | again: | 
					
						
							|  |  |  | 	tg_pt_gp_id_tmp = (tg_pt_gp_id != 0) ? tg_pt_gp_id : | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 			dev->t10_alua.alua_tg_pt_gps_counter++; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 	list_for_each_entry(tg_pt_gp_tmp, &dev->t10_alua.tg_pt_gps_list, | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			tg_pt_gp_list) { | 
					
						
							|  |  |  | 		if (tg_pt_gp_tmp->tg_pt_gp_id == tg_pt_gp_id_tmp) { | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 			if (!tg_pt_gp_id) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 				goto again; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 			pr_err("ALUA Target Port Group ID: %hu already" | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 				" exists, ignoring request\n", tg_pt_gp_id); | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 			spin_unlock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 			return -EINVAL; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	tg_pt_gp->tg_pt_gp_id = tg_pt_gp_id_tmp; | 
					
						
							|  |  |  | 	tg_pt_gp->tg_pt_gp_valid_id = 1; | 
					
						
							|  |  |  | 	list_add_tail(&tg_pt_gp->tg_pt_gp_list, | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 			&dev->t10_alua.tg_pt_gps_list); | 
					
						
							|  |  |  | 	dev->t10_alua.alua_tg_pt_gps_count++; | 
					
						
							|  |  |  | 	spin_unlock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct t10_alua_tg_pt_gp_member *core_alua_allocate_tg_pt_gp_mem( | 
					
						
							|  |  |  | 	struct se_port *port) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp_member *tg_pt_gp_mem; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	tg_pt_gp_mem = kmem_cache_zalloc(t10_alua_tg_pt_gp_mem_cache, | 
					
						
							|  |  |  | 				GFP_KERNEL); | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 	if (!tg_pt_gp_mem) { | 
					
						
							|  |  |  | 		pr_err("Unable to allocate struct t10_alua_tg_pt_gp_member\n"); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		return ERR_PTR(-ENOMEM); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	INIT_LIST_HEAD(&tg_pt_gp_mem->tg_pt_gp_mem_list); | 
					
						
							|  |  |  | 	spin_lock_init(&tg_pt_gp_mem->tg_pt_gp_mem_lock); | 
					
						
							|  |  |  | 	atomic_set(&tg_pt_gp_mem->tg_pt_gp_mem_ref_cnt, 0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	tg_pt_gp_mem->tg_pt = port; | 
					
						
							|  |  |  | 	port->sep_alua_tg_pt_gp_mem = tg_pt_gp_mem; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return tg_pt_gp_mem; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void core_alua_free_tg_pt_gp( | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 	struct se_device *dev = tg_pt_gp->tg_pt_gp_dev; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	struct t10_alua_tg_pt_gp_member *tg_pt_gp_mem, *tg_pt_gp_mem_tmp; | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Once we have reached this point, config_item_put() has already | 
					
						
							|  |  |  | 	 * been called from target_core_alua_drop_tg_pt_gp(). | 
					
						
							|  |  |  | 	 * | 
					
						
							|  |  |  | 	 * Here we remove *tg_pt_gp from the global list so that | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:47 +01:00
										 |  |  | 	 * no associations *OR* explicit ALUA via SET_TARGET_PORT_GROUPS | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	 * can be made while we are releasing struct t10_alua_tg_pt_gp. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 	spin_lock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	list_del(&tg_pt_gp->tg_pt_gp_list); | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 	dev->t10_alua.alua_tg_pt_gps_counter--; | 
					
						
							|  |  |  | 	spin_unlock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-17 09:18:46 +01:00
										 |  |  | 	flush_delayed_work(&tg_pt_gp->tg_pt_gp_transition_work); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Allow a struct t10_alua_tg_pt_gp_member * referenced by | 
					
						
							|  |  |  | 	 * core_alua_get_tg_pt_gp_by_name() in | 
					
						
							|  |  |  | 	 * target_core_configfs.c:target_core_store_alua_tg_pt_gp() | 
					
						
							|  |  |  | 	 * to be released with core_alua_put_tg_pt_gp_from_name(). | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	while (atomic_read(&tg_pt_gp->tg_pt_gp_ref_cnt)) | 
					
						
							|  |  |  | 		cpu_relax(); | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Release reference to struct t10_alua_tg_pt_gp from all associated | 
					
						
							|  |  |  | 	 * struct se_port. | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	spin_lock(&tg_pt_gp->tg_pt_gp_lock); | 
					
						
							|  |  |  | 	list_for_each_entry_safe(tg_pt_gp_mem, tg_pt_gp_mem_tmp, | 
					
						
							|  |  |  | 			&tg_pt_gp->tg_pt_gp_mem_list, tg_pt_gp_mem_list) { | 
					
						
							|  |  |  | 		if (tg_pt_gp_mem->tg_pt_gp_assoc) { | 
					
						
							|  |  |  | 			list_del(&tg_pt_gp_mem->tg_pt_gp_mem_list); | 
					
						
							|  |  |  | 			tg_pt_gp->tg_pt_gp_members--; | 
					
						
							|  |  |  | 			tg_pt_gp_mem->tg_pt_gp_assoc = 0; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		spin_unlock(&tg_pt_gp->tg_pt_gp_lock); | 
					
						
							|  |  |  | 		/*
 | 
					
						
							| 
									
										
										
										
											2011-03-30 22:57:33 -03:00
										 |  |  | 		 * tg_pt_gp_mem is associated with a single | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		 * se_port->sep_alua_tg_pt_gp_mem, and is released via | 
					
						
							|  |  |  | 		 * core_alua_free_tg_pt_gp_mem(). | 
					
						
							|  |  |  | 		 * | 
					
						
							|  |  |  | 		 * If the passed tg_pt_gp does NOT match the default_tg_pt_gp, | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:47 +01:00
										 |  |  | 		 * assume we want to re-associate a given tg_pt_gp_mem with | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		 * default_tg_pt_gp. | 
					
						
							|  |  |  | 		 */ | 
					
						
							|  |  |  | 		spin_lock(&tg_pt_gp_mem->tg_pt_gp_mem_lock); | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 		if (tg_pt_gp != dev->t10_alua.default_tg_pt_gp) { | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			__core_alua_attach_tg_pt_gp_mem(tg_pt_gp_mem, | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 					dev->t10_alua.default_tg_pt_gp); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		} else | 
					
						
							|  |  |  | 			tg_pt_gp_mem->tg_pt_gp = NULL; | 
					
						
							|  |  |  | 		spin_unlock(&tg_pt_gp_mem->tg_pt_gp_mem_lock); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		spin_lock(&tg_pt_gp->tg_pt_gp_lock); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	spin_unlock(&tg_pt_gp->tg_pt_gp_lock); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	kmem_cache_free(t10_alua_tg_pt_gp_cache, tg_pt_gp); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void core_alua_free_tg_pt_gp_mem(struct se_port *port) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp; | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp_member *tg_pt_gp_mem; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	tg_pt_gp_mem = port->sep_alua_tg_pt_gp_mem; | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 	if (!tg_pt_gp_mem) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	while (atomic_read(&tg_pt_gp_mem->tg_pt_gp_mem_ref_cnt)) | 
					
						
							|  |  |  | 		cpu_relax(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	spin_lock(&tg_pt_gp_mem->tg_pt_gp_mem_lock); | 
					
						
							|  |  |  | 	tg_pt_gp = tg_pt_gp_mem->tg_pt_gp; | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 	if (tg_pt_gp) { | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		spin_lock(&tg_pt_gp->tg_pt_gp_lock); | 
					
						
							|  |  |  | 		if (tg_pt_gp_mem->tg_pt_gp_assoc) { | 
					
						
							|  |  |  | 			list_del(&tg_pt_gp_mem->tg_pt_gp_mem_list); | 
					
						
							|  |  |  | 			tg_pt_gp->tg_pt_gp_members--; | 
					
						
							|  |  |  | 			tg_pt_gp_mem->tg_pt_gp_assoc = 0; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		spin_unlock(&tg_pt_gp->tg_pt_gp_lock); | 
					
						
							|  |  |  | 		tg_pt_gp_mem->tg_pt_gp = NULL; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	spin_unlock(&tg_pt_gp_mem->tg_pt_gp_mem_lock); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	kmem_cache_free(t10_alua_tg_pt_gp_mem_cache, tg_pt_gp_mem); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct t10_alua_tg_pt_gp *core_alua_get_tg_pt_gp_by_name( | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 		struct se_device *dev, const char *name) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | { | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp; | 
					
						
							|  |  |  | 	struct config_item *ci; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 	spin_lock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							|  |  |  | 	list_for_each_entry(tg_pt_gp, &dev->t10_alua.tg_pt_gps_list, | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			tg_pt_gp_list) { | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		if (!tg_pt_gp->tg_pt_gp_valid_id) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			continue; | 
					
						
							|  |  |  | 		ci = &tg_pt_gp->tg_pt_gp_group.cg_item; | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		if (!strcmp(config_item_name(ci), name)) { | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			atomic_inc(&tg_pt_gp->tg_pt_gp_ref_cnt); | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 			spin_unlock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			return tg_pt_gp; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 	spin_unlock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	return NULL; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void core_alua_put_tg_pt_gp_from_name( | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 	struct se_device *dev = tg_pt_gp->tg_pt_gp_dev; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 	spin_lock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	atomic_dec(&tg_pt_gp->tg_pt_gp_ref_cnt); | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 	spin_unlock(&dev->t10_alua.tg_pt_gps_lock); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * Called with struct t10_alua_tg_pt_gp_member->tg_pt_gp_mem_lock held | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | void __core_alua_attach_tg_pt_gp_mem( | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp_member *tg_pt_gp_mem, | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	spin_lock(&tg_pt_gp->tg_pt_gp_lock); | 
					
						
							|  |  |  | 	tg_pt_gp_mem->tg_pt_gp = tg_pt_gp; | 
					
						
							|  |  |  | 	tg_pt_gp_mem->tg_pt_gp_assoc = 1; | 
					
						
							|  |  |  | 	list_add_tail(&tg_pt_gp_mem->tg_pt_gp_mem_list, | 
					
						
							|  |  |  | 			&tg_pt_gp->tg_pt_gp_mem_list); | 
					
						
							|  |  |  | 	tg_pt_gp->tg_pt_gp_members++; | 
					
						
							|  |  |  | 	spin_unlock(&tg_pt_gp->tg_pt_gp_lock); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * Called with struct t10_alua_tg_pt_gp_member->tg_pt_gp_mem_lock held | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | static void __core_alua_drop_tg_pt_gp_mem( | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp_member *tg_pt_gp_mem, | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	spin_lock(&tg_pt_gp->tg_pt_gp_lock); | 
					
						
							|  |  |  | 	list_del(&tg_pt_gp_mem->tg_pt_gp_mem_list); | 
					
						
							|  |  |  | 	tg_pt_gp_mem->tg_pt_gp = NULL; | 
					
						
							|  |  |  | 	tg_pt_gp_mem->tg_pt_gp_assoc = 0; | 
					
						
							|  |  |  | 	tg_pt_gp->tg_pt_gp_members--; | 
					
						
							|  |  |  | 	spin_unlock(&tg_pt_gp->tg_pt_gp_lock); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ssize_t core_alua_show_tg_pt_gp_info(struct se_port *port, char *page) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct config_item *tg_pt_ci; | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp; | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp_member *tg_pt_gp_mem; | 
					
						
							|  |  |  | 	ssize_t len = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	tg_pt_gp_mem = port->sep_alua_tg_pt_gp_mem; | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 	if (!tg_pt_gp_mem) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		return len; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	spin_lock(&tg_pt_gp_mem->tg_pt_gp_mem_lock); | 
					
						
							|  |  |  | 	tg_pt_gp = tg_pt_gp_mem->tg_pt_gp; | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 	if (tg_pt_gp) { | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		tg_pt_ci = &tg_pt_gp->tg_pt_gp_group.cg_item; | 
					
						
							|  |  |  | 		len += sprintf(page, "TG Port Alias: %s\nTG Port Group ID:" | 
					
						
							|  |  |  | 			" %hu\nTG Port Primary Access State: %s\nTG Port " | 
					
						
							|  |  |  | 			"Primary Access Status: %s\nTG Port Secondary Access" | 
					
						
							|  |  |  | 			" State: %s\nTG Port Secondary Access Status: %s\n", | 
					
						
							|  |  |  | 			config_item_name(tg_pt_ci), tg_pt_gp->tg_pt_gp_id, | 
					
						
							|  |  |  | 			core_alua_dump_state(atomic_read( | 
					
						
							|  |  |  | 					&tg_pt_gp->tg_pt_gp_alua_access_state)), | 
					
						
							|  |  |  | 			core_alua_dump_status( | 
					
						
							|  |  |  | 				tg_pt_gp->tg_pt_gp_alua_access_status), | 
					
						
							|  |  |  | 			(atomic_read(&port->sep_tg_pt_secondary_offline)) ? | 
					
						
							|  |  |  | 			"Offline" : "None", | 
					
						
							|  |  |  | 			core_alua_dump_status(port->sep_tg_pt_secondary_stat)); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	spin_unlock(&tg_pt_gp_mem->tg_pt_gp_mem_lock); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return len; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ssize_t core_alua_store_tg_pt_gp_info( | 
					
						
							|  |  |  | 	struct se_port *port, | 
					
						
							|  |  |  | 	const char *page, | 
					
						
							|  |  |  | 	size_t count) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct se_portal_group *tpg; | 
					
						
							|  |  |  | 	struct se_lun *lun; | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 	struct se_device *dev = port->sep_lun->lun_se_dev; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp = NULL, *tg_pt_gp_new = NULL; | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp_member *tg_pt_gp_mem; | 
					
						
							|  |  |  | 	unsigned char buf[TG_PT_GROUP_NAME_BUF]; | 
					
						
							|  |  |  | 	int move = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	tpg = port->sep_tpg; | 
					
						
							|  |  |  | 	lun = port->sep_lun; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-10 17:37:16 -04:00
										 |  |  | 	tg_pt_gp_mem = port->sep_alua_tg_pt_gp_mem; | 
					
						
							|  |  |  | 	if (!tg_pt_gp_mem) | 
					
						
							|  |  |  | 		return 0; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if (count > TG_PT_GROUP_NAME_BUF) { | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		pr_err("ALUA Target Port Group alias too large!\n"); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		return -EINVAL; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	memset(buf, 0, TG_PT_GROUP_NAME_BUF); | 
					
						
							|  |  |  | 	memcpy(buf, page, count); | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Any ALUA target port group alias besides "NULL" means we will be | 
					
						
							|  |  |  | 	 * making a new group association. | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	if (strcmp(strstrip(buf), "NULL")) { | 
					
						
							|  |  |  | 		/*
 | 
					
						
							|  |  |  | 		 * core_alua_get_tg_pt_gp_by_name() will increment reference to | 
					
						
							|  |  |  | 		 * struct t10_alua_tg_pt_gp.  This reference is released with | 
					
						
							|  |  |  | 		 * core_alua_put_tg_pt_gp_from_name() below. | 
					
						
							|  |  |  | 		 */ | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 		tg_pt_gp_new = core_alua_get_tg_pt_gp_by_name(dev, | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 					strstrip(buf)); | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		if (!tg_pt_gp_new) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			return -ENODEV; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	spin_lock(&tg_pt_gp_mem->tg_pt_gp_mem_lock); | 
					
						
							|  |  |  | 	tg_pt_gp = tg_pt_gp_mem->tg_pt_gp; | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 	if (tg_pt_gp) { | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		/*
 | 
					
						
							|  |  |  | 		 * Clearing an existing tg_pt_gp association, and replacing | 
					
						
							|  |  |  | 		 * with the default_tg_pt_gp. | 
					
						
							|  |  |  | 		 */ | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		if (!tg_pt_gp_new) { | 
					
						
							|  |  |  | 			pr_debug("Target_Core_ConfigFS: Moving" | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 				" %s/tpgt_%hu/%s from ALUA Target Port Group:" | 
					
						
							|  |  |  | 				" alua/%s, ID: %hu back to" | 
					
						
							|  |  |  | 				" default_tg_pt_gp\n", | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 				tpg->se_tpg_tfo->tpg_get_wwn(tpg), | 
					
						
							|  |  |  | 				tpg->se_tpg_tfo->tpg_get_tag(tpg), | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 				config_item_name(&lun->lun_group.cg_item), | 
					
						
							|  |  |  | 				config_item_name( | 
					
						
							|  |  |  | 					&tg_pt_gp->tg_pt_gp_group.cg_item), | 
					
						
							|  |  |  | 				tg_pt_gp->tg_pt_gp_id); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			__core_alua_drop_tg_pt_gp_mem(tg_pt_gp_mem, tg_pt_gp); | 
					
						
							|  |  |  | 			__core_alua_attach_tg_pt_gp_mem(tg_pt_gp_mem, | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 					dev->t10_alua.default_tg_pt_gp); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			spin_unlock(&tg_pt_gp_mem->tg_pt_gp_mem_lock); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			return count; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		/*
 | 
					
						
							|  |  |  | 		 * Removing existing association of tg_pt_gp_mem with tg_pt_gp | 
					
						
							|  |  |  | 		 */ | 
					
						
							|  |  |  | 		__core_alua_drop_tg_pt_gp_mem(tg_pt_gp_mem, tg_pt_gp); | 
					
						
							|  |  |  | 		move = 1; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Associate tg_pt_gp_mem with tg_pt_gp_new. | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	__core_alua_attach_tg_pt_gp_mem(tg_pt_gp_mem, tg_pt_gp_new); | 
					
						
							|  |  |  | 	spin_unlock(&tg_pt_gp_mem->tg_pt_gp_mem_lock); | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 	pr_debug("Target_Core_ConfigFS: %s %s/tpgt_%hu/%s to ALUA" | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		" Target Port Group: alua/%s, ID: %hu\n", (move) ? | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 		"Moving" : "Adding", tpg->se_tpg_tfo->tpg_get_wwn(tpg), | 
					
						
							|  |  |  | 		tpg->se_tpg_tfo->tpg_get_tag(tpg), | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		config_item_name(&lun->lun_group.cg_item), | 
					
						
							|  |  |  | 		config_item_name(&tg_pt_gp_new->tg_pt_gp_group.cg_item), | 
					
						
							|  |  |  | 		tg_pt_gp_new->tg_pt_gp_id); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	core_alua_put_tg_pt_gp_from_name(tg_pt_gp_new); | 
					
						
							|  |  |  | 	return count; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ssize_t core_alua_show_access_type( | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp, | 
					
						
							|  |  |  | 	char *page) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  | 	if ((tg_pt_gp->tg_pt_gp_alua_access_type & TPGS_EXPLICIT_ALUA) && | 
					
						
							|  |  |  | 	    (tg_pt_gp->tg_pt_gp_alua_access_type & TPGS_IMPLICIT_ALUA)) | 
					
						
							|  |  |  | 		return sprintf(page, "Implicit and Explicit\n"); | 
					
						
							|  |  |  | 	else if (tg_pt_gp->tg_pt_gp_alua_access_type & TPGS_IMPLICIT_ALUA) | 
					
						
							|  |  |  | 		return sprintf(page, "Implicit\n"); | 
					
						
							|  |  |  | 	else if (tg_pt_gp->tg_pt_gp_alua_access_type & TPGS_EXPLICIT_ALUA) | 
					
						
							|  |  |  | 		return sprintf(page, "Explicit\n"); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	else | 
					
						
							|  |  |  | 		return sprintf(page, "None\n"); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ssize_t core_alua_store_access_type( | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp, | 
					
						
							|  |  |  | 	const char *page, | 
					
						
							|  |  |  | 	size_t count) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	unsigned long tmp; | 
					
						
							|  |  |  | 	int ret; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-07-19 16:22:19 +09:00
										 |  |  | 	ret = kstrtoul(page, 0, &tmp); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	if (ret < 0) { | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		pr_err("Unable to extract alua_access_type\n"); | 
					
						
							| 
									
										
										
										
											2013-07-19 16:22:19 +09:00
										 |  |  | 		return ret; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	if ((tmp != 0) && (tmp != 1) && (tmp != 2) && (tmp != 3)) { | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		pr_err("Illegal value for alua_access_type:" | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 				" %lu\n", tmp); | 
					
						
							|  |  |  | 		return -EINVAL; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	if (tmp == 3) | 
					
						
							|  |  |  | 		tg_pt_gp->tg_pt_gp_alua_access_type = | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  | 			TPGS_IMPLICIT_ALUA | TPGS_EXPLICIT_ALUA; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	else if (tmp == 2) | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  | 		tg_pt_gp->tg_pt_gp_alua_access_type = TPGS_EXPLICIT_ALUA; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	else if (tmp == 1) | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  | 		tg_pt_gp->tg_pt_gp_alua_access_type = TPGS_IMPLICIT_ALUA; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	else | 
					
						
							|  |  |  | 		tg_pt_gp->tg_pt_gp_alua_access_type = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return count; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ssize_t core_alua_show_nonop_delay_msecs( | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp, | 
					
						
							|  |  |  | 	char *page) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return sprintf(page, "%d\n", tg_pt_gp->tg_pt_gp_nonop_delay_msecs); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ssize_t core_alua_store_nonop_delay_msecs( | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp, | 
					
						
							|  |  |  | 	const char *page, | 
					
						
							|  |  |  | 	size_t count) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	unsigned long tmp; | 
					
						
							|  |  |  | 	int ret; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-07-19 16:22:19 +09:00
										 |  |  | 	ret = kstrtoul(page, 0, &tmp); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	if (ret < 0) { | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		pr_err("Unable to extract nonop_delay_msecs\n"); | 
					
						
							| 
									
										
										
										
											2013-07-19 16:22:19 +09:00
										 |  |  | 		return ret; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	if (tmp > ALUA_MAX_NONOP_DELAY_MSECS) { | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		pr_err("Passed nonop_delay_msecs: %lu, exceeds" | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			" ALUA_MAX_NONOP_DELAY_MSECS: %d\n", tmp, | 
					
						
							|  |  |  | 			ALUA_MAX_NONOP_DELAY_MSECS); | 
					
						
							|  |  |  | 		return -EINVAL; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	tg_pt_gp->tg_pt_gp_nonop_delay_msecs = (int)tmp; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return count; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ssize_t core_alua_show_trans_delay_msecs( | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp, | 
					
						
							|  |  |  | 	char *page) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return sprintf(page, "%d\n", tg_pt_gp->tg_pt_gp_trans_delay_msecs); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ssize_t core_alua_store_trans_delay_msecs( | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp, | 
					
						
							|  |  |  | 	const char *page, | 
					
						
							|  |  |  | 	size_t count) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	unsigned long tmp; | 
					
						
							|  |  |  | 	int ret; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-07-19 16:22:19 +09:00
										 |  |  | 	ret = kstrtoul(page, 0, &tmp); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	if (ret < 0) { | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		pr_err("Unable to extract trans_delay_msecs\n"); | 
					
						
							| 
									
										
										
										
											2013-07-19 16:22:19 +09:00
										 |  |  | 		return ret; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	if (tmp > ALUA_MAX_TRANS_DELAY_MSECS) { | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		pr_err("Passed trans_delay_msecs: %lu, exceeds" | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			" ALUA_MAX_TRANS_DELAY_MSECS: %d\n", tmp, | 
					
						
							|  |  |  | 			ALUA_MAX_TRANS_DELAY_MSECS); | 
					
						
							|  |  |  | 		return -EINVAL; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	tg_pt_gp->tg_pt_gp_trans_delay_msecs = (int)tmp; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return count; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  | ssize_t core_alua_show_implicit_trans_secs( | 
					
						
							| 
									
										
										
										
											2012-05-16 22:02:34 -07:00
										 |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp, | 
					
						
							|  |  |  | 	char *page) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  | 	return sprintf(page, "%d\n", tg_pt_gp->tg_pt_gp_implicit_trans_secs); | 
					
						
							| 
									
										
										
										
											2012-05-16 22:02:34 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  | ssize_t core_alua_store_implicit_trans_secs( | 
					
						
							| 
									
										
										
										
											2012-05-16 22:02:34 -07:00
										 |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp, | 
					
						
							|  |  |  | 	const char *page, | 
					
						
							|  |  |  | 	size_t count) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	unsigned long tmp; | 
					
						
							|  |  |  | 	int ret; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-07-19 16:22:19 +09:00
										 |  |  | 	ret = kstrtoul(page, 0, &tmp); | 
					
						
							| 
									
										
										
										
											2012-05-16 22:02:34 -07:00
										 |  |  | 	if (ret < 0) { | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  | 		pr_err("Unable to extract implicit_trans_secs\n"); | 
					
						
							| 
									
										
										
										
											2013-07-19 16:22:19 +09:00
										 |  |  | 		return ret; | 
					
						
							| 
									
										
										
										
											2012-05-16 22:02:34 -07:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  | 	if (tmp > ALUA_MAX_IMPLICIT_TRANS_SECS) { | 
					
						
							|  |  |  | 		pr_err("Passed implicit_trans_secs: %lu, exceeds" | 
					
						
							|  |  |  | 			" ALUA_MAX_IMPLICIT_TRANS_SECS: %d\n", tmp, | 
					
						
							|  |  |  | 			ALUA_MAX_IMPLICIT_TRANS_SECS); | 
					
						
							| 
									
										
										
										
											2012-05-16 22:02:34 -07:00
										 |  |  | 		return  -EINVAL; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  | 	tg_pt_gp->tg_pt_gp_implicit_trans_secs = (int)tmp; | 
					
						
							| 
									
										
										
										
											2012-05-16 22:02:34 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	return count; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | ssize_t core_alua_show_preferred_bit( | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp, | 
					
						
							|  |  |  | 	char *page) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return sprintf(page, "%d\n", tg_pt_gp->tg_pt_gp_pref); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ssize_t core_alua_store_preferred_bit( | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp *tg_pt_gp, | 
					
						
							|  |  |  | 	const char *page, | 
					
						
							|  |  |  | 	size_t count) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	unsigned long tmp; | 
					
						
							|  |  |  | 	int ret; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-07-19 16:22:19 +09:00
										 |  |  | 	ret = kstrtoul(page, 0, &tmp); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	if (ret < 0) { | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		pr_err("Unable to extract preferred ALUA value\n"); | 
					
						
							| 
									
										
										
										
											2013-07-19 16:22:19 +09:00
										 |  |  | 		return ret; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	if ((tmp != 0) && (tmp != 1)) { | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		pr_err("Illegal value for preferred ALUA: %lu\n", tmp); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		return -EINVAL; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	tg_pt_gp->tg_pt_gp_pref = (int)tmp; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return count; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ssize_t core_alua_show_offline_bit(struct se_lun *lun, char *page) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 	if (!lun->lun_sep) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		return -ENODEV; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return sprintf(page, "%d\n", | 
					
						
							|  |  |  | 		atomic_read(&lun->lun_sep->sep_tg_pt_secondary_offline)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ssize_t core_alua_store_offline_bit( | 
					
						
							|  |  |  | 	struct se_lun *lun, | 
					
						
							|  |  |  | 	const char *page, | 
					
						
							|  |  |  | 	size_t count) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct t10_alua_tg_pt_gp_member *tg_pt_gp_mem; | 
					
						
							|  |  |  | 	unsigned long tmp; | 
					
						
							|  |  |  | 	int ret; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 	if (!lun->lun_sep) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		return -ENODEV; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-07-19 16:22:19 +09:00
										 |  |  | 	ret = kstrtoul(page, 0, &tmp); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	if (ret < 0) { | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		pr_err("Unable to extract alua_tg_pt_offline value\n"); | 
					
						
							| 
									
										
										
										
											2013-07-19 16:22:19 +09:00
										 |  |  | 		return ret; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	if ((tmp != 0) && (tmp != 1)) { | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		pr_err("Illegal value for alua_tg_pt_offline: %lu\n", | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 				tmp); | 
					
						
							|  |  |  | 		return -EINVAL; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	tg_pt_gp_mem = lun->lun_sep->sep_alua_tg_pt_gp_mem; | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 	if (!tg_pt_gp_mem) { | 
					
						
							|  |  |  | 		pr_err("Unable to locate *tg_pt_gp_mem\n"); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		return -EINVAL; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	ret = core_alua_set_tg_pt_secondary_state(tg_pt_gp_mem, | 
					
						
							|  |  |  | 			lun->lun_sep, 0, (int)tmp); | 
					
						
							|  |  |  | 	if (ret < 0) | 
					
						
							|  |  |  | 		return -EINVAL; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return count; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ssize_t core_alua_show_secondary_status( | 
					
						
							|  |  |  | 	struct se_lun *lun, | 
					
						
							|  |  |  | 	char *page) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return sprintf(page, "%d\n", lun->lun_sep->sep_tg_pt_secondary_stat); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ssize_t core_alua_store_secondary_status( | 
					
						
							|  |  |  | 	struct se_lun *lun, | 
					
						
							|  |  |  | 	const char *page, | 
					
						
							|  |  |  | 	size_t count) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	unsigned long tmp; | 
					
						
							|  |  |  | 	int ret; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-07-19 16:22:19 +09:00
										 |  |  | 	ret = kstrtoul(page, 0, &tmp); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	if (ret < 0) { | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		pr_err("Unable to extract alua_tg_pt_status\n"); | 
					
						
							| 
									
										
										
										
											2013-07-19 16:22:19 +09:00
										 |  |  | 		return ret; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	if ((tmp != ALUA_STATUS_NONE) && | 
					
						
							| 
									
										
										
										
											2013-11-19 09:07:46 +01:00
										 |  |  | 	    (tmp != ALUA_STATUS_ALTERED_BY_EXPLICIT_STPG) && | 
					
						
							|  |  |  | 	    (tmp != ALUA_STATUS_ALTERED_BY_IMPLICIT_ALUA)) { | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		pr_err("Illegal value for alua_tg_pt_status: %lu\n", | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 				tmp); | 
					
						
							|  |  |  | 		return -EINVAL; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	lun->lun_sep->sep_tg_pt_secondary_stat = (int)tmp; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return count; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ssize_t core_alua_show_secondary_write_metadata( | 
					
						
							|  |  |  | 	struct se_lun *lun, | 
					
						
							|  |  |  | 	char *page) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return sprintf(page, "%d\n", | 
					
						
							|  |  |  | 			lun->lun_sep->sep_tg_pt_secondary_write_md); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ssize_t core_alua_store_secondary_write_metadata( | 
					
						
							|  |  |  | 	struct se_lun *lun, | 
					
						
							|  |  |  | 	const char *page, | 
					
						
							|  |  |  | 	size_t count) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	unsigned long tmp; | 
					
						
							|  |  |  | 	int ret; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-07-19 16:22:19 +09:00
										 |  |  | 	ret = kstrtoul(page, 0, &tmp); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	if (ret < 0) { | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		pr_err("Unable to extract alua_tg_pt_write_md\n"); | 
					
						
							| 
									
										
										
										
											2013-07-19 16:22:19 +09:00
										 |  |  | 		return ret; | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	if ((tmp != 0) && (tmp != 1)) { | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		pr_err("Illegal value for alua_tg_pt_write_md:" | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 				" %lu\n", tmp); | 
					
						
							|  |  |  | 		return -EINVAL; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	lun->lun_sep->sep_tg_pt_secondary_write_md = (int)tmp; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return count; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | int core_setup_alua(struct se_device *dev) | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-10-10 17:37:16 -04:00
										 |  |  | 	if (dev->transport->transport_type != TRANSPORT_PLUGIN_PHBA_PDEV && | 
					
						
							|  |  |  | 	    !(dev->se_hba->hba_flags & HBA_FLAGS_INTERNAL_USE)) { | 
					
						
							|  |  |  | 		struct t10_alua_lu_gp_member *lu_gp_mem; | 
					
						
							| 
									
										
										
										
											2012-10-08 00:03:19 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		/*
 | 
					
						
							| 
									
										
										
										
											2011-03-30 22:57:33 -03:00
										 |  |  | 		 * Associate this struct se_device with the default ALUA | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		 * LUN Group. | 
					
						
							|  |  |  | 		 */ | 
					
						
							|  |  |  | 		lu_gp_mem = core_alua_allocate_lu_gp_mem(dev); | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 		if (IS_ERR(lu_gp_mem)) | 
					
						
							|  |  |  | 			return PTR_ERR(lu_gp_mem); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		spin_lock(&lu_gp_mem->lu_gp_mem_lock); | 
					
						
							|  |  |  | 		__core_alua_attach_lu_gp_mem(lu_gp_mem, | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 				default_lu_gp); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 		spin_unlock(&lu_gp_mem->lu_gp_mem_lock); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-08 10:36:43 -07:00
										 |  |  | 		pr_debug("%s: Adding to default ALUA LU Group:" | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 			" core/alua/lu_gps/default_lu_gp\n", | 
					
						
							| 
									
										
										
										
											2011-07-19 08:55:10 +00:00
										 |  |  | 			dev->transport->name); | 
					
						
							| 
									
										
											  
											
												[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
 Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
											
										 
											2010-12-17 11:11:26 -08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } |