On Thu, 2013-04-25 at 15:04 -0700, Andy Grover wrote: > if the fileio backing file is actually a block device, fd_dev_size will > be 0. Ensure we return the correct value by calling fd_get_blocks() and > multiplying by block size. > > Move fd_get_blocks in source file, so fd_show_configfs_dev_params can > call it. > > Signed-off-by: Andy Grover <agrover@xxxxxxxxxx> > --- Given that /info is intended to provide backend driver specific information needed for re-configuration after target restart, I don't see the point of providing this output when it's not actually required for FILEIO backend driver setup w/ struct block_device. So unless there's a reason, please don't change /info output. --nab > drivers/target/target_core_file.c | 29 ++++++++++++++++------------- > 1 files changed, 16 insertions(+), 13 deletions(-) > > diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c > index 58ed683..2330dc4 100644 > --- a/drivers/target/target_core_file.c > +++ b/drivers/target/target_core_file.c > @@ -674,19 +674,6 @@ out: > return (!ret) ? count : ret; > } > > -static ssize_t fd_show_configfs_dev_params(struct se_device *dev, char *b) > -{ > - struct fd_dev *fd_dev = FD_DEV(dev); > - ssize_t bl = 0; > - > - bl = sprintf(b + bl, "TCM FILEIO ID: %u", fd_dev->fd_dev_id); > - bl += sprintf(b + bl, " File: %s Size: %llu Mode: %s\n", > - fd_dev->fd_dev_name, fd_dev->fd_dev_size, > - (fd_dev->fbd_flags & FDBD_HAS_BUFFERED_IO_WCE) ? > - "Buffered-WCE" : "O_DSYNC"); > - return bl; > -} > - > static sector_t fd_get_blocks(struct se_device *dev) > { > struct fd_dev *fd_dev = FD_DEV(dev); > @@ -706,6 +693,22 @@ static sector_t fd_get_blocks(struct se_device *dev) > return div_u64(dev_size, dev->dev_attrib.block_size); > } > > +static ssize_t fd_show_configfs_dev_params(struct se_device *dev, char *b) > +{ > + struct fd_dev *fd_dev = FD_DEV(dev); > + ssize_t bl = 0; > + long long unsigned int dev_size; > + > + dev_size = fd_get_blocks(dev) * dev->dev_attrib.block_size; > + > + bl = sprintf(b + bl, "TCM FILEIO ID: %u", fd_dev->fd_dev_id); > + bl += sprintf(b + bl, " File: %s Size: %llu Mode: %s\n", > + fd_dev->fd_dev_name, dev_size, > + (fd_dev->fbd_flags & FDBD_HAS_BUFFERED_IO_WCE) ? > + "Buffered-WCE" : "O_DSYNC"); > + return bl; > +} > + > static struct sbc_ops fd_sbc_ops = { > .execute_rw = fd_execute_rw, > .execute_sync_cache = fd_execute_sync_cache, -- 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