提交 72f96e0e 编写于 作者: L Linus Torvalds

Merge branch 'for-linus-core' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending

* 'for-linus-core' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (38 commits)
  target: Bump version to v4.1.0-rc1-ml
  target: remove custom hex2bin() implementation
  target: fix typo Assoication -> Association
  target: Update QUEUE ALGORITHM MODIFIER control page default
  target: ->map_task_SG conversion to ->map_control_SG and ->map_data_SG
  target: Follow up core updates from AGrover and HCH (round 4)
  target: Eliminate usage of struct se_mem
  target: Pass 2nd param of transport_split_cdb by value
  target: Enforce 1 page max for control cdb buffer sizes
  target: Make all control CDBs scatter-gather
  target: Implement Block Device Characteristics VPD page
  target: Fix reporting of supported VPD pages
  target: Allow for built-in target modules
  tcm_fc: Convert to wake_up_process and schedule_timeout_interruptible
  tcm_fc: Makefile cleanups
  loopback: Fix memory leak in tcm_loop_make_scsi_hba()
  loopback: Remove duplicate scsi/scsi_tcq.h include
  loopback: off by one in tcm_loop_make_naa_tpg()
  target/iblock: Remove unused iblock_dev members
  target/iblock: Use request_queue->nr_request for se_device defaults
  ...
...@@ -3,9 +3,3 @@ config LOOPBACK_TARGET ...@@ -3,9 +3,3 @@ config LOOPBACK_TARGET
help help
Say Y here to enable the TCM Virtual SAS target and Linux/SCSI LLD Say Y here to enable the TCM Virtual SAS target and Linux/SCSI LLD
fabric loopback module. fabric loopback module.
config LOOPBACK_TARGET_CDB_DEBUG
bool "TCM loopback fabric module CDB debug code"
depends on LOOPBACK_TARGET
help
Say Y here to enable the TCM loopback fabric module CDB debug code
此差异已折叠。
...@@ -16,12 +16,6 @@ ...@@ -16,12 +16,6 @@
*/ */
#define TL_SCSI_MAX_CMD_LEN 32 #define TL_SCSI_MAX_CMD_LEN 32
#ifdef CONFIG_LOOPBACK_TARGET_CDB_DEBUG
# define TL_CDB_DEBUG(x...) printk(KERN_INFO x)
#else
# define TL_CDB_DEBUG(x...)
#endif
struct tcm_loop_cmd { struct tcm_loop_cmd {
/* State of Linux/SCSI CDB+Data descriptor */ /* State of Linux/SCSI CDB+Data descriptor */
u32 sc_cmd_state; u32 sc_cmd_state;
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
...@@ -60,7 +60,7 @@ static void target_fabric_setup_##_name##_cit(struct target_fabric_configfs *tf) ...@@ -60,7 +60,7 @@ static void target_fabric_setup_##_name##_cit(struct target_fabric_configfs *tf)
cit->ct_group_ops = _group_ops; \ cit->ct_group_ops = _group_ops; \
cit->ct_attrs = _attrs; \ cit->ct_attrs = _attrs; \
cit->ct_owner = tf->tf_module; \ cit->ct_owner = tf->tf_module; \
printk("Setup generic %s\n", __stringify(_name)); \ pr_debug("Setup generic %s\n", __stringify(_name)); \
} }
/* Start of tfc_tpg_mappedlun_cit */ /* Start of tfc_tpg_mappedlun_cit */
...@@ -80,8 +80,8 @@ static int target_fabric_mappedlun_link( ...@@ -80,8 +80,8 @@ static int target_fabric_mappedlun_link(
/* /*
* Ensure that the source port exists * Ensure that the source port exists
*/ */
if (!(lun->lun_sep) || !(lun->lun_sep->sep_tpg)) { if (!lun->lun_sep || !lun->lun_sep->sep_tpg) {
printk(KERN_ERR "Source se_lun->lun_sep or lun->lun_sep->sep" pr_err("Source se_lun->lun_sep or lun->lun_sep->sep"
"_tpg does not exist\n"); "_tpg does not exist\n");
return -EINVAL; return -EINVAL;
} }
...@@ -96,12 +96,12 @@ static int target_fabric_mappedlun_link( ...@@ -96,12 +96,12 @@ static int target_fabric_mappedlun_link(
* Make sure the SymLink is going to the same $FABRIC/$WWN/tpgt_$TPGT * Make sure the SymLink is going to the same $FABRIC/$WWN/tpgt_$TPGT
*/ */
if (strcmp(config_item_name(wwn_ci), config_item_name(wwn_ci_s))) { if (strcmp(config_item_name(wwn_ci), config_item_name(wwn_ci_s))) {
printk(KERN_ERR "Illegal Initiator ACL SymLink outside of %s\n", pr_err("Illegal Initiator ACL SymLink outside of %s\n",
config_item_name(wwn_ci)); config_item_name(wwn_ci));
return -EINVAL; return -EINVAL;
} }
if (strcmp(config_item_name(tpg_ci), config_item_name(tpg_ci_s))) { if (strcmp(config_item_name(tpg_ci), config_item_name(tpg_ci_s))) {
printk(KERN_ERR "Illegal Initiator ACL Symlink outside of %s" pr_err("Illegal Initiator ACL Symlink outside of %s"
" TPGT: %s\n", config_item_name(wwn_ci), " TPGT: %s\n", config_item_name(wwn_ci),
config_item_name(tpg_ci)); config_item_name(tpg_ci));
return -EINVAL; return -EINVAL;
...@@ -118,7 +118,7 @@ static int target_fabric_mappedlun_link( ...@@ -118,7 +118,7 @@ static int target_fabric_mappedlun_link(
lun_access = deve->lun_flags; lun_access = deve->lun_flags;
else else
lun_access = lun_access =
(TPG_TFO(se_tpg)->tpg_check_prod_mode_write_protect( (se_tpg->se_tpg_tfo->tpg_check_prod_mode_write_protect(
se_tpg)) ? TRANSPORT_LUNFLAGS_READ_ONLY : se_tpg)) ? TRANSPORT_LUNFLAGS_READ_ONLY :
TRANSPORT_LUNFLAGS_READ_WRITE; TRANSPORT_LUNFLAGS_READ_WRITE;
spin_unlock_irq(&lacl->se_lun_nacl->device_list_lock); spin_unlock_irq(&lacl->se_lun_nacl->device_list_lock);
...@@ -147,7 +147,7 @@ static int target_fabric_mappedlun_unlink( ...@@ -147,7 +147,7 @@ static int target_fabric_mappedlun_unlink(
/* /*
* Determine if the underlying MappedLUN has already been released.. * Determine if the underlying MappedLUN has already been released..
*/ */
if (!(deve->se_lun)) if (!deve->se_lun)
return 0; return 0;
lun = container_of(to_config_group(lun_ci), struct se_lun, lun_group); lun = container_of(to_config_group(lun_ci), struct se_lun, lun_group);
...@@ -202,9 +202,9 @@ static ssize_t target_fabric_mappedlun_store_write_protect( ...@@ -202,9 +202,9 @@ static ssize_t target_fabric_mappedlun_store_write_protect(
TRANSPORT_LUNFLAGS_READ_WRITE, TRANSPORT_LUNFLAGS_READ_WRITE,
lacl->se_lun_nacl); lacl->se_lun_nacl);
printk(KERN_INFO "%s_ConfigFS: Changed Initiator ACL: %s" pr_debug("%s_ConfigFS: Changed Initiator ACL: %s"
" Mapped LUN: %u Write Protect bit to %s\n", " Mapped LUN: %u Write Protect bit to %s\n",
TPG_TFO(se_tpg)->get_fabric_name(), se_tpg->se_tpg_tfo->get_fabric_name(),
lacl->initiatorname, lacl->mapped_lun, (op) ? "ON" : "OFF"); lacl->initiatorname, lacl->mapped_lun, (op) ? "ON" : "OFF");
return count; return count;
...@@ -327,14 +327,14 @@ static struct config_group *target_fabric_make_mappedlun( ...@@ -327,14 +327,14 @@ static struct config_group *target_fabric_make_mappedlun(
int ret = 0; int ret = 0;
acl_ci = &group->cg_item; acl_ci = &group->cg_item;
if (!(acl_ci)) { if (!acl_ci) {
printk(KERN_ERR "Unable to locatel acl_ci\n"); pr_err("Unable to locatel acl_ci\n");
return NULL; return NULL;
} }
buf = kzalloc(strlen(name) + 1, GFP_KERNEL); buf = kzalloc(strlen(name) + 1, GFP_KERNEL);
if (!(buf)) { if (!buf) {
printk(KERN_ERR "Unable to allocate memory for name buf\n"); pr_err("Unable to allocate memory for name buf\n");
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
snprintf(buf, strlen(name) + 1, "%s", name); snprintf(buf, strlen(name) + 1, "%s", name);
...@@ -342,7 +342,7 @@ static struct config_group *target_fabric_make_mappedlun( ...@@ -342,7 +342,7 @@ static struct config_group *target_fabric_make_mappedlun(
* Make sure user is creating iscsi/$IQN/$TPGT/acls/$INITIATOR/lun_$ID. * Make sure user is creating iscsi/$IQN/$TPGT/acls/$INITIATOR/lun_$ID.
*/ */
if (strstr(buf, "lun_") != buf) { if (strstr(buf, "lun_") != buf) {
printk(KERN_ERR "Unable to locate \"lun_\" from buf: %s" pr_err("Unable to locate \"lun_\" from buf: %s"
" name: %s\n", buf, name); " name: %s\n", buf, name);
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
...@@ -358,7 +358,7 @@ static struct config_group *target_fabric_make_mappedlun( ...@@ -358,7 +358,7 @@ static struct config_group *target_fabric_make_mappedlun(
lacl = core_dev_init_initiator_node_lun_acl(se_tpg, mapped_lun, lacl = core_dev_init_initiator_node_lun_acl(se_tpg, mapped_lun,
config_item_name(acl_ci), &ret); config_item_name(acl_ci), &ret);
if (!(lacl)) { if (!lacl) {
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
...@@ -367,7 +367,7 @@ static struct config_group *target_fabric_make_mappedlun( ...@@ -367,7 +367,7 @@ static struct config_group *target_fabric_make_mappedlun(
lacl_cg->default_groups = kzalloc(sizeof(struct config_group) * 2, lacl_cg->default_groups = kzalloc(sizeof(struct config_group) * 2,
GFP_KERNEL); GFP_KERNEL);
if (!lacl_cg->default_groups) { if (!lacl_cg->default_groups) {
printk(KERN_ERR "Unable to allocate lacl_cg->default_groups\n"); pr_err("Unable to allocate lacl_cg->default_groups\n");
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
} }
...@@ -379,11 +379,11 @@ static struct config_group *target_fabric_make_mappedlun( ...@@ -379,11 +379,11 @@ static struct config_group *target_fabric_make_mappedlun(
lacl_cg->default_groups[0] = &lacl->ml_stat_grps.stat_group; lacl_cg->default_groups[0] = &lacl->ml_stat_grps.stat_group;
lacl_cg->default_groups[1] = NULL; lacl_cg->default_groups[1] = NULL;
ml_stat_grp = &ML_STAT_GRPS(lacl)->stat_group; ml_stat_grp = &lacl->ml_stat_grps.stat_group;
ml_stat_grp->default_groups = kzalloc(sizeof(struct config_group) * 3, ml_stat_grp->default_groups = kzalloc(sizeof(struct config_group) * 3,
GFP_KERNEL); GFP_KERNEL);
if (!ml_stat_grp->default_groups) { if (!ml_stat_grp->default_groups) {
printk(KERN_ERR "Unable to allocate ml_stat_grp->default_groups\n"); pr_err("Unable to allocate ml_stat_grp->default_groups\n");
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
} }
...@@ -408,7 +408,7 @@ static void target_fabric_drop_mappedlun( ...@@ -408,7 +408,7 @@ static void target_fabric_drop_mappedlun(
struct config_group *lacl_cg = NULL, *ml_stat_grp = NULL; struct config_group *lacl_cg = NULL, *ml_stat_grp = NULL;
int i; int i;
ml_stat_grp = &ML_STAT_GRPS(lacl)->stat_group; ml_stat_grp = &lacl->ml_stat_grps.stat_group;
for (i = 0; ml_stat_grp->default_groups[i]; i++) { for (i = 0; ml_stat_grp->default_groups[i]; i++) {
df_item = &ml_stat_grp->default_groups[i]->cg_item; df_item = &ml_stat_grp->default_groups[i]->cg_item;
ml_stat_grp->default_groups[i] = NULL; ml_stat_grp->default_groups[i] = NULL;
...@@ -474,8 +474,8 @@ static struct config_group *target_fabric_make_nodeacl( ...@@ -474,8 +474,8 @@ static struct config_group *target_fabric_make_nodeacl(
struct se_node_acl *se_nacl; struct se_node_acl *se_nacl;
struct config_group *nacl_cg; struct config_group *nacl_cg;
if (!(tf->tf_ops.fabric_make_nodeacl)) { if (!tf->tf_ops.fabric_make_nodeacl) {
printk(KERN_ERR "tf->tf_ops.fabric_make_nodeacl is NULL\n"); pr_err("tf->tf_ops.fabric_make_nodeacl is NULL\n");
return ERR_PTR(-ENOSYS); return ERR_PTR(-ENOSYS);
} }
...@@ -572,13 +572,13 @@ static struct config_group *target_fabric_make_np( ...@@ -572,13 +572,13 @@ static struct config_group *target_fabric_make_np(
struct target_fabric_configfs *tf = se_tpg->se_tpg_wwn->wwn_tf; struct target_fabric_configfs *tf = se_tpg->se_tpg_wwn->wwn_tf;
struct se_tpg_np *se_tpg_np; struct se_tpg_np *se_tpg_np;
if (!(tf->tf_ops.fabric_make_np)) { if (!tf->tf_ops.fabric_make_np) {
printk(KERN_ERR "tf->tf_ops.fabric_make_np is NULL\n"); pr_err("tf->tf_ops.fabric_make_np is NULL\n");
return ERR_PTR(-ENOSYS); return ERR_PTR(-ENOSYS);
} }
se_tpg_np = tf->tf_ops.fabric_make_np(se_tpg, group, name); se_tpg_np = tf->tf_ops.fabric_make_np(se_tpg, group, name);
if (!(se_tpg_np) || IS_ERR(se_tpg_np)) if (!se_tpg_np || IS_ERR(se_tpg_np))
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
se_tpg_np->tpg_np_parent = se_tpg; se_tpg_np->tpg_np_parent = se_tpg;
...@@ -627,10 +627,7 @@ static ssize_t target_fabric_port_show_attr_alua_tg_pt_gp( ...@@ -627,10 +627,7 @@ static ssize_t target_fabric_port_show_attr_alua_tg_pt_gp(
struct se_lun *lun, struct se_lun *lun,
char *page) char *page)
{ {
if (!(lun)) if (!lun || !lun->lun_sep)
return -ENODEV;
if (!(lun->lun_sep))
return -ENODEV; return -ENODEV;
return core_alua_show_tg_pt_gp_info(lun->lun_sep, page); return core_alua_show_tg_pt_gp_info(lun->lun_sep, page);
...@@ -641,10 +638,7 @@ static ssize_t target_fabric_port_store_attr_alua_tg_pt_gp( ...@@ -641,10 +638,7 @@ static ssize_t target_fabric_port_store_attr_alua_tg_pt_gp(
const char *page, const char *page,
size_t count) size_t count)
{ {
if (!(lun)) if (!lun || !lun->lun_sep)
return -ENODEV;
if (!(lun->lun_sep))
return -ENODEV; return -ENODEV;
return core_alua_store_tg_pt_gp_info(lun->lun_sep, page, count); return core_alua_store_tg_pt_gp_info(lun->lun_sep, page, count);
...@@ -659,10 +653,7 @@ static ssize_t target_fabric_port_show_attr_alua_tg_pt_offline( ...@@ -659,10 +653,7 @@ static ssize_t target_fabric_port_show_attr_alua_tg_pt_offline(
struct se_lun *lun, struct se_lun *lun,
char *page) char *page)
{ {
if (!(lun)) if (!lun || !lun->lun_sep)
return -ENODEV;
if (!(lun->lun_sep))
return -ENODEV; return -ENODEV;
return core_alua_show_offline_bit(lun, page); return core_alua_show_offline_bit(lun, page);
...@@ -673,10 +664,7 @@ static ssize_t target_fabric_port_store_attr_alua_tg_pt_offline( ...@@ -673,10 +664,7 @@ static ssize_t target_fabric_port_store_attr_alua_tg_pt_offline(
const char *page, const char *page,
size_t count) size_t count)
{ {
if (!(lun)) if (!lun || !lun->lun_sep)
return -ENODEV;
if (!(lun->lun_sep))
return -ENODEV; return -ENODEV;
return core_alua_store_offline_bit(lun, page, count); return core_alua_store_offline_bit(lun, page, count);
...@@ -691,10 +679,7 @@ static ssize_t target_fabric_port_show_attr_alua_tg_pt_status( ...@@ -691,10 +679,7 @@ static ssize_t target_fabric_port_show_attr_alua_tg_pt_status(
struct se_lun *lun, struct se_lun *lun,
char *page) char *page)
{ {
if (!(lun)) if (!lun || !lun->lun_sep)
return -ENODEV;
if (!(lun->lun_sep))
return -ENODEV; return -ENODEV;
return core_alua_show_secondary_status(lun, page); return core_alua_show_secondary_status(lun, page);
...@@ -705,10 +690,7 @@ static ssize_t target_fabric_port_store_attr_alua_tg_pt_status( ...@@ -705,10 +690,7 @@ static ssize_t target_fabric_port_store_attr_alua_tg_pt_status(
const char *page, const char *page,
size_t count) size_t count)
{ {
if (!(lun)) if (!lun || !lun->lun_sep)
return -ENODEV;
if (!(lun->lun_sep))
return -ENODEV; return -ENODEV;
return core_alua_store_secondary_status(lun, page, count); return core_alua_store_secondary_status(lun, page, count);
...@@ -723,10 +705,7 @@ static ssize_t target_fabric_port_show_attr_alua_tg_pt_write_md( ...@@ -723,10 +705,7 @@ static ssize_t target_fabric_port_show_attr_alua_tg_pt_write_md(
struct se_lun *lun, struct se_lun *lun,
char *page) char *page)
{ {
if (!(lun)) if (!lun || !lun->lun_sep)
return -ENODEV;
if (!(lun->lun_sep))
return -ENODEV; return -ENODEV;
return core_alua_show_secondary_write_metadata(lun, page); return core_alua_show_secondary_write_metadata(lun, page);
...@@ -737,10 +716,7 @@ static ssize_t target_fabric_port_store_attr_alua_tg_pt_write_md( ...@@ -737,10 +716,7 @@ static ssize_t target_fabric_port_store_attr_alua_tg_pt_write_md(
const char *page, const char *page,
size_t count) size_t count)
{ {
if (!(lun)) if (!lun || !lun->lun_sep)
return -ENODEV;
if (!(lun->lun_sep))
return -ENODEV; return -ENODEV;
return core_alua_store_secondary_write_metadata(lun, page, count); return core_alua_store_secondary_write_metadata(lun, page, count);
...@@ -781,13 +757,13 @@ static int target_fabric_port_link( ...@@ -781,13 +757,13 @@ static int target_fabric_port_link(
tf = se_tpg->se_tpg_wwn->wwn_tf; tf = se_tpg->se_tpg_wwn->wwn_tf;
if (lun->lun_se_dev != NULL) { if (lun->lun_se_dev != NULL) {
printk(KERN_ERR "Port Symlink already exists\n"); pr_err("Port Symlink already exists\n");
return -EEXIST; return -EEXIST;
} }
dev = se_dev->se_dev_ptr; dev = se_dev->se_dev_ptr;
if (!(dev)) { if (!dev) {
printk(KERN_ERR "Unable to locate struct se_device pointer from" pr_err("Unable to locate struct se_device pointer from"
" %s\n", config_item_name(se_dev_ci)); " %s\n", config_item_name(se_dev_ci));
ret = -ENODEV; ret = -ENODEV;
goto out; goto out;
...@@ -795,8 +771,8 @@ static int target_fabric_port_link( ...@@ -795,8 +771,8 @@ static int target_fabric_port_link(
lun_p = core_dev_add_lun(se_tpg, dev->se_hba, dev, lun_p = core_dev_add_lun(se_tpg, dev->se_hba, dev,
lun->unpacked_lun); lun->unpacked_lun);
if ((IS_ERR(lun_p)) || !(lun_p)) { if (IS_ERR(lun_p) || !lun_p) {
printk(KERN_ERR "core_dev_add_lun() failed\n"); pr_err("core_dev_add_lun() failed\n");
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
...@@ -888,7 +864,7 @@ static struct config_group *target_fabric_make_lun( ...@@ -888,7 +864,7 @@ static struct config_group *target_fabric_make_lun(
int errno; int errno;
if (strstr(name, "lun_") != name) { if (strstr(name, "lun_") != name) {
printk(KERN_ERR "Unable to locate \'_\" in" pr_err("Unable to locate \'_\" in"
" \"lun_$LUN_NUMBER\"\n"); " \"lun_$LUN_NUMBER\"\n");
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
...@@ -896,14 +872,14 @@ static struct config_group *target_fabric_make_lun( ...@@ -896,14 +872,14 @@ static struct config_group *target_fabric_make_lun(
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
lun = core_get_lun_from_tpg(se_tpg, unpacked_lun); lun = core_get_lun_from_tpg(se_tpg, unpacked_lun);
if (!(lun)) if (!lun)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
lun_cg = &lun->lun_group; lun_cg = &lun->lun_group;
lun_cg->default_groups = kzalloc(sizeof(struct config_group) * 2, lun_cg->default_groups = kzalloc(sizeof(struct config_group) * 2,
GFP_KERNEL); GFP_KERNEL);
if (!lun_cg->default_groups) { if (!lun_cg->default_groups) {
printk(KERN_ERR "Unable to allocate lun_cg->default_groups\n"); pr_err("Unable to allocate lun_cg->default_groups\n");
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
...@@ -914,11 +890,11 @@ static struct config_group *target_fabric_make_lun( ...@@ -914,11 +890,11 @@ static struct config_group *target_fabric_make_lun(
lun_cg->default_groups[0] = &lun->port_stat_grps.stat_group; lun_cg->default_groups[0] = &lun->port_stat_grps.stat_group;
lun_cg->default_groups[1] = NULL; lun_cg->default_groups[1] = NULL;
port_stat_grp = &PORT_STAT_GRP(lun)->stat_group; port_stat_grp = &lun->port_stat_grps.stat_group;
port_stat_grp->default_groups = kzalloc(sizeof(struct config_group) * 3, port_stat_grp->default_groups = kzalloc(sizeof(struct config_group) * 3,
GFP_KERNEL); GFP_KERNEL);
if (!port_stat_grp->default_groups) { if (!port_stat_grp->default_groups) {
printk(KERN_ERR "Unable to allocate port_stat_grp->default_groups\n"); pr_err("Unable to allocate port_stat_grp->default_groups\n");
errno = -ENOMEM; errno = -ENOMEM;
goto out; goto out;
} }
...@@ -941,7 +917,7 @@ static void target_fabric_drop_lun( ...@@ -941,7 +917,7 @@ static void target_fabric_drop_lun(
struct config_group *lun_cg, *port_stat_grp; struct config_group *lun_cg, *port_stat_grp;
int i; int i;
port_stat_grp = &PORT_STAT_GRP(lun)->stat_group; port_stat_grp = &lun->port_stat_grps.stat_group;
for (i = 0; port_stat_grp->default_groups[i]; i++) { for (i = 0; port_stat_grp->default_groups[i]; i++) {
df_item = &port_stat_grp->default_groups[i]->cg_item; df_item = &port_stat_grp->default_groups[i]->cg_item;
port_stat_grp->default_groups[i] = NULL; port_stat_grp->default_groups[i] = NULL;
...@@ -1031,13 +1007,13 @@ static struct config_group *target_fabric_make_tpg( ...@@ -1031,13 +1007,13 @@ static struct config_group *target_fabric_make_tpg(
struct target_fabric_configfs *tf = wwn->wwn_tf; struct target_fabric_configfs *tf = wwn->wwn_tf;
struct se_portal_group *se_tpg; struct se_portal_group *se_tpg;
if (!(tf->tf_ops.fabric_make_tpg)) { if (!tf->tf_ops.fabric_make_tpg) {
printk(KERN_ERR "tf->tf_ops.fabric_make_tpg is NULL\n"); pr_err("tf->tf_ops.fabric_make_tpg is NULL\n");
return ERR_PTR(-ENOSYS); return ERR_PTR(-ENOSYS);
} }
se_tpg = tf->tf_ops.fabric_make_tpg(wwn, group, name); se_tpg = tf->tf_ops.fabric_make_tpg(wwn, group, name);
if (!(se_tpg) || IS_ERR(se_tpg)) if (!se_tpg || IS_ERR(se_tpg))
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
/* /*
* Setup default groups from pre-allocated se_tpg->tpg_default_groups * Setup default groups from pre-allocated se_tpg->tpg_default_groups
...@@ -1130,13 +1106,13 @@ static struct config_group *target_fabric_make_wwn( ...@@ -1130,13 +1106,13 @@ static struct config_group *target_fabric_make_wwn(
struct target_fabric_configfs, tf_group); struct target_fabric_configfs, tf_group);
struct se_wwn *wwn; struct se_wwn *wwn;
if (!(tf->tf_ops.fabric_make_wwn)) { if (!tf->tf_ops.fabric_make_wwn) {
printk(KERN_ERR "tf->tf_ops.fabric_make_wwn is NULL\n"); pr_err("tf->tf_ops.fabric_make_wwn is NULL\n");
return ERR_PTR(-ENOSYS); return ERR_PTR(-ENOSYS);
} }
wwn = tf->tf_ops.fabric_make_wwn(tf, group, name); wwn = tf->tf_ops.fabric_make_wwn(tf, group, name);
if (!(wwn) || IS_ERR(wwn)) if (!wwn || IS_ERR(wwn))
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
wwn->wwn_tf = tf; wwn->wwn_tf = tf;
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
* *
******************************************************************************/ ******************************************************************************/
#include <linux/kernel.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
...@@ -61,9 +62,8 @@ u32 sas_get_pr_transport_id( ...@@ -61,9 +62,8 @@ u32 sas_get_pr_transport_id(
int *format_code, int *format_code,
unsigned char *buf) unsigned char *buf)
{ {
unsigned char binary, *ptr; unsigned char *ptr;
int i;
u32 off = 4;
/* /*
* Set PROTOCOL IDENTIFIER to 6h for SAS * Set PROTOCOL IDENTIFIER to 6h for SAS
*/ */
...@@ -74,10 +74,8 @@ u32 sas_get_pr_transport_id( ...@@ -74,10 +74,8 @@ u32 sas_get_pr_transport_id(
*/ */
ptr = &se_nacl->initiatorname[4]; /* Skip over 'naa. prefix */ ptr = &se_nacl->initiatorname[4]; /* Skip over 'naa. prefix */
for (i = 0; i < 16; i += 2) { hex2bin(&buf[4], ptr, 8);
binary = transport_asciihex_to_binaryhex(&ptr[i]);
buf[off++] = binary;
}
/* /*
* The SAS Transport ID is a hardcoded 24-byte length * The SAS Transport ID is a hardcoded 24-byte length
*/ */
...@@ -157,7 +155,7 @@ u32 fc_get_pr_transport_id( ...@@ -157,7 +155,7 @@ u32 fc_get_pr_transport_id(
int *format_code, int *format_code,
unsigned char *buf) unsigned char *buf)
{ {
unsigned char binary, *ptr; unsigned char *ptr;
int i; int i;
u32 off = 8; u32 off = 8;
/* /*
...@@ -172,12 +170,11 @@ u32 fc_get_pr_transport_id( ...@@ -172,12 +170,11 @@ u32 fc_get_pr_transport_id(
ptr = &se_nacl->initiatorname[0]; ptr = &se_nacl->initiatorname[0];
for (i = 0; i < 24; ) { for (i = 0; i < 24; ) {
if (!(strncmp(&ptr[i], ":", 1))) { if (!strncmp(&ptr[i], ":", 1)) {
i++; i++;
continue; continue;
} }
binary = transport_asciihex_to_binaryhex(&ptr[i]); hex2bin(&buf[off++], &ptr[i], 1);
buf[off++] = binary;
i += 2; i += 2;
} }
/* /*
...@@ -386,7 +383,7 @@ char *iscsi_parse_pr_out_transport_id( ...@@ -386,7 +383,7 @@ char *iscsi_parse_pr_out_transport_id(
* Reserved * Reserved
*/ */
if ((format_code != 0x00) && (format_code != 0x40)) { if ((format_code != 0x00) && (format_code != 0x40)) {
printk(KERN_ERR "Illegal format code: 0x%02x for iSCSI" pr_err("Illegal format code: 0x%02x for iSCSI"
" Initiator Transport ID\n", format_code); " Initiator Transport ID\n", format_code);
return NULL; return NULL;
} }
...@@ -406,7 +403,7 @@ char *iscsi_parse_pr_out_transport_id( ...@@ -406,7 +403,7 @@ char *iscsi_parse_pr_out_transport_id(
tid_len += padding; tid_len += padding;
if ((add_len + 4) != tid_len) { if ((add_len + 4) != tid_len) {
printk(KERN_INFO "LIO-Target Extracted add_len: %hu " pr_debug("LIO-Target Extracted add_len: %hu "
"does not match calculated tid_len: %u," "does not match calculated tid_len: %u,"
" using tid_len instead\n", add_len+4, tid_len); " using tid_len instead\n", add_len+4, tid_len);
*out_tid_len = tid_len; *out_tid_len = tid_len;
...@@ -420,8 +417,8 @@ char *iscsi_parse_pr_out_transport_id( ...@@ -420,8 +417,8 @@ char *iscsi_parse_pr_out_transport_id(
*/ */
if (format_code == 0x40) { if (format_code == 0x40) {
p = strstr((char *)&buf[4], ",i,0x"); p = strstr((char *)&buf[4], ",i,0x");
if (!(p)) { if (!p) {
printk(KERN_ERR "Unable to locate \",i,0x\" seperator" pr_err("Unable to locate \",i,0x\" seperator"
" for Initiator port identifier: %s\n", " for Initiator port identifier: %s\n",
(char *)&buf[4]); (char *)&buf[4]);
return NULL; return NULL;
......
此差异已折叠。
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
#define FD_VERSION "4.0" #define FD_VERSION "4.0"
#define FD_MAX_DEV_NAME 256 #define FD_MAX_DEV_NAME 256
/* Maximum queuedepth for the FILEIO HBA */
#define FD_HBA_QUEUE_DEPTH 256
#define FD_DEVICE_QUEUE_DEPTH 32 #define FD_DEVICE_QUEUE_DEPTH 32
#define FD_MAX_DEVICE_QUEUE_DEPTH 128 #define FD_MAX_DEVICE_QUEUE_DEPTH 128
#define FD_BLOCKSIZE 512 #define FD_BLOCKSIZE 512
...@@ -18,8 +16,6 @@ struct fd_request { ...@@ -18,8 +16,6 @@ struct fd_request {
struct se_task fd_task; struct se_task fd_task;
/* SCSI CDB from iSCSI Command PDU */ /* SCSI CDB from iSCSI Command PDU */
unsigned char fd_scsi_cdb[TCM_MAX_COMMAND_SIZE]; unsigned char fd_scsi_cdb[TCM_MAX_COMMAND_SIZE];
/* FILEIO device */
struct fd_dev *fd_dev;
} ____cacheline_aligned; } ____cacheline_aligned;
#define FBDF_HAS_PATH 0x01 #define FBDF_HAS_PATH 0x01
......
/******************************************************************************* /*******************************************************************************
* Filename: target_core_hba.c * Filename: target_core_hba.c
* *
* This file copntains the iSCSI HBA Transport related functions. * This file contains the TCM HBA Transport related functions.
* *
* Copyright (c) 2003, 2004, 2005 PyX Technologies, Inc. * Copyright (c) 2003, 2004, 2005 PyX Technologies, Inc.
* Copyright (c) 2005, 2006, 2007 SBE, Inc. * Copyright (c) 2005, 2006, 2007 SBE, Inc.
...@@ -45,6 +45,11 @@ ...@@ -45,6 +45,11 @@
static LIST_HEAD(subsystem_list); static LIST_HEAD(subsystem_list);
static DEFINE_MUTEX(subsystem_mutex); static DEFINE_MUTEX(subsystem_mutex);
static u32 hba_id_counter;
static DEFINE_SPINLOCK(hba_lock);
static LIST_HEAD(hba_list);
int transport_subsystem_register(struct se_subsystem_api *sub_api) int transport_subsystem_register(struct se_subsystem_api *sub_api)
{ {
struct se_subsystem_api *s; struct se_subsystem_api *s;
...@@ -53,8 +58,8 @@ int transport_subsystem_register(struct se_subsystem_api *sub_api) ...@@ -53,8 +58,8 @@ int transport_subsystem_register(struct se_subsystem_api *sub_api)
mutex_lock(&subsystem_mutex); mutex_lock(&subsystem_mutex);
list_for_each_entry(s, &subsystem_list, sub_api_list) { list_for_each_entry(s, &subsystem_list, sub_api_list) {
if (!(strcmp(s->name, sub_api->name))) { if (!strcmp(s->name, sub_api->name)) {
printk(KERN_ERR "%p is already registered with" pr_err("%p is already registered with"
" duplicate name %s, unable to process" " duplicate name %s, unable to process"
" request\n", s, s->name); " request\n", s, s->name);
mutex_unlock(&subsystem_mutex); mutex_unlock(&subsystem_mutex);
...@@ -64,7 +69,7 @@ int transport_subsystem_register(struct se_subsystem_api *sub_api) ...@@ -64,7 +69,7 @@ int transport_subsystem_register(struct se_subsystem_api *sub_api)
list_add_tail(&sub_api->sub_api_list, &subsystem_list); list_add_tail(&sub_api->sub_api_list, &subsystem_list);
mutex_unlock(&subsystem_mutex); mutex_unlock(&subsystem_mutex);
printk(KERN_INFO "TCM: Registered subsystem plugin: %s struct module:" pr_debug("TCM: Registered subsystem plugin: %s struct module:"
" %p\n", sub_api->name, sub_api->owner); " %p\n", sub_api->name, sub_api->owner);
return 0; return 0;
} }
...@@ -104,21 +109,17 @@ core_alloc_hba(const char *plugin_name, u32 plugin_dep_id, u32 hba_flags) ...@@ -104,21 +109,17 @@ core_alloc_hba(const char *plugin_name, u32 plugin_dep_id, u32 hba_flags)
hba = kzalloc(sizeof(*hba), GFP_KERNEL); hba = kzalloc(sizeof(*hba), GFP_KERNEL);
if (!hba) { if (!hba) {
printk(KERN_ERR "Unable to allocate struct se_hba\n"); pr_err("Unable to allocate struct se_hba\n");
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
INIT_LIST_HEAD(&hba->hba_dev_list); INIT_LIST_HEAD(&hba->hba_dev_list);
spin_lock_init(&hba->device_lock); spin_lock_init(&hba->device_lock);
spin_lock_init(&hba->hba_queue_lock);
mutex_init(&hba->hba_access_mutex); mutex_init(&hba->hba_access_mutex);
hba->hba_index = scsi_get_new_index(SCSI_INST_INDEX); hba->hba_index = scsi_get_new_index(SCSI_INST_INDEX);
hba->hba_flags |= hba_flags; hba->hba_flags |= hba_flags;
atomic_set(&hba->max_queue_depth, 0);
atomic_set(&hba->left_queue_depth, 0);
hba->transport = core_get_backend(plugin_name); hba->transport = core_get_backend(plugin_name);
if (!hba->transport) { if (!hba->transport) {
ret = -EINVAL; ret = -EINVAL;
...@@ -129,12 +130,12 @@ core_alloc_hba(const char *plugin_name, u32 plugin_dep_id, u32 hba_flags) ...@@ -129,12 +130,12 @@ core_alloc_hba(const char *plugin_name, u32 plugin_dep_id, u32 hba_flags)
if (ret < 0) if (ret < 0)
goto out_module_put; goto out_module_put;
spin_lock(&se_global->hba_lock); spin_lock(&hba_lock);
hba->hba_id = se_global->g_hba_id_counter++; hba->hba_id = hba_id_counter++;
list_add_tail(&hba->hba_list, &se_global->g_hba_list); list_add_tail(&hba->hba_node, &hba_list);
spin_unlock(&se_global->hba_lock); spin_unlock(&hba_lock);
printk(KERN_INFO "CORE_HBA[%d] - Attached HBA to Generic Target" pr_debug("CORE_HBA[%d] - Attached HBA to Generic Target"
" Core\n", hba->hba_id); " Core\n", hba->hba_id);
return hba; return hba;
...@@ -156,11 +157,11 @@ core_delete_hba(struct se_hba *hba) ...@@ -156,11 +157,11 @@ core_delete_hba(struct se_hba *hba)
hba->transport->detach_hba(hba); hba->transport->detach_hba(hba);
spin_lock(&se_global->hba_lock); spin_lock(&hba_lock);
list_del(&hba->hba_list); list_del(&hba->hba_node);
spin_unlock(&se_global->hba_lock); spin_unlock(&hba_lock);
printk(KERN_INFO "CORE_HBA[%d] - Detached HBA from Generic Target" pr_debug("CORE_HBA[%d] - Detached HBA from Generic Target"
" Core\n", hba->hba_id); " Core\n", hba->hba_id);
if (hba->transport->owner) if (hba->transport->owner)
......
此差异已折叠。
...@@ -3,9 +3,6 @@ ...@@ -3,9 +3,6 @@
#define IBLOCK_VERSION "4.0" #define IBLOCK_VERSION "4.0"
#define IBLOCK_HBA_QUEUE_DEPTH 512
#define IBLOCK_DEVICE_QUEUE_DEPTH 32
#define IBLOCK_MAX_DEVICE_QUEUE_DEPTH 128
#define IBLOCK_MAX_CDBS 16 #define IBLOCK_MAX_CDBS 16
#define IBLOCK_LBA_SHIFT 9 #define IBLOCK_LBA_SHIFT 9
...@@ -15,18 +12,12 @@ struct iblock_req { ...@@ -15,18 +12,12 @@ struct iblock_req {
atomic_t ib_bio_cnt; atomic_t ib_bio_cnt;
atomic_t ib_bio_err_cnt; atomic_t ib_bio_err_cnt;
struct bio *ib_bio; struct bio *ib_bio;
struct iblock_dev *ib_dev;
} ____cacheline_aligned; } ____cacheline_aligned;
#define IBDF_HAS_UDEV_PATH 0x01 #define IBDF_HAS_UDEV_PATH 0x01
#define IBDF_HAS_FORCE 0x02
struct iblock_dev { struct iblock_dev {
unsigned char ibd_udev_path[SE_UDEV_PATH_LEN]; unsigned char ibd_udev_path[SE_UDEV_PATH_LEN];
int ibd_force;
int ibd_major;
int ibd_minor;
u32 ibd_depth;
u32 ibd_flags; u32 ibd_flags;
struct bio_set *ibd_bio_set; struct bio_set *ibd_bio_set;
struct block_device *ibd_bd; struct block_device *ibd_bd;
......
此差异已折叠。
...@@ -49,7 +49,7 @@ extern int core_pr_dump_initiator_port(struct t10_pr_registration *, ...@@ -49,7 +49,7 @@ extern int core_pr_dump_initiator_port(struct t10_pr_registration *,
char *, u32); char *, u32);
extern int core_scsi2_emulate_crh(struct se_cmd *); extern int core_scsi2_emulate_crh(struct se_cmd *);
extern int core_scsi3_alloc_aptpl_registration( extern int core_scsi3_alloc_aptpl_registration(
struct t10_reservation_template *, u64, struct t10_reservation *, u64,
unsigned char *, unsigned char *, u32, unsigned char *, unsigned char *, u32,
unsigned char *, u16, u32, int, int, u8); unsigned char *, u16, u32, int, int, u8);
extern int core_scsi3_check_aptpl_registration(struct se_device *, extern int core_scsi3_check_aptpl_registration(struct se_device *,
......
此差异已折叠。
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
#define TARGET_CORE_PSCSI_H #define TARGET_CORE_PSCSI_H
#define PSCSI_VERSION "v4.0" #define PSCSI_VERSION "v4.0"
#define PSCSI_VIRTUAL_HBA_DEPTH 2048
/* used in pscsi_find_alloc_len() */ /* used in pscsi_find_alloc_len() */
#ifndef INQUIRY_DATA_SIZE #ifndef INQUIRY_DATA_SIZE
...@@ -24,13 +23,12 @@ ...@@ -24,13 +23,12 @@
struct pscsi_plugin_task { struct pscsi_plugin_task {
struct se_task pscsi_task; struct se_task pscsi_task;
unsigned char *pscsi_cdb;
unsigned char __pscsi_cdb[TCM_MAX_COMMAND_SIZE];
unsigned char pscsi_sense[SCSI_SENSE_BUFFERSIZE]; unsigned char pscsi_sense[SCSI_SENSE_BUFFERSIZE];
int pscsi_direction; int pscsi_direction;
int pscsi_result; int pscsi_result;
u32 pscsi_resid; u32 pscsi_resid;
struct request *pscsi_req; struct request *pscsi_req;
unsigned char pscsi_cdb[0];
} ____cacheline_aligned; } ____cacheline_aligned;
#define PDF_HAS_CHANNEL_ID 0x01 #define PDF_HAS_CHANNEL_ID 0x01
......
此差异已折叠。
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
/* Largest piece of memory kmalloc can allocate */ /* Largest piece of memory kmalloc can allocate */
#define RD_MAX_ALLOCATION_SIZE 65536 #define RD_MAX_ALLOCATION_SIZE 65536
/* Maximum queuedepth for the Ramdisk HBA */
#define RD_HBA_QUEUE_DEPTH 256
#define RD_DEVICE_QUEUE_DEPTH 32 #define RD_DEVICE_QUEUE_DEPTH 32
#define RD_MAX_DEVICE_QUEUE_DEPTH 128 #define RD_MAX_DEVICE_QUEUE_DEPTH 128
#define RD_BLOCKSIZE 512 #define RD_BLOCKSIZE 512
...@@ -34,8 +32,6 @@ struct rd_request { ...@@ -34,8 +32,6 @@ struct rd_request {
u32 rd_page_count; u32 rd_page_count;
/* Scatterlist count */ /* Scatterlist count */
u32 rd_size; u32 rd_size;
/* Ramdisk device */
struct rd_dev *rd_dev;
} ____cacheline_aligned; } ____cacheline_aligned;
struct rd_dev_sg_table { struct rd_dev_sg_table {
......
...@@ -42,13 +42,13 @@ ...@@ -42,13 +42,13 @@
*/ */
void split_cdb_XX_6( void split_cdb_XX_6(
unsigned long long lba, unsigned long long lba,
u32 *sectors, u32 sectors,
unsigned char *cdb) unsigned char *cdb)
{ {
cdb[1] = (lba >> 16) & 0x1f; cdb[1] = (lba >> 16) & 0x1f;
cdb[2] = (lba >> 8) & 0xff; cdb[2] = (lba >> 8) & 0xff;
cdb[3] = lba & 0xff; cdb[3] = lba & 0xff;
cdb[4] = *sectors & 0xff; cdb[4] = sectors & 0xff;
} }
/* split_cdb_XX_10(): /* split_cdb_XX_10():
...@@ -57,11 +57,11 @@ void split_cdb_XX_6( ...@@ -57,11 +57,11 @@ void split_cdb_XX_6(
*/ */
void split_cdb_XX_10( void split_cdb_XX_10(
unsigned long long lba, unsigned long long lba,
u32 *sectors, u32 sectors,
unsigned char *cdb) unsigned char *cdb)
{ {
put_unaligned_be32(lba, &cdb[2]); put_unaligned_be32(lba, &cdb[2]);
put_unaligned_be16(*sectors, &cdb[7]); put_unaligned_be16(sectors, &cdb[7]);
} }
/* split_cdb_XX_12(): /* split_cdb_XX_12():
...@@ -70,11 +70,11 @@ void split_cdb_XX_10( ...@@ -70,11 +70,11 @@ void split_cdb_XX_10(
*/ */
void split_cdb_XX_12( void split_cdb_XX_12(
unsigned long long lba, unsigned long long lba,
u32 *sectors, u32 sectors,
unsigned char *cdb) unsigned char *cdb)
{ {
put_unaligned_be32(lba, &cdb[2]); put_unaligned_be32(lba, &cdb[2]);
put_unaligned_be32(*sectors, &cdb[6]); put_unaligned_be32(sectors, &cdb[6]);
} }
/* split_cdb_XX_16(): /* split_cdb_XX_16():
...@@ -83,11 +83,11 @@ void split_cdb_XX_12( ...@@ -83,11 +83,11 @@ void split_cdb_XX_12(
*/ */
void split_cdb_XX_16( void split_cdb_XX_16(
unsigned long long lba, unsigned long long lba,
u32 *sectors, u32 sectors,
unsigned char *cdb) unsigned char *cdb)
{ {
put_unaligned_be64(lba, &cdb[2]); put_unaligned_be64(lba, &cdb[2]);
put_unaligned_be32(*sectors, &cdb[10]); put_unaligned_be32(sectors, &cdb[10]);
} }
/* /*
...@@ -97,9 +97,9 @@ void split_cdb_XX_16( ...@@ -97,9 +97,9 @@ void split_cdb_XX_16(
*/ */
void split_cdb_XX_32( void split_cdb_XX_32(
unsigned long long lba, unsigned long long lba,
u32 *sectors, u32 sectors,
unsigned char *cdb) unsigned char *cdb)
{ {
put_unaligned_be64(lba, &cdb[12]); put_unaligned_be64(lba, &cdb[12]);
put_unaligned_be32(*sectors, &cdb[28]); put_unaligned_be32(sectors, &cdb[28]);
} }
#ifndef TARGET_CORE_SCDB_H #ifndef TARGET_CORE_SCDB_H
#define TARGET_CORE_SCDB_H #define TARGET_CORE_SCDB_H
extern void split_cdb_XX_6(unsigned long long, u32 *, unsigned char *); extern void split_cdb_XX_6(unsigned long long, u32, unsigned char *);
extern void split_cdb_XX_10(unsigned long long, u32 *, unsigned char *); extern void split_cdb_XX_10(unsigned long long, u32, unsigned char *);
extern void split_cdb_XX_12(unsigned long long, u32 *, unsigned char *); extern void split_cdb_XX_12(unsigned long long, u32, unsigned char *);
extern void split_cdb_XX_16(unsigned long long, u32 *, unsigned char *); extern void split_cdb_XX_16(unsigned long long, u32, unsigned char *);
extern void split_cdb_XX_32(unsigned long long, u32 *, unsigned char *); extern void split_cdb_XX_32(unsigned long long, u32, unsigned char *);
#endif /* TARGET_CORE_SCDB_H */ #endif /* TARGET_CORE_SCDB_H */
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册