aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-29 11:18:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-29 11:18:03 -0400
commitbd5d435a96837c3495e62eef37cbe4cb728b79ae (patch)
tree82aacaf5a1d220910c4b0a1088d7d2482c0d9ee0 /drivers
parentfee4b19fb3f28d17c0b9f9ea0668db5275697178 (diff)
parentac9fafa1243640349aa481adf473db283a695766 (diff)
Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
* 'for-linus' of git://git.kernel.dk/linux-2.6-block: block: Skip I/O merges when disabled block: add large command support block: replace sizeof(rq->cmd) with BLK_MAX_CDB ide: use blk_rq_init() to initialize the request block: use blk_rq_init() to initialize the request block: rename and export rq_init() block: no need to initialize rq->cmd with blk_get_request block: no need to initialize rq->cmd in prepare_flush_fn hook block/blk-barrier.c:blk_ordered_cur_seq() mustn't be inline block/elevator.c:elv_rq_merge_ok() mustn't be inline block: make queue flags non-atomic block: add dma alignment and padding support to blk_rq_map_kern unexport blk_max_pfn ps3disk: Remove superfluous cast block: make rq_init() do a full memset() relay: fix splice problem
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/loop.c2
-rw-r--r--drivers/block/nbd.c1
-rw-r--r--drivers/block/paride/pd.c4
-rw-r--r--drivers/block/pktcdvd.c2
-rw-r--r--drivers/block/ps3disk.c4
-rw-r--r--drivers/block/ub.c2
-rw-r--r--drivers/cdrom/cdrom.c1
-rw-r--r--drivers/ide/ide-cd.c4
-rw-r--r--drivers/ide/ide-cd_verbose.c2
-rw-r--r--drivers/ide/ide-io.c3
-rw-r--r--drivers/ide/ide-tape.c2
-rw-r--r--drivers/ide/ide-taskfile.c3
-rw-r--r--drivers/ide/ide.c4
-rw-r--r--drivers/md/dm-emc.c2
-rw-r--r--drivers/md/dm-mpath-hp-sw.c1
-rw-r--r--drivers/md/dm-mpath-rdac.c1
-rw-r--r--drivers/md/dm-table.c7
-rw-r--r--drivers/md/md.c3
-rw-r--r--drivers/scsi/scsi_debug.c2
-rw-r--r--drivers/scsi/scsi_error.c1
-rw-r--r--drivers/scsi/scsi_lib.c31
-rw-r--r--drivers/scsi/scsi_transport_sas.c3
-rw-r--r--drivers/scsi/sd.c1
23 files changed, 41 insertions, 45 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index f7f163557aa0..d3a25b027ff9 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -546,7 +546,7 @@ static void loop_unplug(struct request_queue *q)
546{ 546{
547 struct loop_device *lo = q->queuedata; 547 struct loop_device *lo = q->queuedata;
548 548
549 clear_bit(QUEUE_FLAG_PLUGGED, &q->queue_flags); 549 queue_flag_clear_unlocked(QUEUE_FLAG_PLUGGED, q);
550 blk_run_address_space(lo->lo_backing_file->f_mapping); 550 blk_run_address_space(lo->lo_backing_file->f_mapping);
551} 551}
552 552
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index bdba282f15e4..ad98dda6037d 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -577,6 +577,7 @@ static int nbd_ioctl(struct inode *inode, struct file *file,
577 switch (cmd) { 577 switch (cmd) {
578 case NBD_DISCONNECT: 578 case NBD_DISCONNECT:
579 printk(KERN_INFO "%s: NBD_DISCONNECT\n", lo->disk->disk_name); 579 printk(KERN_INFO "%s: NBD_DISCONNECT\n", lo->disk->disk_name);
580 blk_rq_init(NULL, &sreq);
580 sreq.cmd_type = REQ_TYPE_SPECIAL; 581 sreq.cmd_type = REQ_TYPE_SPECIAL;
581 nbd_cmd(&sreq) = NBD_CMD_DISC; 582 nbd_cmd(&sreq) = NBD_CMD_DISC;
582 /* 583 /*
diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
index df819f8a95a6..570f3b70dce7 100644
--- a/drivers/block/paride/pd.c
+++ b/drivers/block/paride/pd.c
@@ -716,10 +716,8 @@ static int pd_special_command(struct pd_unit *disk,
716 struct request rq; 716 struct request rq;
717 int err = 0; 717 int err = 0;
718 718
719 memset(&rq, 0, sizeof(rq)); 719 blk_rq_init(NULL, &rq);
720 rq.errors = 0;
721 rq.rq_disk = disk->gd; 720 rq.rq_disk = disk->gd;
722 rq.ref_count = 1;
723 rq.end_io_data = &wait; 721 rq.end_io_data = &wait;
724 rq.end_io = blk_end_sync_rq; 722 rq.end_io = blk_end_sync_rq;
725 blk_insert_request(disk->gd->queue, &rq, 0, func); 723 blk_insert_request(disk->gd->queue, &rq, 0, func);
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index fd0472996df8..3ba1df93e9e3 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -776,8 +776,6 @@ static int pkt_generic_packet(struct pktcdvd_device *pd, struct packet_command *
776 776
777 rq->cmd_len = COMMAND_SIZE(cgc->cmd[0]); 777 rq->cmd_len = COMMAND_SIZE(cgc->cmd[0]);
778 memcpy(rq->cmd, cgc->cmd, CDROM_PACKET_SIZE); 778 memcpy(rq->cmd, cgc->cmd, CDROM_PACKET_SIZE);
779 if (sizeof(rq->cmd) > CDROM_PACKET_SIZE)
780 memset(rq->cmd + CDROM_PACKET_SIZE, 0, sizeof(rq->cmd) - CDROM_PACKET_SIZE);
781 779
782 rq->timeout = 60*HZ; 780 rq->timeout = 60*HZ;
783 rq->cmd_type = REQ_TYPE_BLOCK_PC; 781 rq->cmd_type = REQ_TYPE_BLOCK_PC;
diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c
index 7483f947f0e9..d797e209951d 100644
--- a/drivers/block/ps3disk.c
+++ b/drivers/block/ps3disk.c
@@ -102,8 +102,7 @@ static void ps3disk_scatter_gather(struct ps3_storage_device *dev,
102 dev_dbg(&dev->sbd.core, 102 dev_dbg(&dev->sbd.core,
103 "%s:%u: bio %u: %u segs %u sectors from %lu\n", 103 "%s:%u: bio %u: %u segs %u sectors from %lu\n",
104 __func__, __LINE__, i, bio_segments(iter.bio), 104 __func__, __LINE__, i, bio_segments(iter.bio),
105 bio_sectors(iter.bio), 105 bio_sectors(iter.bio), iter.bio->bi_sector);
106 (unsigned long)iter.bio->bi_sector);
107 106
108 size = bvec->bv_len; 107 size = bvec->bv_len;
109 buf = bvec_kmap_irq(bvec, &flags); 108 buf = bvec_kmap_irq(bvec, &flags);
@@ -406,7 +405,6 @@ static void ps3disk_prepare_flush(struct request_queue *q, struct request *req)
406 405
407 dev_dbg(&dev->sbd.core, "%s:%u\n", __func__, __LINE__); 406 dev_dbg(&dev->sbd.core, "%s:%u\n", __func__, __LINE__);
408 407
409 memset(req->cmd, 0, sizeof(req->cmd));
410 req->cmd_type = REQ_TYPE_FLUSH; 408 req->cmd_type = REQ_TYPE_FLUSH;
411} 409}
412 410
diff --git a/drivers/block/ub.c b/drivers/block/ub.c
index 27bfe72aab59..e322cce8c12d 100644
--- a/drivers/block/ub.c
+++ b/drivers/block/ub.c
@@ -2399,7 +2399,7 @@ static void ub_disconnect(struct usb_interface *intf)
2399 del_gendisk(lun->disk); 2399 del_gendisk(lun->disk);
2400 /* 2400 /*
2401 * I wish I could do: 2401 * I wish I could do:
2402 * set_bit(QUEUE_FLAG_DEAD, &q->queue_flags); 2402 * queue_flag_set(QUEUE_FLAG_DEAD, q);
2403 * As it is, we rely on our internal poisoning and let 2403 * As it is, we rely on our internal poisoning and let
2404 * the upper levels to spin furiously failing all the I/O. 2404 * the upper levels to spin furiously failing all the I/O.
2405 */ 2405 */
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index ac3829030ac5..69f26eb6415b 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -2194,7 +2194,6 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf,
2194 if (ret) 2194 if (ret)
2195 break; 2195 break;
2196 2196
2197 memset(rq->cmd, 0, sizeof(rq->cmd));
2198 rq->cmd[0] = GPCMD_READ_CD; 2197 rq->cmd[0] = GPCMD_READ_CD;
2199 rq->cmd[1] = 1 << 2; 2198 rq->cmd[1] = 1 << 2;
2200 rq->cmd[2] = (lba >> 24) & 0xff; 2199 rq->cmd[2] = (lba >> 24) & 0xff;
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index fe9df38f62cc..68e7f19dc036 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -782,7 +782,7 @@ static ide_startstop_t cdrom_start_seek_continuation(ide_drive_t *drive)
782 782
783 sector_div(frame, queue_hardsect_size(drive->queue) >> SECTOR_BITS); 783 sector_div(frame, queue_hardsect_size(drive->queue) >> SECTOR_BITS);
784 784
785 memset(rq->cmd, 0, sizeof(rq->cmd)); 785 memset(rq->cmd, 0, BLK_MAX_CDB);
786 rq->cmd[0] = GPCMD_SEEK; 786 rq->cmd[0] = GPCMD_SEEK;
787 put_unaligned(cpu_to_be32(frame), (unsigned int *) &rq->cmd[2]); 787 put_unaligned(cpu_to_be32(frame), (unsigned int *) &rq->cmd[2]);
788 788
@@ -1694,7 +1694,7 @@ static int ide_cdrom_prep_fs(struct request_queue *q, struct request *rq)
1694 long block = (long)rq->hard_sector / (hard_sect >> 9); 1694 long block = (long)rq->hard_sector / (hard_sect >> 9);
1695 unsigned long blocks = rq->hard_nr_sectors / (hard_sect >> 9); 1695 unsigned long blocks = rq->hard_nr_sectors / (hard_sect >> 9);
1696 1696
1697 memset(rq->cmd, 0, sizeof(rq->cmd)); 1697 memset(rq->cmd, 0, BLK_MAX_CDB);
1698 1698
1699 if (rq_data_dir(rq) == READ) 1699 if (rq_data_dir(rq) == READ)
1700 rq->cmd[0] = GPCMD_READ_10; 1700 rq->cmd[0] = GPCMD_READ_10;
diff --git a/drivers/ide/ide-cd_verbose.c b/drivers/ide/ide-cd_verbose.c
index 6ed7ca071331..6490a2dea96b 100644
--- a/drivers/ide/ide-cd_verbose.c
+++ b/drivers/ide/ide-cd_verbose.c
@@ -326,7 +326,7 @@ void ide_cd_log_error(const char *name, struct request *failed_command,
326 326
327 printk(KERN_ERR " The failed \"%s\" packet command " 327 printk(KERN_ERR " The failed \"%s\" packet command "
328 "was: \n \"", s); 328 "was: \n \"", s);
329 for (i = 0; i < sizeof(failed_command->cmd); i++) 329 for (i = 0; i < BLK_MAX_CDB; i++)
330 printk(KERN_CONT "%02x ", failed_command->cmd[i]); 330 printk(KERN_CONT "%02x ", failed_command->cmd[i]);
331 printk(KERN_CONT "\"\n"); 331 printk(KERN_CONT "\"\n");
332 } 332 }
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 788783da9025..696525342e9a 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -1550,8 +1550,7 @@ irqreturn_t ide_intr (int irq, void *dev_id)
1550 1550
1551void ide_init_drive_cmd (struct request *rq) 1551void ide_init_drive_cmd (struct request *rq)
1552{ 1552{
1553 memset(rq, 0, sizeof(*rq)); 1553 blk_rq_init(NULL, rq);
1554 rq->ref_count = 1;
1555} 1554}
1556 1555
1557EXPORT_SYMBOL(ide_init_drive_cmd); 1556EXPORT_SYMBOL(ide_init_drive_cmd);
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 54a43b044608..1e1f26331a24 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -662,7 +662,7 @@ static void idetape_create_request_sense_cmd(struct ide_atapi_pc *pc)
662 662
663static void idetape_init_rq(struct request *rq, u8 cmd) 663static void idetape_init_rq(struct request *rq, u8 cmd)
664{ 664{
665 memset(rq, 0, sizeof(*rq)); 665 blk_rq_init(NULL, rq);
666 rq->cmd_type = REQ_TYPE_SPECIAL; 666 rq->cmd_type = REQ_TYPE_SPECIAL;
667 rq->cmd[0] = cmd; 667 rq->cmd[0] = cmd;
668} 668}
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 9a846a0cd5a4..0c908ca3ff79 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -494,8 +494,7 @@ int ide_raw_taskfile(ide_drive_t *drive, ide_task_t *task, u8 *buf, u16 nsect)
494{ 494{
495 struct request rq; 495 struct request rq;
496 496
497 memset(&rq, 0, sizeof(rq)); 497 blk_rq_init(NULL, &rq);
498 rq.ref_count = 1;
499 rq.cmd_type = REQ_TYPE_ATA_TASKFILE; 498 rq.cmd_type = REQ_TYPE_ATA_TASKFILE;
500 rq.buffer = buf; 499 rq.buffer = buf;
501 500
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 999584c03d97..c758dcb13b14 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -564,7 +564,7 @@ static int generic_ide_suspend(struct device *dev, pm_message_t mesg)
564 if (!(drive->dn % 2)) 564 if (!(drive->dn % 2))
565 ide_acpi_get_timing(hwif); 565 ide_acpi_get_timing(hwif);
566 566
567 memset(&rq, 0, sizeof(rq)); 567 blk_rq_init(NULL, &rq);
568 memset(&rqpm, 0, sizeof(rqpm)); 568 memset(&rqpm, 0, sizeof(rqpm));
569 memset(&args, 0, sizeof(args)); 569 memset(&args, 0, sizeof(args));
570 rq.cmd_type = REQ_TYPE_PM_SUSPEND; 570 rq.cmd_type = REQ_TYPE_PM_SUSPEND;
@@ -602,7 +602,7 @@ static int generic_ide_resume(struct device *dev)
602 602
603 ide_acpi_exec_tfs(drive); 603 ide_acpi_exec_tfs(drive);
604 604
605 memset(&rq, 0, sizeof(rq)); 605 blk_rq_init(NULL, &rq);
606 memset(&rqpm, 0, sizeof(rqpm)); 606 memset(&rqpm, 0, sizeof(rqpm));
607 memset(&args, 0, sizeof(args)); 607 memset(&args, 0, sizeof(args));
608 rq.cmd_type = REQ_TYPE_PM_RESUME; 608 rq.cmd_type = REQ_TYPE_PM_RESUME;
diff --git a/drivers/md/dm-emc.c b/drivers/md/dm-emc.c
index 6b91b9ab1d41..3ea5ad4b7805 100644
--- a/drivers/md/dm-emc.c
+++ b/drivers/md/dm-emc.c
@@ -110,8 +110,6 @@ static struct request *get_failover_req(struct emc_handler *h,
110 memset(rq->sense, 0, SCSI_SENSE_BUFFERSIZE); 110 memset(rq->sense, 0, SCSI_SENSE_BUFFERSIZE);
111 rq->sense_len = 0; 111 rq->sense_len = 0;
112 112
113 memset(&rq->cmd, 0, BLK_MAX_CDB);
114
115 rq->timeout = EMC_FAILOVER_TIMEOUT; 113 rq->timeout = EMC_FAILOVER_TIMEOUT;
116 rq->cmd_type = REQ_TYPE_BLOCK_PC; 114 rq->cmd_type = REQ_TYPE_BLOCK_PC;
117 rq->cmd_flags |= REQ_FAILFAST | REQ_NOMERGE; 115 rq->cmd_flags |= REQ_FAILFAST | REQ_NOMERGE;
diff --git a/drivers/md/dm-mpath-hp-sw.c b/drivers/md/dm-mpath-hp-sw.c
index 204bf42c9449..b63a0ab37c53 100644
--- a/drivers/md/dm-mpath-hp-sw.c
+++ b/drivers/md/dm-mpath-hp-sw.c
@@ -137,7 +137,6 @@ static struct request *hp_sw_get_request(struct dm_path *path)
137 req->sense = h->sense; 137 req->sense = h->sense;
138 memset(req->sense, 0, SCSI_SENSE_BUFFERSIZE); 138 memset(req->sense, 0, SCSI_SENSE_BUFFERSIZE);
139 139
140 memset(&req->cmd, 0, BLK_MAX_CDB);
141 req->cmd[0] = START_STOP; 140 req->cmd[0] = START_STOP;
142 req->cmd[4] = 1; 141 req->cmd[4] = 1;
143 req->cmd_len = COMMAND_SIZE(req->cmd[0]); 142 req->cmd_len = COMMAND_SIZE(req->cmd[0]);
diff --git a/drivers/md/dm-mpath-rdac.c b/drivers/md/dm-mpath-rdac.c
index e04eb5c697fb..95e77734880a 100644
--- a/drivers/md/dm-mpath-rdac.c
+++ b/drivers/md/dm-mpath-rdac.c
@@ -284,7 +284,6 @@ static struct request *get_rdac_req(struct rdac_handler *h,
284 return NULL; 284 return NULL;
285 } 285 }
286 286
287 memset(&rq->cmd, 0, BLK_MAX_CDB);
288 rq->sense = h->sense; 287 rq->sense = h->sense;
289 memset(rq->sense, 0, SCSI_SENSE_BUFFERSIZE); 288 memset(rq->sense, 0, SCSI_SENSE_BUFFERSIZE);
290 rq->sense_len = 0; 289 rq->sense_len = 0;
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 51be53344214..73326e7c54bf 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -873,10 +873,13 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q)
873 q->max_hw_sectors = t->limits.max_hw_sectors; 873 q->max_hw_sectors = t->limits.max_hw_sectors;
874 q->seg_boundary_mask = t->limits.seg_boundary_mask; 874 q->seg_boundary_mask = t->limits.seg_boundary_mask;
875 q->bounce_pfn = t->limits.bounce_pfn; 875 q->bounce_pfn = t->limits.bounce_pfn;
876 /* XXX: the below will probably go bug. must ensure there can be no
877 * concurrency on queue_flags, and use the unlocked versions...
878 */
876 if (t->limits.no_cluster) 879 if (t->limits.no_cluster)
877 q->queue_flags &= ~(1 << QUEUE_FLAG_CLUSTER); 880 queue_flag_clear(QUEUE_FLAG_CLUSTER, q);
878 else 881 else
879 q->queue_flags |= (1 << QUEUE_FLAG_CLUSTER); 882 queue_flag_set(QUEUE_FLAG_CLUSTER, q);
880 883
881} 884}
882 885
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 6fe4a769c854..bb3e4b1cb773 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -282,7 +282,8 @@ static mddev_t * mddev_find(dev_t unit)
282 kfree(new); 282 kfree(new);
283 return NULL; 283 return NULL;
284 } 284 }
285 set_bit(QUEUE_FLAG_CLUSTER, &new->queue->queue_flags); 285 /* Can be unlocked because the queue is new: no concurrency */
286 queue_flag_set_unlocked(QUEUE_FLAG_CLUSTER, new->queue);
286 287
287 blk_queue_make_request(new->queue, md_fail_request); 288 blk_queue_make_request(new->queue, md_fail_request);
288 289
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 07103c399fe0..f6600bfb5bde 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -1773,7 +1773,7 @@ static int scsi_debug_slave_alloc(struct scsi_device *sdp)
1773 if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts) 1773 if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
1774 printk(KERN_INFO "scsi_debug: slave_alloc <%u %u %u %u>\n", 1774 printk(KERN_INFO "scsi_debug: slave_alloc <%u %u %u %u>\n",
1775 sdp->host->host_no, sdp->channel, sdp->id, sdp->lun); 1775 sdp->host->host_no, sdp->channel, sdp->id, sdp->lun);
1776 set_bit(QUEUE_FLAG_BIDI, &sdp->request_queue->queue_flags); 1776 queue_flag_set_unlocked(QUEUE_FLAG_BIDI, sdp->request_queue);
1777 return 0; 1777 return 0;
1778} 1778}
1779 1779
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 221f31e36d26..1eaba6cd80f4 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1771,6 +1771,7 @@ scsi_reset_provider(struct scsi_device *dev, int flag)
1771 unsigned long flags; 1771 unsigned long flags;
1772 int rtn; 1772 int rtn;
1773 1773
1774 blk_rq_init(NULL, &req);
1774 scmd->request = &req; 1775 scmd->request = &req;
1775 memset(&scmd->eh_timeout, 0, sizeof(scmd->eh_timeout)); 1776 memset(&scmd->eh_timeout, 0, sizeof(scmd->eh_timeout));
1776 1777
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 67f412bb4974..d545ad1cf47a 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -536,6 +536,9 @@ static void scsi_run_queue(struct request_queue *q)
536 !shost->host_blocked && !shost->host_self_blocked && 536 !shost->host_blocked && !shost->host_self_blocked &&
537 !((shost->can_queue > 0) && 537 !((shost->can_queue > 0) &&
538 (shost->host_busy >= shost->can_queue))) { 538 (shost->host_busy >= shost->can_queue))) {
539
540 int flagset;
541
539 /* 542 /*
540 * As long as shost is accepting commands and we have 543 * As long as shost is accepting commands and we have
541 * starved queues, call blk_run_queue. scsi_request_fn 544 * starved queues, call blk_run_queue. scsi_request_fn
@@ -549,19 +552,20 @@ static void scsi_run_queue(struct request_queue *q)
549 sdev = list_entry(shost->starved_list.next, 552 sdev = list_entry(shost->starved_list.next,
550 struct scsi_device, starved_entry); 553 struct scsi_device, starved_entry);
551 list_del_init(&sdev->starved_entry); 554 list_del_init(&sdev->starved_entry);
552 spin_unlock_irqrestore(shost->host_lock, flags); 555 spin_unlock(shost->host_lock);
553 556
557 spin_lock(sdev->request_queue->queue_lock);
558 flagset = test_bit(QUEUE_FLAG_REENTER, &q->queue_flags) &&
559 !test_bit(QUEUE_FLAG_REENTER,
560 &sdev->request_queue->queue_flags);
561 if (flagset)
562 queue_flag_set(QUEUE_FLAG_REENTER, sdev->request_queue);
563 __blk_run_queue(sdev->request_queue);
564 if (flagset)
565 queue_flag_clear(QUEUE_FLAG_REENTER, sdev->request_queue);
566 spin_unlock(sdev->request_queue->queue_lock);
554 567
555 if (test_bit(QUEUE_FLAG_REENTER, &q->queue_flags) && 568 spin_lock(shost->host_lock);
556 !test_and_set_bit(QUEUE_FLAG_REENTER,
557 &sdev->request_queue->queue_flags)) {
558 blk_run_queue(sdev->request_queue);
559 clear_bit(QUEUE_FLAG_REENTER,
560 &sdev->request_queue->queue_flags);
561 } else
562 blk_run_queue(sdev->request_queue);
563
564 spin_lock_irqsave(shost->host_lock, flags);
565 if (unlikely(!list_empty(&sdev->starved_entry))) 569 if (unlikely(!list_empty(&sdev->starved_entry)))
566 /* 570 /*
567 * sdev lost a race, and was put back on the 571 * sdev lost a race, and was put back on the
@@ -1585,8 +1589,9 @@ struct request_queue *__scsi_alloc_queue(struct Scsi_Host *shost,
1585 1589
1586 blk_queue_max_segment_size(q, dma_get_max_seg_size(dev)); 1590 blk_queue_max_segment_size(q, dma_get_max_seg_size(dev));
1587 1591
1592 /* New queue, no concurrency on queue_flags */
1588 if (!shost->use_clustering) 1593 if (!shost->use_clustering)
1589 clear_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags); 1594 queue_flag_clear_unlocked(QUEUE_FLAG_CLUSTER, q);
1590 1595
1591 /* 1596 /*
1592 * set a reasonable default alignment on word boundaries: the 1597 * set a reasonable default alignment on word boundaries: the
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
index 7899e3dda9bf..f4461d35ffb9 100644
--- a/drivers/scsi/scsi_transport_sas.c
+++ b/drivers/scsi/scsi_transport_sas.c
@@ -248,8 +248,7 @@ static int sas_bsg_initialize(struct Scsi_Host *shost, struct sas_rphy *rphy)
248 else 248 else
249 q->queuedata = shost; 249 q->queuedata = shost;
250 250
251 set_bit(QUEUE_FLAG_BIDI, &q->queue_flags); 251 queue_flag_set_unlocked(QUEUE_FLAG_BIDI, q);
252
253 return 0; 252 return 0;
254} 253}
255 254
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 3cea17dd5dba..01cefbb2d539 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -860,7 +860,6 @@ static int sd_sync_cache(struct scsi_disk *sdkp)
860 860
861static void sd_prepare_flush(struct request_queue *q, struct request *rq) 861static void sd_prepare_flush(struct request_queue *q, struct request *rq)
862{ 862{
863 memset(rq->cmd, 0, sizeof(rq->cmd));
864 rq->cmd_type = REQ_TYPE_BLOCK_PC; 863 rq->cmd_type = REQ_TYPE_BLOCK_PC;
865 rq->timeout = SD_TIMEOUT; 864 rq->timeout = SD_TIMEOUT;
866 rq->cmd[0] = SYNCHRONIZE_CACHE; 865 rq->cmd[0] = SYNCHRONIZE_CACHE;