2019-05-27 06:55:05 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 19:11:26 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
* Filename: target_core_iblock.c
|
|
|
|
*
|
|
|
|
* This file contains the Storage Engine <-> Linux BlockIO transport
|
|
|
|
* specific functions.
|
|
|
|
*
|
2013-09-05 22:29:12 +00: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 19:11:26 +00:00
|
|
|
*
|
|
|
|
* Nicholas A. Bellinger <nab@kernel.org>
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
#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 18:20:44 +00:00
|
|
|
#include <linux/module.h>
|
2015-05-08 08:11:12 +00:00
|
|
|
#include <scsi/scsi_proto.h>
|
2012-06-17 22:40:55 +00: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 19:11:26 +00:00
|
|
|
|
|
|
|
#include <target/target_core_base.h>
|
2011-11-16 14:46:48 +00: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 19:11:26 +00:00
|
|
|
|
|
|
|
#include "target_core_iblock.h"
|
|
|
|
|
2011-12-21 19:20:31 +00: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 04:03:19 +00: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 19:11:26 +00:00
|
|
|
static int iblock_attach_hba(struct se_hba *hba, u32 host_id)
|
|
|
|
{
|
2011-06-08 17:36:43 +00: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 19:11:26 +00:00
|
|
|
" Generic Target Core Stack %s\n", hba->hba_id,
|
2015-06-19 13:14:39 +00: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 19:11:26 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void iblock_detach_hba(struct se_hba *hba)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-10-08 04:03:19 +00: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 19:11:26 +00:00
|
|
|
{
|
|
|
|
struct iblock_dev *ib_dev = NULL;
|
|
|
|
|
|
|
|
ib_dev = kzalloc(sizeof(struct iblock_dev), GFP_KERNEL);
|
2011-06-08 17:36:43 +00: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 19:11:26 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-06-08 17:36:43 +00: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 19:11:26 +00:00
|
|
|
|
2012-10-08 04:03:19 +00: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 19:11:26 +00:00
|
|
|
}
|
|
|
|
|
2012-10-08 04:03:19 +00: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 19:11:26 +00:00
|
|
|
{
|
2012-10-08 04:03:19 +00: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 19:11:26 +00:00
|
|
|
struct request_queue *q;
|
2012-10-08 04:03:19 +00:00
|
|
|
struct block_device *bd = NULL;
|
2013-12-23 20:31:24 +00:00
|
|
|
struct blk_integrity *bi;
|
2012-06-07 17:38:51 +00:00
|
|
|
fmode_t mode;
|
2017-04-12 05:21:47 +00:00
|
|
|
unsigned int max_write_zeroes_sectors;
|
2012-10-08 04:03:19 +00: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 19:11:26 +00:00
|
|
|
|
2012-10-08 04:03:19 +00: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 19:11:26 +00:00
|
|
|
}
|
2011-12-21 19:20:31 +00:00
|
|
|
|
2018-05-20 22:25:54 +00:00
|
|
|
ret = bioset_init(&ib_dev->ibd_bio_set, IBLOCK_BIO_POOL_SIZE, 0, BIOSET_NEED_BVECS);
|
|
|
|
if (ret) {
|
2012-10-08 04:03:19 +00: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 19:11:26 +00:00
|
|
|
}
|
2012-10-08 04:03:19 +00:00
|
|
|
|
2011-06-08 17:36:43 +00: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 19:11:26 +00:00
|
|
|
ib_dev->ibd_udev_path);
|
|
|
|
|
2012-06-07 17:38:51 +00:00
|
|
|
mode = FMODE_READ|FMODE_EXCL;
|
|
|
|
if (!ib_dev->ibd_readonly)
|
|
|
|
mode |= FMODE_WRITE;
|
2015-09-16 00:27:35 +00:00
|
|
|
else
|
|
|
|
dev->dev_flags |= DF_READ_ONLY;
|
2012-06-07 17:38:51 +00:00
|
|
|
|
|
|
|
bd = blkdev_get_by_path(ib_dev->ibd_udev_path, mode, ib_dev);
|
2011-03-14 11:05:59 +00:00
|
|
|
if (IS_ERR(bd)) {
|
|
|
|
ret = PTR_ERR(bd);
|
2012-10-08 04:03:19 +00:00
|
|
|
goto out_free_bioset;
|
2011-03-14 11:05:59 +00:00
|
|
|
}
|
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 19:11:26 +00:00
|
|
|
ib_dev->ibd_bd = bd;
|
|
|
|
|
2012-10-08 04:03:19 +00:00
|
|
|
q = bdev_get_queue(bd);
|
|
|
|
|
|
|
|
dev->dev_attrib.hw_block_size = bdev_logical_block_size(bd);
|
2015-01-07 00:10:37 +00:00
|
|
|
dev->dev_attrib.hw_max_sectors = queue_max_hw_sectors(q);
|
2012-10-08 04:03:19 +00: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 19:11:26 +00:00
|
|
|
|
2016-06-03 01:12:37 +00:00
|
|
|
if (target_configure_unmap_from_queue(&dev->dev_attrib, q))
|
2011-06-08 17:36:43 +00:00
|
|
|
pr_debug("IBLOCK: BLOCK Discard support available,"
|
2016-01-18 20:09:27 +00:00
|
|
|
" disabled by default\n");
|
|
|
|
|
2012-11-08 04:08:38 +00: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 05:21:47 +00: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 19:11:26 +00:00
|
|
|
|
2011-07-05 20:34:52 +00:00
|
|
|
if (blk_queue_nonrot(q))
|
2012-10-08 04:03:19 +00:00
|
|
|
dev->dev_attrib.is_nonrot = 1;
|
2013-01-30 06:10:06 +00:00
|
|
|
|
2013-12-23 20:31:24 +00:00
|
|
|
bi = bdev_get_integrity(bd);
|
|
|
|
if (bi) {
|
2018-05-20 22:25:54 +00:00
|
|
|
struct bio_set *bs = &ib_dev->ibd_bio_set;
|
2013-12-23 20:31:24 +00:00
|
|
|
|
2015-10-21 17:19:33 +00:00
|
|
|
if (!strcmp(bi->profile->name, "T10-DIF-TYPE3-IP") ||
|
|
|
|
!strcmp(bi->profile->name, "T10-DIF-TYPE1-IP")) {
|
2013-12-23 20:31:24 +00:00
|
|
|
pr_err("IBLOCK export of blk_integrity: %s not"
|
2015-10-21 17:19:33 +00:00
|
|
|
" supported\n", bi->profile->name);
|
2013-12-23 20:31:24 +00:00
|
|
|
ret = -ENOSYS;
|
|
|
|
goto out_blkdev_put;
|
|
|
|
}
|
|
|
|
|
2015-10-21 17:19:33 +00:00
|
|
|
if (!strcmp(bi->profile->name, "T10-DIF-TYPE3-CRC")) {
|
2013-12-23 20:31:24 +00:00
|
|
|
dev->dev_attrib.pi_prot_type = TARGET_DIF_TYPE3_PROT;
|
2015-10-21 17:19:33 +00:00
|
|
|
} else if (!strcmp(bi->profile->name, "T10-DIF-TYPE1-CRC")) {
|
2013-12-23 20:31:24 +00: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",
|
2018-05-09 01:33:52 +00:00
|
|
|
&bs->bio_integrity_pool);
|
2013-12-23 20:31:24 +00:00
|
|
|
}
|
|
|
|
dev->dev_attrib.hw_pi_prot_type = dev->dev_attrib.pi_prot_type;
|
|
|
|
}
|
|
|
|
|
2012-10-08 04:03:19 +00: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 19:11:26 +00:00
|
|
|
|
2013-12-23 20:31:24 +00:00
|
|
|
out_blkdev_put:
|
|
|
|
blkdev_put(ib_dev->ibd_bd, FMODE_WRITE|FMODE_READ|FMODE_EXCL);
|
2012-10-08 04:03:19 +00:00
|
|
|
out_free_bioset:
|
2018-05-20 22:25:54 +00:00
|
|
|
bioset_exit(&ib_dev->ibd_bio_set);
|
2012-10-08 04:03:19 +00:00
|
|
|
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 19:11:26 +00:00
|
|
|
}
|
|
|
|
|
2015-05-19 07:03:07 +00: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 04:03:19 +00:00
|
|
|
static void iblock_free_device(struct se_device *dev)
|
2017-06-23 06:18:12 +00: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 19:11:26 +00:00
|
|
|
{
|
2012-10-08 04:03:19 +00: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 19:11:26 +00:00
|
|
|
|
2011-02-09 23:34:38 +00:00
|
|
|
if (ib_dev->ibd_bd != NULL)
|
|
|
|
blkdev_put(ib_dev->ibd_bd, FMODE_WRITE|FMODE_READ|FMODE_EXCL);
|
2018-05-20 22:25:54 +00:00
|
|
|
bioset_exit(&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 19:11:26 +00: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 04:03:19 +00: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 19:11:26 +00:00
|
|
|
return blocks_long;
|
|
|
|
|
|
|
|
switch (block_size) {
|
|
|
|
case 4096:
|
2012-10-08 04:03:19 +00: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 19:11:26 +00:00
|
|
|
case 2048:
|
|
|
|
blocks_long <<= 1;
|
|
|
|
break;
|
|
|
|
case 1024:
|
|
|
|
blocks_long <<= 2;
|
|
|
|
break;
|
|
|
|
case 512:
|
|
|
|
blocks_long <<= 3;
|
2020-11-20 18:32:32 +00:00
|
|
|
break;
|
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 19:11:26 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2048:
|
2012-10-08 04:03:19 +00: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 19:11:26 +00: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 04:03:19 +00: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 19:11:26 +00: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 04:03:19 +00: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 19:11:26 +00: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-17 22:27:55 +00:00
|
|
|
static void iblock_complete_cmd(struct se_cmd *cmd)
|
|
|
|
{
|
|
|
|
struct iblock_req *ibr = cmd->priv;
|
|
|
|
u8 status;
|
|
|
|
|
2017-03-06 14:21:11 +00:00
|
|
|
if (!refcount_dec_and_test(&ibr->pending))
|
2012-11-17 22:27:55 +00: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 13:29:37 +00:00
|
|
|
static void iblock_bio_done(struct bio *bio)
|
2012-11-17 22:27:55 +00:00
|
|
|
{
|
|
|
|
struct se_cmd *cmd = bio->bi_private;
|
|
|
|
struct iblock_req *ibr = cmd->priv;
|
|
|
|
|
2017-06-03 07:38:06 +00:00
|
|
|
if (bio->bi_status) {
|
|
|
|
pr_err("bio error: %p, err: %d\n", bio, bio->bi_status);
|
2012-11-17 22:27:55 +00:00
|
|
|
/*
|
|
|
|
* Bump the ib_bio_err_cnt and release bio.
|
|
|
|
*/
|
|
|
|
atomic_inc(&ibr->ib_bio_err_cnt);
|
2014-03-17 17:06:10 +00:00
|
|
|
smp_mb__after_atomic();
|
2012-11-17 22:27:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bio_put(bio);
|
|
|
|
|
|
|
|
iblock_complete_cmd(cmd);
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct bio *
|
2016-06-05 19:32:08 +00:00
|
|
|
iblock_get_bio(struct se_cmd *cmd, sector_t lba, u32 sg_num, int op,
|
|
|
|
int op_flags)
|
2012-11-17 22:27:55 +00: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.
|
|
|
|
*/
|
2021-01-29 04:38:57 +00:00
|
|
|
bio = bio_alloc_bioset(GFP_NOIO, bio_max_segs(sg_num),
|
|
|
|
&ib_dev->ibd_bio_set);
|
2012-11-17 22:27:55 +00:00
|
|
|
if (!bio) {
|
|
|
|
pr_err("Unable to allocate memory for bio\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2017-08-23 17:10:32 +00:00
|
|
|
bio_set_dev(bio, ib_dev->ibd_bd);
|
2012-11-17 22:27:55 +00:00
|
|
|
bio->bi_private = cmd;
|
|
|
|
bio->bi_end_io = &iblock_bio_done;
|
2013-10-11 22:44:27 +00:00
|
|
|
bio->bi_iter.bi_sector = lba;
|
2016-06-05 19:32:08 +00:00
|
|
|
bio_set_op_attrs(bio, op, op_flags);
|
2012-11-17 22:27:55 +00:00
|
|
|
|
|
|
|
return bio;
|
|
|
|
}
|
|
|
|
|
2016-06-05 19:31:41 +00:00
|
|
|
static void iblock_submit_bios(struct bio_list *list)
|
2012-11-17 22:27:55 +00:00
|
|
|
{
|
|
|
|
struct blk_plug plug;
|
|
|
|
struct bio *bio;
|
|
|
|
|
|
|
|
blk_start_plug(&plug);
|
|
|
|
while ((bio = bio_list_pop(list)))
|
2016-06-05 19:31:41 +00:00
|
|
|
submit_bio(bio);
|
2012-11-17 22:27:55 +00:00
|
|
|
blk_finish_plug(&plug);
|
|
|
|
}
|
|
|
|
|
2015-07-20 13:29:37 +00:00
|
|
|
static void iblock_end_io_flush(struct bio *bio)
|
2011-10-14 11:29:58 +00:00
|
|
|
{
|
|
|
|
struct se_cmd *cmd = bio->bi_private;
|
|
|
|
|
2017-06-03 07:38:06 +00:00
|
|
|
if (bio->bi_status)
|
|
|
|
pr_err("IBLOCK: cache flush failed: %d\n", bio->bi_status);
|
2011-10-14 11:29:58 +00:00
|
|
|
|
2012-04-24 04:25:06 +00:00
|
|
|
if (cmd) {
|
2017-06-03 07:38:06 +00:00
|
|
|
if (bio->bi_status)
|
2012-04-24 04:25:06 +00:00
|
|
|
target_complete_cmd(cmd, SAM_STAT_CHECK_CONDITION);
|
2012-11-06 20:24:09 +00:00
|
|
|
else
|
2012-04-24 04:25:06 +00:00
|
|
|
target_complete_cmd(cmd, SAM_STAT_GOOD);
|
|
|
|
}
|
|
|
|
|
2011-10-14 11:29:58 +00: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 19:11:26 +00:00
|
|
|
/*
|
2011-10-14 11:29:58 +00: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 19:11:26 +00:00
|
|
|
*/
|
2012-11-06 20:24:09 +00: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 19:11:26 +00:00
|
|
|
{
|
2012-10-08 04:03:19 +00:00
|
|
|
struct iblock_dev *ib_dev = IBLOCK_DEV(cmd->se_dev);
|
2011-05-03 00:12:10 +00:00
|
|
|
int immed = (cmd->t_task_cdb[1] & 0x2);
|
2011-10-14 11:29:58 +00: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 19:11:26 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If the Immediate bit is set, queue up the GOOD response
|
2011-10-14 11:29:58 +00: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 19:11:26 +00:00
|
|
|
*/
|
|
|
|
if (immed)
|
2012-04-24 04:25:06 +00: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 19:11:26 +00:00
|
|
|
|
2011-10-14 11:29:58 +00:00
|
|
|
bio = bio_alloc(GFP_KERNEL, 0);
|
|
|
|
bio->bi_end_io = iblock_end_io_flush;
|
2017-08-23 17:10:32 +00:00
|
|
|
bio_set_dev(bio, ib_dev->ibd_bd);
|
2016-11-01 13:40:10 +00: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 19:11:26 +00:00
|
|
|
if (!immed)
|
2011-10-14 11:29:58 +00:00
|
|
|
bio->bi_private = cmd;
|
2016-06-05 19:31:41 +00:00
|
|
|
submit_bio(bio);
|
2012-06-17 22:40:53 +00: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 19:11:26 +00:00
|
|
|
}
|
|
|
|
|
2013-02-25 06:03:45 +00:00
|
|
|
static sense_reason_t
|
2015-06-19 13:10:59 +00:00
|
|
|
iblock_execute_unmap(struct se_cmd *cmd, sector_t lba, sector_t nolb)
|
2013-02-25 06:03:45 +00:00
|
|
|
{
|
2015-06-19 13:10:59 +00:00
|
|
|
struct block_device *bdev = IBLOCK_DEV(cmd->se_dev)->ibd_bd;
|
2016-01-18 20:09:27 +00:00
|
|
|
struct se_device *dev = cmd->se_dev;
|
2013-02-25 06:03:45 +00:00
|
|
|
int ret;
|
|
|
|
|
2016-01-18 20:09:27 +00:00
|
|
|
ret = blkdev_issue_discard(bdev,
|
|
|
|
target_to_linux_sector(dev, lba),
|
|
|
|
target_to_linux_sector(dev, nolb),
|
|
|
|
GFP_KERNEL, 0);
|
2013-02-25 06:03:45 +00:00
|
|
|
if (ret < 0) {
|
|
|
|
pr_err("blkdev_issue_discard() failed: %d\n", ret);
|
|
|
|
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-02-24 19:56:33 +00:00
|
|
|
static sense_reason_t
|
2017-04-12 05:21:47 +00:00
|
|
|
iblock_execute_zero_out(struct block_device *bdev, struct se_cmd *cmd)
|
2016-02-24 19:56:33 +00:00
|
|
|
{
|
|
|
|
struct se_device *dev = cmd->se_dev;
|
|
|
|
struct scatterlist *sg = &cmd->t_data_sg[0];
|
2018-04-17 15:33:21 +00:00
|
|
|
unsigned char *buf, *not_zero;
|
|
|
|
int ret;
|
2016-02-24 19:56:33 +00:00
|
|
|
|
2017-04-12 05:21:47 +00: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.
|
|
|
|
*/
|
2018-04-17 15:33:21 +00:00
|
|
|
not_zero = memchr_inv(buf, 0x00, cmd->data_length);
|
2017-04-12 05:21:47 +00:00
|
|
|
kunmap(sg_page(sg));
|
2016-02-24 19:56:33 +00:00
|
|
|
|
2018-04-17 15:33:21 +00:00
|
|
|
if (not_zero)
|
2017-04-12 05:21:47 +00:00
|
|
|
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
|
2016-02-24 19:56:33 +00:00
|
|
|
|
2017-04-12 05:21:47 +00:00
|
|
|
ret = blkdev_issue_zeroout(bdev,
|
2016-02-24 19:56:33 +00:00
|
|
|
target_to_linux_sector(dev, cmd->t_task_lba),
|
|
|
|
target_to_linux_sector(dev,
|
|
|
|
sbc_get_write_same_sectors(cmd)),
|
2020-04-19 16:31:09 +00:00
|
|
|
GFP_KERNEL, BLKDEV_ZERO_NOUNMAP);
|
2016-02-24 19:56:33 +00:00
|
|
|
if (ret)
|
|
|
|
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
|
|
|
|
|
|
|
|
target_complete_cmd(cmd, GOOD);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-11-08 04:08:38 +00:00
|
|
|
static sense_reason_t
|
|
|
|
iblock_execute_write_same(struct se_cmd *cmd)
|
|
|
|
{
|
2016-02-24 19:56:33 +00:00
|
|
|
struct block_device *bdev = IBLOCK_DEV(cmd->se_dev)->ibd_bd;
|
2012-11-08 04:08:38 +00:00
|
|
|
struct iblock_req *ibr;
|
|
|
|
struct scatterlist *sg;
|
|
|
|
struct bio *bio;
|
|
|
|
struct bio_list list;
|
2016-01-18 20:09:27 +00: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 04:08:38 +00:00
|
|
|
|
2015-02-14 01:32:11 +00: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 04:08:38 +00: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 05:21:47 +00:00
|
|
|
if (bdev_write_zeroes_sectors(bdev)) {
|
|
|
|
if (!iblock_execute_zero_out(bdev, cmd))
|
|
|
|
return 0;
|
|
|
|
}
|
2016-02-24 19:56:33 +00:00
|
|
|
|
2012-11-08 04:08:38 +00:00
|
|
|
ibr = kzalloc(sizeof(struct iblock_req), GFP_KERNEL);
|
|
|
|
if (!ibr)
|
|
|
|
goto fail;
|
|
|
|
cmd->priv = ibr;
|
|
|
|
|
2016-06-05 19:32:08 +00:00
|
|
|
bio = iblock_get_bio(cmd, block_lba, 1, REQ_OP_WRITE, 0);
|
2012-11-08 04:08:38 +00:00
|
|
|
if (!bio)
|
|
|
|
goto fail_free_ibr;
|
|
|
|
|
|
|
|
bio_list_init(&list);
|
|
|
|
bio_list_add(&list, bio);
|
|
|
|
|
2017-03-06 14:21:11 +00:00
|
|
|
refcount_set(&ibr->pending, 1);
|
2012-11-08 04:08:38 +00:00
|
|
|
|
|
|
|
while (sectors) {
|
|
|
|
while (bio_add_page(bio, sg_page(sg), sg->length, sg->offset)
|
|
|
|
!= sg->length) {
|
|
|
|
|
2016-06-05 19:32:08 +00:00
|
|
|
bio = iblock_get_bio(cmd, block_lba, 1, REQ_OP_WRITE,
|
|
|
|
0);
|
2012-11-08 04:08:38 +00:00
|
|
|
if (!bio)
|
|
|
|
goto fail_put_bios;
|
|
|
|
|
2017-03-06 14:21:11 +00:00
|
|
|
refcount_inc(&ibr->pending);
|
2012-11-08 04:08:38 +00:00
|
|
|
bio_list_add(&list, bio);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Always in 512 byte units for Linux/Block */
|
2018-10-15 15:51:37 +00:00
|
|
|
block_lba += sg->length >> SECTOR_SHIFT;
|
2019-07-02 19:16:38 +00:00
|
|
|
sectors -= sg->length >> SECTOR_SHIFT;
|
2012-11-08 04:08:38 +00:00
|
|
|
}
|
|
|
|
|
2016-06-05 19:31:41 +00:00
|
|
|
iblock_submit_bios(&list);
|
2012-11-08 04:08:38 +00: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 19:11:26 +00:00
|
|
|
enum {
|
2012-06-07 17:38:51 +00: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 19:11:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static match_table_t tokens = {
|
|
|
|
{Opt_udev_path, "udev_path=%s"},
|
2012-06-07 17:38:51 +00: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 19:11:26 +00:00
|
|
|
{Opt_force, "force=%d"},
|
|
|
|
{Opt_err, NULL}
|
|
|
|
};
|
|
|
|
|
2012-10-08 04:03:19 +00: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 19:11:26 +00:00
|
|
|
{
|
2012-10-08 04:03:19 +00:00
|
|
|
struct iblock_dev *ib_dev = IBLOCK_DEV(dev);
|
2011-03-14 11:05:56 +00: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 19:11:26 +00:00
|
|
|
substring_t args[MAX_OPT_ARGS];
|
2011-07-05 22:35:02 +00:00
|
|
|
int ret = 0, token;
|
2012-06-07 17:38:51 +00: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 19:11:26 +00:00
|
|
|
|
|
|
|
opts = kstrdup(page, GFP_KERNEL);
|
|
|
|
if (!opts)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
orig = opts;
|
|
|
|
|
2011-11-23 19:53:17 +00: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 19:11:26 +00:00
|
|
|
if (!*ptr)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
token = match_token(ptr, tokens, args);
|
|
|
|
switch (token) {
|
|
|
|
case Opt_udev_path:
|
|
|
|
if (ib_dev->ibd_bd) {
|
2011-06-08 17:36:43 +00: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 19:11:26 +00:00
|
|
|
" ib_dev->ibd_bd exists\n");
|
|
|
|
ret = -EEXIST;
|
|
|
|
goto out;
|
|
|
|
}
|
2012-08-23 01:45:11 +00:00
|
|
|
if (match_strlcpy(ib_dev->ibd_udev_path, &args[0],
|
|
|
|
SE_UDEV_PATH_LEN) == 0) {
|
|
|
|
ret = -EINVAL;
|
2011-03-14 11:05:56 +00:00
|
|
|
break;
|
|
|
|
}
|
2011-06-08 17:36:43 +00: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 19:11:26 +00:00
|
|
|
ib_dev->ibd_udev_path);
|
|
|
|
ib_dev->ibd_flags |= IBDF_HAS_UDEV_PATH;
|
|
|
|
break;
|
2012-06-07 17:38:51 +00:00
|
|
|
case Opt_readonly:
|
|
|
|
arg_p = match_strdup(&args[0]);
|
|
|
|
if (!arg_p) {
|
|
|
|
ret = -ENOMEM;
|
|
|
|
break;
|
|
|
|
}
|
2013-07-19 07:22:19 +00:00
|
|
|
ret = kstrtoul(arg_p, 0, &tmp_readonly);
|
2012-06-07 17:38:51 +00:00
|
|
|
kfree(arg_p);
|
|
|
|
if (ret < 0) {
|
2013-07-19 07:22:19 +00:00
|
|
|
pr_err("kstrtoul() failed for"
|
2012-06-07 17:38:51 +00: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 19:11:26 +00:00
|
|
|
case Opt_force:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
out:
|
|
|
|
kfree(orig);
|
|
|
|
return (!ret) ? count : ret;
|
|
|
|
}
|
|
|
|
|
2012-10-08 04:03:19 +00: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 19:11:26 +00:00
|
|
|
{
|
2012-10-08 04:03:19 +00: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 19:11:26 +00:00
|
|
|
char buf[BDEVNAME_SIZE];
|
|
|
|
ssize_t bl = 0;
|
|
|
|
|
|
|
|
if (bd)
|
|
|
|
bl += sprintf(b + bl, "iBlock device: %s",
|
|
|
|
bdevname(bd, buf));
|
2012-10-08 04:03:19 +00:00
|
|
|
if (ib_dev->ibd_flags & IBDF_HAS_UDEV_PATH)
|
2012-06-07 17:38:51 +00:00
|
|
|
bl += sprintf(b + bl, " UDEV PATH: %s",
|
2012-10-08 04:03:19 +00: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 19:11:26 +00:00
|
|
|
|
|
|
|
bl += sprintf(b + bl, " ");
|
|
|
|
if (bd) {
|
|
|
|
bl += sprintf(b + bl, "Major: %d Minor: %d %s\n",
|
2020-09-03 05:41:02 +00:00
|
|
|
MAJOR(bd->bd_dev), MINOR(bd->bd_dev),
|
|
|
|
"CLAIMED: IBLOCK");
|
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 19:11:26 +00:00
|
|
|
} else {
|
2011-07-05 22:35:02 +00: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 19:11:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return bl;
|
|
|
|
}
|
|
|
|
|
2013-12-23 20:31:24 +00:00
|
|
|
static int
|
2018-09-04 17:19:10 +00:00
|
|
|
iblock_alloc_bip(struct se_cmd *cmd, struct bio *bio,
|
|
|
|
struct sg_mapping_iter *miter)
|
2013-12-23 20:31:24 +00:00
|
|
|
{
|
|
|
|
struct se_device *dev = cmd->se_dev;
|
|
|
|
struct blk_integrity *bi;
|
|
|
|
struct bio_integrity_payload *bip;
|
|
|
|
struct iblock_dev *ib_dev = IBLOCK_DEV(dev);
|
2018-09-04 17:19:10 +00:00
|
|
|
int rc;
|
|
|
|
size_t resid, len;
|
2013-12-23 20:31:24 +00:00
|
|
|
|
|
|
|
bi = bdev_get_integrity(ib_dev->ibd_bd);
|
|
|
|
if (!bi) {
|
|
|
|
pr_err("Unable to locate bio_integrity\n");
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
2021-01-29 04:38:57 +00:00
|
|
|
bip = bio_integrity_alloc(bio, GFP_NOIO, bio_max_segs(cmd->t_prot_nents));
|
2015-12-03 16:32:21 +00:00
|
|
|
if (IS_ERR(bip)) {
|
2013-12-23 20:31:24 +00:00
|
|
|
pr_err("Unable to allocate bio_integrity_payload\n");
|
2015-12-03 16:32:21 +00:00
|
|
|
return PTR_ERR(bip);
|
2013-12-23 20:31:24 +00:00
|
|
|
}
|
|
|
|
|
2018-09-04 17:19:10 +00:00
|
|
|
bip->bip_iter.bi_size = bio_integrity_bytes(bi, bio_sectors(bio));
|
2019-12-11 15:36:02 +00:00
|
|
|
/* virtual start sector must be in integrity interval units */
|
|
|
|
bip_set_seed(bip, bio->bi_iter.bi_sector >>
|
|
|
|
(bi->interval_exp - SECTOR_SHIFT));
|
2013-12-23 20:31:24 +00:00
|
|
|
|
2014-01-31 23:31:23 +00: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-23 20:31:24 +00:00
|
|
|
|
2018-09-04 17:19:10 +00:00
|
|
|
resid = bip->bip_iter.bi_size;
|
|
|
|
while (resid > 0 && sg_miter_next(miter)) {
|
2013-12-23 20:31:24 +00:00
|
|
|
|
2018-09-04 17:19:10 +00:00
|
|
|
len = min_t(size_t, miter->length, resid);
|
|
|
|
rc = bio_integrity_add_page(bio, miter->page, len,
|
|
|
|
offset_in_page(miter->addr));
|
|
|
|
if (rc != len) {
|
2013-12-23 20:31:24 +00:00
|
|
|
pr_err("bio_integrity_add_page() failed; %d\n", rc);
|
2018-09-04 17:19:10 +00:00
|
|
|
sg_miter_stop(miter);
|
2013-12-23 20:31:24 +00:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
2018-09-04 17:19:10 +00:00
|
|
|
pr_debug("Added bio integrity page: %p length: %zu offset: %lu\n",
|
|
|
|
miter->page, len, offset_in_page(miter->addr));
|
|
|
|
|
|
|
|
resid -= len;
|
|
|
|
if (len < miter->length)
|
|
|
|
miter->consumed -= miter->length - len;
|
2013-12-23 20:31:24 +00:00
|
|
|
}
|
2018-09-04 17:19:10 +00:00
|
|
|
sg_miter_stop(miter);
|
2013-12-23 20:31:24 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-11-06 20:24:09 +00:00
|
|
|
static sense_reason_t
|
2013-08-20 06:57:30 +00: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 19:11:26 +00:00
|
|
|
{
|
2011-07-19 10:26:37 +00:00
|
|
|
struct se_device *dev = cmd->se_dev;
|
2016-01-18 20:09:27 +00:00
|
|
|
sector_t block_lba = target_to_linux_sector(dev, cmd->t_task_lba);
|
2012-04-24 04:25:06 +00:00
|
|
|
struct iblock_req *ibr;
|
2018-09-04 17:19:10 +00:00
|
|
|
struct bio *bio;
|
2011-09-25 18:56:24 +00: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 19:11:26 +00:00
|
|
|
struct scatterlist *sg;
|
2012-04-24 04:25:06 +00:00
|
|
|
u32 sg_num = sgl_nents;
|
2011-12-21 19:20:31 +00:00
|
|
|
unsigned bio_cnt;
|
2018-09-04 17:19:10 +00:00
|
|
|
int i, rc, op, op_flags = 0;
|
|
|
|
struct sg_mapping_iter prot_miter;
|
2011-09-25 18:56:24 +00:00
|
|
|
|
2012-04-24 04:25:06 +00:00
|
|
|
if (data_direction == DMA_TO_DEVICE) {
|
2013-01-30 06:10:06 +00:00
|
|
|
struct iblock_dev *ib_dev = IBLOCK_DEV(dev);
|
|
|
|
struct request_queue *q = bdev_get_queue(ib_dev->ibd_bd);
|
2011-09-25 18:56:24 +00:00
|
|
|
/*
|
2016-11-01 13:40:10 +00:00
|
|
|
* Force writethrough using REQ_FUA if a volatile write cache
|
2013-01-30 06:10:06 +00:00
|
|
|
* is not enabled, or if initiator set the Force Unit Access bit.
|
2011-09-25 18:56:24 +00:00
|
|
|
*/
|
2016-06-05 19:32:08 +00:00
|
|
|
op = REQ_OP_WRITE;
|
2016-04-13 19:33:19 +00:00
|
|
|
if (test_bit(QUEUE_FLAG_FUA, &q->queue_flags)) {
|
2013-01-30 06:10:06 +00:00
|
|
|
if (cmd->se_cmd_flags & SCF_FUA)
|
2016-11-01 13:40:10 +00:00
|
|
|
op_flags = REQ_FUA;
|
2016-04-13 19:33:19 +00:00
|
|
|
else if (!test_bit(QUEUE_FLAG_WC, &q->queue_flags))
|
2016-11-01 13:40:10 +00:00
|
|
|
op_flags = REQ_FUA;
|
2013-01-30 06:10:06 +00:00
|
|
|
}
|
2011-09-25 18:56:24 +00:00
|
|
|
} else {
|
2016-06-05 19:32:08 +00:00
|
|
|
op = REQ_OP_READ;
|
2011-09-25 18:56:24 +00:00
|
|
|
}
|
|
|
|
|
2012-04-24 04:25:06 +00:00
|
|
|
ibr = kzalloc(sizeof(struct iblock_req), GFP_KERNEL);
|
|
|
|
if (!ibr)
|
|
|
|
goto fail;
|
|
|
|
cmd->priv = ibr;
|
|
|
|
|
2012-09-07 15:30:41 +00:00
|
|
|
if (!sgl_nents) {
|
2017-03-06 14:21:11 +00:00
|
|
|
refcount_set(&ibr->pending, 1);
|
2012-09-07 15:30:41 +00:00
|
|
|
iblock_complete_cmd(cmd);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-06-05 19:32:08 +00:00
|
|
|
bio = iblock_get_bio(cmd, block_lba, sgl_nents, op, op_flags);
|
2012-04-24 04:25:06 +00:00
|
|
|
if (!bio)
|
|
|
|
goto fail_free_ibr;
|
2011-09-25 18:56:24 +00:00
|
|
|
|
|
|
|
bio_list_init(&list);
|
|
|
|
bio_list_add(&list, bio);
|
2012-04-24 04:25:06 +00:00
|
|
|
|
2017-03-06 14:21:11 +00:00
|
|
|
refcount_set(&ibr->pending, 2);
|
2011-12-21 19:20:31 +00: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 19:11:26 +00:00
|
|
|
|
2018-09-04 17:19:10 +00:00
|
|
|
if (cmd->prot_type && dev->dev_attrib.pi_prot_type)
|
|
|
|
sg_miter_start(&prot_miter, cmd->t_prot_sg, cmd->t_prot_nents,
|
|
|
|
op == REQ_OP_READ ? SG_MITER_FROM_SG :
|
|
|
|
SG_MITER_TO_SG);
|
|
|
|
|
2012-04-24 04:25:06 +00:00
|
|
|
for_each_sg(sgl, sg, sgl_nents, i) {
|
2011-09-25 18:56:24 +00: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) {
|
2018-09-04 17:19:10 +00:00
|
|
|
if (cmd->prot_type && dev->dev_attrib.pi_prot_type) {
|
|
|
|
rc = iblock_alloc_bip(cmd, bio, &prot_miter);
|
|
|
|
if (rc)
|
|
|
|
goto fail_put_bios;
|
|
|
|
}
|
|
|
|
|
2011-12-21 19:20:31 +00:00
|
|
|
if (bio_cnt >= IBLOCK_MAX_BIO_PER_TASK) {
|
2016-06-05 19:31:41 +00:00
|
|
|
iblock_submit_bios(&list);
|
2011-12-21 19:20:31 +00:00
|
|
|
bio_cnt = 0;
|
|
|
|
}
|
|
|
|
|
2016-06-05 19:32:08 +00:00
|
|
|
bio = iblock_get_bio(cmd, block_lba, sg_num, op,
|
|
|
|
op_flags);
|
2011-06-08 17:36:43 +00:00
|
|
|
if (!bio)
|
2012-04-24 04:25:06 +00:00
|
|
|
goto fail_put_bios;
|
|
|
|
|
2017-03-06 14:21:11 +00:00
|
|
|
refcount_inc(&ibr->pending);
|
2011-09-25 18:56:24 +00:00
|
|
|
bio_list_add(&list, bio);
|
2011-12-21 19:20:31 +00: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 19:11:26 +00:00
|
|
|
}
|
2011-09-25 18:56:24 +00:00
|
|
|
|
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 19:11:26 +00:00
|
|
|
/* Always in 512 byte units for Linux/Block */
|
2018-10-15 15:51:37 +00:00
|
|
|
block_lba += sg->length >> SECTOR_SHIFT;
|
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the
following feature set:
High-performance, non-blocking, multithreaded architecture with SIMD
support.
Advanced SCSI feature set:
* Persistent Reservations (PRs)
* Asymmetric Logical Unit Assignment (ALUA)
* Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
* Full Error Recovery (ERL=0,1,2)
* Active/active task migration and session continuation (ERL=2)
* Thin LUN provisioning (UNMAP and WRITE_SAMExx)
Multiprotocol target plugins
Storage media independence:
* Virtualization of all storage media; transparent mapping of IO to LUNs
* No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
* Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
Standards compliance:
* Full compliance with IETF (RFC 3720)
* Full implementation of SPC-4 PRs and ALUA
Significant code cleanups done by Christoph Hellwig.
[jejb: fix up for new block bdev exclusive interface. Minor fixes from
Randy Dunlap and Dan Carpenter.]
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-17 19:11:26 +00:00
|
|
|
sg_num--;
|
|
|
|
}
|
|
|
|
|
2015-03-28 06:14:16 +00:00
|
|
|
if (cmd->prot_type && dev->dev_attrib.pi_prot_type) {
|
2018-09-04 17:19:10 +00:00
|
|
|
rc = iblock_alloc_bip(cmd, bio, &prot_miter);
|
2013-12-23 20:31:24 +00:00
|
|
|
if (rc)
|
|
|
|
goto fail_put_bios;
|
|
|
|
}
|
|
|
|
|
2016-06-05 19:31:41 +00:00
|
|
|
iblock_submit_bios(&list);
|
2012-04-24 04:25:06 +00:00
|
|
|
iblock_complete_cmd(cmd);
|
2011-11-04 09:36:16 +00:00
|
|
|
return 0;
|
2011-09-25 18:56:24 +00:00
|
|
|
|
2012-04-24 04:25:06 +00:00
|
|
|
fail_put_bios:
|
2011-09-25 18:56:24 +00: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 19:11:26 +00:00
|
|
|
bio_put(bio);
|
2012-04-24 04:25:06 +00:00
|
|
|
fail_free_ibr:
|
|
|
|
kfree(ibr);
|
|
|
|
fail:
|
2012-11-06 20:24:09 +00: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 19:11:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static sector_t iblock_get_blocks(struct se_device *dev)
|
|
|
|
{
|
2012-10-08 04:03:19 +00: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 19:11:26 +00:00
|
|
|
struct request_queue *q = bdev_get_queue(bd);
|
|
|
|
|
|
|
|
return iblock_emulate_read_cap_with_block_size(dev, bd, q);
|
|
|
|
}
|
|
|
|
|
2013-11-11 16:59:17 +00: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 14:55:50 +00:00
|
|
|
static struct sbc_ops iblock_sbc_ops = {
|
2012-06-17 22:40:52 +00:00
|
|
|
.execute_rw = iblock_execute_rw,
|
2012-06-17 22:40:53 +00:00
|
|
|
.execute_sync_cache = iblock_execute_sync_cache,
|
2012-06-17 22:40:54 +00:00
|
|
|
.execute_write_same = iblock_execute_write_same,
|
2012-06-17 22:40:55 +00:00
|
|
|
.execute_unmap = iblock_execute_unmap,
|
2012-06-17 22:40:52 +00:00
|
|
|
};
|
|
|
|
|
2012-11-06 20:24:09 +00:00
|
|
|
static sense_reason_t
|
|
|
|
iblock_parse_cdb(struct se_cmd *cmd)
|
2012-06-17 22:40:52 +00:00
|
|
|
{
|
2012-10-07 14:55:50 +00:00
|
|
|
return sbc_parse_cdb(cmd, &iblock_sbc_ops);
|
2012-06-17 22:40:52 +00:00
|
|
|
}
|
|
|
|
|
2013-12-18 18:26:44 +00:00
|
|
|
static bool iblock_get_write_cache(struct se_device *dev)
|
2013-01-30 06:10:06 +00: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 19:33:19 +00:00
|
|
|
return test_bit(QUEUE_FLAG_WC, &q->queue_flags);
|
2013-01-30 06:10:06 +00:00
|
|
|
}
|
|
|
|
|
2015-05-10 16:14:56 +00: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 19:11:26 +00:00
|
|
|
.name = "iblock",
|
2012-10-08 04:03:19 +00: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 19:11:26 +00:00
|
|
|
.owner = THIS_MODULE,
|
|
|
|
.attach_hba = iblock_attach_hba,
|
|
|
|
.detach_hba = iblock_detach_hba,
|
2012-10-08 04:03:19 +00:00
|
|
|
.alloc_device = iblock_alloc_device,
|
|
|
|
.configure_device = iblock_configure_device,
|
2017-06-23 06:18:12 +00: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 19:11:26 +00:00
|
|
|
.free_device = iblock_free_device,
|
2012-06-17 22:40:52 +00: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 19:11:26 +00:00
|
|
|
.set_configfs_dev_params = iblock_set_configfs_dev_params,
|
|
|
|
.show_configfs_dev_params = iblock_show_configfs_dev_params,
|
2012-10-07 14:55:53 +00: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 19:11:26 +00:00
|
|
|
.get_blocks = iblock_get_blocks,
|
2013-11-11 16:59:17 +00: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 06:10:06 +00:00
|
|
|
.get_write_cache = iblock_get_write_cache,
|
2015-05-10 16:14:57 +00: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 19:11:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static int __init iblock_module_init(void)
|
|
|
|
{
|
2015-05-10 16:14:56 +00: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 19:11:26 +00:00
|
|
|
}
|
|
|
|
|
2013-02-27 04:50:56 +00: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 19:11:26 +00:00
|
|
|
{
|
2015-05-10 16:14:56 +00: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 19:11:26 +00: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);
|