RE: [PATCH] usb-storage: Add a limitation for blk_queue_max_hw_sectors()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Christoph,

> From: Christoph Hellwig, Sent: Thursday, June 13, 2019 4:34 PM
> 
> > +	if (max_sectors > 0) {
> > +		struct device *dev = us->pusb_dev->bus->sysdev;
> > +		size_t max_dma_sectors = dma_max_mapping_size(dev) >>
> > +					 SECTOR_SHIFT;
> > +
> > +		max_sectors = min_t(size_t, max_sectors, max_dma_sectors);
> > +		blk_queue_max_hw_sectors(sdev->request_queue, max_sectors);
> 
> I think we need to do this unconditionally for the rare (or maybe even
> theoretical case) of a dma max mapping size smaller than the default
> max_sectos.
> 
> So something like this:
> 
> 	blk_queue_max_hw_sectors(sdev->request_queue,
> 		min_t(unsigned long,
> 			queue_max_hw_sectors(sdev->request_queue),
> 			dma_max_mapping_size(dev) >> SECTOR_SHIFT));

I believe this patch I sent has already covered it. What do you think?

For examples (all value units are "sectors"):
	default	mapping size	max_sectors
case 1	240	MAX		2048		--> we use 2048
case 2	240	512		2048		--> we use 512
case 3	240	128		2048		--> we use 128
case 4	240	128		64		--> we use 64

Best regards,
Yoshihiro Shimoda





[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux