scsiglue.c (b7e56edba4b02f2079042c326a8cd72a44635817) scsiglue.c (086fa5ff0854c676ec333760f4c0154b3b242616)
1/* Driver for USB Mass Storage compliant devices
2 * SCSI layer glue code
3 *
4 * Current development and maintenance by:
5 * (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net)
6 *
7 * Developed with the assistance of:
8 * (c) 2000 David L. Brown, Jr. (usb-storage@davidb.org)

--- 120 unchanged lines hidden (view full) ---

129 * are limiting both to 32K (64 sectores).
130 */
131 if (us->fflags & (US_FL_MAX_SECTORS_64 | US_FL_MAX_SECTORS_MIN)) {
132 unsigned int max_sectors = 64;
133
134 if (us->fflags & US_FL_MAX_SECTORS_MIN)
135 max_sectors = PAGE_CACHE_SIZE >> 9;
136 if (queue_max_sectors(sdev->request_queue) > max_sectors)
1/* Driver for USB Mass Storage compliant devices
2 * SCSI layer glue code
3 *
4 * Current development and maintenance by:
5 * (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net)
6 *
7 * Developed with the assistance of:
8 * (c) 2000 David L. Brown, Jr. (usb-storage@davidb.org)

--- 120 unchanged lines hidden (view full) ---

129 * are limiting both to 32K (64 sectores).
130 */
131 if (us->fflags & (US_FL_MAX_SECTORS_64 | US_FL_MAX_SECTORS_MIN)) {
132 unsigned int max_sectors = 64;
133
134 if (us->fflags & US_FL_MAX_SECTORS_MIN)
135 max_sectors = PAGE_CACHE_SIZE >> 9;
136 if (queue_max_sectors(sdev->request_queue) > max_sectors)
137 blk_queue_max_sectors(sdev->request_queue,
137 blk_queue_max_hw_sectors(sdev->request_queue,
138 max_sectors);
139 } else if (sdev->type == TYPE_TAPE) {
140 /* Tapes need much higher max_sector limits, so just
141 * raise it to the maximum possible (4 GB / 512) and
142 * let the queue segment size sort out the real limit.
143 */
138 max_sectors);
139 } else if (sdev->type == TYPE_TAPE) {
140 /* Tapes need much higher max_sector limits, so just
141 * raise it to the maximum possible (4 GB / 512) and
142 * let the queue segment size sort out the real limit.
143 */
144 blk_queue_max_sectors(sdev->request_queue, 0x7FFFFF);
144 blk_queue_max_hw_sectors(sdev->request_queue, 0x7FFFFF);
145 }
146
147 /* Some USB host controllers can't do DMA; they have to use PIO.
148 * They indicate this by setting their dma_mask to NULL. For
149 * such controllers we need to make sure the block layer sets
150 * up bounce buffers in addressable memory.
151 */
152 if (!us->pusb_dev->bus->controller->dma_mask)

--- 337 unchanged lines hidden (view full) ---

490/* Input routine for the sysfs max_sectors file */
491static ssize_t store_max_sectors(struct device *dev, struct device_attribute *attr, const char *buf,
492 size_t count)
493{
494 struct scsi_device *sdev = to_scsi_device(dev);
495 unsigned short ms;
496
497 if (sscanf(buf, "%hu", &ms) > 0 && ms <= SCSI_DEFAULT_MAX_SECTORS) {
145 }
146
147 /* Some USB host controllers can't do DMA; they have to use PIO.
148 * They indicate this by setting their dma_mask to NULL. For
149 * such controllers we need to make sure the block layer sets
150 * up bounce buffers in addressable memory.
151 */
152 if (!us->pusb_dev->bus->controller->dma_mask)

--- 337 unchanged lines hidden (view full) ---

490/* Input routine for the sysfs max_sectors file */
491static ssize_t store_max_sectors(struct device *dev, struct device_attribute *attr, const char *buf,
492 size_t count)
493{
494 struct scsi_device *sdev = to_scsi_device(dev);
495 unsigned short ms;
496
497 if (sscanf(buf, "%hu", &ms) > 0 && ms <= SCSI_DEFAULT_MAX_SECTORS) {
498 blk_queue_max_sectors(sdev->request_queue, ms);
498 blk_queue_max_hw_sectors(sdev->request_queue, ms);
499 return strlen(buf);
500 }
501 return -EINVAL;
502}
503
504static DEVICE_ATTR(max_sectors, S_IRUGO | S_IWUSR, show_max_sectors,
505 store_max_sectors);
506

--- 67 unchanged lines hidden ---
499 return strlen(buf);
500 }
501 return -EINVAL;
502}
503
504static DEVICE_ATTR(max_sectors, S_IRUGO | S_IWUSR, show_max_sectors,
505 store_max_sectors);
506

--- 67 unchanged lines hidden ---