diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 12:01:25 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 12:01:25 -0500 |
commit | d99cf9d679a520d67f81d805b7cb91c68e1847f0 (patch) | |
tree | 415aefe6d168df27c006fcc53b1ea5242eabaaea /drivers | |
parent | 7ed40918a386afc2e14a6d3da563ea6d13686c25 (diff) | |
parent | e650c305ec3178818b317dad37a6d9c7fa8ba28d (diff) |
Merge branch 'post-2.6.15' of git://brick.kernel.dk/data/git/linux-2.6-block
Manual fixup for merge with Jens' "Suspend support for libata", commit
ID 9b847548663ef1039dd49f0eb4463d001e596bc3.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
36 files changed, 176 insertions, 232 deletions
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index 70eaa5c7ac08..21097a39a057 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c | |||
@@ -3471,7 +3471,7 @@ static inline boolean DAC960_ProcessCompletedRequest(DAC960_Command_T *Command, | |||
3471 | 3471 | ||
3472 | if (!end_that_request_first(Request, UpToDate, Command->BlockCount)) { | 3472 | if (!end_that_request_first(Request, UpToDate, Command->BlockCount)) { |
3473 | 3473 | ||
3474 | end_that_request_last(Request); | 3474 | end_that_request_last(Request, UpToDate); |
3475 | 3475 | ||
3476 | if (Command->Completion) { | 3476 | if (Command->Completion) { |
3477 | complete(Command->Completion); | 3477 | complete(Command->Completion); |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index c3441b3f086e..d2815b7a9150 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -2310,7 +2310,7 @@ static inline void complete_command( ctlr_info_t *h, CommandList_struct *cmd, | |||
2310 | printk("Done with %p\n", cmd->rq); | 2310 | printk("Done with %p\n", cmd->rq); |
2311 | #endif /* CCISS_DEBUG */ | 2311 | #endif /* CCISS_DEBUG */ |
2312 | 2312 | ||
2313 | end_that_request_last(cmd->rq); | 2313 | end_that_request_last(cmd->rq, status ? 1 : -EIO); |
2314 | cmd_free(h,cmd,1); | 2314 | cmd_free(h,cmd,1); |
2315 | } | 2315 | } |
2316 | 2316 | ||
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c index cf1822a6361c..9bddb6874873 100644 --- a/drivers/block/cpqarray.c +++ b/drivers/block/cpqarray.c | |||
@@ -1036,7 +1036,7 @@ static inline void complete_command(cmdlist_t *cmd, int timeout) | |||
1036 | complete_buffers(cmd->rq->bio, ok); | 1036 | complete_buffers(cmd->rq->bio, ok); |
1037 | 1037 | ||
1038 | DBGPX(printk("Done with %p\n", cmd->rq);); | 1038 | DBGPX(printk("Done with %p\n", cmd->rq);); |
1039 | end_that_request_last(cmd->rq); | 1039 | end_that_request_last(cmd->rq, ok ? 1 : -EIO); |
1040 | } | 1040 | } |
1041 | 1041 | ||
1042 | /* | 1042 | /* |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index f7e765a1d313..a5b857c5c4b8 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -2301,7 +2301,7 @@ static void floppy_end_request(struct request *req, int uptodate) | |||
2301 | add_disk_randomness(req->rq_disk); | 2301 | add_disk_randomness(req->rq_disk); |
2302 | floppy_off((long)req->rq_disk->private_data); | 2302 | floppy_off((long)req->rq_disk->private_data); |
2303 | blkdev_dequeue_request(req); | 2303 | blkdev_dequeue_request(req); |
2304 | end_that_request_last(req); | 2304 | end_that_request_last(req, uptodate); |
2305 | 2305 | ||
2306 | /* We're done with the request */ | 2306 | /* We're done with the request */ |
2307 | current_req = NULL; | 2307 | current_req = NULL; |
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index d5c8ee7d9815..33d6f237b2ed 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -140,7 +140,7 @@ static void nbd_end_request(struct request *req) | |||
140 | 140 | ||
141 | spin_lock_irqsave(q->queue_lock, flags); | 141 | spin_lock_irqsave(q->queue_lock, flags); |
142 | if (!end_that_request_first(req, uptodate, req->nr_sectors)) { | 142 | if (!end_that_request_first(req, uptodate, req->nr_sectors)) { |
143 | end_that_request_last(req); | 143 | end_that_request_last(req, uptodate); |
144 | } | 144 | } |
145 | spin_unlock_irqrestore(q->queue_lock, flags); | 145 | spin_unlock_irqrestore(q->queue_lock, flags); |
146 | } | 146 | } |
diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c index 1ded3b433459..9251f4131b53 100644 --- a/drivers/block/sx8.c +++ b/drivers/block/sx8.c | |||
@@ -770,7 +770,7 @@ static inline void carm_end_request_queued(struct carm_host *host, | |||
770 | rc = end_that_request_first(req, uptodate, req->hard_nr_sectors); | 770 | rc = end_that_request_first(req, uptodate, req->hard_nr_sectors); |
771 | assert(rc == 0); | 771 | assert(rc == 0); |
772 | 772 | ||
773 | end_that_request_last(req); | 773 | end_that_request_last(req, uptodate); |
774 | 774 | ||
775 | rc = carm_put_request(host, crq); | 775 | rc = carm_put_request(host, crq); |
776 | assert(rc == 0); | 776 | assert(rc == 0); |
diff --git a/drivers/block/ub.c b/drivers/block/ub.c index 10740a065088..a05fe5843e6c 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c | |||
@@ -951,7 +951,7 @@ static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd) | |||
951 | static void ub_end_rq(struct request *rq, int uptodate) | 951 | static void ub_end_rq(struct request *rq, int uptodate) |
952 | { | 952 | { |
953 | end_that_request_first(rq, uptodate, rq->hard_nr_sectors); | 953 | end_that_request_first(rq, uptodate, rq->hard_nr_sectors); |
954 | end_that_request_last(rq); | 954 | end_that_request_last(rq, uptodate); |
955 | } | 955 | } |
956 | 956 | ||
957 | static int ub_rw_cmd_retry(struct ub_dev *sc, struct ub_lun *lun, | 957 | static int ub_rw_cmd_retry(struct ub_dev *sc, struct ub_lun *lun, |
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c index 2d518aa2720a..063f0304a163 100644 --- a/drivers/block/viodasd.c +++ b/drivers/block/viodasd.c | |||
@@ -305,7 +305,7 @@ static void viodasd_end_request(struct request *req, int uptodate, | |||
305 | if (end_that_request_first(req, uptodate, num_sectors)) | 305 | if (end_that_request_first(req, uptodate, num_sectors)) |
306 | return; | 306 | return; |
307 | add_disk_randomness(req->rq_disk); | 307 | add_disk_randomness(req->rq_disk); |
308 | end_that_request_last(req); | 308 | end_that_request_last(req, uptodate); |
309 | } | 309 | } |
310 | 310 | ||
311 | /* | 311 | /* |
diff --git a/drivers/cdrom/cdu31a.c b/drivers/cdrom/cdu31a.c index ac96de15d833..378e88d20757 100644 --- a/drivers/cdrom/cdu31a.c +++ b/drivers/cdrom/cdu31a.c | |||
@@ -1402,7 +1402,7 @@ static void do_cdu31a_request(request_queue_t * q) | |||
1402 | if (!end_that_request_first(req, 1, nblock)) { | 1402 | if (!end_that_request_first(req, 1, nblock)) { |
1403 | spin_lock_irq(q->queue_lock); | 1403 | spin_lock_irq(q->queue_lock); |
1404 | blkdev_dequeue_request(req); | 1404 | blkdev_dequeue_request(req); |
1405 | end_that_request_last(req); | 1405 | end_that_request_last(req, 1); |
1406 | spin_unlock_irq(q->queue_lock); | 1406 | spin_unlock_irq(q->queue_lock); |
1407 | } | 1407 | } |
1408 | continue; | 1408 | continue; |
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 70aeb3a60120..d31117eb95aa 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -614,7 +614,7 @@ static void cdrom_end_request (ide_drive_t *drive, int uptodate) | |||
614 | */ | 614 | */ |
615 | spin_lock_irqsave(&ide_lock, flags); | 615 | spin_lock_irqsave(&ide_lock, flags); |
616 | end_that_request_chunk(failed, 0, failed->data_len); | 616 | end_that_request_chunk(failed, 0, failed->data_len); |
617 | end_that_request_last(failed); | 617 | end_that_request_last(failed, 0); |
618 | spin_unlock_irqrestore(&ide_lock, flags); | 618 | spin_unlock_irqrestore(&ide_lock, flags); |
619 | } | 619 | } |
620 | 620 | ||
@@ -1735,7 +1735,7 @@ end_request: | |||
1735 | 1735 | ||
1736 | spin_lock_irqsave(&ide_lock, flags); | 1736 | spin_lock_irqsave(&ide_lock, flags); |
1737 | blkdev_dequeue_request(rq); | 1737 | blkdev_dequeue_request(rq); |
1738 | end_that_request_last(rq); | 1738 | end_that_request_last(rq, 1); |
1739 | HWGROUP(drive)->rq = NULL; | 1739 | HWGROUP(drive)->rq = NULL; |
1740 | spin_unlock_irqrestore(&ide_lock, flags); | 1740 | spin_unlock_irqrestore(&ide_lock, flags); |
1741 | return ide_stopped; | 1741 | return ide_stopped; |
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 4e5767968d7f..4b441720b6ba 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -681,50 +681,9 @@ static ide_proc_entry_t idedisk_proc[] = { | |||
681 | 681 | ||
682 | #endif /* CONFIG_PROC_FS */ | 682 | #endif /* CONFIG_PROC_FS */ |
683 | 683 | ||
684 | static void idedisk_end_flush(request_queue_t *q, struct request *flush_rq) | 684 | static void idedisk_prepare_flush(request_queue_t *q, struct request *rq) |
685 | { | 685 | { |
686 | ide_drive_t *drive = q->queuedata; | 686 | ide_drive_t *drive = q->queuedata; |
687 | struct request *rq = flush_rq->end_io_data; | ||
688 | int good_sectors = rq->hard_nr_sectors; | ||
689 | int bad_sectors; | ||
690 | sector_t sector; | ||
691 | |||
692 | if (flush_rq->errors & ABRT_ERR) { | ||
693 | printk(KERN_ERR "%s: barrier support doesn't work\n", drive->name); | ||
694 | blk_queue_ordered(drive->queue, QUEUE_ORDERED_NONE); | ||
695 | blk_queue_issue_flush_fn(drive->queue, NULL); | ||
696 | good_sectors = 0; | ||
697 | } else if (flush_rq->errors) { | ||
698 | good_sectors = 0; | ||
699 | if (blk_barrier_preflush(rq)) { | ||
700 | sector = ide_get_error_location(drive,flush_rq->buffer); | ||
701 | if ((sector >= rq->hard_sector) && | ||
702 | (sector < rq->hard_sector + rq->hard_nr_sectors)) | ||
703 | good_sectors = sector - rq->hard_sector; | ||
704 | } | ||
705 | } | ||
706 | |||
707 | if (flush_rq->errors) | ||
708 | printk(KERN_ERR "%s: failed barrier write: " | ||
709 | "sector=%Lx(good=%d/bad=%d)\n", | ||
710 | drive->name, (unsigned long long)rq->sector, | ||
711 | good_sectors, | ||
712 | (int) (rq->hard_nr_sectors-good_sectors)); | ||
713 | |||
714 | bad_sectors = rq->hard_nr_sectors - good_sectors; | ||
715 | |||
716 | if (good_sectors) | ||
717 | __ide_end_request(drive, rq, 1, good_sectors); | ||
718 | if (bad_sectors) | ||
719 | __ide_end_request(drive, rq, 0, bad_sectors); | ||
720 | } | ||
721 | |||
722 | static int idedisk_prepare_flush(request_queue_t *q, struct request *rq) | ||
723 | { | ||
724 | ide_drive_t *drive = q->queuedata; | ||
725 | |||
726 | if (!drive->wcache) | ||
727 | return 0; | ||
728 | 687 | ||
729 | memset(rq->cmd, 0, sizeof(rq->cmd)); | 688 | memset(rq->cmd, 0, sizeof(rq->cmd)); |
730 | 689 | ||
@@ -735,9 +694,8 @@ static int idedisk_prepare_flush(request_queue_t *q, struct request *rq) | |||
735 | rq->cmd[0] = WIN_FLUSH_CACHE; | 694 | rq->cmd[0] = WIN_FLUSH_CACHE; |
736 | 695 | ||
737 | 696 | ||
738 | rq->flags |= REQ_DRIVE_TASK | REQ_SOFTBARRIER; | 697 | rq->flags |= REQ_DRIVE_TASK; |
739 | rq->buffer = rq->cmd; | 698 | rq->buffer = rq->cmd; |
740 | return 1; | ||
741 | } | 699 | } |
742 | 700 | ||
743 | static int idedisk_issue_flush(request_queue_t *q, struct gendisk *disk, | 701 | static int idedisk_issue_flush(request_queue_t *q, struct gendisk *disk, |
@@ -794,27 +752,64 @@ static int set_nowerr(ide_drive_t *drive, int arg) | |||
794 | return 0; | 752 | return 0; |
795 | } | 753 | } |
796 | 754 | ||
755 | static void update_ordered(ide_drive_t *drive) | ||
756 | { | ||
757 | struct hd_driveid *id = drive->id; | ||
758 | unsigned ordered = QUEUE_ORDERED_NONE; | ||
759 | prepare_flush_fn *prep_fn = NULL; | ||
760 | issue_flush_fn *issue_fn = NULL; | ||
761 | |||
762 | if (drive->wcache) { | ||
763 | unsigned long long capacity; | ||
764 | int barrier; | ||
765 | /* | ||
766 | * We must avoid issuing commands a drive does not | ||
767 | * understand or we may crash it. We check flush cache | ||
768 | * is supported. We also check we have the LBA48 flush | ||
769 | * cache if the drive capacity is too large. By this | ||
770 | * time we have trimmed the drive capacity if LBA48 is | ||
771 | * not available so we don't need to recheck that. | ||
772 | */ | ||
773 | capacity = idedisk_capacity(drive); | ||
774 | barrier = ide_id_has_flush_cache(id) && | ||
775 | (drive->addressing == 0 || capacity <= (1ULL << 28) || | ||
776 | ide_id_has_flush_cache_ext(id)); | ||
777 | |||
778 | printk(KERN_INFO "%s: cache flushes %ssupported\n", | ||
779 | drive->name, barrier ? "" : "not"); | ||
780 | |||
781 | if (barrier) { | ||
782 | ordered = QUEUE_ORDERED_DRAIN_FLUSH; | ||
783 | prep_fn = idedisk_prepare_flush; | ||
784 | issue_fn = idedisk_issue_flush; | ||
785 | } | ||
786 | } else | ||
787 | ordered = QUEUE_ORDERED_DRAIN; | ||
788 | |||
789 | blk_queue_ordered(drive->queue, ordered, prep_fn); | ||
790 | blk_queue_issue_flush_fn(drive->queue, issue_fn); | ||
791 | } | ||
792 | |||
797 | static int write_cache(ide_drive_t *drive, int arg) | 793 | static int write_cache(ide_drive_t *drive, int arg) |
798 | { | 794 | { |
799 | ide_task_t args; | 795 | ide_task_t args; |
800 | int err; | 796 | int err = 1; |
801 | |||
802 | if (!ide_id_has_flush_cache(drive->id)) | ||
803 | return 1; | ||
804 | 797 | ||
805 | memset(&args, 0, sizeof(ide_task_t)); | 798 | if (ide_id_has_flush_cache(drive->id)) { |
806 | args.tfRegister[IDE_FEATURE_OFFSET] = (arg) ? | 799 | memset(&args, 0, sizeof(ide_task_t)); |
800 | args.tfRegister[IDE_FEATURE_OFFSET] = (arg) ? | ||
807 | SETFEATURES_EN_WCACHE : SETFEATURES_DIS_WCACHE; | 801 | SETFEATURES_EN_WCACHE : SETFEATURES_DIS_WCACHE; |
808 | args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SETFEATURES; | 802 | args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SETFEATURES; |
809 | args.command_type = IDE_DRIVE_TASK_NO_DATA; | 803 | args.command_type = IDE_DRIVE_TASK_NO_DATA; |
810 | args.handler = &task_no_data_intr; | 804 | args.handler = &task_no_data_intr; |
805 | err = ide_raw_taskfile(drive, &args, NULL); | ||
806 | if (err == 0) | ||
807 | drive->wcache = arg; | ||
808 | } | ||
811 | 809 | ||
812 | err = ide_raw_taskfile(drive, &args, NULL); | 810 | update_ordered(drive); |
813 | if (err) | ||
814 | return err; | ||
815 | 811 | ||
816 | drive->wcache = arg; | 812 | return err; |
817 | return 0; | ||
818 | } | 813 | } |
819 | 814 | ||
820 | static int do_idedisk_flushcache (ide_drive_t *drive) | 815 | static int do_idedisk_flushcache (ide_drive_t *drive) |
@@ -888,7 +883,6 @@ static void idedisk_setup (ide_drive_t *drive) | |||
888 | { | 883 | { |
889 | struct hd_driveid *id = drive->id; | 884 | struct hd_driveid *id = drive->id; |
890 | unsigned long long capacity; | 885 | unsigned long long capacity; |
891 | int barrier; | ||
892 | 886 | ||
893 | idedisk_add_settings(drive); | 887 | idedisk_add_settings(drive); |
894 | 888 | ||
@@ -992,31 +986,6 @@ static void idedisk_setup (ide_drive_t *drive) | |||
992 | drive->wcache = 1; | 986 | drive->wcache = 1; |
993 | 987 | ||
994 | write_cache(drive, 1); | 988 | write_cache(drive, 1); |
995 | |||
996 | /* | ||
997 | * We must avoid issuing commands a drive does not understand | ||
998 | * or we may crash it. We check flush cache is supported. We also | ||
999 | * check we have the LBA48 flush cache if the drive capacity is | ||
1000 | * too large. By this time we have trimmed the drive capacity if | ||
1001 | * LBA48 is not available so we don't need to recheck that. | ||
1002 | */ | ||
1003 | barrier = 0; | ||
1004 | if (ide_id_has_flush_cache(id)) | ||
1005 | barrier = 1; | ||
1006 | if (drive->addressing == 1) { | ||
1007 | /* Can't issue the correct flush ? */ | ||
1008 | if (capacity > (1ULL << 28) && !ide_id_has_flush_cache_ext(id)) | ||
1009 | barrier = 0; | ||
1010 | } | ||
1011 | |||
1012 | printk(KERN_INFO "%s: cache flushes %ssupported\n", | ||
1013 | drive->name, barrier ? "" : "not "); | ||
1014 | if (barrier) { | ||
1015 | blk_queue_ordered(drive->queue, QUEUE_ORDERED_FLUSH); | ||
1016 | drive->queue->prepare_flush_fn = idedisk_prepare_flush; | ||
1017 | drive->queue->end_flush_fn = idedisk_end_flush; | ||
1018 | blk_queue_issue_flush_fn(drive->queue, idedisk_issue_flush); | ||
1019 | } | ||
1020 | } | 989 | } |
1021 | 990 | ||
1022 | static void ide_cacheflush_p(ide_drive_t *drive) | 991 | static void ide_cacheflush_p(ide_drive_t *drive) |
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index ecfafcdafea4..b5dc6df8e67d 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -89,7 +89,7 @@ int __ide_end_request(ide_drive_t *drive, struct request *rq, int uptodate, | |||
89 | 89 | ||
90 | blkdev_dequeue_request(rq); | 90 | blkdev_dequeue_request(rq); |
91 | HWGROUP(drive)->rq = NULL; | 91 | HWGROUP(drive)->rq = NULL; |
92 | end_that_request_last(rq); | 92 | end_that_request_last(rq, uptodate); |
93 | ret = 0; | 93 | ret = 0; |
94 | } | 94 | } |
95 | return ret; | 95 | return ret; |
@@ -119,10 +119,7 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors) | |||
119 | if (!nr_sectors) | 119 | if (!nr_sectors) |
120 | nr_sectors = rq->hard_cur_sectors; | 120 | nr_sectors = rq->hard_cur_sectors; |
121 | 121 | ||
122 | if (blk_complete_barrier_rq_locked(drive->queue, rq, nr_sectors)) | 122 | ret = __ide_end_request(drive, rq, uptodate, nr_sectors); |
123 | ret = rq->nr_sectors != 0; | ||
124 | else | ||
125 | ret = __ide_end_request(drive, rq, uptodate, nr_sectors); | ||
126 | 123 | ||
127 | spin_unlock_irqrestore(&ide_lock, flags); | 124 | spin_unlock_irqrestore(&ide_lock, flags); |
128 | return ret; | 125 | return ret; |
@@ -247,7 +244,7 @@ static void ide_complete_pm_request (ide_drive_t *drive, struct request *rq) | |||
247 | } | 244 | } |
248 | blkdev_dequeue_request(rq); | 245 | blkdev_dequeue_request(rq); |
249 | HWGROUP(drive)->rq = NULL; | 246 | HWGROUP(drive)->rq = NULL; |
250 | end_that_request_last(rq); | 247 | end_that_request_last(rq, 1); |
251 | spin_unlock_irqrestore(&ide_lock, flags); | 248 | spin_unlock_irqrestore(&ide_lock, flags); |
252 | } | 249 | } |
253 | 250 | ||
@@ -379,7 +376,7 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err) | |||
379 | blkdev_dequeue_request(rq); | 376 | blkdev_dequeue_request(rq); |
380 | HWGROUP(drive)->rq = NULL; | 377 | HWGROUP(drive)->rq = NULL; |
381 | rq->errors = err; | 378 | rq->errors = err; |
382 | end_that_request_last(rq); | 379 | end_that_request_last(rq, !rq->errors); |
383 | spin_unlock_irqrestore(&ide_lock, flags); | 380 | spin_unlock_irqrestore(&ide_lock, flags); |
384 | } | 381 | } |
385 | 382 | ||
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c index c5807d6e85cc..5b1febed3133 100644 --- a/drivers/message/i2o/i2o_block.c +++ b/drivers/message/i2o/i2o_block.c | |||
@@ -468,7 +468,7 @@ static void i2o_block_end_request(struct request *req, int uptodate, | |||
468 | 468 | ||
469 | spin_lock_irqsave(q->queue_lock, flags); | 469 | spin_lock_irqsave(q->queue_lock, flags); |
470 | 470 | ||
471 | end_that_request_last(req); | 471 | end_that_request_last(req, uptodate); |
472 | 472 | ||
473 | if (likely(dev)) { | 473 | if (likely(dev)) { |
474 | dev->open_queue_depth--; | 474 | dev->open_queue_depth--; |
diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c index abcf19116d70..8e380c14bf65 100644 --- a/drivers/mmc/mmc_block.c +++ b/drivers/mmc/mmc_block.c | |||
@@ -263,7 +263,7 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) | |||
263 | */ | 263 | */ |
264 | add_disk_randomness(req->rq_disk); | 264 | add_disk_randomness(req->rq_disk); |
265 | blkdev_dequeue_request(req); | 265 | blkdev_dequeue_request(req); |
266 | end_that_request_last(req); | 266 | end_that_request_last(req, 1); |
267 | } | 267 | } |
268 | spin_unlock_irq(&md->lock); | 268 | spin_unlock_irq(&md->lock); |
269 | } while (ret); | 269 | } while (ret); |
@@ -289,7 +289,7 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) | |||
289 | 289 | ||
290 | add_disk_randomness(req->rq_disk); | 290 | add_disk_randomness(req->rq_disk); |
291 | blkdev_dequeue_request(req); | 291 | blkdev_dequeue_request(req); |
292 | end_that_request_last(req); | 292 | end_that_request_last(req, 0); |
293 | spin_unlock_irq(&md->lock); | 293 | spin_unlock_irq(&md->lock); |
294 | 294 | ||
295 | return 0; | 295 | return 0; |
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 041e1a621885..f779f674dfa0 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -1035,7 +1035,7 @@ dasd_end_request(struct request *req, int uptodate) | |||
1035 | if (end_that_request_first(req, uptodate, req->hard_nr_sectors)) | 1035 | if (end_that_request_first(req, uptodate, req->hard_nr_sectors)) |
1036 | BUG(); | 1036 | BUG(); |
1037 | add_disk_randomness(req->rq_disk); | 1037 | add_disk_randomness(req->rq_disk); |
1038 | end_that_request_last(req); | 1038 | end_that_request_last(req, uptodate); |
1039 | } | 1039 | } |
1040 | 1040 | ||
1041 | /* | 1041 | /* |
diff --git a/drivers/s390/char/tape_block.c b/drivers/s390/char/tape_block.c index 482e07e388c8..5ced2725d6c7 100644 --- a/drivers/s390/char/tape_block.c +++ b/drivers/s390/char/tape_block.c | |||
@@ -78,7 +78,7 @@ tapeblock_end_request(struct request *req, int uptodate) | |||
78 | { | 78 | { |
79 | if (end_that_request_first(req, uptodate, req->hard_nr_sectors)) | 79 | if (end_that_request_first(req, uptodate, req->hard_nr_sectors)) |
80 | BUG(); | 80 | BUG(); |
81 | end_that_request_last(req); | 81 | end_that_request_last(req, uptodate); |
82 | } | 82 | } |
83 | 83 | ||
84 | static void | 84 | static void |
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index 887eaa2a3ebf..d113290b5fc0 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c | |||
@@ -214,7 +214,6 @@ static struct scsi_host_template ahci_sht = { | |||
214 | .dma_boundary = AHCI_DMA_BOUNDARY, | 214 | .dma_boundary = AHCI_DMA_BOUNDARY, |
215 | .slave_configure = ata_scsi_slave_config, | 215 | .slave_configure = ata_scsi_slave_config, |
216 | .bios_param = ata_std_bios_param, | 216 | .bios_param = ata_std_bios_param, |
217 | .ordered_flush = 1, | ||
218 | }; | 217 | }; |
219 | 218 | ||
220 | static const struct ata_port_operations ahci_ops = { | 219 | static const struct ata_port_operations ahci_ops = { |
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c index f79630340028..557788ec4eec 100644 --- a/drivers/scsi/ata_piix.c +++ b/drivers/scsi/ata_piix.c | |||
@@ -187,7 +187,6 @@ static struct scsi_host_template piix_sht = { | |||
187 | .dma_boundary = ATA_DMA_BOUNDARY, | 187 | .dma_boundary = ATA_DMA_BOUNDARY, |
188 | .slave_configure = ata_scsi_slave_config, | 188 | .slave_configure = ata_scsi_slave_config, |
189 | .bios_param = ata_std_bios_param, | 189 | .bios_param = ata_std_bios_param, |
190 | .ordered_flush = 1, | ||
191 | .resume = ata_scsi_device_resume, | 190 | .resume = ata_scsi_device_resume, |
192 | .suspend = ata_scsi_device_suspend, | 191 | .suspend = ata_scsi_device_suspend, |
193 | }; | 192 | }; |
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 5b9c2c5a7f0e..66783c860a19 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c | |||
@@ -347,17 +347,8 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) | |||
347 | shost->cmd_per_lun = sht->cmd_per_lun; | 347 | shost->cmd_per_lun = sht->cmd_per_lun; |
348 | shost->unchecked_isa_dma = sht->unchecked_isa_dma; | 348 | shost->unchecked_isa_dma = sht->unchecked_isa_dma; |
349 | shost->use_clustering = sht->use_clustering; | 349 | shost->use_clustering = sht->use_clustering; |
350 | shost->ordered_flush = sht->ordered_flush; | ||
351 | shost->ordered_tag = sht->ordered_tag; | 350 | shost->ordered_tag = sht->ordered_tag; |
352 | 351 | ||
353 | /* | ||
354 | * hosts/devices that do queueing must support ordered tags | ||
355 | */ | ||
356 | if (shost->can_queue > 1 && shost->ordered_flush) { | ||
357 | printk(KERN_ERR "scsi: ordered flushes don't support queueing\n"); | ||
358 | shost->ordered_flush = 0; | ||
359 | } | ||
360 | |||
361 | if (sht->max_host_blocked) | 352 | if (sht->max_host_blocked) |
362 | shost->max_host_blocked = sht->max_host_blocked; | 353 | shost->max_host_blocked = sht->max_host_blocked; |
363 | else | 354 | else |
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index 4cb1f3ed9100..3c688ef54660 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c | |||
@@ -1046,7 +1046,7 @@ static int idescsi_eh_reset (struct scsi_cmnd *cmd) | |||
1046 | 1046 | ||
1047 | /* kill current request */ | 1047 | /* kill current request */ |
1048 | blkdev_dequeue_request(req); | 1048 | blkdev_dequeue_request(req); |
1049 | end_that_request_last(req); | 1049 | end_that_request_last(req, 0); |
1050 | if (req->flags & REQ_SENSE) | 1050 | if (req->flags & REQ_SENSE) |
1051 | kfree(scsi->pc->buffer); | 1051 | kfree(scsi->pc->buffer); |
1052 | kfree(scsi->pc); | 1052 | kfree(scsi->pc); |
@@ -1056,7 +1056,7 @@ static int idescsi_eh_reset (struct scsi_cmnd *cmd) | |||
1056 | /* now nuke the drive queue */ | 1056 | /* now nuke the drive queue */ |
1057 | while ((req = elv_next_request(drive->queue))) { | 1057 | while ((req = elv_next_request(drive->queue))) { |
1058 | blkdev_dequeue_request(req); | 1058 | blkdev_dequeue_request(req); |
1059 | end_that_request_last(req); | 1059 | end_that_request_last(req, 0); |
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | HWGROUP(drive)->rq = NULL; | 1062 | HWGROUP(drive)->rq = NULL; |
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 9c66d4059399..f55b9b3f7b37 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -562,16 +562,28 @@ static const u8 ata_rw_cmds[] = { | |||
562 | ATA_CMD_WRITE_MULTI, | 562 | ATA_CMD_WRITE_MULTI, |
563 | ATA_CMD_READ_MULTI_EXT, | 563 | ATA_CMD_READ_MULTI_EXT, |
564 | ATA_CMD_WRITE_MULTI_EXT, | 564 | ATA_CMD_WRITE_MULTI_EXT, |
565 | 0, | ||
566 | 0, | ||
567 | 0, | ||
568 | ATA_CMD_WRITE_MULTI_FUA_EXT, | ||
565 | /* pio */ | 569 | /* pio */ |
566 | ATA_CMD_PIO_READ, | 570 | ATA_CMD_PIO_READ, |
567 | ATA_CMD_PIO_WRITE, | 571 | ATA_CMD_PIO_WRITE, |
568 | ATA_CMD_PIO_READ_EXT, | 572 | ATA_CMD_PIO_READ_EXT, |
569 | ATA_CMD_PIO_WRITE_EXT, | 573 | ATA_CMD_PIO_WRITE_EXT, |
574 | 0, | ||
575 | 0, | ||
576 | 0, | ||
577 | 0, | ||
570 | /* dma */ | 578 | /* dma */ |
571 | ATA_CMD_READ, | 579 | ATA_CMD_READ, |
572 | ATA_CMD_WRITE, | 580 | ATA_CMD_WRITE, |
573 | ATA_CMD_READ_EXT, | 581 | ATA_CMD_READ_EXT, |
574 | ATA_CMD_WRITE_EXT | 582 | ATA_CMD_WRITE_EXT, |
583 | 0, | ||
584 | 0, | ||
585 | 0, | ||
586 | ATA_CMD_WRITE_FUA_EXT | ||
575 | }; | 587 | }; |
576 | 588 | ||
577 | /** | 589 | /** |
@@ -584,25 +596,32 @@ static const u8 ata_rw_cmds[] = { | |||
584 | * LOCKING: | 596 | * LOCKING: |
585 | * caller. | 597 | * caller. |
586 | */ | 598 | */ |
587 | void ata_rwcmd_protocol(struct ata_queued_cmd *qc) | 599 | int ata_rwcmd_protocol(struct ata_queued_cmd *qc) |
588 | { | 600 | { |
589 | struct ata_taskfile *tf = &qc->tf; | 601 | struct ata_taskfile *tf = &qc->tf; |
590 | struct ata_device *dev = qc->dev; | 602 | struct ata_device *dev = qc->dev; |
603 | u8 cmd; | ||
591 | 604 | ||
592 | int index, lba48, write; | 605 | int index, fua, lba48, write; |
593 | 606 | ||
607 | fua = (tf->flags & ATA_TFLAG_FUA) ? 4 : 0; | ||
594 | lba48 = (tf->flags & ATA_TFLAG_LBA48) ? 2 : 0; | 608 | lba48 = (tf->flags & ATA_TFLAG_LBA48) ? 2 : 0; |
595 | write = (tf->flags & ATA_TFLAG_WRITE) ? 1 : 0; | 609 | write = (tf->flags & ATA_TFLAG_WRITE) ? 1 : 0; |
596 | 610 | ||
597 | if (dev->flags & ATA_DFLAG_PIO) { | 611 | if (dev->flags & ATA_DFLAG_PIO) { |
598 | tf->protocol = ATA_PROT_PIO; | 612 | tf->protocol = ATA_PROT_PIO; |
599 | index = dev->multi_count ? 0 : 4; | 613 | index = dev->multi_count ? 0 : 8; |
600 | } else { | 614 | } else { |
601 | tf->protocol = ATA_PROT_DMA; | 615 | tf->protocol = ATA_PROT_DMA; |
602 | index = 8; | 616 | index = 16; |
603 | } | 617 | } |
604 | 618 | ||
605 | tf->command = ata_rw_cmds[index + lba48 + write]; | 619 | cmd = ata_rw_cmds[index + fua + lba48 + write]; |
620 | if (cmd) { | ||
621 | tf->command = cmd; | ||
622 | return 0; | ||
623 | } | ||
624 | return -1; | ||
606 | } | 625 | } |
607 | 626 | ||
608 | static const char * const xfer_mode_str[] = { | 627 | static const char * const xfer_mode_str[] = { |
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index c1ebede14a48..cfbceb504718 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -1096,11 +1096,13 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicm | |||
1096 | scsicmd[0] == WRITE_16) | 1096 | scsicmd[0] == WRITE_16) |
1097 | tf->flags |= ATA_TFLAG_WRITE; | 1097 | tf->flags |= ATA_TFLAG_WRITE; |
1098 | 1098 | ||
1099 | /* Calculate the SCSI LBA and transfer length. */ | 1099 | /* Calculate the SCSI LBA, transfer length and FUA. */ |
1100 | switch (scsicmd[0]) { | 1100 | switch (scsicmd[0]) { |
1101 | case READ_10: | 1101 | case READ_10: |
1102 | case WRITE_10: | 1102 | case WRITE_10: |
1103 | scsi_10_lba_len(scsicmd, &block, &n_block); | 1103 | scsi_10_lba_len(scsicmd, &block, &n_block); |
1104 | if (unlikely(scsicmd[1] & (1 << 3))) | ||
1105 | tf->flags |= ATA_TFLAG_FUA; | ||
1104 | break; | 1106 | break; |
1105 | case READ_6: | 1107 | case READ_6: |
1106 | case WRITE_6: | 1108 | case WRITE_6: |
@@ -1115,6 +1117,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicm | |||
1115 | case READ_16: | 1117 | case READ_16: |
1116 | case WRITE_16: | 1118 | case WRITE_16: |
1117 | scsi_16_lba_len(scsicmd, &block, &n_block); | 1119 | scsi_16_lba_len(scsicmd, &block, &n_block); |
1120 | if (unlikely(scsicmd[1] & (1 << 3))) | ||
1121 | tf->flags |= ATA_TFLAG_FUA; | ||
1118 | break; | 1122 | break; |
1119 | default: | 1123 | default: |
1120 | DPRINTK("no-byte command\n"); | 1124 | DPRINTK("no-byte command\n"); |
@@ -1158,7 +1162,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicm | |||
1158 | tf->device |= (block >> 24) & 0xf; | 1162 | tf->device |= (block >> 24) & 0xf; |
1159 | } | 1163 | } |
1160 | 1164 | ||
1161 | ata_rwcmd_protocol(qc); | 1165 | if (unlikely(ata_rwcmd_protocol(qc) < 0)) |
1166 | goto invalid_fld; | ||
1162 | 1167 | ||
1163 | qc->nsect = n_block; | 1168 | qc->nsect = n_block; |
1164 | tf->nsect = n_block & 0xff; | 1169 | tf->nsect = n_block & 0xff; |
@@ -1176,7 +1181,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicm | |||
1176 | if ((block >> 28) || (n_block > 256)) | 1181 | if ((block >> 28) || (n_block > 256)) |
1177 | goto out_of_range; | 1182 | goto out_of_range; |
1178 | 1183 | ||
1179 | ata_rwcmd_protocol(qc); | 1184 | if (unlikely(ata_rwcmd_protocol(qc) < 0)) |
1185 | goto invalid_fld; | ||
1180 | 1186 | ||
1181 | /* Convert LBA to CHS */ | 1187 | /* Convert LBA to CHS */ |
1182 | track = (u32)block / dev->sectors; | 1188 | track = (u32)block / dev->sectors; |
@@ -1711,6 +1717,7 @@ static unsigned int ata_msense_rw_recovery(u8 **ptr_io, const u8 *last) | |||
1711 | unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf, | 1717 | unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf, |
1712 | unsigned int buflen) | 1718 | unsigned int buflen) |
1713 | { | 1719 | { |
1720 | struct ata_device *dev = args->dev; | ||
1714 | u8 *scsicmd = args->cmd->cmnd, *p, *last; | 1721 | u8 *scsicmd = args->cmd->cmnd, *p, *last; |
1715 | const u8 sat_blk_desc[] = { | 1722 | const u8 sat_blk_desc[] = { |
1716 | 0, 0, 0, 0, /* number of blocks: sat unspecified */ | 1723 | 0, 0, 0, 0, /* number of blocks: sat unspecified */ |
@@ -1719,6 +1726,7 @@ unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf, | |||
1719 | }; | 1726 | }; |
1720 | u8 pg, spg; | 1727 | u8 pg, spg; |
1721 | unsigned int ebd, page_control, six_byte, output_len, alloc_len, minlen; | 1728 | unsigned int ebd, page_control, six_byte, output_len, alloc_len, minlen; |
1729 | u8 dpofua; | ||
1722 | 1730 | ||
1723 | VPRINTK("ENTER\n"); | 1731 | VPRINTK("ENTER\n"); |
1724 | 1732 | ||
@@ -1787,9 +1795,17 @@ unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf, | |||
1787 | 1795 | ||
1788 | if (minlen < 1) | 1796 | if (minlen < 1) |
1789 | return 0; | 1797 | return 0; |
1798 | |||
1799 | dpofua = 0; | ||
1800 | if (ata_id_has_fua(args->id) && dev->flags & ATA_DFLAG_LBA48 && | ||
1801 | (!(dev->flags & ATA_DFLAG_PIO) || dev->multi_count)) | ||
1802 | dpofua = 1 << 4; | ||
1803 | |||
1790 | if (six_byte) { | 1804 | if (six_byte) { |
1791 | output_len--; | 1805 | output_len--; |
1792 | rbuf[0] = output_len; | 1806 | rbuf[0] = output_len; |
1807 | if (minlen > 2) | ||
1808 | rbuf[2] |= dpofua; | ||
1793 | if (ebd) { | 1809 | if (ebd) { |
1794 | if (minlen > 3) | 1810 | if (minlen > 3) |
1795 | rbuf[3] = sizeof(sat_blk_desc); | 1811 | rbuf[3] = sizeof(sat_blk_desc); |
@@ -1802,6 +1818,8 @@ unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf, | |||
1802 | rbuf[0] = output_len >> 8; | 1818 | rbuf[0] = output_len >> 8; |
1803 | if (minlen > 1) | 1819 | if (minlen > 1) |
1804 | rbuf[1] = output_len; | 1820 | rbuf[1] = output_len; |
1821 | if (minlen > 3) | ||
1822 | rbuf[3] |= dpofua; | ||
1805 | if (ebd) { | 1823 | if (ebd) { |
1806 | if (minlen > 7) | 1824 | if (minlen > 7) |
1807 | rbuf[7] = sizeof(sat_blk_desc); | 1825 | rbuf[7] = sizeof(sat_blk_desc); |
@@ -2462,7 +2480,7 @@ int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | |||
2462 | if (xlat_func) | 2480 | if (xlat_func) |
2463 | ata_scsi_translate(ap, dev, cmd, done, xlat_func); | 2481 | ata_scsi_translate(ap, dev, cmd, done, xlat_func); |
2464 | else | 2482 | else |
2465 | ata_scsi_simulate(dev->id, cmd, done); | 2483 | ata_scsi_simulate(ap, dev, cmd, done); |
2466 | } else | 2484 | } else |
2467 | ata_scsi_translate(ap, dev, cmd, done, atapi_xlat); | 2485 | ata_scsi_translate(ap, dev, cmd, done, atapi_xlat); |
2468 | 2486 | ||
@@ -2485,14 +2503,16 @@ out_unlock: | |||
2485 | * spin_lock_irqsave(host_set lock) | 2503 | * spin_lock_irqsave(host_set lock) |
2486 | */ | 2504 | */ |
2487 | 2505 | ||
2488 | void ata_scsi_simulate(u16 *id, | 2506 | void ata_scsi_simulate(struct ata_port *ap, struct ata_device *dev, |
2489 | struct scsi_cmnd *cmd, | 2507 | struct scsi_cmnd *cmd, |
2490 | void (*done)(struct scsi_cmnd *)) | 2508 | void (*done)(struct scsi_cmnd *)) |
2491 | { | 2509 | { |
2492 | struct ata_scsi_args args; | 2510 | struct ata_scsi_args args; |
2493 | const u8 *scsicmd = cmd->cmnd; | 2511 | const u8 *scsicmd = cmd->cmnd; |
2494 | 2512 | ||
2495 | args.id = id; | 2513 | args.ap = ap; |
2514 | args.dev = dev; | ||
2515 | args.id = dev->id; | ||
2496 | args.cmd = cmd; | 2516 | args.cmd = cmd; |
2497 | args.done = done; | 2517 | args.done = done; |
2498 | 2518 | ||
diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h index 251e53bdc6e0..e03ce48b7b4b 100644 --- a/drivers/scsi/libata.h +++ b/drivers/scsi/libata.h | |||
@@ -32,6 +32,8 @@ | |||
32 | #define DRV_VERSION "1.20" /* must be exactly four chars */ | 32 | #define DRV_VERSION "1.20" /* must be exactly four chars */ |
33 | 33 | ||
34 | struct ata_scsi_args { | 34 | struct ata_scsi_args { |
35 | struct ata_port *ap; | ||
36 | struct ata_device *dev; | ||
35 | u16 *id; | 37 | u16 *id; |
36 | struct scsi_cmnd *cmd; | 38 | struct scsi_cmnd *cmd; |
37 | void (*done)(struct scsi_cmnd *); | 39 | void (*done)(struct scsi_cmnd *); |
@@ -41,7 +43,7 @@ struct ata_scsi_args { | |||
41 | extern int atapi_enabled; | 43 | extern int atapi_enabled; |
42 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, | 44 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, |
43 | struct ata_device *dev); | 45 | struct ata_device *dev); |
44 | extern void ata_rwcmd_protocol(struct ata_queued_cmd *qc); | 46 | extern int ata_rwcmd_protocol(struct ata_queued_cmd *qc); |
45 | extern void ata_qc_free(struct ata_queued_cmd *qc); | 47 | extern void ata_qc_free(struct ata_queued_cmd *qc); |
46 | extern int ata_qc_issue(struct ata_queued_cmd *qc); | 48 | extern int ata_qc_issue(struct ata_queued_cmd *qc); |
47 | extern int ata_check_atapi_dma(struct ata_queued_cmd *qc); | 49 | extern int ata_check_atapi_dma(struct ata_queued_cmd *qc); |
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index b2bf16a9bf4b..cd54244058b5 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c | |||
@@ -374,7 +374,6 @@ static struct scsi_host_template mv_sht = { | |||
374 | .dma_boundary = MV_DMA_BOUNDARY, | 374 | .dma_boundary = MV_DMA_BOUNDARY, |
375 | .slave_configure = ata_scsi_slave_config, | 375 | .slave_configure = ata_scsi_slave_config, |
376 | .bios_param = ata_std_bios_param, | 376 | .bios_param = ata_std_bios_param, |
377 | .ordered_flush = 1, | ||
378 | }; | 377 | }; |
379 | 378 | ||
380 | static const struct ata_port_operations mv5_ops = { | 379 | static const struct ata_port_operations mv5_ops = { |
diff --git a/drivers/scsi/sata_nv.c b/drivers/scsi/sata_nv.c index 4954896dfdb9..c0cf52cb975a 100644 --- a/drivers/scsi/sata_nv.c +++ b/drivers/scsi/sata_nv.c | |||
@@ -235,7 +235,6 @@ static struct scsi_host_template nv_sht = { | |||
235 | .dma_boundary = ATA_DMA_BOUNDARY, | 235 | .dma_boundary = ATA_DMA_BOUNDARY, |
236 | .slave_configure = ata_scsi_slave_config, | 236 | .slave_configure = ata_scsi_slave_config, |
237 | .bios_param = ata_std_bios_param, | 237 | .bios_param = ata_std_bios_param, |
238 | .ordered_flush = 1, | ||
239 | }; | 238 | }; |
240 | 239 | ||
241 | static const struct ata_port_operations nv_ops = { | 240 | static const struct ata_port_operations nv_ops = { |
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c index da7fa04b8a73..3d1ea09a06a1 100644 --- a/drivers/scsi/sata_promise.c +++ b/drivers/scsi/sata_promise.c | |||
@@ -114,7 +114,6 @@ static struct scsi_host_template pdc_ata_sht = { | |||
114 | .dma_boundary = ATA_DMA_BOUNDARY, | 114 | .dma_boundary = ATA_DMA_BOUNDARY, |
115 | .slave_configure = ata_scsi_slave_config, | 115 | .slave_configure = ata_scsi_slave_config, |
116 | .bios_param = ata_std_bios_param, | 116 | .bios_param = ata_std_bios_param, |
117 | .ordered_flush = 1, | ||
118 | }; | 117 | }; |
119 | 118 | ||
120 | static const struct ata_port_operations pdc_sata_ops = { | 119 | static const struct ata_port_operations pdc_sata_ops = { |
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c index d2053487c73b..b017f85e6d6a 100644 --- a/drivers/scsi/sata_sil.c +++ b/drivers/scsi/sata_sil.c | |||
@@ -147,7 +147,6 @@ static struct scsi_host_template sil_sht = { | |||
147 | .dma_boundary = ATA_DMA_BOUNDARY, | 147 | .dma_boundary = ATA_DMA_BOUNDARY, |
148 | .slave_configure = ata_scsi_slave_config, | 148 | .slave_configure = ata_scsi_slave_config, |
149 | .bios_param = ata_std_bios_param, | 149 | .bios_param = ata_std_bios_param, |
150 | .ordered_flush = 1, | ||
151 | }; | 150 | }; |
152 | 151 | ||
153 | static const struct ata_port_operations sil_ops = { | 152 | static const struct ata_port_operations sil_ops = { |
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c index a0ad3ed2200a..923130185a9e 100644 --- a/drivers/scsi/sata_sil24.c +++ b/drivers/scsi/sata_sil24.c | |||
@@ -292,7 +292,6 @@ static struct scsi_host_template sil24_sht = { | |||
292 | .dma_boundary = ATA_DMA_BOUNDARY, | 292 | .dma_boundary = ATA_DMA_BOUNDARY, |
293 | .slave_configure = ata_scsi_slave_config, | 293 | .slave_configure = ata_scsi_slave_config, |
294 | .bios_param = ata_std_bios_param, | 294 | .bios_param = ata_std_bios_param, |
295 | .ordered_flush = 1, /* NCQ not supported yet */ | ||
296 | }; | 295 | }; |
297 | 296 | ||
298 | static const struct ata_port_operations sil24_ops = { | 297 | static const struct ata_port_operations sil24_ops = { |
diff --git a/drivers/scsi/sata_sis.c b/drivers/scsi/sata_sis.c index 32e12620b162..2df8c5632ac3 100644 --- a/drivers/scsi/sata_sis.c +++ b/drivers/scsi/sata_sis.c | |||
@@ -99,7 +99,6 @@ static struct scsi_host_template sis_sht = { | |||
99 | .dma_boundary = ATA_DMA_BOUNDARY, | 99 | .dma_boundary = ATA_DMA_BOUNDARY, |
100 | .slave_configure = ata_scsi_slave_config, | 100 | .slave_configure = ata_scsi_slave_config, |
101 | .bios_param = ata_std_bios_param, | 101 | .bios_param = ata_std_bios_param, |
102 | .ordered_flush = 1, | ||
103 | }; | 102 | }; |
104 | 103 | ||
105 | static const struct ata_port_operations sis_ops = { | 104 | static const struct ata_port_operations sis_ops = { |
diff --git a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c index 6e7f7c83a75a..668373590aa4 100644 --- a/drivers/scsi/sata_svw.c +++ b/drivers/scsi/sata_svw.c | |||
@@ -303,7 +303,6 @@ static struct scsi_host_template k2_sata_sht = { | |||
303 | .proc_info = k2_sata_proc_info, | 303 | .proc_info = k2_sata_proc_info, |
304 | #endif | 304 | #endif |
305 | .bios_param = ata_std_bios_param, | 305 | .bios_param = ata_std_bios_param, |
306 | .ordered_flush = 1, | ||
307 | }; | 306 | }; |
308 | 307 | ||
309 | 308 | ||
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c index 94b253b80da8..bc87c16c80d2 100644 --- a/drivers/scsi/sata_sx4.c +++ b/drivers/scsi/sata_sx4.c | |||
@@ -194,7 +194,6 @@ static struct scsi_host_template pdc_sata_sht = { | |||
194 | .dma_boundary = ATA_DMA_BOUNDARY, | 194 | .dma_boundary = ATA_DMA_BOUNDARY, |
195 | .slave_configure = ata_scsi_slave_config, | 195 | .slave_configure = ata_scsi_slave_config, |
196 | .bios_param = ata_std_bios_param, | 196 | .bios_param = ata_std_bios_param, |
197 | .ordered_flush = 1, | ||
198 | }; | 197 | }; |
199 | 198 | ||
200 | static const struct ata_port_operations pdc_20621_ops = { | 199 | static const struct ata_port_operations pdc_20621_ops = { |
diff --git a/drivers/scsi/sata_uli.c b/drivers/scsi/sata_uli.c index b2422a0f25c8..9635ca700977 100644 --- a/drivers/scsi/sata_uli.c +++ b/drivers/scsi/sata_uli.c | |||
@@ -87,7 +87,6 @@ static struct scsi_host_template uli_sht = { | |||
87 | .dma_boundary = ATA_DMA_BOUNDARY, | 87 | .dma_boundary = ATA_DMA_BOUNDARY, |
88 | .slave_configure = ata_scsi_slave_config, | 88 | .slave_configure = ata_scsi_slave_config, |
89 | .bios_param = ata_std_bios_param, | 89 | .bios_param = ata_std_bios_param, |
90 | .ordered_flush = 1, | ||
91 | }; | 90 | }; |
92 | 91 | ||
93 | static const struct ata_port_operations uli_ops = { | 92 | static const struct ata_port_operations uli_ops = { |
diff --git a/drivers/scsi/sata_via.c b/drivers/scsi/sata_via.c index c76215692da2..6d5b0a794cfd 100644 --- a/drivers/scsi/sata_via.c +++ b/drivers/scsi/sata_via.c | |||
@@ -106,7 +106,6 @@ static struct scsi_host_template svia_sht = { | |||
106 | .dma_boundary = ATA_DMA_BOUNDARY, | 106 | .dma_boundary = ATA_DMA_BOUNDARY, |
107 | .slave_configure = ata_scsi_slave_config, | 107 | .slave_configure = ata_scsi_slave_config, |
108 | .bios_param = ata_std_bios_param, | 108 | .bios_param = ata_std_bios_param, |
109 | .ordered_flush = 1, | ||
110 | }; | 109 | }; |
111 | 110 | ||
112 | static const struct ata_port_operations svia_sata_ops = { | 111 | static const struct ata_port_operations svia_sata_ops = { |
diff --git a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c index fcfa486965b4..2e2c3b7acb0c 100644 --- a/drivers/scsi/sata_vsc.c +++ b/drivers/scsi/sata_vsc.c | |||
@@ -235,7 +235,6 @@ static struct scsi_host_template vsc_sata_sht = { | |||
235 | .dma_boundary = ATA_DMA_BOUNDARY, | 235 | .dma_boundary = ATA_DMA_BOUNDARY, |
236 | .slave_configure = ata_scsi_slave_config, | 236 | .slave_configure = ata_scsi_slave_config, |
237 | .bios_param = ata_std_bios_param, | 237 | .bios_param = ata_std_bios_param, |
238 | .ordered_flush = 1, | ||
239 | }; | 238 | }; |
240 | 239 | ||
241 | 240 | ||
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index a7f3f0c84db7..ba93d6e66d48 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -308,7 +308,7 @@ struct scsi_io_context { | |||
308 | 308 | ||
309 | static kmem_cache_t *scsi_io_context_cache; | 309 | static kmem_cache_t *scsi_io_context_cache; |
310 | 310 | ||
311 | static void scsi_end_async(struct request *req) | 311 | static void scsi_end_async(struct request *req, int uptodate) |
312 | { | 312 | { |
313 | struct scsi_io_context *sioc = req->end_io_data; | 313 | struct scsi_io_context *sioc = req->end_io_data; |
314 | 314 | ||
@@ -791,7 +791,7 @@ static struct scsi_cmnd *scsi_end_request(struct scsi_cmnd *cmd, int uptodate, | |||
791 | spin_lock_irqsave(q->queue_lock, flags); | 791 | spin_lock_irqsave(q->queue_lock, flags); |
792 | if (blk_rq_tagged(req)) | 792 | if (blk_rq_tagged(req)) |
793 | blk_queue_end_tag(q, req); | 793 | blk_queue_end_tag(q, req); |
794 | end_that_request_last(req); | 794 | end_that_request_last(req, uptodate); |
795 | spin_unlock_irqrestore(q->queue_lock, flags); | 795 | spin_unlock_irqrestore(q->queue_lock, flags); |
796 | 796 | ||
797 | /* | 797 | /* |
@@ -932,9 +932,6 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes, | |||
932 | int sense_valid = 0; | 932 | int sense_valid = 0; |
933 | int sense_deferred = 0; | 933 | int sense_deferred = 0; |
934 | 934 | ||
935 | if (blk_complete_barrier_rq(q, req, good_bytes >> 9)) | ||
936 | return; | ||
937 | |||
938 | /* | 935 | /* |
939 | * Free up any indirection buffers we allocated for DMA purposes. | 936 | * Free up any indirection buffers we allocated for DMA purposes. |
940 | * For the case of a READ, we need to copy the data out of the | 937 | * For the case of a READ, we need to copy the data out of the |
@@ -1199,38 +1196,6 @@ static int scsi_init_io(struct scsi_cmnd *cmd) | |||
1199 | return BLKPREP_KILL; | 1196 | return BLKPREP_KILL; |
1200 | } | 1197 | } |
1201 | 1198 | ||
1202 | static int scsi_prepare_flush_fn(request_queue_t *q, struct request *rq) | ||
1203 | { | ||
1204 | struct scsi_device *sdev = q->queuedata; | ||
1205 | struct scsi_driver *drv; | ||
1206 | |||
1207 | if (sdev->sdev_state == SDEV_RUNNING) { | ||
1208 | drv = *(struct scsi_driver **) rq->rq_disk->private_data; | ||
1209 | |||
1210 | if (drv->prepare_flush) | ||
1211 | return drv->prepare_flush(q, rq); | ||
1212 | } | ||
1213 | |||
1214 | return 0; | ||
1215 | } | ||
1216 | |||
1217 | static void scsi_end_flush_fn(request_queue_t *q, struct request *rq) | ||
1218 | { | ||
1219 | struct scsi_device *sdev = q->queuedata; | ||
1220 | struct request *flush_rq = rq->end_io_data; | ||
1221 | struct scsi_driver *drv; | ||
1222 | |||
1223 | if (flush_rq->errors) { | ||
1224 | printk("scsi: barrier error, disabling flush support\n"); | ||
1225 | blk_queue_ordered(q, QUEUE_ORDERED_NONE); | ||
1226 | } | ||
1227 | |||
1228 | if (sdev->sdev_state == SDEV_RUNNING) { | ||
1229 | drv = *(struct scsi_driver **) rq->rq_disk->private_data; | ||
1230 | drv->end_flush(q, rq); | ||
1231 | } | ||
1232 | } | ||
1233 | |||
1234 | static int scsi_issue_flush_fn(request_queue_t *q, struct gendisk *disk, | 1199 | static int scsi_issue_flush_fn(request_queue_t *q, struct gendisk *disk, |
1235 | sector_t *error_sector) | 1200 | sector_t *error_sector) |
1236 | { | 1201 | { |
@@ -1703,17 +1668,6 @@ struct request_queue *scsi_alloc_queue(struct scsi_device *sdev) | |||
1703 | blk_queue_segment_boundary(q, shost->dma_boundary); | 1668 | blk_queue_segment_boundary(q, shost->dma_boundary); |
1704 | blk_queue_issue_flush_fn(q, scsi_issue_flush_fn); | 1669 | blk_queue_issue_flush_fn(q, scsi_issue_flush_fn); |
1705 | 1670 | ||
1706 | /* | ||
1707 | * ordered tags are superior to flush ordering | ||
1708 | */ | ||
1709 | if (shost->ordered_tag) | ||
1710 | blk_queue_ordered(q, QUEUE_ORDERED_TAG); | ||
1711 | else if (shost->ordered_flush) { | ||
1712 | blk_queue_ordered(q, QUEUE_ORDERED_FLUSH); | ||
1713 | q->prepare_flush_fn = scsi_prepare_flush_fn; | ||
1714 | q->end_flush_fn = scsi_end_flush_fn; | ||
1715 | } | ||
1716 | |||
1717 | if (!shost->use_clustering) | 1671 | if (!shost->use_clustering) |
1718 | clear_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags); | 1672 | clear_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags); |
1719 | return q; | 1673 | return q; |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 3d3ad7d1b779..32d4d8d7b9f3 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -102,6 +102,7 @@ struct scsi_disk { | |||
102 | u8 write_prot; | 102 | u8 write_prot; |
103 | unsigned WCE : 1; /* state of disk WCE bit */ | 103 | unsigned WCE : 1; /* state of disk WCE bit */ |
104 | unsigned RCD : 1; /* state of disk RCD bit, unused */ | 104 | unsigned RCD : 1; /* state of disk RCD bit, unused */ |
105 | unsigned DPOFUA : 1; /* state of disk DPOFUA bit */ | ||
105 | }; | 106 | }; |
106 | 107 | ||
107 | static DEFINE_IDR(sd_index_idr); | 108 | static DEFINE_IDR(sd_index_idr); |
@@ -121,8 +122,7 @@ static void sd_shutdown(struct device *dev); | |||
121 | static void sd_rescan(struct device *); | 122 | static void sd_rescan(struct device *); |
122 | static int sd_init_command(struct scsi_cmnd *); | 123 | static int sd_init_command(struct scsi_cmnd *); |
123 | static int sd_issue_flush(struct device *, sector_t *); | 124 | static int sd_issue_flush(struct device *, sector_t *); |
124 | static void sd_end_flush(request_queue_t *, struct request *); | 125 | static void sd_prepare_flush(request_queue_t *, struct request *); |
125 | static int sd_prepare_flush(request_queue_t *, struct request *); | ||
126 | static void sd_read_capacity(struct scsi_disk *sdkp, char *diskname, | 126 | static void sd_read_capacity(struct scsi_disk *sdkp, char *diskname, |
127 | unsigned char *buffer); | 127 | unsigned char *buffer); |
128 | 128 | ||
@@ -137,8 +137,6 @@ static struct scsi_driver sd_template = { | |||
137 | .rescan = sd_rescan, | 137 | .rescan = sd_rescan, |
138 | .init_command = sd_init_command, | 138 | .init_command = sd_init_command, |
139 | .issue_flush = sd_issue_flush, | 139 | .issue_flush = sd_issue_flush, |
140 | .prepare_flush = sd_prepare_flush, | ||
141 | .end_flush = sd_end_flush, | ||
142 | }; | 140 | }; |
143 | 141 | ||
144 | /* | 142 | /* |
@@ -346,6 +344,7 @@ static int sd_init_command(struct scsi_cmnd * SCpnt) | |||
346 | 344 | ||
347 | if (block > 0xffffffff) { | 345 | if (block > 0xffffffff) { |
348 | SCpnt->cmnd[0] += READ_16 - READ_6; | 346 | SCpnt->cmnd[0] += READ_16 - READ_6; |
347 | SCpnt->cmnd[1] |= blk_fua_rq(rq) ? 0x8 : 0; | ||
349 | SCpnt->cmnd[2] = sizeof(block) > 4 ? (unsigned char) (block >> 56) & 0xff : 0; | 348 | SCpnt->cmnd[2] = sizeof(block) > 4 ? (unsigned char) (block >> 56) & 0xff : 0; |
350 | SCpnt->cmnd[3] = sizeof(block) > 4 ? (unsigned char) (block >> 48) & 0xff : 0; | 349 | SCpnt->cmnd[3] = sizeof(block) > 4 ? (unsigned char) (block >> 48) & 0xff : 0; |
351 | SCpnt->cmnd[4] = sizeof(block) > 4 ? (unsigned char) (block >> 40) & 0xff : 0; | 350 | SCpnt->cmnd[4] = sizeof(block) > 4 ? (unsigned char) (block >> 40) & 0xff : 0; |
@@ -365,6 +364,7 @@ static int sd_init_command(struct scsi_cmnd * SCpnt) | |||
365 | this_count = 0xffff; | 364 | this_count = 0xffff; |
366 | 365 | ||
367 | SCpnt->cmnd[0] += READ_10 - READ_6; | 366 | SCpnt->cmnd[0] += READ_10 - READ_6; |
367 | SCpnt->cmnd[1] |= blk_fua_rq(rq) ? 0x8 : 0; | ||
368 | SCpnt->cmnd[2] = (unsigned char) (block >> 24) & 0xff; | 368 | SCpnt->cmnd[2] = (unsigned char) (block >> 24) & 0xff; |
369 | SCpnt->cmnd[3] = (unsigned char) (block >> 16) & 0xff; | 369 | SCpnt->cmnd[3] = (unsigned char) (block >> 16) & 0xff; |
370 | SCpnt->cmnd[4] = (unsigned char) (block >> 8) & 0xff; | 370 | SCpnt->cmnd[4] = (unsigned char) (block >> 8) & 0xff; |
@@ -373,6 +373,17 @@ static int sd_init_command(struct scsi_cmnd * SCpnt) | |||
373 | SCpnt->cmnd[7] = (unsigned char) (this_count >> 8) & 0xff; | 373 | SCpnt->cmnd[7] = (unsigned char) (this_count >> 8) & 0xff; |
374 | SCpnt->cmnd[8] = (unsigned char) this_count & 0xff; | 374 | SCpnt->cmnd[8] = (unsigned char) this_count & 0xff; |
375 | } else { | 375 | } else { |
376 | if (unlikely(blk_fua_rq(rq))) { | ||
377 | /* | ||
378 | * This happens only if this drive failed | ||
379 | * 10byte rw command with ILLEGAL_REQUEST | ||
380 | * during operation and thus turned off | ||
381 | * use_10_for_rw. | ||
382 | */ | ||
383 | printk(KERN_ERR "sd: FUA write on READ/WRITE(6) drive\n"); | ||
384 | return 0; | ||
385 | } | ||
386 | |||
376 | SCpnt->cmnd[1] |= (unsigned char) ((block >> 16) & 0x1f); | 387 | SCpnt->cmnd[1] |= (unsigned char) ((block >> 16) & 0x1f); |
377 | SCpnt->cmnd[2] = (unsigned char) ((block >> 8) & 0xff); | 388 | SCpnt->cmnd[2] = (unsigned char) ((block >> 8) & 0xff); |
378 | SCpnt->cmnd[3] = (unsigned char) block & 0xff; | 389 | SCpnt->cmnd[3] = (unsigned char) block & 0xff; |
@@ -729,42 +740,13 @@ static int sd_issue_flush(struct device *dev, sector_t *error_sector) | |||
729 | return ret; | 740 | return ret; |
730 | } | 741 | } |
731 | 742 | ||
732 | static void sd_end_flush(request_queue_t *q, struct request *flush_rq) | 743 | static void sd_prepare_flush(request_queue_t *q, struct request *rq) |
733 | { | ||
734 | struct request *rq = flush_rq->end_io_data; | ||
735 | struct scsi_cmnd *cmd = rq->special; | ||
736 | unsigned int bytes = rq->hard_nr_sectors << 9; | ||
737 | |||
738 | if (!flush_rq->errors) { | ||
739 | spin_unlock(q->queue_lock); | ||
740 | scsi_io_completion(cmd, bytes, 0); | ||
741 | spin_lock(q->queue_lock); | ||
742 | } else if (blk_barrier_postflush(rq)) { | ||
743 | spin_unlock(q->queue_lock); | ||
744 | scsi_io_completion(cmd, 0, bytes); | ||
745 | spin_lock(q->queue_lock); | ||
746 | } else { | ||
747 | /* | ||
748 | * force journal abort of barriers | ||
749 | */ | ||
750 | end_that_request_first(rq, -EOPNOTSUPP, rq->hard_nr_sectors); | ||
751 | end_that_request_last(rq); | ||
752 | } | ||
753 | } | ||
754 | |||
755 | static int sd_prepare_flush(request_queue_t *q, struct request *rq) | ||
756 | { | 744 | { |
757 | struct scsi_device *sdev = q->queuedata; | ||
758 | struct scsi_disk *sdkp = dev_get_drvdata(&sdev->sdev_gendev); | ||
759 | |||
760 | if (!sdkp || !sdkp->WCE) | ||
761 | return 0; | ||
762 | |||
763 | memset(rq->cmd, 0, sizeof(rq->cmd)); | 745 | memset(rq->cmd, 0, sizeof(rq->cmd)); |
764 | rq->flags |= REQ_BLOCK_PC | REQ_SOFTBARRIER; | 746 | rq->flags |= REQ_BLOCK_PC; |
765 | rq->timeout = SD_TIMEOUT; | 747 | rq->timeout = SD_TIMEOUT; |
766 | rq->cmd[0] = SYNCHRONIZE_CACHE; | 748 | rq->cmd[0] = SYNCHRONIZE_CACHE; |
767 | return 1; | 749 | rq->cmd_len = 10; |
768 | } | 750 | } |
769 | 751 | ||
770 | static void sd_rescan(struct device *dev) | 752 | static void sd_rescan(struct device *dev) |
@@ -1427,10 +1409,18 @@ sd_read_cache_type(struct scsi_disk *sdkp, char *diskname, | |||
1427 | sdkp->RCD = 0; | 1409 | sdkp->RCD = 0; |
1428 | } | 1410 | } |
1429 | 1411 | ||
1412 | sdkp->DPOFUA = (data.device_specific & 0x10) != 0; | ||
1413 | if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) { | ||
1414 | printk(KERN_NOTICE "SCSI device %s: uses " | ||
1415 | "READ/WRITE(6), disabling FUA\n", diskname); | ||
1416 | sdkp->DPOFUA = 0; | ||
1417 | } | ||
1418 | |||
1430 | ct = sdkp->RCD + 2*sdkp->WCE; | 1419 | ct = sdkp->RCD + 2*sdkp->WCE; |
1431 | 1420 | ||
1432 | printk(KERN_NOTICE "SCSI device %s: drive cache: %s\n", | 1421 | printk(KERN_NOTICE "SCSI device %s: drive cache: %s%s\n", |
1433 | diskname, types[ct]); | 1422 | diskname, types[ct], |
1423 | sdkp->DPOFUA ? " w/ FUA" : ""); | ||
1434 | 1424 | ||
1435 | return; | 1425 | return; |
1436 | } | 1426 | } |
@@ -1462,6 +1452,7 @@ static int sd_revalidate_disk(struct gendisk *disk) | |||
1462 | struct scsi_disk *sdkp = scsi_disk(disk); | 1452 | struct scsi_disk *sdkp = scsi_disk(disk); |
1463 | struct scsi_device *sdp = sdkp->device; | 1453 | struct scsi_device *sdp = sdkp->device; |
1464 | unsigned char *buffer; | 1454 | unsigned char *buffer; |
1455 | unsigned ordered; | ||
1465 | 1456 | ||
1466 | SCSI_LOG_HLQUEUE(3, printk("sd_revalidate_disk: disk=%s\n", disk->disk_name)); | 1457 | SCSI_LOG_HLQUEUE(3, printk("sd_revalidate_disk: disk=%s\n", disk->disk_name)); |
1467 | 1458 | ||
@@ -1498,7 +1489,21 @@ static int sd_revalidate_disk(struct gendisk *disk) | |||
1498 | sd_read_write_protect_flag(sdkp, disk->disk_name, buffer); | 1489 | sd_read_write_protect_flag(sdkp, disk->disk_name, buffer); |
1499 | sd_read_cache_type(sdkp, disk->disk_name, buffer); | 1490 | sd_read_cache_type(sdkp, disk->disk_name, buffer); |
1500 | } | 1491 | } |
1501 | 1492 | ||
1493 | /* | ||
1494 | * We now have all cache related info, determine how we deal | ||
1495 | * with ordered requests. Note that as the current SCSI | ||
1496 | * dispatch function can alter request order, we cannot use | ||
1497 | * QUEUE_ORDERED_TAG_* even when ordered tag is supported. | ||
1498 | */ | ||
1499 | if (sdkp->WCE) | ||
1500 | ordered = sdkp->DPOFUA | ||
1501 | ? QUEUE_ORDERED_DRAIN_FUA : QUEUE_ORDERED_DRAIN_FLUSH; | ||
1502 | else | ||
1503 | ordered = QUEUE_ORDERED_DRAIN; | ||
1504 | |||
1505 | blk_queue_ordered(sdkp->disk->queue, ordered, sd_prepare_flush); | ||
1506 | |||
1502 | set_capacity(disk, sdkp->capacity); | 1507 | set_capacity(disk, sdkp->capacity); |
1503 | kfree(buffer); | 1508 | kfree(buffer); |
1504 | 1509 | ||
@@ -1598,6 +1603,7 @@ static int sd_probe(struct device *dev) | |||
1598 | strcpy(gd->devfs_name, sdp->devfs_name); | 1603 | strcpy(gd->devfs_name, sdp->devfs_name); |
1599 | 1604 | ||
1600 | gd->private_data = &sdkp->driver; | 1605 | gd->private_data = &sdkp->driver; |
1606 | gd->queue = sdkp->device->request_queue; | ||
1601 | 1607 | ||
1602 | sd_revalidate_disk(gd); | 1608 | sd_revalidate_disk(gd); |
1603 | 1609 | ||
@@ -1605,7 +1611,6 @@ static int sd_probe(struct device *dev) | |||
1605 | gd->flags = GENHD_FL_DRIVERFS; | 1611 | gd->flags = GENHD_FL_DRIVERFS; |
1606 | if (sdp->removable) | 1612 | if (sdp->removable) |
1607 | gd->flags |= GENHD_FL_REMOVABLE; | 1613 | gd->flags |= GENHD_FL_REMOVABLE; |
1608 | gd->queue = sdkp->device->request_queue; | ||
1609 | 1614 | ||
1610 | dev_set_drvdata(dev, sdkp); | 1615 | dev_set_drvdata(dev, sdkp); |
1611 | add_disk(gd); | 1616 | add_disk(gd); |