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]

 



> +	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));




[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