On Wed, 2016-01-06 at 10:53 -0800, Nicholas A. Bellinger wrote: > On Mon, 2015-12-28 at 11:57 -0800, Sheng Yang wrote: > > The capability of setting hw_block_size was added along with 9c1cd1b68 > > "target/user: Only support full command pass-through", though default > > setting override the user specified value during the enabling of device, > > which called by target_configure_device() to set block_size matching > > hw_block_size, result in user not able to set different block size other > > than default 512. > > > > This patch would use existing hw_block_size value if already set, otherwise > > it would be set to default value(512). > > > > Update: Fix the coding style issue. > > > > Signed-off-by: Sheng Yang <sheng@xxxxxxxxxx> > > --- > > drivers/target/target_core_user.c | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c > > index f379bde..c10cb5c 100644 > > --- a/drivers/target/target_core_user.c > > +++ b/drivers/target/target_core_user.c > > @@ -1074,8 +1074,10 @@ static int tcmu_configure_device(struct se_device *dev) > > if (ret) > > goto err_register; > > > > + /* User can set hw_block_size before enable the device */ > > + if (dev->dev_attrib.hw_block_size == 0) > > + dev->dev_attrib.hw_block_size = 512; > > /* Other attributes can be configured in userspace */ > > - dev->dev_attrib.hw_block_size = 512; > > dev->dev_attrib.hw_max_sectors = 128; > > dev->dev_attrib.hw_queue_depth = 128; > > > > @@ -1249,6 +1251,7 @@ static ssize_t tcmu_show_configfs_dev_params(struct se_device *dev, char *b) > > bl = sprintf(b + bl, "Config: %s ", > > udev->dev_config[0] ? udev->dev_config : "NULL"); > > bl += sprintf(b + bl, "Size: %zu ", udev->dev_size); > > + bl += sprintf(b + bl, "Block Size: %u ", dev->dev_attrib.block_size); > > bl += sprintf(b + bl, "Async: %s\n", > > test_bit(TCMU_DEV_BIT_ASYNC, &udev->flags) ? "yes" : "no"); > > if (test_bit(TCMU_DEV_BIT_ASYNC, &udev->flags)) { > > Seems OK to me. > > Andy, any objections on this..? > Actually, the tcmu_show_configfs_dev_params() bit does not apply.. I assume the TCMU_DEV_BIT_ASYNC thing is something specific to your own tree, yes..? That said, dev->dev_attrib.block_size is already exposed via existing per se_device->dev_group attributes, so there is really no need to expose it again. Dropping this part of the patch. -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html