On Tue, 2011-11-29 at 17:55 -0800, Andy Grover wrote: > By all accounts, the iblock backstore should be more efficient when using > a block device as a backstore. Prevent accidental user misconfiguration > by disallowing block devices to be used with the file backstore. > > Signed-off-by: Andy Grover <agrover@xxxxxxxxxx> > --- > drivers/target/target_core_file.c | 43 +++++------------------------------- > 1 files changed, 6 insertions(+), 37 deletions(-) > This is still useful for allowing read-only access to block_devices already claimed by the local system for people who know what they are doing.. I would consider taking this if TCM block backend code could also provide something similar for rtslib, so since it does not provide equivalent functionality I'll have to NACK it's removal. Nice try though.. > diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c > index 0465521..429b9c0 100644 > --- a/drivers/target/target_core_file.c > +++ b/drivers/target/target_core_file.c > @@ -29,7 +29,6 @@ > #include <linux/string.h> > #include <linux/parser.h> > #include <linux/timer.h> > -#include <linux/blkdev.h> > #include <linux/slab.h> > #include <linux/spinlock.h> > #include <scsi/scsi.h> > @@ -167,29 +166,9 @@ static struct se_device *fd_create_virtdevice( > */ > inode = file->f_mapping->host; > if (S_ISBLK(inode->i_mode)) { > - struct request_queue *q; > - /* > - * Setup the local scope queue_limits from struct request_queue->limits > - * to pass into transport_add_device_to_core_hba() as struct se_dev_limits. > - */ > - q = bdev_get_queue(inode->i_bdev); > - limits = &dev_limits.limits; > - limits->logical_block_size = bdev_logical_block_size(inode->i_bdev); > - limits->max_hw_sectors = queue_max_hw_sectors(q); > - limits->max_sectors = queue_max_sectors(q); > - /* > - * Determine the number of bytes from i_size_read() minus > - * one (1) logical sector from underlying struct block_device > - */ > - fd_dev->fd_block_size = bdev_logical_block_size(inode->i_bdev); > - fd_dev->fd_dev_size = (i_size_read(file->f_mapping->host) - > - fd_dev->fd_block_size); > - > - pr_debug("FILEIO: Using size: %llu bytes from struct" > - " block_device blocks: %llu logical_block_size: %d\n", > - fd_dev->fd_dev_size, > - div_u64(fd_dev->fd_dev_size, fd_dev->fd_block_size), > - fd_dev->fd_block_size); > + pr_err("File backstore doesn't support block devices," > + " use iblock backstore instead\n"); > + goto fail; > } else { > if (!(fd_dev->fbd_flags & FBDF_HAS_SIZE)) { > pr_err("FILEIO: Missing fd_dev_size=" > @@ -303,19 +282,9 @@ static int fd_do_readv(struct se_task *task) > * the expected virt_size for struct file w/o a backing struct > * block_device. > */ > - if (S_ISBLK(fd->f_dentry->d_inode->i_mode)) { > - if (ret < 0 || ret != task->task_size) { > - pr_err("vfs_readv() returned %d," > - " expecting %d for S_ISBLK\n", ret, > - (int)task->task_size); > - return (ret < 0 ? ret : -EINVAL); > - } > - } else { > - if (ret < 0) { > - pr_err("vfs_readv() returned %d for non" > - " S_ISBLK\n", ret); > - return ret; > - } > + if (ret < 0) { > + pr_err("vfs_readv() returned %d\n", ret); > + return ret; > } > > return 1; -- 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