diff options
-rw-r--r-- | Documentation/ABI/testing/sysfs-block | 14 | ||||
-rw-r--r-- | Documentation/block/queue-sysfs.txt | 10 | ||||
-rw-r--r-- | block/blk-core.c | 31 | ||||
-rw-r--r-- | block/blk-settings.c | 26 | ||||
-rw-r--r-- | block/blk-sysfs.c | 11 | ||||
-rw-r--r-- | block/cfq-iosched.c | 6 | ||||
-rw-r--r-- | block/elevator.c | 11 | ||||
-rw-r--r-- | drivers/block/DAC960.c | 2 | ||||
-rw-r--r-- | drivers/block/cciss.c | 37 | ||||
-rw-r--r-- | drivers/block/cciss.h | 9 | ||||
-rw-r--r-- | drivers/block/cciss_cmd.h | 150 | ||||
-rw-r--r-- | drivers/block/cciss_scsi.h | 18 | ||||
-rw-r--r-- | drivers/block/pktcdvd.c | 89 | ||||
-rw-r--r-- | drivers/block/sx8.c | 2 | ||||
-rw-r--r-- | drivers/block/ub.c | 2 | ||||
-rw-r--r-- | drivers/block/virtio_blk.c | 2 | ||||
-rw-r--r-- | drivers/block/xen-blkfront.c | 2 | ||||
-rw-r--r-- | drivers/block/xsysace.c | 2 | ||||
-rw-r--r-- | fs/partitions/check.c | 7 | ||||
-rw-r--r-- | include/linux/Kbuild | 1 | ||||
-rw-r--r-- | include/linux/blkdev.h | 20 | ||||
-rw-r--r-- | include/linux/cciss_defs.h | 130 | ||||
-rw-r--r-- | include/linux/cciss_ioctl.h | 128 | ||||
-rw-r--r-- | include/linux/pktcdvd.h | 10 | ||||
-rw-r--r-- | include/linux/sched.h | 4 |
25 files changed, 291 insertions, 433 deletions
diff --git a/Documentation/ABI/testing/sysfs-block b/Documentation/ABI/testing/sysfs-block index d2f90334bb93..4873c759d535 100644 --- a/Documentation/ABI/testing/sysfs-block +++ b/Documentation/ABI/testing/sysfs-block | |||
@@ -128,3 +128,17 @@ Description: | |||
128 | preferred request size for workloads where sustained | 128 | preferred request size for workloads where sustained |
129 | throughput is desired. If no optimal I/O size is | 129 | throughput is desired. If no optimal I/O size is |
130 | reported this file contains 0. | 130 | reported this file contains 0. |
131 | |||
132 | What: /sys/block/<disk>/queue/nomerges | ||
133 | Date: January 2010 | ||
134 | Contact: | ||
135 | Description: | ||
136 | Standard I/O elevator operations include attempts to | ||
137 | merge contiguous I/Os. For known random I/O loads these | ||
138 | attempts will always fail and result in extra cycles | ||
139 | being spent in the kernel. This allows one to turn off | ||
140 | this behavior on one of two ways: When set to 1, complex | ||
141 | merge checks are disabled, but the simple one-shot merges | ||
142 | with the previous I/O request are enabled. When set to 2, | ||
143 | all merge tries are disabled. The default value is 0 - | ||
144 | which enables all types of merge tries. | ||
diff --git a/Documentation/block/queue-sysfs.txt b/Documentation/block/queue-sysfs.txt index e164403f60e1..f65274081c8d 100644 --- a/Documentation/block/queue-sysfs.txt +++ b/Documentation/block/queue-sysfs.txt | |||
@@ -25,11 +25,11 @@ size allowed by the hardware. | |||
25 | 25 | ||
26 | nomerges (RW) | 26 | nomerges (RW) |
27 | ------------- | 27 | ------------- |
28 | This enables the user to disable the lookup logic involved with IO merging | 28 | This enables the user to disable the lookup logic involved with IO |
29 | requests in the block layer. Merging may still occur through a direct | 29 | merging requests in the block layer. By default (0) all merges are |
30 | 1-hit cache, since that comes for (almost) free. The IO scheduler will not | 30 | enabled. When set to 1 only simple one-hit merges will be tried. When |
31 | waste cycles doing tree/hash lookups for merges if nomerges is 1. Defaults | 31 | set to 2 no merge algorithms will be tried (including one-hit or more |
32 | to 0, enabling all merges. | 32 | complex tree/hash lookups). |
33 | 33 | ||
34 | nr_requests (RW) | 34 | nr_requests (RW) |
35 | ---------------- | 35 | ---------------- |
diff --git a/block/blk-core.c b/block/blk-core.c index d1a9a0a64f95..36c0deebc2dc 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -1490,9 +1490,9 @@ end_io: | |||
1490 | /* | 1490 | /* |
1491 | * We only want one ->make_request_fn to be active at a time, | 1491 | * We only want one ->make_request_fn to be active at a time, |
1492 | * else stack usage with stacked devices could be a problem. | 1492 | * else stack usage with stacked devices could be a problem. |
1493 | * So use current->bio_{list,tail} to keep a list of requests | 1493 | * So use current->bio_list to keep a list of requests |
1494 | * submited by a make_request_fn function. | 1494 | * submited by a make_request_fn function. |
1495 | * current->bio_tail is also used as a flag to say if | 1495 | * current->bio_list is also used as a flag to say if |
1496 | * generic_make_request is currently active in this task or not. | 1496 | * generic_make_request is currently active in this task or not. |
1497 | * If it is NULL, then no make_request is active. If it is non-NULL, | 1497 | * If it is NULL, then no make_request is active. If it is non-NULL, |
1498 | * then a make_request is active, and new requests should be added | 1498 | * then a make_request is active, and new requests should be added |
@@ -1500,11 +1500,11 @@ end_io: | |||
1500 | */ | 1500 | */ |
1501 | void generic_make_request(struct bio *bio) | 1501 | void generic_make_request(struct bio *bio) |
1502 | { | 1502 | { |
1503 | if (current->bio_tail) { | 1503 | struct bio_list bio_list_on_stack; |
1504 | |||
1505 | if (current->bio_list) { | ||
1504 | /* make_request is active */ | 1506 | /* make_request is active */ |
1505 | *(current->bio_tail) = bio; | 1507 | bio_list_add(current->bio_list, bio); |
1506 | bio->bi_next = NULL; | ||
1507 | current->bio_tail = &bio->bi_next; | ||
1508 | return; | 1508 | return; |
1509 | } | 1509 | } |
1510 | /* following loop may be a bit non-obvious, and so deserves some | 1510 | /* following loop may be a bit non-obvious, and so deserves some |
@@ -1512,30 +1512,27 @@ void generic_make_request(struct bio *bio) | |||
1512 | * Before entering the loop, bio->bi_next is NULL (as all callers | 1512 | * Before entering the loop, bio->bi_next is NULL (as all callers |
1513 | * ensure that) so we have a list with a single bio. | 1513 | * ensure that) so we have a list with a single bio. |
1514 | * We pretend that we have just taken it off a longer list, so | 1514 | * We pretend that we have just taken it off a longer list, so |
1515 | * we assign bio_list to the next (which is NULL) and bio_tail | 1515 | * we assign bio_list to a pointer to the bio_list_on_stack, |
1516 | * to &bio_list, thus initialising the bio_list of new bios to be | 1516 | * thus initialising the bio_list of new bios to be |
1517 | * added. __generic_make_request may indeed add some more bios | 1517 | * added. __generic_make_request may indeed add some more bios |
1518 | * through a recursive call to generic_make_request. If it | 1518 | * through a recursive call to generic_make_request. If it |
1519 | * did, we find a non-NULL value in bio_list and re-enter the loop | 1519 | * did, we find a non-NULL value in bio_list and re-enter the loop |
1520 | * from the top. In this case we really did just take the bio | 1520 | * from the top. In this case we really did just take the bio |
1521 | * of the top of the list (no pretending) and so fixup bio_list and | 1521 | * of the top of the list (no pretending) and so remove it from |
1522 | * bio_tail or bi_next, and call into __generic_make_request again. | 1522 | * bio_list, and call into __generic_make_request again. |
1523 | * | 1523 | * |
1524 | * The loop was structured like this to make only one call to | 1524 | * The loop was structured like this to make only one call to |
1525 | * __generic_make_request (which is important as it is large and | 1525 | * __generic_make_request (which is important as it is large and |
1526 | * inlined) and to keep the structure simple. | 1526 | * inlined) and to keep the structure simple. |
1527 | */ | 1527 | */ |
1528 | BUG_ON(bio->bi_next); | 1528 | BUG_ON(bio->bi_next); |
1529 | bio_list_init(&bio_list_on_stack); | ||
1530 | current->bio_list = &bio_list_on_stack; | ||
1529 | do { | 1531 | do { |
1530 | current->bio_list = bio->bi_next; | ||
1531 | if (bio->bi_next == NULL) | ||
1532 | current->bio_tail = ¤t->bio_list; | ||
1533 | else | ||
1534 | bio->bi_next = NULL; | ||
1535 | __generic_make_request(bio); | 1532 | __generic_make_request(bio); |
1536 | bio = current->bio_list; | 1533 | bio = bio_list_pop(current->bio_list); |
1537 | } while (bio); | 1534 | } while (bio); |
1538 | current->bio_tail = NULL; /* deactivate */ | 1535 | current->bio_list = NULL; /* deactivate */ |
1539 | } | 1536 | } |
1540 | EXPORT_SYMBOL(generic_make_request); | 1537 | EXPORT_SYMBOL(generic_make_request); |
1541 | 1538 | ||
diff --git a/block/blk-settings.c b/block/blk-settings.c index 5eeb9e0d256e..78549c723783 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c | |||
@@ -507,7 +507,7 @@ static unsigned int lcm(unsigned int a, unsigned int b) | |||
507 | * blk_stack_limits - adjust queue_limits for stacked devices | 507 | * blk_stack_limits - adjust queue_limits for stacked devices |
508 | * @t: the stacking driver limits (top device) | 508 | * @t: the stacking driver limits (top device) |
509 | * @b: the underlying queue limits (bottom, component device) | 509 | * @b: the underlying queue limits (bottom, component device) |
510 | * @offset: offset to beginning of data within component device | 510 | * @start: first data sector within component device |
511 | * | 511 | * |
512 | * Description: | 512 | * Description: |
513 | * This function is used by stacking drivers like MD and DM to ensure | 513 | * This function is used by stacking drivers like MD and DM to ensure |
@@ -525,10 +525,9 @@ static unsigned int lcm(unsigned int a, unsigned int b) | |||
525 | * the alignment_offset is undefined. | 525 | * the alignment_offset is undefined. |
526 | */ | 526 | */ |
527 | int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, | 527 | int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, |
528 | sector_t offset) | 528 | sector_t start) |
529 | { | 529 | { |
530 | sector_t alignment; | 530 | unsigned int top, bottom, alignment, ret = 0; |
531 | unsigned int top, bottom, ret = 0; | ||
532 | 531 | ||
533 | t->max_sectors = min_not_zero(t->max_sectors, b->max_sectors); | 532 | t->max_sectors = min_not_zero(t->max_sectors, b->max_sectors); |
534 | t->max_hw_sectors = min_not_zero(t->max_hw_sectors, b->max_hw_sectors); | 533 | t->max_hw_sectors = min_not_zero(t->max_hw_sectors, b->max_hw_sectors); |
@@ -548,7 +547,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, | |||
548 | 547 | ||
549 | t->misaligned |= b->misaligned; | 548 | t->misaligned |= b->misaligned; |
550 | 549 | ||
551 | alignment = queue_limit_alignment_offset(b, offset); | 550 | alignment = queue_limit_alignment_offset(b, start); |
552 | 551 | ||
553 | /* Bottom device has different alignment. Check that it is | 552 | /* Bottom device has different alignment. Check that it is |
554 | * compatible with the current top alignment. | 553 | * compatible with the current top alignment. |
@@ -611,11 +610,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, | |||
611 | 610 | ||
612 | /* Discard alignment and granularity */ | 611 | /* Discard alignment and granularity */ |
613 | if (b->discard_granularity) { | 612 | if (b->discard_granularity) { |
614 | unsigned int granularity = b->discard_granularity; | 613 | alignment = queue_limit_discard_alignment(b, start); |
615 | offset &= granularity - 1; | ||
616 | |||
617 | alignment = (granularity + b->discard_alignment - offset) | ||
618 | & (granularity - 1); | ||
619 | 614 | ||
620 | if (t->discard_granularity != 0 && | 615 | if (t->discard_granularity != 0 && |
621 | t->discard_alignment != alignment) { | 616 | t->discard_alignment != alignment) { |
@@ -657,7 +652,7 @@ int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev, | |||
657 | 652 | ||
658 | start += get_start_sect(bdev); | 653 | start += get_start_sect(bdev); |
659 | 654 | ||
660 | return blk_stack_limits(t, &bq->limits, start << 9); | 655 | return blk_stack_limits(t, &bq->limits, start); |
661 | } | 656 | } |
662 | EXPORT_SYMBOL(bdev_stack_limits); | 657 | EXPORT_SYMBOL(bdev_stack_limits); |
663 | 658 | ||
@@ -668,9 +663,8 @@ EXPORT_SYMBOL(bdev_stack_limits); | |||
668 | * @offset: offset to beginning of data within component device | 663 | * @offset: offset to beginning of data within component device |
669 | * | 664 | * |
670 | * Description: | 665 | * Description: |
671 | * Merges the limits for two queues. Returns 0 if alignment | 666 | * Merges the limits for a top level gendisk and a bottom level |
672 | * didn't change. Returns -1 if adding the bottom device caused | 667 | * block_device. |
673 | * misalignment. | ||
674 | */ | 668 | */ |
675 | void disk_stack_limits(struct gendisk *disk, struct block_device *bdev, | 669 | void disk_stack_limits(struct gendisk *disk, struct block_device *bdev, |
676 | sector_t offset) | 670 | sector_t offset) |
@@ -678,9 +672,7 @@ void disk_stack_limits(struct gendisk *disk, struct block_device *bdev, | |||
678 | struct request_queue *t = disk->queue; | 672 | struct request_queue *t = disk->queue; |
679 | struct request_queue *b = bdev_get_queue(bdev); | 673 | struct request_queue *b = bdev_get_queue(bdev); |
680 | 674 | ||
681 | offset += get_start_sect(bdev) << 9; | 675 | if (bdev_stack_limits(&t->limits, bdev, offset >> 9) < 0) { |
682 | |||
683 | if (blk_stack_limits(&t->limits, &b->limits, offset) < 0) { | ||
684 | char top[BDEVNAME_SIZE], bottom[BDEVNAME_SIZE]; | 676 | char top[BDEVNAME_SIZE], bottom[BDEVNAME_SIZE]; |
685 | 677 | ||
686 | disk_name(disk, 0, top); | 678 | disk_name(disk, 0, top); |
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 8606c9543fdd..e85442415db3 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c | |||
@@ -189,7 +189,8 @@ static ssize_t queue_nonrot_store(struct request_queue *q, const char *page, | |||
189 | 189 | ||
190 | static ssize_t queue_nomerges_show(struct request_queue *q, char *page) | 190 | static ssize_t queue_nomerges_show(struct request_queue *q, char *page) |
191 | { | 191 | { |
192 | return queue_var_show(blk_queue_nomerges(q), page); | 192 | return queue_var_show((blk_queue_nomerges(q) << 1) | |
193 | blk_queue_noxmerges(q), page); | ||
193 | } | 194 | } |
194 | 195 | ||
195 | static ssize_t queue_nomerges_store(struct request_queue *q, const char *page, | 196 | static ssize_t queue_nomerges_store(struct request_queue *q, const char *page, |
@@ -199,10 +200,12 @@ static ssize_t queue_nomerges_store(struct request_queue *q, const char *page, | |||
199 | ssize_t ret = queue_var_store(&nm, page, count); | 200 | ssize_t ret = queue_var_store(&nm, page, count); |
200 | 201 | ||
201 | spin_lock_irq(q->queue_lock); | 202 | spin_lock_irq(q->queue_lock); |
202 | if (nm) | 203 | queue_flag_clear(QUEUE_FLAG_NOMERGES, q); |
204 | queue_flag_clear(QUEUE_FLAG_NOXMERGES, q); | ||
205 | if (nm == 2) | ||
203 | queue_flag_set(QUEUE_FLAG_NOMERGES, q); | 206 | queue_flag_set(QUEUE_FLAG_NOMERGES, q); |
204 | else | 207 | else if (nm) |
205 | queue_flag_clear(QUEUE_FLAG_NOMERGES, q); | 208 | queue_flag_set(QUEUE_FLAG_NOXMERGES, q); |
206 | spin_unlock_irq(q->queue_lock); | 209 | spin_unlock_irq(q->queue_lock); |
207 | 210 | ||
208 | return ret; | 211 | return ret; |
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 023f4e69a337..e3dedfd3bcb4 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -115,11 +115,11 @@ struct cfq_queue { | |||
115 | /* time when queue got scheduled in to dispatch first request. */ | 115 | /* time when queue got scheduled in to dispatch first request. */ |
116 | unsigned long dispatch_start; | 116 | unsigned long dispatch_start; |
117 | unsigned int allocated_slice; | 117 | unsigned int allocated_slice; |
118 | unsigned int slice_dispatch; | ||
118 | /* time when first request from queue completed and slice started. */ | 119 | /* time when first request from queue completed and slice started. */ |
119 | unsigned long slice_start; | 120 | unsigned long slice_start; |
120 | unsigned long slice_end; | 121 | unsigned long slice_end; |
121 | long slice_resid; | 122 | long slice_resid; |
122 | unsigned int slice_dispatch; | ||
123 | 123 | ||
124 | /* pending metadata requests */ | 124 | /* pending metadata requests */ |
125 | int meta_pending; | 125 | int meta_pending; |
@@ -130,13 +130,13 @@ struct cfq_queue { | |||
130 | unsigned short ioprio, org_ioprio; | 130 | unsigned short ioprio, org_ioprio; |
131 | unsigned short ioprio_class, org_ioprio_class; | 131 | unsigned short ioprio_class, org_ioprio_class; |
132 | 132 | ||
133 | pid_t pid; | ||
134 | |||
133 | unsigned int seek_samples; | 135 | unsigned int seek_samples; |
134 | u64 seek_total; | 136 | u64 seek_total; |
135 | sector_t seek_mean; | 137 | sector_t seek_mean; |
136 | sector_t last_request_pos; | 138 | sector_t last_request_pos; |
137 | 139 | ||
138 | pid_t pid; | ||
139 | |||
140 | struct cfq_rb_root *service_tree; | 140 | struct cfq_rb_root *service_tree; |
141 | struct cfq_queue *new_cfqq; | 141 | struct cfq_queue *new_cfqq; |
142 | struct cfq_group *cfqg; | 142 | struct cfq_group *cfqg; |
diff --git a/block/elevator.c b/block/elevator.c index 9ad5ccc4c5ee..ee3a883840f2 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
@@ -474,6 +474,15 @@ int elv_merge(struct request_queue *q, struct request **req, struct bio *bio) | |||
474 | int ret; | 474 | int ret; |
475 | 475 | ||
476 | /* | 476 | /* |
477 | * Levels of merges: | ||
478 | * nomerges: No merges at all attempted | ||
479 | * noxmerges: Only simple one-hit cache try | ||
480 | * merges: All merge tries attempted | ||
481 | */ | ||
482 | if (blk_queue_nomerges(q)) | ||
483 | return ELEVATOR_NO_MERGE; | ||
484 | |||
485 | /* | ||
477 | * First try one-hit cache. | 486 | * First try one-hit cache. |
478 | */ | 487 | */ |
479 | if (q->last_merge) { | 488 | if (q->last_merge) { |
@@ -484,7 +493,7 @@ int elv_merge(struct request_queue *q, struct request **req, struct bio *bio) | |||
484 | } | 493 | } |
485 | } | 494 | } |
486 | 495 | ||
487 | if (blk_queue_nomerges(q)) | 496 | if (blk_queue_noxmerges(q)) |
488 | return ELEVATOR_NO_MERGE; | 497 | return ELEVATOR_NO_MERGE; |
489 | 498 | ||
490 | /* | 499 | /* |
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index ce1fa923c414..7412b5d4f5f3 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c | |||
@@ -7134,7 +7134,7 @@ static struct DAC960_privdata DAC960_P_privdata = { | |||
7134 | .MemoryWindowSize = DAC960_PD_RegisterWindowSize, | 7134 | .MemoryWindowSize = DAC960_PD_RegisterWindowSize, |
7135 | }; | 7135 | }; |
7136 | 7136 | ||
7137 | static struct pci_device_id DAC960_id_table[] = { | 7137 | static const struct pci_device_id DAC960_id_table[] = { |
7138 | { | 7138 | { |
7139 | .vendor = PCI_VENDOR_ID_MYLEX, | 7139 | .vendor = PCI_VENDOR_ID_MYLEX, |
7140 | .device = PCI_DEVICE_ID_MYLEX_DAC960_GEM, | 7140 | .device = PCI_DEVICE_ID_MYLEX_DAC960_GEM, |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 9291614ac6b7..86acdca5d0ce 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -1344,26 +1344,27 @@ static int cciss_ioctl(struct block_device *bdev, fmode_t mode, | |||
1344 | kfree(buff); | 1344 | kfree(buff); |
1345 | return -ENOMEM; | 1345 | return -ENOMEM; |
1346 | } | 1346 | } |
1347 | // Fill in the command type | 1347 | /* Fill in the command type */ |
1348 | c->cmd_type = CMD_IOCTL_PEND; | 1348 | c->cmd_type = CMD_IOCTL_PEND; |
1349 | // Fill in Command Header | 1349 | /* Fill in Command Header */ |
1350 | c->Header.ReplyQueue = 0; // unused in simple mode | 1350 | c->Header.ReplyQueue = 0; /* unused in simple mode */ |
1351 | if (iocommand.buf_size > 0) // buffer to fill | 1351 | if (iocommand.buf_size > 0) /* buffer to fill */ |
1352 | { | 1352 | { |
1353 | c->Header.SGList = 1; | 1353 | c->Header.SGList = 1; |
1354 | c->Header.SGTotal = 1; | 1354 | c->Header.SGTotal = 1; |
1355 | } else // no buffers to fill | 1355 | } else /* no buffers to fill */ |
1356 | { | 1356 | { |
1357 | c->Header.SGList = 0; | 1357 | c->Header.SGList = 0; |
1358 | c->Header.SGTotal = 0; | 1358 | c->Header.SGTotal = 0; |
1359 | } | 1359 | } |
1360 | c->Header.LUN = iocommand.LUN_info; | 1360 | c->Header.LUN = iocommand.LUN_info; |
1361 | c->Header.Tag.lower = c->busaddr; // use the kernel address the cmd block for tag | 1361 | /* use the kernel address the cmd block for tag */ |
1362 | c->Header.Tag.lower = c->busaddr; | ||
1362 | 1363 | ||
1363 | // Fill in Request block | 1364 | /* Fill in Request block */ |
1364 | c->Request = iocommand.Request; | 1365 | c->Request = iocommand.Request; |
1365 | 1366 | ||
1366 | // Fill in the scatter gather information | 1367 | /* Fill in the scatter gather information */ |
1367 | if (iocommand.buf_size > 0) { | 1368 | if (iocommand.buf_size > 0) { |
1368 | temp64.val = pci_map_single(host->pdev, buff, | 1369 | temp64.val = pci_map_single(host->pdev, buff, |
1369 | iocommand.buf_size, | 1370 | iocommand.buf_size, |
@@ -1371,7 +1372,7 @@ static int cciss_ioctl(struct block_device *bdev, fmode_t mode, | |||
1371 | c->SG[0].Addr.lower = temp64.val32.lower; | 1372 | c->SG[0].Addr.lower = temp64.val32.lower; |
1372 | c->SG[0].Addr.upper = temp64.val32.upper; | 1373 | c->SG[0].Addr.upper = temp64.val32.upper; |
1373 | c->SG[0].Len = iocommand.buf_size; | 1374 | c->SG[0].Len = iocommand.buf_size; |
1374 | c->SG[0].Ext = 0; // we are not chaining | 1375 | c->SG[0].Ext = 0; /* we are not chaining */ |
1375 | } | 1376 | } |
1376 | c->waiting = &wait; | 1377 | c->waiting = &wait; |
1377 | 1378 | ||
@@ -2425,7 +2426,7 @@ static int fill_cmd(CommandList_struct *c, __u8 cmd, int ctlr, void *buff, | |||
2425 | c->Request.Type.Direction = XFER_READ; | 2426 | c->Request.Type.Direction = XFER_READ; |
2426 | c->Request.Timeout = 0; | 2427 | c->Request.Timeout = 0; |
2427 | c->Request.CDB[0] = cmd; | 2428 | c->Request.CDB[0] = cmd; |
2428 | c->Request.CDB[6] = (size >> 24) & 0xFF; //MSB | 2429 | c->Request.CDB[6] = (size >> 24) & 0xFF; /* MSB */ |
2429 | c->Request.CDB[7] = (size >> 16) & 0xFF; | 2430 | c->Request.CDB[7] = (size >> 16) & 0xFF; |
2430 | c->Request.CDB[8] = (size >> 8) & 0xFF; | 2431 | c->Request.CDB[8] = (size >> 8) & 0xFF; |
2431 | c->Request.CDB[9] = size & 0xFF; | 2432 | c->Request.CDB[9] = size & 0xFF; |
@@ -2694,7 +2695,7 @@ static void cciss_geometry_inquiry(int ctlr, int logvol, | |||
2694 | "cciss: reading geometry failed, volume " | 2695 | "cciss: reading geometry failed, volume " |
2695 | "does not support reading geometry\n"); | 2696 | "does not support reading geometry\n"); |
2696 | drv->heads = 255; | 2697 | drv->heads = 255; |
2697 | drv->sectors = 32; // Sectors per track | 2698 | drv->sectors = 32; /* Sectors per track */ |
2698 | drv->cylinders = total_size + 1; | 2699 | drv->cylinders = total_size + 1; |
2699 | drv->raid_level = RAID_UNKNOWN; | 2700 | drv->raid_level = RAID_UNKNOWN; |
2700 | } else { | 2701 | } else { |
@@ -3112,19 +3113,19 @@ static void do_cciss_request(struct request_queue *q) | |||
3112 | 3113 | ||
3113 | /* fill in the request */ | 3114 | /* fill in the request */ |
3114 | drv = creq->rq_disk->private_data; | 3115 | drv = creq->rq_disk->private_data; |
3115 | c->Header.ReplyQueue = 0; // unused in simple mode | 3116 | c->Header.ReplyQueue = 0; /* unused in simple mode */ |
3116 | /* got command from pool, so use the command block index instead */ | 3117 | /* got command from pool, so use the command block index instead */ |
3117 | /* for direct lookups. */ | 3118 | /* for direct lookups. */ |
3118 | /* The first 2 bits are reserved for controller error reporting. */ | 3119 | /* The first 2 bits are reserved for controller error reporting. */ |
3119 | c->Header.Tag.lower = (c->cmdindex << 3); | 3120 | c->Header.Tag.lower = (c->cmdindex << 3); |
3120 | c->Header.Tag.lower |= 0x04; /* flag for direct lookup. */ | 3121 | c->Header.Tag.lower |= 0x04; /* flag for direct lookup. */ |
3121 | memcpy(&c->Header.LUN, drv->LunID, sizeof(drv->LunID)); | 3122 | memcpy(&c->Header.LUN, drv->LunID, sizeof(drv->LunID)); |
3122 | c->Request.CDBLen = 10; // 12 byte commands not in FW yet; | 3123 | c->Request.CDBLen = 10; /* 12 byte commands not in FW yet; */ |
3123 | c->Request.Type.Type = TYPE_CMD; // It is a command. | 3124 | c->Request.Type.Type = TYPE_CMD; /* It is a command. */ |
3124 | c->Request.Type.Attribute = ATTR_SIMPLE; | 3125 | c->Request.Type.Attribute = ATTR_SIMPLE; |
3125 | c->Request.Type.Direction = | 3126 | c->Request.Type.Direction = |
3126 | (rq_data_dir(creq) == READ) ? XFER_READ : XFER_WRITE; | 3127 | (rq_data_dir(creq) == READ) ? XFER_READ : XFER_WRITE; |
3127 | c->Request.Timeout = 0; // Don't time out | 3128 | c->Request.Timeout = 0; /* Don't time out */ |
3128 | c->Request.CDB[0] = | 3129 | c->Request.CDB[0] = |
3129 | (rq_data_dir(creq) == READ) ? h->cciss_read : h->cciss_write; | 3130 | (rq_data_dir(creq) == READ) ? h->cciss_read : h->cciss_write; |
3130 | start_blk = blk_rq_pos(creq); | 3131 | start_blk = blk_rq_pos(creq); |
@@ -3209,11 +3210,11 @@ static void do_cciss_request(struct request_queue *q) | |||
3209 | if (likely(blk_fs_request(creq))) { | 3210 | if (likely(blk_fs_request(creq))) { |
3210 | if(h->cciss_read == CCISS_READ_10) { | 3211 | if(h->cciss_read == CCISS_READ_10) { |
3211 | c->Request.CDB[1] = 0; | 3212 | c->Request.CDB[1] = 0; |
3212 | c->Request.CDB[2] = (start_blk >> 24) & 0xff; //MSB | 3213 | c->Request.CDB[2] = (start_blk >> 24) & 0xff; /* MSB */ |
3213 | c->Request.CDB[3] = (start_blk >> 16) & 0xff; | 3214 | c->Request.CDB[3] = (start_blk >> 16) & 0xff; |
3214 | c->Request.CDB[4] = (start_blk >> 8) & 0xff; | 3215 | c->Request.CDB[4] = (start_blk >> 8) & 0xff; |
3215 | c->Request.CDB[5] = start_blk & 0xff; | 3216 | c->Request.CDB[5] = start_blk & 0xff; |
3216 | c->Request.CDB[6] = 0; // (sect >> 24) & 0xff; MSB | 3217 | c->Request.CDB[6] = 0; /* (sect >> 24) & 0xff; MSB */ |
3217 | c->Request.CDB[7] = (blk_rq_sectors(creq) >> 8) & 0xff; | 3218 | c->Request.CDB[7] = (blk_rq_sectors(creq) >> 8) & 0xff; |
3218 | c->Request.CDB[8] = blk_rq_sectors(creq) & 0xff; | 3219 | c->Request.CDB[8] = blk_rq_sectors(creq) & 0xff; |
3219 | c->Request.CDB[9] = c->Request.CDB[11] = c->Request.CDB[12] = 0; | 3220 | c->Request.CDB[9] = c->Request.CDB[11] = c->Request.CDB[12] = 0; |
@@ -3222,7 +3223,7 @@ static void do_cciss_request(struct request_queue *q) | |||
3222 | 3223 | ||
3223 | c->Request.CDBLen = 16; | 3224 | c->Request.CDBLen = 16; |
3224 | c->Request.CDB[1]= 0; | 3225 | c->Request.CDB[1]= 0; |
3225 | c->Request.CDB[2]= (upper32 >> 24) & 0xff; //MSB | 3226 | c->Request.CDB[2]= (upper32 >> 24) & 0xff; /* MSB */ |
3226 | c->Request.CDB[3]= (upper32 >> 16) & 0xff; | 3227 | c->Request.CDB[3]= (upper32 >> 16) & 0xff; |
3227 | c->Request.CDB[4]= (upper32 >> 8) & 0xff; | 3228 | c->Request.CDB[4]= (upper32 >> 8) & 0xff; |
3228 | c->Request.CDB[5]= upper32 & 0xff; | 3229 | c->Request.CDB[5]= upper32 & 0xff; |
diff --git a/drivers/block/cciss.h b/drivers/block/cciss.h index 1d95db254069..2b07bdacbd12 100644 --- a/drivers/block/cciss.h +++ b/drivers/block/cciss.h | |||
@@ -66,7 +66,7 @@ struct ctlr_info | |||
66 | int ctlr; | 66 | int ctlr; |
67 | char devname[8]; | 67 | char devname[8]; |
68 | char *product_name; | 68 | char *product_name; |
69 | char firm_ver[4]; // Firmware version | 69 | char firm_ver[4]; /* Firmware version */ |
70 | struct pci_dev *pdev; | 70 | struct pci_dev *pdev; |
71 | __u32 board_id; | 71 | __u32 board_id; |
72 | void __iomem *vaddr; | 72 | void __iomem *vaddr; |
@@ -103,7 +103,7 @@ struct ctlr_info | |||
103 | BYTE cciss_write; | 103 | BYTE cciss_write; |
104 | BYTE cciss_read_capacity; | 104 | BYTE cciss_read_capacity; |
105 | 105 | ||
106 | // information about each logical volume | 106 | /* information about each logical volume */ |
107 | drive_info_struct *drv[CISS_MAX_LUN]; | 107 | drive_info_struct *drv[CISS_MAX_LUN]; |
108 | 108 | ||
109 | struct access_method access; | 109 | struct access_method access; |
@@ -116,7 +116,7 @@ struct ctlr_info | |||
116 | unsigned int maxSG; | 116 | unsigned int maxSG; |
117 | spinlock_t lock; | 117 | spinlock_t lock; |
118 | 118 | ||
119 | //* pointers to command and error info pool */ | 119 | /* pointers to command and error info pool */ |
120 | CommandList_struct *cmd_pool; | 120 | CommandList_struct *cmd_pool; |
121 | dma_addr_t cmd_pool_dhandle; | 121 | dma_addr_t cmd_pool_dhandle; |
122 | ErrorInfo_struct *errinfo_pool; | 122 | ErrorInfo_struct *errinfo_pool; |
@@ -134,7 +134,7 @@ struct ctlr_info | |||
134 | */ | 134 | */ |
135 | int next_to_run; | 135 | int next_to_run; |
136 | 136 | ||
137 | // Disk structures we need to pass back | 137 | /* Disk structures we need to pass back */ |
138 | struct gendisk *gendisk[CISS_MAX_LUN]; | 138 | struct gendisk *gendisk[CISS_MAX_LUN]; |
139 | #ifdef CONFIG_CISS_SCSI_TAPE | 139 | #ifdef CONFIG_CISS_SCSI_TAPE |
140 | void *scsi_ctlr; /* ptr to structure containing scsi related stuff */ | 140 | void *scsi_ctlr; /* ptr to structure containing scsi related stuff */ |
@@ -315,4 +315,3 @@ struct board_type { | |||
315 | #define CCISS_LOCK(i) (&hba[i]->lock) | 315 | #define CCISS_LOCK(i) (&hba[i]->lock) |
316 | 316 | ||
317 | #endif /* CCISS_H */ | 317 | #endif /* CCISS_H */ |
318 | |||
diff --git a/drivers/block/cciss_cmd.h b/drivers/block/cciss_cmd.h index 6afa700890ff..25f97623bacf 100644 --- a/drivers/block/cciss_cmd.h +++ b/drivers/block/cciss_cmd.h | |||
@@ -1,31 +1,16 @@ | |||
1 | #ifndef CCISS_CMD_H | 1 | #ifndef CCISS_CMD_H |
2 | #define CCISS_CMD_H | 2 | #define CCISS_CMD_H |
3 | //########################################################################### | 3 | |
4 | //DEFINES | 4 | #include <linux/cciss_defs.h> |
5 | //########################################################################### | 5 | |
6 | /* DEFINES */ | ||
6 | #define CISS_VERSION "1.00" | 7 | #define CISS_VERSION "1.00" |
7 | 8 | ||
8 | //general boundary definitions | 9 | /* general boundary definitions */ |
9 | #define SENSEINFOBYTES 32//note that this value may vary between host implementations | ||
10 | #define MAXSGENTRIES 32 | 10 | #define MAXSGENTRIES 32 |
11 | #define CCISS_SG_CHAIN 0x80000000 | 11 | #define CCISS_SG_CHAIN 0x80000000 |
12 | #define MAXREPLYQS 256 | 12 | #define MAXREPLYQS 256 |
13 | 13 | ||
14 | //Command Status value | ||
15 | #define CMD_SUCCESS 0x0000 | ||
16 | #define CMD_TARGET_STATUS 0x0001 | ||
17 | #define CMD_DATA_UNDERRUN 0x0002 | ||
18 | #define CMD_DATA_OVERRUN 0x0003 | ||
19 | #define CMD_INVALID 0x0004 | ||
20 | #define CMD_PROTOCOL_ERR 0x0005 | ||
21 | #define CMD_HARDWARE_ERR 0x0006 | ||
22 | #define CMD_CONNECTION_LOST 0x0007 | ||
23 | #define CMD_ABORTED 0x0008 | ||
24 | #define CMD_ABORT_FAILED 0x0009 | ||
25 | #define CMD_UNSOLICITED_ABORT 0x000A | ||
26 | #define CMD_TIMEOUT 0x000B | ||
27 | #define CMD_UNABORTABLE 0x000C | ||
28 | |||
29 | /* Unit Attentions ASC's as defined for the MSA2012sa */ | 14 | /* Unit Attentions ASC's as defined for the MSA2012sa */ |
30 | #define POWER_OR_RESET 0x29 | 15 | #define POWER_OR_RESET 0x29 |
31 | #define STATE_CHANGED 0x2a | 16 | #define STATE_CHANGED 0x2a |
@@ -49,30 +34,13 @@ | |||
49 | #define ASYM_ACCESS_CHANGED 0x06 | 34 | #define ASYM_ACCESS_CHANGED 0x06 |
50 | #define LUN_CAPACITY_CHANGED 0x09 | 35 | #define LUN_CAPACITY_CHANGED 0x09 |
51 | 36 | ||
52 | //transfer direction | 37 | /* config space register offsets */ |
53 | #define XFER_NONE 0x00 | ||
54 | #define XFER_WRITE 0x01 | ||
55 | #define XFER_READ 0x02 | ||
56 | #define XFER_RSVD 0x03 | ||
57 | |||
58 | //task attribute | ||
59 | #define ATTR_UNTAGGED 0x00 | ||
60 | #define ATTR_SIMPLE 0x04 | ||
61 | #define ATTR_HEADOFQUEUE 0x05 | ||
62 | #define ATTR_ORDERED 0x06 | ||
63 | #define ATTR_ACA 0x07 | ||
64 | |||
65 | //cdb type | ||
66 | #define TYPE_CMD 0x00 | ||
67 | #define TYPE_MSG 0x01 | ||
68 | |||
69 | //config space register offsets | ||
70 | #define CFG_VENDORID 0x00 | 38 | #define CFG_VENDORID 0x00 |
71 | #define CFG_DEVICEID 0x02 | 39 | #define CFG_DEVICEID 0x02 |
72 | #define CFG_I2OBAR 0x10 | 40 | #define CFG_I2OBAR 0x10 |
73 | #define CFG_MEM1BAR 0x14 | 41 | #define CFG_MEM1BAR 0x14 |
74 | 42 | ||
75 | //i2o space register offsets | 43 | /* i2o space register offsets */ |
76 | #define I2O_IBDB_SET 0x20 | 44 | #define I2O_IBDB_SET 0x20 |
77 | #define I2O_IBDB_CLEAR 0x70 | 45 | #define I2O_IBDB_CLEAR 0x70 |
78 | #define I2O_INT_STATUS 0x30 | 46 | #define I2O_INT_STATUS 0x30 |
@@ -81,7 +49,7 @@ | |||
81 | #define I2O_OBPOST_Q 0x44 | 49 | #define I2O_OBPOST_Q 0x44 |
82 | #define I2O_DMA1_CFG 0x214 | 50 | #define I2O_DMA1_CFG 0x214 |
83 | 51 | ||
84 | //Configuration Table | 52 | /* Configuration Table */ |
85 | #define CFGTBL_ChangeReq 0x00000001l | 53 | #define CFGTBL_ChangeReq 0x00000001l |
86 | #define CFGTBL_AccCmds 0x00000001l | 54 | #define CFGTBL_AccCmds 0x00000001l |
87 | 55 | ||
@@ -103,24 +71,17 @@ typedef union _u64bit | |||
103 | __u64 val; | 71 | __u64 val; |
104 | } u64bit; | 72 | } u64bit; |
105 | 73 | ||
106 | // Type defs used in the following structs | 74 | /* Type defs used in the following structs */ |
107 | #define BYTE __u8 | ||
108 | #define WORD __u16 | ||
109 | #define HWORD __u16 | ||
110 | #define DWORD __u32 | ||
111 | #define QWORD vals32 | 75 | #define QWORD vals32 |
112 | 76 | ||
113 | //########################################################################### | 77 | /* STRUCTURES */ |
114 | //STRUCTURES | ||
115 | //########################################################################### | ||
116 | #define CISS_MAX_LUN 1024 | ||
117 | #define CISS_MAX_PHYS_LUN 1024 | 78 | #define CISS_MAX_PHYS_LUN 1024 |
118 | // SCSI-3 Cmmands | 79 | /* SCSI-3 Cmmands */ |
119 | 80 | ||
120 | #pragma pack(1) | 81 | #pragma pack(1) |
121 | 82 | ||
122 | #define CISS_INQUIRY 0x12 | 83 | #define CISS_INQUIRY 0x12 |
123 | //Date returned | 84 | /* Date returned */ |
124 | typedef struct _InquiryData_struct | 85 | typedef struct _InquiryData_struct |
125 | { | 86 | { |
126 | BYTE data_byte[36]; | 87 | BYTE data_byte[36]; |
@@ -128,7 +89,7 @@ typedef struct _InquiryData_struct | |||
128 | 89 | ||
129 | #define CISS_REPORT_LOG 0xc2 /* Report Logical LUNs */ | 90 | #define CISS_REPORT_LOG 0xc2 /* Report Logical LUNs */ |
130 | #define CISS_REPORT_PHYS 0xc3 /* Report Physical LUNs */ | 91 | #define CISS_REPORT_PHYS 0xc3 /* Report Physical LUNs */ |
131 | // Data returned | 92 | /* Data returned */ |
132 | typedef struct _ReportLUNdata_struct | 93 | typedef struct _ReportLUNdata_struct |
133 | { | 94 | { |
134 | BYTE LUNListLength[4]; | 95 | BYTE LUNListLength[4]; |
@@ -139,8 +100,8 @@ typedef struct _ReportLUNdata_struct | |||
139 | #define CCISS_READ_CAPACITY 0x25 /* Read Capacity */ | 100 | #define CCISS_READ_CAPACITY 0x25 /* Read Capacity */ |
140 | typedef struct _ReadCapdata_struct | 101 | typedef struct _ReadCapdata_struct |
141 | { | 102 | { |
142 | BYTE total_size[4]; // Total size in blocks | 103 | BYTE total_size[4]; /* Total size in blocks */ |
143 | BYTE block_size[4]; // Size of blocks in bytes | 104 | BYTE block_size[4]; /* Size of blocks in bytes */ |
144 | } ReadCapdata_struct; | 105 | } ReadCapdata_struct; |
145 | 106 | ||
146 | #define CCISS_READ_CAPACITY_16 0x9e /* Read Capacity 16 */ | 107 | #define CCISS_READ_CAPACITY_16 0x9e /* Read Capacity 16 */ |
@@ -172,52 +133,13 @@ typedef struct _ReadCapdata_struct_16 | |||
172 | #define CDB_LEN10 10 | 133 | #define CDB_LEN10 10 |
173 | #define CDB_LEN16 16 | 134 | #define CDB_LEN16 16 |
174 | 135 | ||
175 | // BMIC commands | 136 | /* BMIC commands */ |
176 | #define BMIC_READ 0x26 | 137 | #define BMIC_READ 0x26 |
177 | #define BMIC_WRITE 0x27 | 138 | #define BMIC_WRITE 0x27 |
178 | #define BMIC_CACHE_FLUSH 0xc2 | 139 | #define BMIC_CACHE_FLUSH 0xc2 |
179 | #define CCISS_CACHE_FLUSH 0x01 //C2 was already being used by CCISS | 140 | #define CCISS_CACHE_FLUSH 0x01 /* C2 was already being used by CCISS */ |
180 | |||
181 | //Command List Structure | ||
182 | typedef union _SCSI3Addr_struct { | ||
183 | struct { | ||
184 | BYTE Dev; | ||
185 | BYTE Bus:6; | ||
186 | BYTE Mode:2; // b00 | ||
187 | } PeripDev; | ||
188 | struct { | ||
189 | BYTE DevLSB; | ||
190 | BYTE DevMSB:6; | ||
191 | BYTE Mode:2; // b01 | ||
192 | } LogDev; | ||
193 | struct { | ||
194 | BYTE Dev:5; | ||
195 | BYTE Bus:3; | ||
196 | BYTE Targ:6; | ||
197 | BYTE Mode:2; // b10 | ||
198 | } LogUnit; | ||
199 | } SCSI3Addr_struct; | ||
200 | |||
201 | typedef struct _PhysDevAddr_struct { | ||
202 | DWORD TargetId:24; | ||
203 | DWORD Bus:6; | ||
204 | DWORD Mode:2; | ||
205 | SCSI3Addr_struct Target[2]; //2 level target device addr | ||
206 | } PhysDevAddr_struct; | ||
207 | |||
208 | typedef struct _LogDevAddr_struct { | ||
209 | DWORD VolId:30; | ||
210 | DWORD Mode:2; | ||
211 | BYTE reserved[4]; | ||
212 | } LogDevAddr_struct; | ||
213 | |||
214 | typedef union _LUNAddr_struct { | ||
215 | BYTE LunAddrBytes[8]; | ||
216 | SCSI3Addr_struct SCSI3Lun[4]; | ||
217 | PhysDevAddr_struct PhysDev; | ||
218 | LogDevAddr_struct LogDev; | ||
219 | } LUNAddr_struct; | ||
220 | 141 | ||
142 | /* Command List Structure */ | ||
221 | #define CTLR_LUNID "\0\0\0\0\0\0\0\0" | 143 | #define CTLR_LUNID "\0\0\0\0\0\0\0\0" |
222 | 144 | ||
223 | typedef struct _CommandListHeader_struct { | 145 | typedef struct _CommandListHeader_struct { |
@@ -227,16 +149,6 @@ typedef struct _CommandListHeader_struct { | |||
227 | QWORD Tag; | 149 | QWORD Tag; |
228 | LUNAddr_struct LUN; | 150 | LUNAddr_struct LUN; |
229 | } CommandListHeader_struct; | 151 | } CommandListHeader_struct; |
230 | typedef struct _RequestBlock_struct { | ||
231 | BYTE CDBLen; | ||
232 | struct { | ||
233 | BYTE Type:3; | ||
234 | BYTE Attribute:3; | ||
235 | BYTE Direction:2; | ||
236 | } Type; | ||
237 | HWORD Timeout; | ||
238 | BYTE CDB[16]; | ||
239 | } RequestBlock_struct; | ||
240 | typedef struct _ErrDescriptor_struct { | 152 | typedef struct _ErrDescriptor_struct { |
241 | QWORD Addr; | 153 | QWORD Addr; |
242 | DWORD Len; | 154 | DWORD Len; |
@@ -247,28 +159,6 @@ typedef struct _SGDescriptor_struct { | |||
247 | DWORD Ext; | 159 | DWORD Ext; |
248 | } SGDescriptor_struct; | 160 | } SGDescriptor_struct; |
249 | 161 | ||
250 | typedef union _MoreErrInfo_struct{ | ||
251 | struct { | ||
252 | BYTE Reserved[3]; | ||
253 | BYTE Type; | ||
254 | DWORD ErrorInfo; | ||
255 | }Common_Info; | ||
256 | struct{ | ||
257 | BYTE Reserved[2]; | ||
258 | BYTE offense_size;//size of offending entry | ||
259 | BYTE offense_num; //byte # of offense 0-base | ||
260 | DWORD offense_value; | ||
261 | }Invalid_Cmd; | ||
262 | }MoreErrInfo_struct; | ||
263 | typedef struct _ErrorInfo_struct { | ||
264 | BYTE ScsiStatus; | ||
265 | BYTE SenseLen; | ||
266 | HWORD CommandStatus; | ||
267 | DWORD ResidualCnt; | ||
268 | MoreErrInfo_struct MoreErrInfo; | ||
269 | BYTE SenseInfo[SENSEINFOBYTES]; | ||
270 | } ErrorInfo_struct; | ||
271 | |||
272 | /* Command types */ | 162 | /* Command types */ |
273 | #define CMD_RWREQ 0x00 | 163 | #define CMD_RWREQ 0x00 |
274 | #define CMD_IOCTL_PEND 0x01 | 164 | #define CMD_IOCTL_PEND 0x01 |
@@ -300,7 +190,7 @@ typedef struct _CommandList_struct { | |||
300 | char pad[PADSIZE]; | 190 | char pad[PADSIZE]; |
301 | } CommandList_struct; | 191 | } CommandList_struct; |
302 | 192 | ||
303 | //Configuration Table Structure | 193 | /* Configuration Table Structure */ |
304 | typedef struct _HostWrite_struct { | 194 | typedef struct _HostWrite_struct { |
305 | DWORD TransportRequest; | 195 | DWORD TransportRequest; |
306 | DWORD Reserved; | 196 | DWORD Reserved; |
@@ -326,4 +216,4 @@ typedef struct _CfgTable_struct { | |||
326 | DWORD MaxPhysicalDrivesPerLogicalUnit; | 216 | DWORD MaxPhysicalDrivesPerLogicalUnit; |
327 | } CfgTable_struct; | 217 | } CfgTable_struct; |
328 | #pragma pack() | 218 | #pragma pack() |
329 | #endif // CCISS_CMD_H | 219 | #endif /* CCISS_CMD_H */ |
diff --git a/drivers/block/cciss_scsi.h b/drivers/block/cciss_scsi.h index 7b750245ae76..6d5822fe851a 100644 --- a/drivers/block/cciss_scsi.h +++ b/drivers/block/cciss_scsi.h | |||
@@ -25,16 +25,16 @@ | |||
25 | 25 | ||
26 | #include <scsi/scsicam.h> /* possibly irrelevant, since we don't show disks */ | 26 | #include <scsi/scsicam.h> /* possibly irrelevant, since we don't show disks */ |
27 | 27 | ||
28 | // the scsi id of the adapter... | 28 | /* the scsi id of the adapter... */ |
29 | #define SELF_SCSI_ID 15 | 29 | #define SELF_SCSI_ID 15 |
30 | // 15 is somewhat arbitrary, since the scsi-2 bus | 30 | /* 15 is somewhat arbitrary, since the scsi-2 bus |
31 | // that's presented by the driver to the OS is | 31 | that's presented by the driver to the OS is |
32 | // fabricated. The "real" scsi-3 bus the | 32 | fabricated. The "real" scsi-3 bus the |
33 | // hardware presents is fabricated too. | 33 | hardware presents is fabricated too. |
34 | // The actual, honest-to-goodness physical | 34 | The actual, honest-to-goodness physical |
35 | // bus that the devices are attached to is not | 35 | bus that the devices are attached to is not |
36 | // addressible natively, and may in fact turn | 36 | addressible natively, and may in fact turn |
37 | // out to be not scsi at all. | 37 | out to be not scsi at all. */ |
38 | 38 | ||
39 | #define SCSI_CCISS_CAN_QUEUE 2 | 39 | #define SCSI_CCISS_CAN_QUEUE 2 |
40 | 40 | ||
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 68b5957f107c..7cd2973ebb7b 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -569,6 +569,7 @@ static struct packet_data *pkt_alloc_packet_data(int frames) | |||
569 | } | 569 | } |
570 | 570 | ||
571 | spin_lock_init(&pkt->lock); | 571 | spin_lock_init(&pkt->lock); |
572 | bio_list_init(&pkt->orig_bios); | ||
572 | 573 | ||
573 | for (i = 0; i < frames; i++) { | 574 | for (i = 0; i < frames; i++) { |
574 | struct bio *bio = pkt_bio_alloc(1); | 575 | struct bio *bio = pkt_bio_alloc(1); |
@@ -721,43 +722,6 @@ static void pkt_rbtree_insert(struct pktcdvd_device *pd, struct pkt_rb_node *nod | |||
721 | } | 722 | } |
722 | 723 | ||
723 | /* | 724 | /* |
724 | * Add a bio to a single linked list defined by its head and tail pointers. | ||
725 | */ | ||
726 | static void pkt_add_list_last(struct bio *bio, struct bio **list_head, struct bio **list_tail) | ||
727 | { | ||
728 | bio->bi_next = NULL; | ||
729 | if (*list_tail) { | ||
730 | BUG_ON((*list_head) == NULL); | ||
731 | (*list_tail)->bi_next = bio; | ||
732 | (*list_tail) = bio; | ||
733 | } else { | ||
734 | BUG_ON((*list_head) != NULL); | ||
735 | (*list_head) = bio; | ||
736 | (*list_tail) = bio; | ||
737 | } | ||
738 | } | ||
739 | |||
740 | /* | ||
741 | * Remove and return the first bio from a single linked list defined by its | ||
742 | * head and tail pointers. | ||
743 | */ | ||
744 | static inline struct bio *pkt_get_list_first(struct bio **list_head, struct bio **list_tail) | ||
745 | { | ||
746 | struct bio *bio; | ||
747 | |||
748 | if (*list_head == NULL) | ||
749 | return NULL; | ||
750 | |||
751 | bio = *list_head; | ||
752 | *list_head = bio->bi_next; | ||
753 | if (*list_head == NULL) | ||
754 | *list_tail = NULL; | ||
755 | |||
756 | bio->bi_next = NULL; | ||
757 | return bio; | ||
758 | } | ||
759 | |||
760 | /* | ||
761 | * Send a packet_command to the underlying block device and | 725 | * Send a packet_command to the underlying block device and |
762 | * wait for completion. | 726 | * wait for completion. |
763 | */ | 727 | */ |
@@ -876,13 +840,10 @@ static noinline_for_stack int pkt_set_speed(struct pktcdvd_device *pd, | |||
876 | static void pkt_queue_bio(struct pktcdvd_device *pd, struct bio *bio) | 840 | static void pkt_queue_bio(struct pktcdvd_device *pd, struct bio *bio) |
877 | { | 841 | { |
878 | spin_lock(&pd->iosched.lock); | 842 | spin_lock(&pd->iosched.lock); |
879 | if (bio_data_dir(bio) == READ) { | 843 | if (bio_data_dir(bio) == READ) |
880 | pkt_add_list_last(bio, &pd->iosched.read_queue, | 844 | bio_list_add(&pd->iosched.read_queue, bio); |
881 | &pd->iosched.read_queue_tail); | 845 | else |
882 | } else { | 846 | bio_list_add(&pd->iosched.write_queue, bio); |
883 | pkt_add_list_last(bio, &pd->iosched.write_queue, | ||
884 | &pd->iosched.write_queue_tail); | ||
885 | } | ||
886 | spin_unlock(&pd->iosched.lock); | 847 | spin_unlock(&pd->iosched.lock); |
887 | 848 | ||
888 | atomic_set(&pd->iosched.attention, 1); | 849 | atomic_set(&pd->iosched.attention, 1); |
@@ -917,8 +878,8 @@ static void pkt_iosched_process_queue(struct pktcdvd_device *pd) | |||
917 | int reads_queued, writes_queued; | 878 | int reads_queued, writes_queued; |
918 | 879 | ||
919 | spin_lock(&pd->iosched.lock); | 880 | spin_lock(&pd->iosched.lock); |
920 | reads_queued = (pd->iosched.read_queue != NULL); | 881 | reads_queued = !bio_list_empty(&pd->iosched.read_queue); |
921 | writes_queued = (pd->iosched.write_queue != NULL); | 882 | writes_queued = !bio_list_empty(&pd->iosched.write_queue); |
922 | spin_unlock(&pd->iosched.lock); | 883 | spin_unlock(&pd->iosched.lock); |
923 | 884 | ||
924 | if (!reads_queued && !writes_queued) | 885 | if (!reads_queued && !writes_queued) |
@@ -927,7 +888,7 @@ static void pkt_iosched_process_queue(struct pktcdvd_device *pd) | |||
927 | if (pd->iosched.writing) { | 888 | if (pd->iosched.writing) { |
928 | int need_write_seek = 1; | 889 | int need_write_seek = 1; |
929 | spin_lock(&pd->iosched.lock); | 890 | spin_lock(&pd->iosched.lock); |
930 | bio = pd->iosched.write_queue; | 891 | bio = bio_list_peek(&pd->iosched.write_queue); |
931 | spin_unlock(&pd->iosched.lock); | 892 | spin_unlock(&pd->iosched.lock); |
932 | if (bio && (bio->bi_sector == pd->iosched.last_write)) | 893 | if (bio && (bio->bi_sector == pd->iosched.last_write)) |
933 | need_write_seek = 0; | 894 | need_write_seek = 0; |
@@ -950,13 +911,10 @@ static void pkt_iosched_process_queue(struct pktcdvd_device *pd) | |||
950 | } | 911 | } |
951 | 912 | ||
952 | spin_lock(&pd->iosched.lock); | 913 | spin_lock(&pd->iosched.lock); |
953 | if (pd->iosched.writing) { | 914 | if (pd->iosched.writing) |
954 | bio = pkt_get_list_first(&pd->iosched.write_queue, | 915 | bio = bio_list_pop(&pd->iosched.write_queue); |
955 | &pd->iosched.write_queue_tail); | 916 | else |
956 | } else { | 917 | bio = bio_list_pop(&pd->iosched.read_queue); |
957 | bio = pkt_get_list_first(&pd->iosched.read_queue, | ||
958 | &pd->iosched.read_queue_tail); | ||
959 | } | ||
960 | spin_unlock(&pd->iosched.lock); | 918 | spin_unlock(&pd->iosched.lock); |
961 | 919 | ||
962 | if (!bio) | 920 | if (!bio) |
@@ -1114,7 +1072,7 @@ static void pkt_gather_data(struct pktcdvd_device *pd, struct packet_data *pkt) | |||
1114 | int f; | 1072 | int f; |
1115 | char written[PACKET_MAX_SIZE]; | 1073 | char written[PACKET_MAX_SIZE]; |
1116 | 1074 | ||
1117 | BUG_ON(!pkt->orig_bios); | 1075 | BUG_ON(bio_list_empty(&pkt->orig_bios)); |
1118 | 1076 | ||
1119 | atomic_set(&pkt->io_wait, 0); | 1077 | atomic_set(&pkt->io_wait, 0); |
1120 | atomic_set(&pkt->io_errors, 0); | 1078 | atomic_set(&pkt->io_errors, 0); |
@@ -1124,7 +1082,7 @@ static void pkt_gather_data(struct pktcdvd_device *pd, struct packet_data *pkt) | |||
1124 | */ | 1082 | */ |
1125 | memset(written, 0, sizeof(written)); | 1083 | memset(written, 0, sizeof(written)); |
1126 | spin_lock(&pkt->lock); | 1084 | spin_lock(&pkt->lock); |
1127 | for (bio = pkt->orig_bios; bio; bio = bio->bi_next) { | 1085 | bio_list_for_each(bio, &pkt->orig_bios) { |
1128 | int first_frame = (bio->bi_sector - pkt->sector) / (CD_FRAMESIZE >> 9); | 1086 | int first_frame = (bio->bi_sector - pkt->sector) / (CD_FRAMESIZE >> 9); |
1129 | int num_frames = bio->bi_size / CD_FRAMESIZE; | 1087 | int num_frames = bio->bi_size / CD_FRAMESIZE; |
1130 | pd->stats.secs_w += num_frames * (CD_FRAMESIZE >> 9); | 1088 | pd->stats.secs_w += num_frames * (CD_FRAMESIZE >> 9); |
@@ -1363,7 +1321,7 @@ try_next_bio: | |||
1363 | break; | 1321 | break; |
1364 | pkt_rbtree_erase(pd, node); | 1322 | pkt_rbtree_erase(pd, node); |
1365 | spin_lock(&pkt->lock); | 1323 | spin_lock(&pkt->lock); |
1366 | pkt_add_list_last(bio, &pkt->orig_bios, &pkt->orig_bios_tail); | 1324 | bio_list_add(&pkt->orig_bios, bio); |
1367 | pkt->write_size += bio->bi_size / CD_FRAMESIZE; | 1325 | pkt->write_size += bio->bi_size / CD_FRAMESIZE; |
1368 | spin_unlock(&pkt->lock); | 1326 | spin_unlock(&pkt->lock); |
1369 | } | 1327 | } |
@@ -1409,7 +1367,7 @@ static void pkt_start_write(struct pktcdvd_device *pd, struct packet_data *pkt) | |||
1409 | */ | 1367 | */ |
1410 | frames_write = 0; | 1368 | frames_write = 0; |
1411 | spin_lock(&pkt->lock); | 1369 | spin_lock(&pkt->lock); |
1412 | for (bio = pkt->orig_bios; bio; bio = bio->bi_next) { | 1370 | bio_list_for_each(bio, &pkt->orig_bios) { |
1413 | int segment = bio->bi_idx; | 1371 | int segment = bio->bi_idx; |
1414 | int src_offs = 0; | 1372 | int src_offs = 0; |
1415 | int first_frame = (bio->bi_sector - pkt->sector) / (CD_FRAMESIZE >> 9); | 1373 | int first_frame = (bio->bi_sector - pkt->sector) / (CD_FRAMESIZE >> 9); |
@@ -1472,20 +1430,14 @@ static void pkt_start_write(struct pktcdvd_device *pd, struct packet_data *pkt) | |||
1472 | 1430 | ||
1473 | static void pkt_finish_packet(struct packet_data *pkt, int uptodate) | 1431 | static void pkt_finish_packet(struct packet_data *pkt, int uptodate) |
1474 | { | 1432 | { |
1475 | struct bio *bio, *next; | 1433 | struct bio *bio; |
1476 | 1434 | ||
1477 | if (!uptodate) | 1435 | if (!uptodate) |
1478 | pkt->cache_valid = 0; | 1436 | pkt->cache_valid = 0; |
1479 | 1437 | ||
1480 | /* Finish all bios corresponding to this packet */ | 1438 | /* Finish all bios corresponding to this packet */ |
1481 | bio = pkt->orig_bios; | 1439 | while ((bio = bio_list_pop(&pkt->orig_bios))) |
1482 | while (bio) { | ||
1483 | next = bio->bi_next; | ||
1484 | bio->bi_next = NULL; | ||
1485 | bio_endio(bio, uptodate ? 0 : -EIO); | 1440 | bio_endio(bio, uptodate ? 0 : -EIO); |
1486 | bio = next; | ||
1487 | } | ||
1488 | pkt->orig_bios = pkt->orig_bios_tail = NULL; | ||
1489 | } | 1441 | } |
1490 | 1442 | ||
1491 | static void pkt_run_state_machine(struct pktcdvd_device *pd, struct packet_data *pkt) | 1443 | static void pkt_run_state_machine(struct pktcdvd_device *pd, struct packet_data *pkt) |
@@ -2567,8 +2519,7 @@ static int pkt_make_request(struct request_queue *q, struct bio *bio) | |||
2567 | spin_lock(&pkt->lock); | 2519 | spin_lock(&pkt->lock); |
2568 | if ((pkt->state == PACKET_WAITING_STATE) || | 2520 | if ((pkt->state == PACKET_WAITING_STATE) || |
2569 | (pkt->state == PACKET_READ_WAIT_STATE)) { | 2521 | (pkt->state == PACKET_READ_WAIT_STATE)) { |
2570 | pkt_add_list_last(bio, &pkt->orig_bios, | 2522 | bio_list_add(&pkt->orig_bios, bio); |
2571 | &pkt->orig_bios_tail); | ||
2572 | pkt->write_size += bio->bi_size / CD_FRAMESIZE; | 2523 | pkt->write_size += bio->bi_size / CD_FRAMESIZE; |
2573 | if ((pkt->write_size >= pkt->frames) && | 2524 | if ((pkt->write_size >= pkt->frames) && |
2574 | (pkt->state == PACKET_WAITING_STATE)) { | 2525 | (pkt->state == PACKET_WAITING_STATE)) { |
@@ -2898,6 +2849,8 @@ static int pkt_setup_dev(dev_t dev, dev_t* pkt_dev) | |||
2898 | 2849 | ||
2899 | spin_lock_init(&pd->lock); | 2850 | spin_lock_init(&pd->lock); |
2900 | spin_lock_init(&pd->iosched.lock); | 2851 | spin_lock_init(&pd->iosched.lock); |
2852 | bio_list_init(&pd->iosched.read_queue); | ||
2853 | bio_list_init(&pd->iosched.write_queue); | ||
2901 | sprintf(pd->name, DRIVER_NAME"%d", idx); | 2854 | sprintf(pd->name, DRIVER_NAME"%d", idx); |
2902 | init_waitqueue_head(&pd->wqueue); | 2855 | init_waitqueue_head(&pd->wqueue); |
2903 | pd->bio_queue = RB_ROOT; | 2856 | pd->bio_queue = RB_ROOT; |
diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c index a7c4184f4a63..7bd7b2f83116 100644 --- a/drivers/block/sx8.c +++ b/drivers/block/sx8.c | |||
@@ -409,7 +409,7 @@ static int carm_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
409 | static void carm_remove_one (struct pci_dev *pdev); | 409 | static void carm_remove_one (struct pci_dev *pdev); |
410 | static int carm_bdev_getgeo(struct block_device *bdev, struct hd_geometry *geo); | 410 | static int carm_bdev_getgeo(struct block_device *bdev, struct hd_geometry *geo); |
411 | 411 | ||
412 | static struct pci_device_id carm_pci_tbl[] = { | 412 | static const struct pci_device_id carm_pci_tbl[] = { |
413 | { PCI_VENDOR_ID_PROMISE, 0x8000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, }, | 413 | { PCI_VENDOR_ID_PROMISE, 0x8000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, }, |
414 | { PCI_VENDOR_ID_PROMISE, 0x8002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, }, | 414 | { PCI_VENDOR_ID_PROMISE, 0x8002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, }, |
415 | { } /* terminate list */ | 415 | { } /* terminate list */ |
diff --git a/drivers/block/ub.c b/drivers/block/ub.c index c739b203fe91..d86d1357ccef 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c | |||
@@ -393,7 +393,7 @@ static int ub_probe_lun(struct ub_dev *sc, int lnum); | |||
393 | #define ub_usb_ids usb_storage_usb_ids | 393 | #define ub_usb_ids usb_storage_usb_ids |
394 | #else | 394 | #else |
395 | 395 | ||
396 | static struct usb_device_id ub_usb_ids[] = { | 396 | static const struct usb_device_id ub_usb_ids[] = { |
397 | { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_SCSI, US_PR_BULK) }, | 397 | { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_SCSI, US_PR_BULK) }, |
398 | { } | 398 | { } |
399 | }; | 399 | }; |
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 51042f0ba7e1..c17e622f85ee 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -404,7 +404,7 @@ static void __devexit virtblk_remove(struct virtio_device *vdev) | |||
404 | kfree(vblk); | 404 | kfree(vblk); |
405 | } | 405 | } |
406 | 406 | ||
407 | static struct virtio_device_id id_table[] = { | 407 | static const struct virtio_device_id id_table[] = { |
408 | { VIRTIO_ID_BLOCK, VIRTIO_DEV_ANY_ID }, | 408 | { VIRTIO_ID_BLOCK, VIRTIO_DEV_ANY_ID }, |
409 | { 0 }, | 409 | { 0 }, |
410 | }; | 410 | }; |
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 05a31e55d278..a84702d1a35e 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
@@ -1050,7 +1050,7 @@ static const struct block_device_operations xlvbd_block_fops = | |||
1050 | }; | 1050 | }; |
1051 | 1051 | ||
1052 | 1052 | ||
1053 | static struct xenbus_device_id blkfront_ids[] = { | 1053 | static const struct xenbus_device_id blkfront_ids[] = { |
1054 | { "vbd" }, | 1054 | { "vbd" }, |
1055 | { "" } | 1055 | { "" } |
1056 | }; | 1056 | }; |
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c index e5c5415eb45e..e1c95e208a66 100644 --- a/drivers/block/xsysace.c +++ b/drivers/block/xsysace.c | |||
@@ -1227,7 +1227,7 @@ static int __devexit ace_of_remove(struct of_device *op) | |||
1227 | } | 1227 | } |
1228 | 1228 | ||
1229 | /* Match table for of_platform binding */ | 1229 | /* Match table for of_platform binding */ |
1230 | static struct of_device_id ace_of_match[] __devinitdata = { | 1230 | static const struct of_device_id ace_of_match[] __devinitconst = { |
1231 | { .compatible = "xlnx,opb-sysace-1.00.b", }, | 1231 | { .compatible = "xlnx,opb-sysace-1.00.b", }, |
1232 | { .compatible = "xlnx,opb-sysace-1.00.c", }, | 1232 | { .compatible = "xlnx,opb-sysace-1.00.c", }, |
1233 | { .compatible = "xlnx,xps-sysace-1.00.a", }, | 1233 | { .compatible = "xlnx,xps-sysace-1.00.a", }, |
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 64bc8998ac9a..e8865c11777f 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c | |||
@@ -412,9 +412,10 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno, | |||
412 | pdev = part_to_dev(p); | 412 | pdev = part_to_dev(p); |
413 | 413 | ||
414 | p->start_sect = start; | 414 | p->start_sect = start; |
415 | p->alignment_offset = queue_sector_alignment_offset(disk->queue, start); | 415 | p->alignment_offset = |
416 | p->discard_alignment = queue_sector_discard_alignment(disk->queue, | 416 | queue_limit_alignment_offset(&disk->queue->limits, start); |
417 | start); | 417 | p->discard_alignment = |
418 | queue_limit_discard_alignment(&disk->queue->limits, start); | ||
418 | p->nr_sects = len; | 419 | p->nr_sects = len; |
419 | p->partno = partno; | 420 | p->partno = partno; |
420 | p->policy = get_disk_ro(disk); | 421 | p->policy = get_disk_ro(disk); |
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index 756f831cbdd5..91be0d896322 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
@@ -43,6 +43,7 @@ header-y += blkpg.h | |||
43 | header-y += bpqether.h | 43 | header-y += bpqether.h |
44 | header-y += bsg.h | 44 | header-y += bsg.h |
45 | header-y += can.h | 45 | header-y += can.h |
46 | header-y += cciss_defs.h | ||
46 | header-y += cdk.h | 47 | header-y += cdk.h |
47 | header-y += chio.h | 48 | header-y += chio.h |
48 | header-y += coda_psdev.h | 49 | header-y += coda_psdev.h |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 1896e868854f..2f17793048e7 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -462,6 +462,7 @@ struct request_queue | |||
462 | #define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */ | 462 | #define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */ |
463 | #define QUEUE_FLAG_IO_STAT 15 /* do IO stats */ | 463 | #define QUEUE_FLAG_IO_STAT 15 /* do IO stats */ |
464 | #define QUEUE_FLAG_DISCARD 16 /* supports DISCARD */ | 464 | #define QUEUE_FLAG_DISCARD 16 /* supports DISCARD */ |
465 | #define QUEUE_FLAG_NOXMERGES 17 /* No extended merges */ | ||
465 | 466 | ||
466 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ | 467 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ |
467 | (1 << QUEUE_FLAG_CLUSTER) | \ | 468 | (1 << QUEUE_FLAG_CLUSTER) | \ |
@@ -587,6 +588,8 @@ enum { | |||
587 | #define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) | 588 | #define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) |
588 | #define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) | 589 | #define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) |
589 | #define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) | 590 | #define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) |
591 | #define blk_queue_noxmerges(q) \ | ||
592 | test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags) | ||
590 | #define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags) | 593 | #define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags) |
591 | #define blk_queue_io_stat(q) test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags) | 594 | #define blk_queue_io_stat(q) test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags) |
592 | #define blk_queue_flushing(q) ((q)->ordseq) | 595 | #define blk_queue_flushing(q) ((q)->ordseq) |
@@ -1110,18 +1113,13 @@ static inline int queue_alignment_offset(struct request_queue *q) | |||
1110 | return q->limits.alignment_offset; | 1113 | return q->limits.alignment_offset; |
1111 | } | 1114 | } |
1112 | 1115 | ||
1113 | static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t offset) | 1116 | static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t sector) |
1114 | { | 1117 | { |
1115 | unsigned int granularity = max(lim->physical_block_size, lim->io_min); | 1118 | unsigned int granularity = max(lim->physical_block_size, lim->io_min); |
1119 | unsigned int alignment = (sector << 9) & (granularity - 1); | ||
1116 | 1120 | ||
1117 | offset &= granularity - 1; | 1121 | return (granularity + lim->alignment_offset - alignment) |
1118 | return (granularity + lim->alignment_offset - offset) & (granularity - 1); | 1122 | & (granularity - 1); |
1119 | } | ||
1120 | |||
1121 | static inline int queue_sector_alignment_offset(struct request_queue *q, | ||
1122 | sector_t sector) | ||
1123 | { | ||
1124 | return queue_limit_alignment_offset(&q->limits, sector << 9); | ||
1125 | } | 1123 | } |
1126 | 1124 | ||
1127 | static inline int bdev_alignment_offset(struct block_device *bdev) | 1125 | static inline int bdev_alignment_offset(struct block_device *bdev) |
@@ -1145,10 +1143,8 @@ static inline int queue_discard_alignment(struct request_queue *q) | |||
1145 | return q->limits.discard_alignment; | 1143 | return q->limits.discard_alignment; |
1146 | } | 1144 | } |
1147 | 1145 | ||
1148 | static inline int queue_sector_discard_alignment(struct request_queue *q, | 1146 | static inline int queue_limit_discard_alignment(struct queue_limits *lim, sector_t sector) |
1149 | sector_t sector) | ||
1150 | { | 1147 | { |
1151 | struct queue_limits *lim = &q->limits; | ||
1152 | unsigned int alignment = (sector << 9) & (lim->discard_granularity - 1); | 1148 | unsigned int alignment = (sector << 9) & (lim->discard_granularity - 1); |
1153 | 1149 | ||
1154 | return (lim->discard_granularity + lim->discard_alignment - alignment) | 1150 | return (lim->discard_granularity + lim->discard_alignment - alignment) |
diff --git a/include/linux/cciss_defs.h b/include/linux/cciss_defs.h new file mode 100644 index 000000000000..316b670d4e33 --- /dev/null +++ b/include/linux/cciss_defs.h | |||
@@ -0,0 +1,130 @@ | |||
1 | #ifndef CCISS_DEFS_H | ||
2 | #define CCISS_DEFS_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | /* general boundary definitions */ | ||
7 | #define SENSEINFOBYTES 32 /* note that this value may vary | ||
8 | between host implementations */ | ||
9 | |||
10 | /* Command Status value */ | ||
11 | #define CMD_SUCCESS 0x0000 | ||
12 | #define CMD_TARGET_STATUS 0x0001 | ||
13 | #define CMD_DATA_UNDERRUN 0x0002 | ||
14 | #define CMD_DATA_OVERRUN 0x0003 | ||
15 | #define CMD_INVALID 0x0004 | ||
16 | #define CMD_PROTOCOL_ERR 0x0005 | ||
17 | #define CMD_HARDWARE_ERR 0x0006 | ||
18 | #define CMD_CONNECTION_LOST 0x0007 | ||
19 | #define CMD_ABORTED 0x0008 | ||
20 | #define CMD_ABORT_FAILED 0x0009 | ||
21 | #define CMD_UNSOLICITED_ABORT 0x000A | ||
22 | #define CMD_TIMEOUT 0x000B | ||
23 | #define CMD_UNABORTABLE 0x000C | ||
24 | |||
25 | /* transfer direction */ | ||
26 | #define XFER_NONE 0x00 | ||
27 | #define XFER_WRITE 0x01 | ||
28 | #define XFER_READ 0x02 | ||
29 | #define XFER_RSVD 0x03 | ||
30 | |||
31 | /* task attribute */ | ||
32 | #define ATTR_UNTAGGED 0x00 | ||
33 | #define ATTR_SIMPLE 0x04 | ||
34 | #define ATTR_HEADOFQUEUE 0x05 | ||
35 | #define ATTR_ORDERED 0x06 | ||
36 | #define ATTR_ACA 0x07 | ||
37 | |||
38 | /* cdb type */ | ||
39 | #define TYPE_CMD 0x00 | ||
40 | #define TYPE_MSG 0x01 | ||
41 | |||
42 | /* Type defs used in the following structs */ | ||
43 | #define BYTE __u8 | ||
44 | #define WORD __u16 | ||
45 | #define HWORD __u16 | ||
46 | #define DWORD __u32 | ||
47 | |||
48 | #define CISS_MAX_LUN 1024 | ||
49 | |||
50 | #define LEVEL2LUN 1 /* index into Target(x) structure, due to byte swapping */ | ||
51 | #define LEVEL3LUN 0 | ||
52 | |||
53 | #pragma pack(1) | ||
54 | |||
55 | /* Command List Structure */ | ||
56 | typedef union _SCSI3Addr_struct { | ||
57 | struct { | ||
58 | BYTE Dev; | ||
59 | BYTE Bus:6; | ||
60 | BYTE Mode:2; /* b00 */ | ||
61 | } PeripDev; | ||
62 | struct { | ||
63 | BYTE DevLSB; | ||
64 | BYTE DevMSB:6; | ||
65 | BYTE Mode:2; /* b01 */ | ||
66 | } LogDev; | ||
67 | struct { | ||
68 | BYTE Dev:5; | ||
69 | BYTE Bus:3; | ||
70 | BYTE Targ:6; | ||
71 | BYTE Mode:2; /* b10 */ | ||
72 | } LogUnit; | ||
73 | } SCSI3Addr_struct; | ||
74 | |||
75 | typedef struct _PhysDevAddr_struct { | ||
76 | DWORD TargetId:24; | ||
77 | DWORD Bus:6; | ||
78 | DWORD Mode:2; | ||
79 | SCSI3Addr_struct Target[2]; /* 2 level target device addr */ | ||
80 | } PhysDevAddr_struct; | ||
81 | |||
82 | typedef struct _LogDevAddr_struct { | ||
83 | DWORD VolId:30; | ||
84 | DWORD Mode:2; | ||
85 | BYTE reserved[4]; | ||
86 | } LogDevAddr_struct; | ||
87 | |||
88 | typedef union _LUNAddr_struct { | ||
89 | BYTE LunAddrBytes[8]; | ||
90 | SCSI3Addr_struct SCSI3Lun[4]; | ||
91 | PhysDevAddr_struct PhysDev; | ||
92 | LogDevAddr_struct LogDev; | ||
93 | } LUNAddr_struct; | ||
94 | |||
95 | typedef struct _RequestBlock_struct { | ||
96 | BYTE CDBLen; | ||
97 | struct { | ||
98 | BYTE Type:3; | ||
99 | BYTE Attribute:3; | ||
100 | BYTE Direction:2; | ||
101 | } Type; | ||
102 | HWORD Timeout; | ||
103 | BYTE CDB[16]; | ||
104 | } RequestBlock_struct; | ||
105 | |||
106 | typedef union _MoreErrInfo_struct{ | ||
107 | struct { | ||
108 | BYTE Reserved[3]; | ||
109 | BYTE Type; | ||
110 | DWORD ErrorInfo; | ||
111 | } Common_Info; | ||
112 | struct{ | ||
113 | BYTE Reserved[2]; | ||
114 | BYTE offense_size; /* size of offending entry */ | ||
115 | BYTE offense_num; /* byte # of offense 0-base */ | ||
116 | DWORD offense_value; | ||
117 | } Invalid_Cmd; | ||
118 | } MoreErrInfo_struct; | ||
119 | typedef struct _ErrorInfo_struct { | ||
120 | BYTE ScsiStatus; | ||
121 | BYTE SenseLen; | ||
122 | HWORD CommandStatus; | ||
123 | DWORD ResidualCnt; | ||
124 | MoreErrInfo_struct MoreErrInfo; | ||
125 | BYTE SenseInfo[SENSEINFOBYTES]; | ||
126 | } ErrorInfo_struct; | ||
127 | |||
128 | #pragma pack() | ||
129 | |||
130 | #endif /* CCISS_DEFS_H */ | ||
diff --git a/include/linux/cciss_ioctl.h b/include/linux/cciss_ioctl.h index eb130b4d8e72..986493f5b92b 100644 --- a/include/linux/cciss_ioctl.h +++ b/include/linux/cciss_ioctl.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <linux/ioctl.h> | 5 | #include <linux/ioctl.h> |
6 | #include <linux/cciss_defs.h> | ||
6 | 7 | ||
7 | #define CCISS_IOC_MAGIC 'B' | 8 | #define CCISS_IOC_MAGIC 'B' |
8 | 9 | ||
@@ -36,133 +37,6 @@ typedef __u32 DriverVer_type; | |||
36 | 37 | ||
37 | #define MAX_KMALLOC_SIZE 128000 | 38 | #define MAX_KMALLOC_SIZE 128000 |
38 | 39 | ||
39 | #ifndef CCISS_CMD_H | ||
40 | // This defines are duplicated in cciss_cmd.h in the driver directory | ||
41 | |||
42 | //general boundary definitions | ||
43 | #define SENSEINFOBYTES 32//note that this value may vary between host implementations | ||
44 | |||
45 | //Command Status value | ||
46 | #define CMD_SUCCESS 0x0000 | ||
47 | #define CMD_TARGET_STATUS 0x0001 | ||
48 | #define CMD_DATA_UNDERRUN 0x0002 | ||
49 | #define CMD_DATA_OVERRUN 0x0003 | ||
50 | #define CMD_INVALID 0x0004 | ||
51 | #define CMD_PROTOCOL_ERR 0x0005 | ||
52 | #define CMD_HARDWARE_ERR 0x0006 | ||
53 | #define CMD_CONNECTION_LOST 0x0007 | ||
54 | #define CMD_ABORTED 0x0008 | ||
55 | #define CMD_ABORT_FAILED 0x0009 | ||
56 | #define CMD_UNSOLICITED_ABORT 0x000A | ||
57 | #define CMD_TIMEOUT 0x000B | ||
58 | #define CMD_UNABORTABLE 0x000C | ||
59 | |||
60 | //transfer direction | ||
61 | #define XFER_NONE 0x00 | ||
62 | #define XFER_WRITE 0x01 | ||
63 | #define XFER_READ 0x02 | ||
64 | #define XFER_RSVD 0x03 | ||
65 | |||
66 | //task attribute | ||
67 | #define ATTR_UNTAGGED 0x00 | ||
68 | #define ATTR_SIMPLE 0x04 | ||
69 | #define ATTR_HEADOFQUEUE 0x05 | ||
70 | #define ATTR_ORDERED 0x06 | ||
71 | #define ATTR_ACA 0x07 | ||
72 | |||
73 | //cdb type | ||
74 | #define TYPE_CMD 0x00 | ||
75 | #define TYPE_MSG 0x01 | ||
76 | |||
77 | // Type defs used in the following structs | ||
78 | #define BYTE __u8 | ||
79 | #define WORD __u16 | ||
80 | #define HWORD __u16 | ||
81 | #define DWORD __u32 | ||
82 | |||
83 | #define CISS_MAX_LUN 1024 | ||
84 | |||
85 | #define LEVEL2LUN 1 // index into Target(x) structure, due to byte swapping | ||
86 | #define LEVEL3LUN 0 | ||
87 | |||
88 | #pragma pack(1) | ||
89 | |||
90 | //Command List Structure | ||
91 | typedef union _SCSI3Addr_struct { | ||
92 | struct { | ||
93 | BYTE Dev; | ||
94 | BYTE Bus:6; | ||
95 | BYTE Mode:2; // b00 | ||
96 | } PeripDev; | ||
97 | struct { | ||
98 | BYTE DevLSB; | ||
99 | BYTE DevMSB:6; | ||
100 | BYTE Mode:2; // b01 | ||
101 | } LogDev; | ||
102 | struct { | ||
103 | BYTE Dev:5; | ||
104 | BYTE Bus:3; | ||
105 | BYTE Targ:6; | ||
106 | BYTE Mode:2; // b10 | ||
107 | } LogUnit; | ||
108 | } SCSI3Addr_struct; | ||
109 | |||
110 | typedef struct _PhysDevAddr_struct { | ||
111 | DWORD TargetId:24; | ||
112 | DWORD Bus:6; | ||
113 | DWORD Mode:2; | ||
114 | SCSI3Addr_struct Target[2]; //2 level target device addr | ||
115 | } PhysDevAddr_struct; | ||
116 | |||
117 | typedef struct _LogDevAddr_struct { | ||
118 | DWORD VolId:30; | ||
119 | DWORD Mode:2; | ||
120 | BYTE reserved[4]; | ||
121 | } LogDevAddr_struct; | ||
122 | |||
123 | typedef union _LUNAddr_struct { | ||
124 | BYTE LunAddrBytes[8]; | ||
125 | SCSI3Addr_struct SCSI3Lun[4]; | ||
126 | PhysDevAddr_struct PhysDev; | ||
127 | LogDevAddr_struct LogDev; | ||
128 | } LUNAddr_struct; | ||
129 | |||
130 | typedef struct _RequestBlock_struct { | ||
131 | BYTE CDBLen; | ||
132 | struct { | ||
133 | BYTE Type:3; | ||
134 | BYTE Attribute:3; | ||
135 | BYTE Direction:2; | ||
136 | } Type; | ||
137 | HWORD Timeout; | ||
138 | BYTE CDB[16]; | ||
139 | } RequestBlock_struct; | ||
140 | |||
141 | typedef union _MoreErrInfo_struct{ | ||
142 | struct { | ||
143 | BYTE Reserved[3]; | ||
144 | BYTE Type; | ||
145 | DWORD ErrorInfo; | ||
146 | }Common_Info; | ||
147 | struct{ | ||
148 | BYTE Reserved[2]; | ||
149 | BYTE offense_size;//size of offending entry | ||
150 | BYTE offense_num; //byte # of offense 0-base | ||
151 | DWORD offense_value; | ||
152 | }Invalid_Cmd; | ||
153 | }MoreErrInfo_struct; | ||
154 | typedef struct _ErrorInfo_struct { | ||
155 | BYTE ScsiStatus; | ||
156 | BYTE SenseLen; | ||
157 | HWORD CommandStatus; | ||
158 | DWORD ResidualCnt; | ||
159 | MoreErrInfo_struct MoreErrInfo; | ||
160 | BYTE SenseInfo[SENSEINFOBYTES]; | ||
161 | } ErrorInfo_struct; | ||
162 | |||
163 | #pragma pack() | ||
164 | #endif /* CCISS_CMD_H */ | ||
165 | |||
166 | typedef struct _IOCTL_Command_struct { | 40 | typedef struct _IOCTL_Command_struct { |
167 | LUNAddr_struct LUN_info; | 41 | LUNAddr_struct LUN_info; |
168 | RequestBlock_struct Request; | 42 | RequestBlock_struct Request; |
diff --git a/include/linux/pktcdvd.h b/include/linux/pktcdvd.h index 76e5053e1fac..721301b0a908 100644 --- a/include/linux/pktcdvd.h +++ b/include/linux/pktcdvd.h | |||
@@ -163,10 +163,8 @@ struct packet_iosched | |||
163 | atomic_t attention; /* Set to non-zero when queue processing is needed */ | 163 | atomic_t attention; /* Set to non-zero when queue processing is needed */ |
164 | int writing; /* Non-zero when writing, zero when reading */ | 164 | int writing; /* Non-zero when writing, zero when reading */ |
165 | spinlock_t lock; /* Protecting read/write queue manipulations */ | 165 | spinlock_t lock; /* Protecting read/write queue manipulations */ |
166 | struct bio *read_queue; | 166 | struct bio_list read_queue; |
167 | struct bio *read_queue_tail; | 167 | struct bio_list write_queue; |
168 | struct bio *write_queue; | ||
169 | struct bio *write_queue_tail; | ||
170 | sector_t last_write; /* The sector where the last write ended */ | 168 | sector_t last_write; /* The sector where the last write ended */ |
171 | int successive_reads; | 169 | int successive_reads; |
172 | }; | 170 | }; |
@@ -206,8 +204,8 @@ struct packet_data | |||
206 | spinlock_t lock; /* Lock protecting state transitions and */ | 204 | spinlock_t lock; /* Lock protecting state transitions and */ |
207 | /* orig_bios list */ | 205 | /* orig_bios list */ |
208 | 206 | ||
209 | struct bio *orig_bios; /* Original bios passed to pkt_make_request */ | 207 | struct bio_list orig_bios; /* Original bios passed to pkt_make_request */ |
210 | struct bio *orig_bios_tail;/* that will be handled by this packet */ | 208 | /* that will be handled by this packet */ |
211 | int write_size; /* Total size of all bios in the orig_bios */ | 209 | int write_size; /* Total size of all bios in the orig_bios */ |
212 | /* list, measured in number of frames */ | 210 | /* list, measured in number of frames */ |
213 | 211 | ||
diff --git a/include/linux/sched.h b/include/linux/sched.h index 78efe7c485ac..7eb82975e1ee 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -97,7 +97,7 @@ struct sched_param { | |||
97 | struct exec_domain; | 97 | struct exec_domain; |
98 | struct futex_pi_state; | 98 | struct futex_pi_state; |
99 | struct robust_list_head; | 99 | struct robust_list_head; |
100 | struct bio; | 100 | struct bio_list; |
101 | struct fs_struct; | 101 | struct fs_struct; |
102 | struct bts_context; | 102 | struct bts_context; |
103 | struct perf_event_context; | 103 | struct perf_event_context; |
@@ -1466,7 +1466,7 @@ struct task_struct { | |||
1466 | void *journal_info; | 1466 | void *journal_info; |
1467 | 1467 | ||
1468 | /* stacked block device info */ | 1468 | /* stacked block device info */ |
1469 | struct bio *bio_list, **bio_tail; | 1469 | struct bio_list *bio_list; |
1470 | 1470 | ||
1471 | /* VM state */ | 1471 | /* VM state */ |
1472 | struct reclaim_state *reclaim_state; | 1472 | struct reclaim_state *reclaim_state; |