[PATCH 7/7] [Target_Core_Mod/ConfigFS]: Add hw_block_size andblock_size configfs attributes

From: Nicholas A. Bellinger
Date: Fri Feb 20 2009 - 03:07:58 EST


>From 78b6d56c09bf1305e9ea532e734b885d0fa60b5d Mon Sep 17 00:00:00 2001
From: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>
Date: Thu, 19 Feb 2009 19:45:37 -0800
Subject: [PATCH 7/7] [Target_Core_Mod/ConfigFS]: Add hw_block_size and block_size configfs attributes

This patch adds the hw_block_size and block_size to /sys/kernel/config/target/core/$HBA/$DEV/attrib.
It allows block_size to be changed for IBLOCK, FILEIO and RAMDISK Target_Core_Mod/ConfigFS
storage objects to 4096, 2048, 1024 or 512 byte sector sizes, but currently requires that there be
*NO* active exports of said storage object to a active $FABRIC_MOD in order to change block_size.

By default, both hw_block_size and block_size are set to 512 bytes from IBLOCK, FILEIO and RAMDISK
subsystem plugins. Note that for Target_Core_Mod/pSCSI storage objects, block_size is not allowed
to be changed (because we are doing passthrough into physical hardware registerd with Linux/SCSI)

Signed-off-by: Nicholas A. Bellinger <nab@xxxxxxxxxxxxxxx>
---
drivers/lio-core/target_core_configfs.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/lio-core/target_core_configfs.c b/drivers/lio-core/target_core_configfs.c
index 46324a6..bcbd2cf 100644
--- a/drivers/lio-core/target_core_configfs.c
+++ b/drivers/lio-core/target_core_configfs.c
@@ -469,6 +469,12 @@ SE_DEV_ATTR(status_thread, S_IRUGO | S_IWUSR);
DEF_DEV_ATTRIB(status_thread_tur);
SE_DEV_ATTR(status_thread_tur, S_IRUGO | S_IWUSR);

+DEF_DEV_ATTRIB_RO(hw_block_size);
+SE_DEV_ATTR_RO(hw_block_size);
+
+DEF_DEV_ATTRIB(block_size);
+SE_DEV_ATTR(block_size, S_IRUGO | S_IWUSR);
+
DEF_DEV_ATTRIB_RO(hw_max_sectors);
SE_DEV_ATTR_RO(hw_max_sectors);

@@ -489,6 +495,8 @@ CONFIGFS_EATTR_OPS(target_core_dev_attrib, se_dev_attrib_s, da_group);
static struct configfs_attribute *target_core_dev_attrib_attrs[] = {
&target_core_dev_attrib_status_thread.attr,
&target_core_dev_attrib_status_thread_tur.attr,
+ &target_core_dev_attrib_hw_block_size.attr,
+ &target_core_dev_attrib_block_size.attr,
&target_core_dev_attrib_hw_max_sectors.attr,
&target_core_dev_attrib_max_sectors.attr,
&target_core_dev_attrib_hw_queue_depth.attr,
--
1.5.4.1



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/