Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block

* 'for-linus' of git://git.kernel.dk/linux-2.6-block:
Make SCSI SG v4 driver enabled by default and remove EXPERIMENTAL dependency, since udev depends on BSG
block: Update topology documentation
block: Stack optimal I/O size
block: Add a wrapper for setting minimum request size without a queue
block: Make blk_queue_stack_limits use the new stacking interface

+78 -50
+23 -14
Documentation/ABI/testing/sysfs-block
··· 94 94 Date: May 2009 95 95 Contact: Martin K. Petersen <martin.petersen@oracle.com> 96 96 Description: 97 - This is the smallest unit the storage device can write 98 - without resorting to read-modify-write operation. It is 99 - usually the same as the logical block size but may be 100 - bigger. One example is SATA drives with 4KB sectors 101 - that expose a 512-byte logical block size to the 102 - operating system. 97 + This is the smallest unit a physical storage device can 98 + write atomically. It is usually the same as the logical 99 + block size but may be bigger. One example is SATA 100 + drives with 4KB sectors that expose a 512-byte logical 101 + block size to the operating system. For stacked block 102 + devices the physical_block_size variable contains the 103 + maximum physical_block_size of the component devices. 103 104 104 105 What: /sys/block/<disk>/queue/minimum_io_size 105 106 Date: April 2009 106 107 Contact: Martin K. Petersen <martin.petersen@oracle.com> 107 108 Description: 108 - Storage devices may report a preferred minimum I/O size, 109 - which is the smallest request the device can perform 110 - without incurring a read-modify-write penalty. For disk 111 - drives this is often the physical block size. For RAID 112 - arrays it is often the stripe chunk size. 109 + Storage devices may report a granularity or preferred 110 + minimum I/O size which is the smallest request the 111 + device can perform without incurring a performance 112 + penalty. For disk drives this is often the physical 113 + block size. For RAID arrays it is often the stripe 114 + chunk size. A properly aligned multiple of 115 + minimum_io_size is the preferred request size for 116 + workloads where a high number of I/O operations is 117 + desired. 113 118 114 119 What: /sys/block/<disk>/queue/optimal_io_size 115 120 Date: April 2009 116 121 Contact: Martin K. Petersen <martin.petersen@oracle.com> 117 122 Description: 118 123 Storage devices may report an optimal I/O size, which is 119 - the device's preferred unit of receiving I/O. This is 120 - rarely reported for disk drives. For RAID devices it is 121 - usually the stripe width or the internal block size. 124 + the device's preferred unit for sustained I/O. This is 125 + rarely reported for disk drives. For RAID arrays it is 126 + usually the stripe width or the internal track size. A 127 + properly aligned multiple of optimal_io_size is the 128 + preferred request size for workloads where sustained 129 + throughput is desired. If no optimal I/O size is 130 + reported this file contains 0.
+7 -4
block/Kconfig
··· 48 48 If unsure, say Y. 49 49 50 50 config BLK_DEV_BSG 51 - bool "Block layer SG support v4 (EXPERIMENTAL)" 52 - depends on EXPERIMENTAL 53 - ---help--- 51 + bool "Block layer SG support v4" 52 + default y 53 + help 54 54 Saying Y here will enable generic SG (SCSI generic) v4 support 55 55 for any block device. 56 56 ··· 60 60 protocols (e.g. Task Management Functions and SMP in Serial 61 61 Attached SCSI). 62 62 63 - If unsure, say N. 63 + This option is required by recent UDEV versions to properly 64 + access device serial numbers, etc. 65 + 66 + If unsure, say Y. 64 67 65 68 config BLK_DEV_INTEGRITY 66 69 bool "Block layer data integrity support"
+47 -32
block/blk-settings.c
··· 7 7 #include <linux/bio.h> 8 8 #include <linux/blkdev.h> 9 9 #include <linux/bootmem.h> /* for max_pfn/max_low_pfn */ 10 + #include <linux/gcd.h> 10 11 11 12 #include "blk.h" 12 13 ··· 385 384 EXPORT_SYMBOL(blk_queue_alignment_offset); 386 385 387 386 /** 388 - * blk_queue_io_min - set minimum request size for the queue 389 - * @q: the request queue for the device 387 + * blk_limits_io_min - set minimum request size for a device 388 + * @limits: the queue limits 390 389 * @min: smallest I/O size in bytes 391 390 * 392 391 * Description: ··· 395 394 * smallest I/O the device can perform without incurring a performance 396 395 * penalty. 397 396 */ 397 + void blk_limits_io_min(struct queue_limits *limits, unsigned int min) 398 + { 399 + limits->io_min = min; 400 + 401 + if (limits->io_min < limits->logical_block_size) 402 + limits->io_min = limits->logical_block_size; 403 + 404 + if (limits->io_min < limits->physical_block_size) 405 + limits->io_min = limits->physical_block_size; 406 + } 407 + EXPORT_SYMBOL(blk_limits_io_min); 408 + 409 + /** 410 + * blk_queue_io_min - set minimum request size for the queue 411 + * @q: the request queue for the device 412 + * @min: smallest I/O size in bytes 413 + * 414 + * Description: 415 + * Storage devices may report a granularity or preferred minimum I/O 416 + * size which is the smallest request the device can perform without 417 + * incurring a performance penalty. For disk drives this is often the 418 + * physical block size. For RAID arrays it is often the stripe chunk 419 + * size. A properly aligned multiple of minimum_io_size is the 420 + * preferred request size for workloads where a high number of I/O 421 + * operations is desired. 422 + */ 398 423 void blk_queue_io_min(struct request_queue *q, unsigned int min) 399 424 { 400 - q->limits.io_min = min; 401 - 402 - if (q->limits.io_min < q->limits.logical_block_size) 403 - q->limits.io_min = q->limits.logical_block_size; 404 - 405 - if (q->limits.io_min < q->limits.physical_block_size) 406 - q->limits.io_min = q->limits.physical_block_size; 425 + blk_limits_io_min(&q->limits, min); 407 426 } 408 427 EXPORT_SYMBOL(blk_queue_io_min); 409 428 ··· 433 412 * @opt: optimal request size in bytes 434 413 * 435 414 * Description: 436 - * Drivers can call this function to set the preferred I/O request 437 - * size for devices that report such a value. 415 + * Storage devices may report an optimal I/O size, which is the 416 + * device's preferred unit for sustained I/O. This is rarely reported 417 + * for disk drives. For RAID arrays it is usually the stripe width or 418 + * the internal track size. A properly aligned multiple of 419 + * optimal_io_size is the preferred request size for workloads where 420 + * sustained throughput is desired. 438 421 */ 439 422 void blk_queue_io_opt(struct request_queue *q, unsigned int opt) 440 423 { ··· 458 433 **/ 459 434 void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b) 460 435 { 461 - /* zero is "infinity" */ 462 - t->limits.max_sectors = min_not_zero(queue_max_sectors(t), 463 - queue_max_sectors(b)); 464 - 465 - t->limits.max_hw_sectors = min_not_zero(queue_max_hw_sectors(t), 466 - queue_max_hw_sectors(b)); 467 - 468 - t->limits.seg_boundary_mask = min_not_zero(queue_segment_boundary(t), 469 - queue_segment_boundary(b)); 470 - 471 - t->limits.max_phys_segments = min_not_zero(queue_max_phys_segments(t), 472 - queue_max_phys_segments(b)); 473 - 474 - t->limits.max_hw_segments = min_not_zero(queue_max_hw_segments(t), 475 - queue_max_hw_segments(b)); 476 - 477 - t->limits.max_segment_size = min_not_zero(queue_max_segment_size(t), 478 - queue_max_segment_size(b)); 479 - 480 - t->limits.logical_block_size = max(queue_logical_block_size(t), 481 - queue_logical_block_size(b)); 436 + blk_stack_limits(&t->limits, &b->limits, 0); 482 437 483 438 if (!t->queue_lock) 484 439 WARN_ON_ONCE(1); ··· 527 522 t->misaligned = 1; 528 523 return -1; 529 524 } 525 + 526 + /* Find lcm() of optimal I/O size */ 527 + if (t->io_opt && b->io_opt) 528 + t->io_opt = (t->io_opt * b->io_opt) / gcd(t->io_opt, b->io_opt); 529 + else if (b->io_opt) 530 + t->io_opt = b->io_opt; 531 + 532 + /* Verify that optimal I/O size is a multiple of io_min */ 533 + if (t->io_min && t->io_opt % t->io_min) 534 + return -1; 530 535 531 536 return 0; 532 537 }
+1
include/linux/blkdev.h
··· 913 913 extern void blk_queue_physical_block_size(struct request_queue *, unsigned short); 914 914 extern void blk_queue_alignment_offset(struct request_queue *q, 915 915 unsigned int alignment); 916 + extern void blk_limits_io_min(struct queue_limits *limits, unsigned int min); 916 917 extern void blk_queue_io_min(struct request_queue *q, unsigned int min); 917 918 extern void blk_queue_io_opt(struct request_queue *q, unsigned int opt); 918 919 extern void blk_set_default_limits(struct queue_limits *lim);