Skip to contentSkip to conversation

: Add hw_block_size and block_size configfs attributes

PATCH New Nicholas A. Bellinger 1 participant 1 message Feb 20, 2009 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 7/7 : Add hw_block_size and block_size configfs attributes

Quoted 1 line

From 78b6d56c09bf1305e9ea532e734b885d0fa60b5d Mon Sep 17 00:00:00 2001

From: Nicholas Bellinger <[email protected]>
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)

---
 drivers/lio-core/target_core_configfs.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/lio-core/target_core_configfs.c +8 -0
index 46324a6..bcbd2cf 100644
@@ -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,
Signature · 1 line
1.5.4.1