diff options
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/ide-atapi.c | 3 | ||||
-rw-r--r-- | drivers/ide/ide-cd.c | 23 | ||||
-rw-r--r-- | drivers/ide/ide-cd.h | 3 | ||||
-rw-r--r-- | drivers/ide/ide-cd_ioctl.c | 8 | ||||
-rw-r--r-- | drivers/ide/ide-gd.c | 14 | ||||
-rw-r--r-- | drivers/ide/ide-io.c | 4 | ||||
-rw-r--r-- | drivers/ide/ide-park.c | 2 |
7 files changed, 24 insertions, 33 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index e88a2cf17711..6f218e014e99 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c | |||
@@ -233,8 +233,7 @@ int ide_queue_sense_rq(ide_drive_t *drive, void *special) | |||
233 | 233 | ||
234 | drive->hwif->rq = NULL; | 234 | drive->hwif->rq = NULL; |
235 | 235 | ||
236 | elv_add_request(drive->queue, &drive->sense_rq, | 236 | elv_add_request(drive->queue, &drive->sense_rq, ELEVATOR_INSERT_FRONT); |
237 | ELEVATOR_INSERT_FRONT, 0); | ||
238 | return 0; | 237 | return 0; |
239 | } | 238 | } |
240 | EXPORT_SYMBOL_GPL(ide_queue_sense_rq); | 239 | EXPORT_SYMBOL_GPL(ide_queue_sense_rq); |
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 0c73fe39a236..fd1e11799137 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -258,17 +258,10 @@ static int ide_cd_breathe(ide_drive_t *drive, struct request *rq) | |||
258 | if (time_after(jiffies, info->write_timeout)) | 258 | if (time_after(jiffies, info->write_timeout)) |
259 | return 0; | 259 | return 0; |
260 | else { | 260 | else { |
261 | struct request_queue *q = drive->queue; | ||
262 | unsigned long flags; | ||
263 | |||
264 | /* | 261 | /* |
265 | * take a breather relying on the unplug timer to kick us again | 262 | * take a breather |
266 | */ | 263 | */ |
267 | 264 | blk_delay_queue(drive->queue, 1); | |
268 | spin_lock_irqsave(q->queue_lock, flags); | ||
269 | blk_plug_device(q); | ||
270 | spin_unlock_irqrestore(q->queue_lock, flags); | ||
271 | |||
272 | return 1; | 265 | return 1; |
273 | } | 266 | } |
274 | } | 267 | } |
@@ -1177,7 +1170,7 @@ static struct cdrom_device_ops ide_cdrom_dops = { | |||
1177 | .open = ide_cdrom_open_real, | 1170 | .open = ide_cdrom_open_real, |
1178 | .release = ide_cdrom_release_real, | 1171 | .release = ide_cdrom_release_real, |
1179 | .drive_status = ide_cdrom_drive_status, | 1172 | .drive_status = ide_cdrom_drive_status, |
1180 | .media_changed = ide_cdrom_check_media_change_real, | 1173 | .check_events = ide_cdrom_check_events_real, |
1181 | .tray_move = ide_cdrom_tray_move, | 1174 | .tray_move = ide_cdrom_tray_move, |
1182 | .lock_door = ide_cdrom_lock_door, | 1175 | .lock_door = ide_cdrom_lock_door, |
1183 | .select_speed = ide_cdrom_select_speed, | 1176 | .select_speed = ide_cdrom_select_speed, |
@@ -1514,8 +1507,6 @@ static int ide_cdrom_setup(ide_drive_t *drive) | |||
1514 | blk_queue_dma_alignment(q, 31); | 1507 | blk_queue_dma_alignment(q, 31); |
1515 | blk_queue_update_dma_pad(q, 15); | 1508 | blk_queue_update_dma_pad(q, 15); |
1516 | 1509 | ||
1517 | q->unplug_delay = max((1 * HZ) / 1000, 1); | ||
1518 | |||
1519 | drive->dev_flags |= IDE_DFLAG_MEDIA_CHANGED; | 1510 | drive->dev_flags |= IDE_DFLAG_MEDIA_CHANGED; |
1520 | drive->atapi_flags = IDE_AFLAG_NO_EJECT | ide_cd_flags(id); | 1511 | drive->atapi_flags = IDE_AFLAG_NO_EJECT | ide_cd_flags(id); |
1521 | 1512 | ||
@@ -1702,10 +1693,11 @@ static int idecd_ioctl(struct block_device *bdev, fmode_t mode, | |||
1702 | } | 1693 | } |
1703 | 1694 | ||
1704 | 1695 | ||
1705 | static int idecd_media_changed(struct gendisk *disk) | 1696 | static unsigned int idecd_check_events(struct gendisk *disk, |
1697 | unsigned int clearing) | ||
1706 | { | 1698 | { |
1707 | struct cdrom_info *info = ide_drv_g(disk, cdrom_info); | 1699 | struct cdrom_info *info = ide_drv_g(disk, cdrom_info); |
1708 | return cdrom_media_changed(&info->devinfo); | 1700 | return cdrom_check_events(&info->devinfo, clearing); |
1709 | } | 1701 | } |
1710 | 1702 | ||
1711 | static int idecd_revalidate_disk(struct gendisk *disk) | 1703 | static int idecd_revalidate_disk(struct gendisk *disk) |
@@ -1723,7 +1715,7 @@ static const struct block_device_operations idecd_ops = { | |||
1723 | .open = idecd_open, | 1715 | .open = idecd_open, |
1724 | .release = idecd_release, | 1716 | .release = idecd_release, |
1725 | .ioctl = idecd_ioctl, | 1717 | .ioctl = idecd_ioctl, |
1726 | .media_changed = idecd_media_changed, | 1718 | .check_events = idecd_check_events, |
1727 | .revalidate_disk = idecd_revalidate_disk | 1719 | .revalidate_disk = idecd_revalidate_disk |
1728 | }; | 1720 | }; |
1729 | 1721 | ||
@@ -1790,6 +1782,7 @@ static int ide_cd_probe(ide_drive_t *drive) | |||
1790 | ide_cd_read_toc(drive, &sense); | 1782 | ide_cd_read_toc(drive, &sense); |
1791 | g->fops = &idecd_ops; | 1783 | g->fops = &idecd_ops; |
1792 | g->flags |= GENHD_FL_REMOVABLE; | 1784 | g->flags |= GENHD_FL_REMOVABLE; |
1785 | g->events = DISK_EVENT_MEDIA_CHANGE; | ||
1793 | add_disk(g); | 1786 | add_disk(g); |
1794 | return 0; | 1787 | return 0; |
1795 | 1788 | ||
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h index 93a3cf1b0f3f..1efc936f5b66 100644 --- a/drivers/ide/ide-cd.h +++ b/drivers/ide/ide-cd.h | |||
@@ -111,7 +111,8 @@ int cdrom_check_status(ide_drive_t *, struct request_sense *); | |||
111 | int ide_cdrom_open_real(struct cdrom_device_info *, int); | 111 | int ide_cdrom_open_real(struct cdrom_device_info *, int); |
112 | void ide_cdrom_release_real(struct cdrom_device_info *); | 112 | void ide_cdrom_release_real(struct cdrom_device_info *); |
113 | int ide_cdrom_drive_status(struct cdrom_device_info *, int); | 113 | int ide_cdrom_drive_status(struct cdrom_device_info *, int); |
114 | int ide_cdrom_check_media_change_real(struct cdrom_device_info *, int); | 114 | unsigned int ide_cdrom_check_events_real(struct cdrom_device_info *, |
115 | unsigned int clearing, int slot_nr); | ||
115 | int ide_cdrom_tray_move(struct cdrom_device_info *, int); | 116 | int ide_cdrom_tray_move(struct cdrom_device_info *, int); |
116 | int ide_cdrom_lock_door(struct cdrom_device_info *, int); | 117 | int ide_cdrom_lock_door(struct cdrom_device_info *, int); |
117 | int ide_cdrom_select_speed(struct cdrom_device_info *, int); | 118 | int ide_cdrom_select_speed(struct cdrom_device_info *, int); |
diff --git a/drivers/ide/ide-cd_ioctl.c b/drivers/ide/ide-cd_ioctl.c index 766b3deeb23c..2a6bc50e8a41 100644 --- a/drivers/ide/ide-cd_ioctl.c +++ b/drivers/ide/ide-cd_ioctl.c | |||
@@ -79,8 +79,8 @@ int ide_cdrom_drive_status(struct cdrom_device_info *cdi, int slot_nr) | |||
79 | return CDS_DRIVE_NOT_READY; | 79 | return CDS_DRIVE_NOT_READY; |
80 | } | 80 | } |
81 | 81 | ||
82 | int ide_cdrom_check_media_change_real(struct cdrom_device_info *cdi, | 82 | unsigned int ide_cdrom_check_events_real(struct cdrom_device_info *cdi, |
83 | int slot_nr) | 83 | unsigned int clearing, int slot_nr) |
84 | { | 84 | { |
85 | ide_drive_t *drive = cdi->handle; | 85 | ide_drive_t *drive = cdi->handle; |
86 | int retval; | 86 | int retval; |
@@ -89,9 +89,9 @@ int ide_cdrom_check_media_change_real(struct cdrom_device_info *cdi, | |||
89 | (void) cdrom_check_status(drive, NULL); | 89 | (void) cdrom_check_status(drive, NULL); |
90 | retval = (drive->dev_flags & IDE_DFLAG_MEDIA_CHANGED) ? 1 : 0; | 90 | retval = (drive->dev_flags & IDE_DFLAG_MEDIA_CHANGED) ? 1 : 0; |
91 | drive->dev_flags &= ~IDE_DFLAG_MEDIA_CHANGED; | 91 | drive->dev_flags &= ~IDE_DFLAG_MEDIA_CHANGED; |
92 | return retval; | 92 | return retval ? DISK_EVENT_MEDIA_CHANGE : 0; |
93 | } else { | 93 | } else { |
94 | return -EINVAL; | 94 | return 0; |
95 | } | 95 | } |
96 | } | 96 | } |
97 | 97 | ||
diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c index 35c4b43585e3..c4ffd4888939 100644 --- a/drivers/ide/ide-gd.c +++ b/drivers/ide/ide-gd.c | |||
@@ -285,11 +285,12 @@ static int ide_gd_getgeo(struct block_device *bdev, struct hd_geometry *geo) | |||
285 | return 0; | 285 | return 0; |
286 | } | 286 | } |
287 | 287 | ||
288 | static int ide_gd_media_changed(struct gendisk *disk) | 288 | static unsigned int ide_gd_check_events(struct gendisk *disk, |
289 | unsigned int clearing) | ||
289 | { | 290 | { |
290 | struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); | 291 | struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); |
291 | ide_drive_t *drive = idkp->drive; | 292 | ide_drive_t *drive = idkp->drive; |
292 | int ret; | 293 | bool ret; |
293 | 294 | ||
294 | /* do not scan partitions twice if this is a removable device */ | 295 | /* do not scan partitions twice if this is a removable device */ |
295 | if (drive->dev_flags & IDE_DFLAG_ATTACH) { | 296 | if (drive->dev_flags & IDE_DFLAG_ATTACH) { |
@@ -297,10 +298,10 @@ static int ide_gd_media_changed(struct gendisk *disk) | |||
297 | return 0; | 298 | return 0; |
298 | } | 299 | } |
299 | 300 | ||
300 | ret = !!(drive->dev_flags & IDE_DFLAG_MEDIA_CHANGED); | 301 | ret = drive->dev_flags & IDE_DFLAG_MEDIA_CHANGED; |
301 | drive->dev_flags &= ~IDE_DFLAG_MEDIA_CHANGED; | 302 | drive->dev_flags &= ~IDE_DFLAG_MEDIA_CHANGED; |
302 | 303 | ||
303 | return ret; | 304 | return ret ? DISK_EVENT_MEDIA_CHANGE : 0; |
304 | } | 305 | } |
305 | 306 | ||
306 | static void ide_gd_unlock_native_capacity(struct gendisk *disk) | 307 | static void ide_gd_unlock_native_capacity(struct gendisk *disk) |
@@ -318,7 +319,7 @@ static int ide_gd_revalidate_disk(struct gendisk *disk) | |||
318 | struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); | 319 | struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); |
319 | ide_drive_t *drive = idkp->drive; | 320 | ide_drive_t *drive = idkp->drive; |
320 | 321 | ||
321 | if (ide_gd_media_changed(disk)) | 322 | if (ide_gd_check_events(disk, 0)) |
322 | drive->disk_ops->get_capacity(drive); | 323 | drive->disk_ops->get_capacity(drive); |
323 | 324 | ||
324 | set_capacity(disk, ide_gd_capacity(drive)); | 325 | set_capacity(disk, ide_gd_capacity(drive)); |
@@ -340,7 +341,7 @@ static const struct block_device_operations ide_gd_ops = { | |||
340 | .release = ide_gd_release, | 341 | .release = ide_gd_release, |
341 | .ioctl = ide_gd_ioctl, | 342 | .ioctl = ide_gd_ioctl, |
342 | .getgeo = ide_gd_getgeo, | 343 | .getgeo = ide_gd_getgeo, |
343 | .media_changed = ide_gd_media_changed, | 344 | .check_events = ide_gd_check_events, |
344 | .unlock_native_capacity = ide_gd_unlock_native_capacity, | 345 | .unlock_native_capacity = ide_gd_unlock_native_capacity, |
345 | .revalidate_disk = ide_gd_revalidate_disk | 346 | .revalidate_disk = ide_gd_revalidate_disk |
346 | }; | 347 | }; |
@@ -412,6 +413,7 @@ static int ide_gd_probe(ide_drive_t *drive) | |||
412 | if (drive->dev_flags & IDE_DFLAG_REMOVABLE) | 413 | if (drive->dev_flags & IDE_DFLAG_REMOVABLE) |
413 | g->flags = GENHD_FL_REMOVABLE; | 414 | g->flags = GENHD_FL_REMOVABLE; |
414 | g->fops = &ide_gd_ops; | 415 | g->fops = &ide_gd_ops; |
416 | g->events = DISK_EVENT_MEDIA_CHANGE; | ||
415 | add_disk(g); | 417 | add_disk(g); |
416 | return 0; | 418 | return 0; |
417 | 419 | ||
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 999dac054bcc..f4077840d3ab 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -549,8 +549,6 @@ plug_device_2: | |||
549 | 549 | ||
550 | if (rq) | 550 | if (rq) |
551 | blk_requeue_request(q, rq); | 551 | blk_requeue_request(q, rq); |
552 | if (!elv_queue_empty(q)) | ||
553 | blk_plug_device(q); | ||
554 | } | 552 | } |
555 | 553 | ||
556 | void ide_requeue_and_plug(ide_drive_t *drive, struct request *rq) | 554 | void ide_requeue_and_plug(ide_drive_t *drive, struct request *rq) |
@@ -562,8 +560,6 @@ void ide_requeue_and_plug(ide_drive_t *drive, struct request *rq) | |||
562 | 560 | ||
563 | if (rq) | 561 | if (rq) |
564 | blk_requeue_request(q, rq); | 562 | blk_requeue_request(q, rq); |
565 | if (!elv_queue_empty(q)) | ||
566 | blk_plug_device(q); | ||
567 | 563 | ||
568 | spin_unlock_irqrestore(q->queue_lock, flags); | 564 | spin_unlock_irqrestore(q->queue_lock, flags); |
569 | } | 565 | } |
diff --git a/drivers/ide/ide-park.c b/drivers/ide/ide-park.c index 88a380c5a470..6ab9ab2a5081 100644 --- a/drivers/ide/ide-park.c +++ b/drivers/ide/ide-park.c | |||
@@ -52,7 +52,7 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout) | |||
52 | rq->cmd[0] = REQ_UNPARK_HEADS; | 52 | rq->cmd[0] = REQ_UNPARK_HEADS; |
53 | rq->cmd_len = 1; | 53 | rq->cmd_len = 1; |
54 | rq->cmd_type = REQ_TYPE_SPECIAL; | 54 | rq->cmd_type = REQ_TYPE_SPECIAL; |
55 | elv_add_request(q, rq, ELEVATOR_INSERT_FRONT, 1); | 55 | elv_add_request(q, rq, ELEVATOR_INSERT_FRONT); |
56 | 56 | ||
57 | out: | 57 | out: |
58 | return; | 58 | return; |