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 Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux