Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e3e84cda authored by Andy Grover's avatar Andy Grover Committed by Nicholas Bellinger
Browse files

target: Use FD_MAX_SECTORS/FD_BLOCKSIZE for blockdevs using fileio

We can still see the error reported in

https://patchwork.kernel.org/patch/2338981/



when using fileio backed by a block device.

I'm assuming this will get us past that error (from sbc_parse_cdb),
and also assuming it's OK to have our max_sectors be larger than
the block's queue max hw sectors?

Reported-by: default avatarEric Harney <eharney@redhat.com>
Signed-off-by: default avatarAndy Grover <agrover@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 2acd09f3
Loading
Loading
Loading
Loading
+2 −7
Original line number Original line Diff line number Diff line
@@ -153,10 +153,6 @@ static int fd_configure_device(struct se_device *dev)
		struct request_queue *q = bdev_get_queue(inode->i_bdev);
		struct request_queue *q = bdev_get_queue(inode->i_bdev);
		unsigned long long dev_size;
		unsigned long long dev_size;


		dev->dev_attrib.hw_block_size =
			bdev_logical_block_size(inode->i_bdev);
		dev->dev_attrib.hw_max_sectors = queue_max_hw_sectors(q);

		/*
		/*
		 * Determine the number of bytes from i_size_read() minus
		 * Determine the number of bytes from i_size_read() minus
		 * one (1) logical sector from underlying struct block_device
		 * one (1) logical sector from underlying struct block_device
@@ -203,9 +199,6 @@ static int fd_configure_device(struct se_device *dev)
			goto fail;
			goto fail;
		}
		}


		dev->dev_attrib.hw_block_size = FD_BLOCKSIZE;
		dev->dev_attrib.hw_max_sectors = FD_MAX_SECTORS;

		/*
		/*
		 * Limit UNMAP emulation to 8k Number of LBAs (NoLB)
		 * Limit UNMAP emulation to 8k Number of LBAs (NoLB)
		 */
		 */
@@ -226,6 +219,8 @@ static int fd_configure_device(struct se_device *dev)


	fd_dev->fd_block_size = dev->dev_attrib.hw_block_size;
	fd_dev->fd_block_size = dev->dev_attrib.hw_block_size;


	dev->dev_attrib.hw_block_size = FD_BLOCKSIZE;
	dev->dev_attrib.hw_max_sectors = FD_MAX_SECTORS;
	dev->dev_attrib.hw_queue_depth = FD_MAX_DEVICE_QUEUE_DEPTH;
	dev->dev_attrib.hw_queue_depth = FD_MAX_DEVICE_QUEUE_DEPTH;


	if (fd_dev->fbd_flags & FDBD_HAS_BUFFERED_IO_WCE) {
	if (fd_dev->fbd_flags & FDBD_HAS_BUFFERED_IO_WCE) {