[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
/*******************************************************************************
* Filename : target_core_iblock . c
*
* This file contains the Storage Engine < - > Linux BlockIO transport
* specific functions .
*
2013-09-06 02:29:12 +04:00
* ( c ) Copyright 2003 - 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 22:11:26 +03: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/string.h>
# include <linux/parser.h>
# include <linux/timer.h>
# include <linux/fs.h>
# include <linux/blkdev.h>
# include <linux/slab.h>
# include <linux/spinlock.h>
# include <linux/bio.h>
# include <linux/genhd.h>
# include <linux/file.h>
2011-08-30 22:20:44 +04:00
# include <linux/module.h>
2015-05-08 11:11:12 +03:00
# include <scsi/scsi_proto.h>
2012-06-18 02:40:55 +04: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 22:11:26 +03:00
# include <target/target_core_base.h>
2011-11-16 18:46:48 +04:00
# include <target/target_core_backend.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 22:11:26 +03:00
# include "target_core_iblock.h"
2011-12-21 23:20:31 +04:00
# define IBLOCK_MAX_BIO_PER_TASK 32 /* max # of bios to submit at a time */
# define IBLOCK_BIO_POOL_SIZE 128
2012-10-08 08:03:19 +04:00
static inline struct iblock_dev * IBLOCK_DEV ( struct se_device * dev )
{
return container_of ( dev , struct iblock_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 22:11:26 +03:00
static int iblock_attach_hba ( struct se_hba * hba , u32 host_id )
{
2011-06-08 21:36:43 +04:00
pr_debug ( " CORE_HBA[%d] - TCM iBlock HBA Driver %s on "
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
" Generic Target Core Stack %s \n " , hba - > hba_id ,
2015-06-19 16:14:39 +03:00
IBLOCK_VERSION , TARGET_CORE_VERSION ) ;
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
return 0 ;
}
static void iblock_detach_hba ( struct se_hba * hba )
{
}
2012-10-08 08:03:19 +04:00
static struct se_device * iblock_alloc_device ( struct se_hba * hba , 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 22:11:26 +03:00
{
struct iblock_dev * ib_dev = NULL ;
ib_dev = kzalloc ( sizeof ( struct iblock_dev ) , GFP_KERNEL ) ;
2011-06-08 21:36:43 +04:00
if ( ! ib_dev ) {
pr_err ( " Unable to allocate struct iblock_dev \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 22:11:26 +03:00
return NULL ;
}
2011-06-08 21:36:43 +04:00
pr_debug ( " IBLOCK: Allocated ib_dev for %s \n " , 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 22:11:26 +03:00
2012-10-08 08:03:19 +04:00
return & ib_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 22:11:26 +03:00
}
2012-10-08 08:03:19 +04:00
static int iblock_configure_device ( 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 22:11:26 +03:00
{
2012-10-08 08:03:19 +04:00
struct iblock_dev * ib_dev = IBLOCK_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 22:11:26 +03:00
struct request_queue * q ;
2012-10-08 08:03:19 +04:00
struct block_device * bd = NULL ;
2013-12-24 00:31:24 +04:00
struct blk_integrity * bi ;
2012-06-07 21:38:51 +04:00
fmode_t mode ;
2017-04-12 08:21:47 +03:00
unsigned int max_write_zeroes_sectors ;
2012-10-08 08:03:19 +04:00
int ret = - 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 22:11:26 +03:00
2012-10-08 08:03:19 +04:00
if ( ! ( ib_dev - > ibd_flags & IBDF_HAS_UDEV_PATH ) ) {
pr_err ( " Missing udev_path= parameters for IBLOCK \n " ) ;
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 22:11:26 +03:00
}
2011-12-21 23:20:31 +04:00
2017-06-18 07:38:57 +03:00
ib_dev - > ibd_bio_set = bioset_create ( IBLOCK_BIO_POOL_SIZE , 0 , BIOSET_NEED_BVECS ) ;
2011-06-08 21:36:43 +04:00
if ( ! ib_dev - > ibd_bio_set ) {
2012-10-08 08:03:19 +04:00
pr_err ( " IBLOCK: Unable to create bioset \n " ) ;
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 22:11:26 +03:00
}
2012-10-08 08:03:19 +04:00
2011-06-08 21:36:43 +04:00
pr_debug ( " IBLOCK: Claiming struct block_device: %s \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 22:11:26 +03:00
ib_dev - > ibd_udev_path ) ;
2012-06-07 21:38:51 +04:00
mode = FMODE_READ | FMODE_EXCL ;
if ( ! ib_dev - > ibd_readonly )
mode | = FMODE_WRITE ;
2015-09-16 03:27:35 +03:00
else
dev - > dev_flags | = DF_READ_ONLY ;
2012-06-07 21:38:51 +04:00
bd = blkdev_get_by_path ( ib_dev - > ibd_udev_path , mode , ib_dev ) ;
2011-03-14 14:05:59 +03:00
if ( IS_ERR ( bd ) ) {
ret = PTR_ERR ( bd ) ;
2012-10-08 08:03:19 +04:00
goto out_free_bioset ;
2011-03-14 14:05:59 +03: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 22:11:26 +03:00
ib_dev - > ibd_bd = bd ;
2012-10-08 08:03:19 +04:00
q = bdev_get_queue ( bd ) ;
dev - > dev_attrib . hw_block_size = bdev_logical_block_size ( bd ) ;
2015-01-07 03:10:37 +03:00
dev - > dev_attrib . hw_max_sectors = queue_max_hw_sectors ( q ) ;
2012-10-08 08:03:19 +04:00
dev - > dev_attrib . hw_queue_depth = q - > nr_requests ;
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
2016-06-03 04:12:37 +03:00
if ( target_configure_unmap_from_queue ( & dev - > dev_attrib , q ) )
2011-06-08 21:36:43 +04:00
pr_debug ( " IBLOCK: BLOCK Discard support available, "
2016-01-18 23:09:27 +03:00
" disabled by default \n " ) ;
2012-11-08 08:08:38 +04:00
/*
* Enable write same emulation for IBLOCK and use 0xFFFF as
* the smaller WRITE_SAME ( 10 ) only has a two - byte block count .
*/
2017-04-12 08:21:47 +03:00
max_write_zeroes_sectors = bdev_write_zeroes_sectors ( bd ) ;
if ( max_write_zeroes_sectors )
dev - > dev_attrib . max_write_same_len = max_write_zeroes_sectors ;
else
dev - > dev_attrib . max_write_same_len = 0xFFFF ;
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
2011-07-06 00:34:52 +04:00
if ( blk_queue_nonrot ( q ) )
2012-10-08 08:03:19 +04:00
dev - > dev_attrib . is_nonrot = 1 ;
2013-01-30 10:10:06 +04:00
2013-12-24 00:31:24 +04:00
bi = bdev_get_integrity ( bd ) ;
if ( bi ) {
struct bio_set * bs = ib_dev - > ibd_bio_set ;
2015-10-21 20:19:33 +03:00
if ( ! strcmp ( bi - > profile - > name , " T10-DIF-TYPE3-IP " ) | |
! strcmp ( bi - > profile - > name , " T10-DIF-TYPE1-IP " ) ) {
2013-12-24 00:31:24 +04:00
pr_err ( " IBLOCK export of blk_integrity: %s not "
2015-10-21 20:19:33 +03:00
" supported \n " , bi - > profile - > name ) ;
2013-12-24 00:31:24 +04:00
ret = - ENOSYS ;
goto out_blkdev_put ;
}
2015-10-21 20:19:33 +03:00
if ( ! strcmp ( bi - > profile - > name , " T10-DIF-TYPE3-CRC " ) ) {
2013-12-24 00:31:24 +04:00
dev - > dev_attrib . pi_prot_type = TARGET_DIF_TYPE3_PROT ;
2015-10-21 20:19:33 +03:00
} else if ( ! strcmp ( bi - > profile - > name , " T10-DIF-TYPE1-CRC " ) ) {
2013-12-24 00:31:24 +04:00
dev - > dev_attrib . pi_prot_type = TARGET_DIF_TYPE1_PROT ;
}
if ( dev - > dev_attrib . pi_prot_type ) {
if ( bioset_integrity_create ( bs , IBLOCK_BIO_POOL_SIZE ) < 0 ) {
pr_err ( " Unable to allocate bioset for PI \n " ) ;
ret = - ENOMEM ;
goto out_blkdev_put ;
}
pr_debug ( " IBLOCK setup BIP bs->bio_integrity_pool: %p \n " ,
bs - > bio_integrity_pool ) ;
}
dev - > dev_attrib . hw_pi_prot_type = dev - > dev_attrib . pi_prot_type ;
}
2012-10-08 08:03:19 +04: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 22:11:26 +03:00
2013-12-24 00:31:24 +04:00
out_blkdev_put :
blkdev_put ( ib_dev - > ibd_bd , FMODE_WRITE | FMODE_READ | FMODE_EXCL ) ;
2012-10-08 08:03:19 +04:00
out_free_bioset :
bioset_free ( ib_dev - > ibd_bio_set ) ;
ib_dev - > ibd_bio_set = NULL ;
out :
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 22:11:26 +03:00
}
2015-05-19 10:03:07 +03:00
static void iblock_dev_call_rcu ( struct rcu_head * p )
{
struct se_device * dev = container_of ( p , struct se_device , rcu_head ) ;
struct iblock_dev * ib_dev = IBLOCK_DEV ( dev ) ;
kfree ( ib_dev ) ;
}
2012-10-08 08:03:19 +04:00
static void iblock_free_device ( struct se_device * dev )
2017-06-23 09:18:12 +03:00
{
call_rcu ( & dev - > rcu_head , iblock_dev_call_rcu ) ;
}
static void iblock_destroy_device ( 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 22:11:26 +03:00
{
2012-10-08 08:03:19 +04:00
struct iblock_dev * ib_dev = IBLOCK_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 22:11:26 +03:00
2011-02-10 02:34:38 +03:00
if ( ib_dev - > ibd_bd ! = NULL )
blkdev_put ( ib_dev - > ibd_bd , FMODE_WRITE | FMODE_READ | FMODE_EXCL ) ;
2014-04-03 07:35:02 +04:00
if ( ib_dev - > ibd_bio_set ! = NULL )
2011-02-10 02:34:38 +03:00
bioset_free ( ib_dev - > ibd_bio_set ) ;
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
}
static unsigned long long iblock_emulate_read_cap_with_block_size (
struct se_device * dev ,
struct block_device * bd ,
struct request_queue * q )
{
unsigned long long blocks_long = ( div_u64 ( i_size_read ( bd - > bd_inode ) ,
bdev_logical_block_size ( bd ) ) - 1 ) ;
u32 block_size = bdev_logical_block_size ( bd ) ;
2012-10-08 08:03:19 +04:00
if ( block_size = = dev - > dev_attrib . block_size )
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
return blocks_long ;
switch ( block_size ) {
case 4096 :
2012-10-08 08:03:19 +04:00
switch ( dev - > dev_attrib . block_size ) {
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
case 2048 :
blocks_long < < = 1 ;
break ;
case 1024 :
blocks_long < < = 2 ;
break ;
case 512 :
blocks_long < < = 3 ;
default :
break ;
}
break ;
case 2048 :
2012-10-08 08:03:19 +04:00
switch ( dev - > dev_attrib . block_size ) {
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
case 4096 :
blocks_long > > = 1 ;
break ;
case 1024 :
blocks_long < < = 1 ;
break ;
case 512 :
blocks_long < < = 2 ;
break ;
default :
break ;
}
break ;
case 1024 :
2012-10-08 08:03:19 +04:00
switch ( dev - > dev_attrib . block_size ) {
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
case 4096 :
blocks_long > > = 2 ;
break ;
case 2048 :
blocks_long > > = 1 ;
break ;
case 512 :
blocks_long < < = 1 ;
break ;
default :
break ;
}
break ;
case 512 :
2012-10-08 08:03:19 +04:00
switch ( dev - > dev_attrib . block_size ) {
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
case 4096 :
blocks_long > > = 3 ;
break ;
case 2048 :
blocks_long > > = 2 ;
break ;
case 1024 :
blocks_long > > = 1 ;
break ;
default :
break ;
}
break ;
default :
break ;
}
return blocks_long ;
}
2012-11-18 02:27:55 +04:00
static void iblock_complete_cmd ( struct se_cmd * cmd )
{
struct iblock_req * ibr = cmd - > priv ;
u8 status ;
2017-03-06 17:21:11 +03:00
if ( ! refcount_dec_and_test ( & ibr - > pending ) )
2012-11-18 02:27:55 +04:00
return ;
if ( atomic_read ( & ibr - > ib_bio_err_cnt ) )
status = SAM_STAT_CHECK_CONDITION ;
else
status = SAM_STAT_GOOD ;
target_complete_cmd ( cmd , status ) ;
kfree ( ibr ) ;
}
2015-07-20 16:29:37 +03:00
static void iblock_bio_done ( struct bio * bio )
2012-11-18 02:27:55 +04:00
{
struct se_cmd * cmd = bio - > bi_private ;
struct iblock_req * ibr = cmd - > priv ;
2017-06-03 10:38:06 +03:00
if ( bio - > bi_status ) {
pr_err ( " bio error: %p, err: %d \n " , bio , bio - > bi_status ) ;
2012-11-18 02:27:55 +04:00
/*
* Bump the ib_bio_err_cnt and release bio .
*/
atomic_inc ( & ibr - > ib_bio_err_cnt ) ;
2014-03-17 21:06:10 +04:00
smp_mb__after_atomic ( ) ;
2012-11-18 02:27:55 +04:00
}
bio_put ( bio ) ;
iblock_complete_cmd ( cmd ) ;
}
static struct bio *
2016-06-05 22:32:08 +03:00
iblock_get_bio ( struct se_cmd * cmd , sector_t lba , u32 sg_num , int op ,
int op_flags )
2012-11-18 02:27:55 +04:00
{
struct iblock_dev * ib_dev = IBLOCK_DEV ( cmd - > se_dev ) ;
struct bio * bio ;
/*
* Only allocate as many vector entries as the bio code allows us to ,
* we ' ll loop later on until we have handled the whole request .
*/
if ( sg_num > BIO_MAX_PAGES )
sg_num = BIO_MAX_PAGES ;
bio = bio_alloc_bioset ( GFP_NOIO , sg_num , ib_dev - > ibd_bio_set ) ;
if ( ! bio ) {
pr_err ( " Unable to allocate memory for bio \n " ) ;
return NULL ;
}
2017-08-23 20:10:32 +03:00
bio_set_dev ( bio , ib_dev - > ibd_bd ) ;
2012-11-18 02:27:55 +04:00
bio - > bi_private = cmd ;
bio - > bi_end_io = & iblock_bio_done ;
2013-10-12 02:44:27 +04:00
bio - > bi_iter . bi_sector = lba ;
2016-06-05 22:32:08 +03:00
bio_set_op_attrs ( bio , op , op_flags ) ;
2012-11-18 02:27:55 +04:00
return bio ;
}
2016-06-05 22:31:41 +03:00
static void iblock_submit_bios ( struct bio_list * list )
2012-11-18 02:27:55 +04:00
{
struct blk_plug plug ;
struct bio * bio ;
blk_start_plug ( & plug ) ;
while ( ( bio = bio_list_pop ( list ) ) )
2016-06-05 22:31:41 +03:00
submit_bio ( bio ) ;
2012-11-18 02:27:55 +04:00
blk_finish_plug ( & plug ) ;
}
2015-07-20 16:29:37 +03:00
static void iblock_end_io_flush ( struct bio * bio )
2011-10-14 15:29:58 +04:00
{
struct se_cmd * cmd = bio - > bi_private ;
2017-06-03 10:38:06 +03:00
if ( bio - > bi_status )
pr_err ( " IBLOCK: cache flush failed: %d \n " , bio - > bi_status ) ;
2011-10-14 15:29:58 +04:00
2012-04-24 08:25:06 +04:00
if ( cmd ) {
2017-06-03 10:38:06 +03:00
if ( bio - > bi_status )
2012-04-24 08:25:06 +04:00
target_complete_cmd ( cmd , SAM_STAT_CHECK_CONDITION ) ;
2012-11-07 00:24:09 +04:00
else
2012-04-24 08:25:06 +04:00
target_complete_cmd ( cmd , SAM_STAT_GOOD ) ;
}
2011-10-14 15:29:58 +04:00
bio_put ( bio ) ;
}
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
/*
2011-10-14 15:29:58 +04:00
* Implement SYCHRONIZE CACHE . Note that we can ' t handle lba ranges and must
* always flush the whole cache .
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
*/
2012-11-07 00:24:09 +04:00
static sense_reason_t
iblock_execute_sync_cache ( 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 22:11:26 +03:00
{
2012-10-08 08:03:19 +04:00
struct iblock_dev * ib_dev = IBLOCK_DEV ( cmd - > se_dev ) ;
2011-05-03 04:12:10 +04:00
int immed = ( cmd - > t_task_cdb [ 1 ] & 0x2 ) ;
2011-10-14 15:29:58 +04:00
struct bio * bio ;
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
/*
* If the Immediate bit is set , queue up the GOOD response
2011-10-14 15:29:58 +04:00
* for this SYNCHRONIZE_CACHE op .
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
*/
if ( immed )
2012-04-24 08:25:06 +04:00
target_complete_cmd ( cmd , SAM_STAT_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 22:11:26 +03:00
2011-10-14 15:29:58 +04:00
bio = bio_alloc ( GFP_KERNEL , 0 ) ;
bio - > bi_end_io = iblock_end_io_flush ;
2017-08-23 20:10:32 +03:00
bio_set_dev ( bio , ib_dev - > ibd_bd ) ;
2016-11-01 16:40:10 +03:00
bio - > bi_opf = REQ_OP_WRITE | REQ_PREFLUSH ;
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
if ( ! immed )
2011-10-14 15:29:58 +04:00
bio - > bi_private = cmd ;
2016-06-05 22:31:41 +03:00
submit_bio ( bio ) ;
2012-06-18 02:40:53 +04: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 22:11:26 +03:00
}
2013-02-25 10:03:45 +04:00
static sense_reason_t
2015-06-19 16:10:59 +03:00
iblock_execute_unmap ( struct se_cmd * cmd , sector_t lba , sector_t nolb )
2013-02-25 10:03:45 +04:00
{
2015-06-19 16:10:59 +03:00
struct block_device * bdev = IBLOCK_DEV ( cmd - > se_dev ) - > ibd_bd ;
2016-01-18 23:09:27 +03:00
struct se_device * dev = cmd - > se_dev ;
2013-02-25 10:03:45 +04:00
int ret ;
2016-01-18 23:09:27 +03:00
ret = blkdev_issue_discard ( bdev ,
target_to_linux_sector ( dev , lba ) ,
target_to_linux_sector ( dev , nolb ) ,
GFP_KERNEL , 0 ) ;
2013-02-25 10:03:45 +04:00
if ( ret < 0 ) {
pr_err ( " blkdev_issue_discard() failed: %d \n " , ret ) ;
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE ;
}
return 0 ;
}
2016-02-24 22:56:33 +03:00
static sense_reason_t
2017-04-12 08:21:47 +03:00
iblock_execute_zero_out ( struct block_device * bdev , struct se_cmd * cmd )
2016-02-24 22:56:33 +03:00
{
struct se_device * dev = cmd - > se_dev ;
struct scatterlist * sg = & cmd - > t_data_sg [ 0 ] ;
2017-04-12 08:21:47 +03:00
unsigned char * buf , zero = 0x00 , * p = & zero ;
int rc , ret ;
2016-02-24 22:56:33 +03:00
2017-04-12 08:21:47 +03:00
buf = kmap ( sg_page ( sg ) ) + sg - > offset ;
if ( ! buf )
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE ;
/*
* Fall back to block_execute_write_same ( ) slow - path if
* incoming WRITE_SAME payload does not contain zeros .
*/
rc = memcmp ( buf , p , cmd - > data_length ) ;
kunmap ( sg_page ( sg ) ) ;
2016-02-24 22:56:33 +03:00
2017-04-12 08:21:47 +03:00
if ( rc )
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE ;
2016-02-24 22:56:33 +03:00
2017-04-12 08:21:47 +03:00
ret = blkdev_issue_zeroout ( bdev ,
2016-02-24 22:56:33 +03:00
target_to_linux_sector ( dev , cmd - > t_task_lba ) ,
target_to_linux_sector ( dev ,
sbc_get_write_same_sectors ( cmd ) ) ,
2017-04-12 08:21:47 +03:00
GFP_KERNEL , false ) ;
2016-02-24 22:56:33 +03:00
if ( ret )
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE ;
target_complete_cmd ( cmd , GOOD ) ;
return 0 ;
}
2012-11-08 08:08:38 +04:00
static sense_reason_t
iblock_execute_write_same ( struct se_cmd * cmd )
{
2016-02-24 22:56:33 +03:00
struct block_device * bdev = IBLOCK_DEV ( cmd - > se_dev ) - > ibd_bd ;
2012-11-08 08:08:38 +04:00
struct iblock_req * ibr ;
struct scatterlist * sg ;
struct bio * bio ;
struct bio_list list ;
2016-01-18 23:09:27 +03:00
struct se_device * dev = cmd - > se_dev ;
sector_t block_lba = target_to_linux_sector ( dev , cmd - > t_task_lba ) ;
sector_t sectors = target_to_linux_sector ( dev ,
sbc_get_write_same_sectors ( cmd ) ) ;
2012-11-08 08:08:38 +04:00
2015-02-14 04:32:11 +03:00
if ( cmd - > prot_op ) {
pr_err ( " WRITE_SAME: Protection information with IBLOCK "
" backends not supported \n " ) ;
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE ;
}
2012-11-08 08:08:38 +04:00
sg = & cmd - > t_data_sg [ 0 ] ;
if ( cmd - > t_data_nents > 1 | |
sg - > length ! = cmd - > se_dev - > dev_attrib . block_size ) {
pr_err ( " WRITE_SAME: Illegal SGL t_data_nents: %u length: %u "
" block_size: %u \n " , cmd - > t_data_nents , sg - > length ,
cmd - > se_dev - > dev_attrib . block_size ) ;
return TCM_INVALID_CDB_FIELD ;
}
2017-04-12 08:21:47 +03:00
if ( bdev_write_zeroes_sectors ( bdev ) ) {
if ( ! iblock_execute_zero_out ( bdev , cmd ) )
return 0 ;
}
2016-02-24 22:56:33 +03:00
2012-11-08 08:08:38 +04:00
ibr = kzalloc ( sizeof ( struct iblock_req ) , GFP_KERNEL ) ;
if ( ! ibr )
goto fail ;
cmd - > priv = ibr ;
2016-06-05 22:32:08 +03:00
bio = iblock_get_bio ( cmd , block_lba , 1 , REQ_OP_WRITE , 0 ) ;
2012-11-08 08:08:38 +04:00
if ( ! bio )
goto fail_free_ibr ;
bio_list_init ( & list ) ;
bio_list_add ( & list , bio ) ;
2017-03-06 17:21:11 +03:00
refcount_set ( & ibr - > pending , 1 ) ;
2012-11-08 08:08:38 +04:00
while ( sectors ) {
while ( bio_add_page ( bio , sg_page ( sg ) , sg - > length , sg - > offset )
! = sg - > length ) {
2016-06-05 22:32:08 +03:00
bio = iblock_get_bio ( cmd , block_lba , 1 , REQ_OP_WRITE ,
0 ) ;
2012-11-08 08:08:38 +04:00
if ( ! bio )
goto fail_put_bios ;
2017-03-06 17:21:11 +03:00
refcount_inc ( & ibr - > pending ) ;
2012-11-08 08:08:38 +04:00
bio_list_add ( & list , bio ) ;
}
/* Always in 512 byte units for Linux/Block */
block_lba + = sg - > length > > IBLOCK_LBA_SHIFT ;
sectors - = 1 ;
}
2016-06-05 22:31:41 +03:00
iblock_submit_bios ( & list ) ;
2012-11-08 08:08:38 +04:00
return 0 ;
fail_put_bios :
while ( ( bio = bio_list_pop ( & list ) ) )
bio_put ( bio ) ;
fail_free_ibr :
kfree ( ibr ) ;
fail :
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE ;
}
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
enum {
2012-06-07 21:38:51 +04:00
Opt_udev_path , Opt_readonly , Opt_force , Opt_err
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
} ;
static match_table_t tokens = {
{ Opt_udev_path , " udev_path=%s " } ,
2012-06-07 21:38:51 +04:00
{ Opt_readonly , " readonly=%d " } ,
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
{ Opt_force , " force=%d " } ,
{ Opt_err , NULL }
} ;
2012-10-08 08:03:19 +04:00
static ssize_t iblock_set_configfs_dev_params ( struct se_device * dev ,
const char * page , ssize_t 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 22:11:26 +03:00
{
2012-10-08 08:03:19 +04:00
struct iblock_dev * ib_dev = IBLOCK_DEV ( dev ) ;
2011-03-14 14:05:56 +03:00
char * orig , * ptr , * arg_p , * opts ;
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
substring_t args [ MAX_OPT_ARGS ] ;
2011-07-06 02:35:02 +04:00
int ret = 0 , token ;
2012-06-07 21:38:51 +04:00
unsigned long tmp_readonly ;
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
opts = kstrdup ( page , GFP_KERNEL ) ;
if ( ! opts )
return - ENOMEM ;
orig = opts ;
2011-11-23 23:53:17 +04:00
while ( ( ptr = strsep ( & opts , " , \n " ) ) ! = 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 22:11:26 +03:00
if ( ! * ptr )
continue ;
token = match_token ( ptr , tokens , args ) ;
switch ( token ) {
case Opt_udev_path :
if ( ib_dev - > ibd_bd ) {
2011-06-08 21:36:43 +04:00
pr_err ( " Unable to set udev_path= while "
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
" ib_dev->ibd_bd exists \n " ) ;
ret = - EEXIST ;
goto out ;
}
2012-08-23 05:45:11 +04:00
if ( match_strlcpy ( ib_dev - > ibd_udev_path , & args [ 0 ] ,
SE_UDEV_PATH_LEN ) = = 0 ) {
ret = - EINVAL ;
2011-03-14 14:05:56 +03:00
break ;
}
2011-06-08 21:36:43 +04:00
pr_debug ( " IBLOCK: Referencing UDEV path: %s \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 22:11:26 +03:00
ib_dev - > ibd_udev_path ) ;
ib_dev - > ibd_flags | = IBDF_HAS_UDEV_PATH ;
break ;
2012-06-07 21:38:51 +04:00
case Opt_readonly :
arg_p = match_strdup ( & args [ 0 ] ) ;
if ( ! arg_p ) {
ret = - ENOMEM ;
break ;
}
2013-07-19 11:22:19 +04:00
ret = kstrtoul ( arg_p , 0 , & tmp_readonly ) ;
2012-06-07 21:38:51 +04:00
kfree ( arg_p ) ;
if ( ret < 0 ) {
2013-07-19 11:22:19 +04:00
pr_err ( " kstrtoul() failed for "
2012-06-07 21:38:51 +04:00
" readonly= \n " ) ;
goto out ;
}
ib_dev - > ibd_readonly = tmp_readonly ;
pr_debug ( " IBLOCK: readonly: %d \n " , ib_dev - > ibd_readonly ) ;
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 22:11:26 +03:00
case Opt_force :
break ;
default :
break ;
}
}
out :
kfree ( orig ) ;
return ( ! ret ) ? count : ret ;
}
2012-10-08 08:03:19 +04:00
static ssize_t iblock_show_configfs_dev_params ( struct se_device * dev , char * b )
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
{
2012-10-08 08:03:19 +04:00
struct iblock_dev * ib_dev = IBLOCK_DEV ( dev ) ;
struct block_device * bd = ib_dev - > ibd_bd ;
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
char buf [ BDEVNAME_SIZE ] ;
ssize_t bl = 0 ;
if ( bd )
bl + = sprintf ( b + bl , " iBlock device: %s " ,
bdevname ( bd , buf ) ) ;
2012-10-08 08:03:19 +04:00
if ( ib_dev - > ibd_flags & IBDF_HAS_UDEV_PATH )
2012-06-07 21:38:51 +04:00
bl + = sprintf ( b + bl , " UDEV PATH: %s " ,
2012-10-08 08:03:19 +04:00
ib_dev - > ibd_udev_path ) ;
bl + = sprintf ( b + bl , " readonly: %d \n " , ib_dev - > ibd_readonly ) ;
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
bl + = sprintf ( b + bl , " " ) ;
if ( bd ) {
bl + = sprintf ( b + bl , " Major: %d Minor: %d %s \n " ,
2011-07-06 02:35:02 +04:00
MAJOR ( bd - > bd_dev ) , MINOR ( bd - > bd_dev ) , ( ! bd - > bd_contains ) ?
2012-10-08 08:03:19 +04:00
" " : ( bd - > bd_holder = = ib_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 22:11:26 +03:00
" CLAIMED: IBLOCK " : " CLAIMED: OS " ) ;
} else {
2011-07-06 02:35:02 +04:00
bl + = sprintf ( b + bl , " Major: 0 Minor: 0 \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 22:11:26 +03:00
}
return bl ;
}
2013-12-24 00:31:24 +04:00
static int
iblock_alloc_bip ( struct se_cmd * cmd , struct bio * bio )
{
struct se_device * dev = cmd - > se_dev ;
struct blk_integrity * bi ;
struct bio_integrity_payload * bip ;
struct iblock_dev * ib_dev = IBLOCK_DEV ( dev ) ;
struct scatterlist * sg ;
int i , rc ;
bi = bdev_get_integrity ( ib_dev - > ibd_bd ) ;
if ( ! bi ) {
pr_err ( " Unable to locate bio_integrity \n " ) ;
return - ENODEV ;
}
bip = bio_integrity_alloc ( bio , GFP_NOIO , cmd - > t_prot_nents ) ;
2015-12-03 19:32:21 +03:00
if ( IS_ERR ( bip ) ) {
2013-12-24 00:31:24 +04:00
pr_err ( " Unable to allocate bio_integrity_payload \n " ) ;
2015-12-03 19:32:21 +03:00
return PTR_ERR ( bip ) ;
2013-12-24 00:31:24 +04:00
}
2014-02-01 03:31:23 +04:00
bip - > bip_iter . bi_size = ( cmd - > data_length / dev - > dev_attrib . block_size ) *
2013-12-24 00:31:24 +04:00
dev - > prot_length ;
2014-02-01 03:31:23 +04:00
bip - > bip_iter . bi_sector = bio - > bi_iter . bi_sector ;
2013-12-24 00:31:24 +04:00
2014-02-01 03:31:23 +04:00
pr_debug ( " IBLOCK BIP Size: %u Sector: %llu \n " , bip - > bip_iter . bi_size ,
( unsigned long long ) bip - > bip_iter . bi_sector ) ;
2013-12-24 00:31:24 +04:00
for_each_sg ( cmd - > t_prot_sg , sg , cmd - > t_prot_nents , i ) {
rc = bio_integrity_add_page ( bio , sg_page ( sg ) , sg - > length ,
sg - > offset ) ;
if ( rc ! = sg - > length ) {
pr_err ( " bio_integrity_add_page() failed; %d \n " , rc ) ;
return - ENOMEM ;
}
pr_debug ( " Added bio integrity page: %p length: %d offset; %d \n " ,
sg_page ( sg ) , sg - > length , sg - > offset ) ;
}
return 0 ;
}
2012-11-07 00:24:09 +04:00
static sense_reason_t
2013-08-20 10:57:30 +04:00
iblock_execute_rw ( struct se_cmd * cmd , struct scatterlist * sgl , u32 sgl_nents ,
enum dma_data_direction data_direction )
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
{
2011-07-19 14:26:37 +04:00
struct se_device * dev = cmd - > se_dev ;
2016-01-18 23:09:27 +03:00
sector_t block_lba = target_to_linux_sector ( dev , cmd - > t_task_lba ) ;
2012-04-24 08:25:06 +04:00
struct iblock_req * ibr ;
2013-12-24 00:31:24 +04:00
struct bio * bio , * bio_start ;
2011-09-25 22:56:24 +04:00
struct bio_list 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 22:11:26 +03:00
struct scatterlist * sg ;
2012-04-24 08:25:06 +04:00
u32 sg_num = sgl_nents ;
2011-12-21 23:20:31 +04:00
unsigned bio_cnt ;
2016-06-05 22:32:08 +03:00
int i , op , op_flags = 0 ;
2011-09-25 22:56:24 +04:00
2012-04-24 08:25:06 +04:00
if ( data_direction = = DMA_TO_DEVICE ) {
2013-01-30 10:10:06 +04:00
struct iblock_dev * ib_dev = IBLOCK_DEV ( dev ) ;
struct request_queue * q = bdev_get_queue ( ib_dev - > ibd_bd ) ;
2011-09-25 22:56:24 +04:00
/*
2016-11-01 16:40:10 +03:00
* Force writethrough using REQ_FUA if a volatile write cache
2013-01-30 10:10:06 +04:00
* is not enabled , or if initiator set the Force Unit Access bit .
2011-09-25 22:56:24 +04:00
*/
2016-06-05 22:32:08 +03:00
op = REQ_OP_WRITE ;
2016-04-13 22:33:19 +03:00
if ( test_bit ( QUEUE_FLAG_FUA , & q - > queue_flags ) ) {
2013-01-30 10:10:06 +04:00
if ( cmd - > se_cmd_flags & SCF_FUA )
2016-11-01 16:40:10 +03:00
op_flags = REQ_FUA ;
2016-04-13 22:33:19 +03:00
else if ( ! test_bit ( QUEUE_FLAG_WC , & q - > queue_flags ) )
2016-11-01 16:40:10 +03:00
op_flags = REQ_FUA ;
2013-01-30 10:10:06 +04:00
}
2011-09-25 22:56:24 +04:00
} else {
2016-06-05 22:32:08 +03:00
op = REQ_OP_READ ;
2011-09-25 22:56:24 +04:00
}
2012-04-24 08:25:06 +04:00
ibr = kzalloc ( sizeof ( struct iblock_req ) , GFP_KERNEL ) ;
if ( ! ibr )
goto fail ;
cmd - > priv = ibr ;
2012-09-07 19:30:41 +04:00
if ( ! sgl_nents ) {
2017-03-06 17:21:11 +03:00
refcount_set ( & ibr - > pending , 1 ) ;
2012-09-07 19:30:41 +04:00
iblock_complete_cmd ( cmd ) ;
return 0 ;
}
2016-06-05 22:32:08 +03:00
bio = iblock_get_bio ( cmd , block_lba , sgl_nents , op , op_flags ) ;
2012-04-24 08:25:06 +04:00
if ( ! bio )
goto fail_free_ibr ;
2011-09-25 22:56:24 +04:00
2013-12-24 00:31:24 +04:00
bio_start = bio ;
2011-09-25 22:56:24 +04:00
bio_list_init ( & list ) ;
bio_list_add ( & list , bio ) ;
2012-04-24 08:25:06 +04:00
2017-03-06 17:21:11 +03:00
refcount_set ( & ibr - > pending , 2 ) ;
2011-12-21 23:20:31 +04:00
bio_cnt = 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 22:11:26 +03:00
2012-04-24 08:25:06 +04:00
for_each_sg ( sgl , sg , sgl_nents , i ) {
2011-09-25 22:56:24 +04:00
/*
* XXX : if the length the device accepts is shorter than the
* length of the S / G list entry this will cause and
* endless loop . Better hope no driver uses huge pages .
*/
while ( bio_add_page ( bio , sg_page ( sg ) , sg - > length , sg - > offset )
! = sg - > length ) {
2011-12-21 23:20:31 +04:00
if ( bio_cnt > = IBLOCK_MAX_BIO_PER_TASK ) {
2016-06-05 22:31:41 +03:00
iblock_submit_bios ( & list ) ;
2011-12-21 23:20:31 +04:00
bio_cnt = 0 ;
}
2016-06-05 22:32:08 +03:00
bio = iblock_get_bio ( cmd , block_lba , sg_num , op ,
op_flags ) ;
2011-06-08 21:36:43 +04:00
if ( ! bio )
2012-04-24 08:25:06 +04:00
goto fail_put_bios ;
2017-03-06 17:21:11 +03:00
refcount_inc ( & ibr - > pending ) ;
2011-09-25 22:56:24 +04:00
bio_list_add ( & list , bio ) ;
2011-12-21 23:20:31 +04:00
bio_cnt + + ;
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
}
2011-09-25 22:56:24 +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 22:11:26 +03:00
/* Always in 512 byte units for Linux/Block */
block_lba + = sg - > length > > IBLOCK_LBA_SHIFT ;
sg_num - - ;
}
2015-03-28 09:14:16 +03:00
if ( cmd - > prot_type & & dev - > dev_attrib . pi_prot_type ) {
2013-12-24 00:31:24 +04:00
int rc = iblock_alloc_bip ( cmd , bio_start ) ;
if ( rc )
goto fail_put_bios ;
}
2016-06-05 22:31:41 +03:00
iblock_submit_bios ( & list ) ;
2012-04-24 08:25:06 +04:00
iblock_complete_cmd ( cmd ) ;
2011-11-04 13:36:16 +04:00
return 0 ;
2011-09-25 22:56:24 +04:00
2012-04-24 08:25:06 +04:00
fail_put_bios :
2011-09-25 22:56:24 +04:00
while ( ( bio = bio_list_pop ( & 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 22:11:26 +03:00
bio_put ( bio ) ;
2012-04-24 08:25:06 +04:00
fail_free_ibr :
kfree ( ibr ) ;
fail :
2012-11-07 00:24:09 +04:00
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE ;
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
}
static sector_t iblock_get_blocks ( struct se_device * dev )
{
2012-10-08 08:03:19 +04:00
struct iblock_dev * ib_dev = IBLOCK_DEV ( dev ) ;
struct block_device * bd = ib_dev - > ibd_bd ;
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
struct request_queue * q = bdev_get_queue ( bd ) ;
return iblock_emulate_read_cap_with_block_size ( dev , bd , q ) ;
}
2013-11-11 20:59:17 +04:00
static sector_t iblock_get_alignment_offset_lbas ( struct se_device * dev )
{
struct iblock_dev * ib_dev = IBLOCK_DEV ( dev ) ;
struct block_device * bd = ib_dev - > ibd_bd ;
int ret ;
ret = bdev_alignment_offset ( bd ) ;
if ( ret = = - 1 )
return 0 ;
/* convert offset-bytes to offset-lbas */
return ret / bdev_logical_block_size ( bd ) ;
}
static unsigned int iblock_get_lbppbe ( struct se_device * dev )
{
struct iblock_dev * ib_dev = IBLOCK_DEV ( dev ) ;
struct block_device * bd = ib_dev - > ibd_bd ;
int logs_per_phys = bdev_physical_block_size ( bd ) / bdev_logical_block_size ( bd ) ;
return ilog2 ( logs_per_phys ) ;
}
static unsigned int iblock_get_io_min ( struct se_device * dev )
{
struct iblock_dev * ib_dev = IBLOCK_DEV ( dev ) ;
struct block_device * bd = ib_dev - > ibd_bd ;
return bdev_io_min ( bd ) ;
}
static unsigned int iblock_get_io_opt ( struct se_device * dev )
{
struct iblock_dev * ib_dev = IBLOCK_DEV ( dev ) ;
struct block_device * bd = ib_dev - > ibd_bd ;
return bdev_io_opt ( bd ) ;
}
2012-10-07 18:55:50 +04:00
static struct sbc_ops iblock_sbc_ops = {
2012-06-18 02:40:52 +04:00
. execute_rw = iblock_execute_rw ,
2012-06-18 02:40:53 +04:00
. execute_sync_cache = iblock_execute_sync_cache ,
2012-06-18 02:40:54 +04:00
. execute_write_same = iblock_execute_write_same ,
2012-06-18 02:40:55 +04:00
. execute_unmap = iblock_execute_unmap ,
2012-06-18 02:40:52 +04:00
} ;
2012-11-07 00:24:09 +04:00
static sense_reason_t
iblock_parse_cdb ( struct se_cmd * cmd )
2012-06-18 02:40:52 +04:00
{
2012-10-07 18:55:50 +04:00
return sbc_parse_cdb ( cmd , & iblock_sbc_ops ) ;
2012-06-18 02:40:52 +04:00
}
2013-12-18 22:26:44 +04:00
static bool iblock_get_write_cache ( struct se_device * dev )
2013-01-30 10:10:06 +04:00
{
struct iblock_dev * ib_dev = IBLOCK_DEV ( dev ) ;
struct block_device * bd = ib_dev - > ibd_bd ;
struct request_queue * q = bdev_get_queue ( bd ) ;
2016-04-13 22:33:19 +03:00
return test_bit ( QUEUE_FLAG_WC , & q - > queue_flags ) ;
2013-01-30 10:10:06 +04:00
}
2015-05-10 19:14:56 +03:00
static const struct target_backend_ops iblock_ops = {
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
. name = " iblock " ,
2012-10-08 08:03:19 +04:00
. inquiry_prod = " IBLOCK " ,
. inquiry_rev = IBLOCK_VERSION ,
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
. owner = THIS_MODULE ,
. attach_hba = iblock_attach_hba ,
. detach_hba = iblock_detach_hba ,
2012-10-08 08:03:19 +04:00
. alloc_device = iblock_alloc_device ,
. configure_device = iblock_configure_device ,
2017-06-23 09:18:12 +03:00
. destroy_device = iblock_destroy_device ,
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
. free_device = iblock_free_device ,
2012-06-18 02:40:52 +04:00
. parse_cdb = iblock_parse_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 22:11:26 +03:00
. set_configfs_dev_params = iblock_set_configfs_dev_params ,
. show_configfs_dev_params = iblock_show_configfs_dev_params ,
2012-10-07 18:55:53 +04:00
. get_device_type = sbc_get_device_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 22:11:26 +03:00
. get_blocks = iblock_get_blocks ,
2013-11-11 20:59:17 +04:00
. get_alignment_offset_lbas = iblock_get_alignment_offset_lbas ,
. get_lbppbe = iblock_get_lbppbe ,
. get_io_min = iblock_get_io_min ,
. get_io_opt = iblock_get_io_opt ,
2013-01-30 10:10:06 +04:00
. get_write_cache = iblock_get_write_cache ,
2015-05-10 19:14:57 +03:00
. tb_dev_attrib_attrs = sbc_attrib_attrs ,
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
} ;
static int __init iblock_module_init ( void )
{
2015-05-10 19:14:56 +03:00
return transport_backend_register ( & iblock_ops ) ;
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
}
2013-02-27 08:50:56 +04:00
static void __exit iblock_module_exit ( void )
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
{
2015-05-10 19:14:56 +03:00
target_backend_unregister ( & iblock_ops ) ;
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 22:11:26 +03:00
}
MODULE_DESCRIPTION ( " TCM IBLOCK subsystem plugin " ) ;
MODULE_AUTHOR ( " nab@Linux-iSCSI.org " ) ;
MODULE_LICENSE ( " GPL " ) ;
module_init ( iblock_module_init ) ;
module_exit ( iblock_module_exit ) ;