On Thu, 25 Feb 2010, Martin K. Petersen wrote: > >>>>> "Alan" == Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> writes: > > Alan> Why is max_sectors changed? If it is already smaller than the new > Alan> value of max_hw_sectors, shouldn't it remain the same? > > We have a lot of legacy device drivers kicking around in the tree so the > default max request size remains the conservative SAFE_MAX_SECTORS > (255). > > When a low level driver explicitly tells us that it can support bigger > requests we take the opportunity to increase the soft limit to the block > layer default (1024). > > Also, this function is generally called at block device creation time so > it's not like we're overwriting an existing user setting. With usb-storage we've got a situation where the function can be called later than device creation time. This is because there's such a wide variety among USB devices, there's no way for the driver always to know the device's actual capabilities -- sometimes the user has to tell it. This should work out okay with your code. I just have to change usb-storage so that the value it reports to the user in the attribute file is max_hw_sectors instead of max_sectors, to reflect what's actually being changed. BTW, how come you didn't write it like this? q->limits.max_hw_sectors = max_sectors; if (max_sectors < BLK_DEF_MAX_SECTORS) q->limits.max_sectors = max_sectors; else q->limits.max_sectors = BLK_DEF_MAX_SECTORS; For me this is easier to understand. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html