On Mon, 2013-12-16 at 16:28 +0100, Christoph Hellwig wrote: > On Thu, Dec 12, 2013 at 08:38:47PM +0000, Nicholas A. Bellinger wrote: > > From: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx> > > > > This patch allows FILEIO to update hw_max_sectors based on the current > > block_size. This is required because vfs_[writev,readv]() can accept > > a maximum of 2048 iovecs per call, so the enforced hw_max_sectors really > > needs to be calculated based on block_size. > > > > This addresses a >= v3.5 bug where block_size=512 was rejecting > 1M > > sized I/O requests, because FD_MAX_SECTORS was hardcoded to 2048 for > > the block_size=4096 case. > > The whole setup seems stupid here. What's the point of another method > during config time if there are enough already? > The issue is that block_size can be changed for FILEIO after the device has been configured, so a method to reset hw_max_sectors was required in order to correctly report (via EVPD=0xb0) and limit I/O size in sbc_parse_cdb(). > And why is the max I/O size specified in sectors anyway, and not counted > in bytes? > Sectors is what EVPD=0xb0 reports and sbc_parse_cdb() enforces for backends. I'd prefer to have simply checked this limit in fd_do_rw(), but given that EVPD=0 is reporting back MAXIMUM TRANSFER LENGTH as hw_max_sectors, it made sense to change this for FILEIO based upon current block_size to report the correct value back to the initiator. --nab -- 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