diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-24 13:16:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-24 13:16:26 -0400 |
commit | 6c5103890057b1bb781b26b7aae38d33e4c517d8 (patch) | |
tree | e6e57961dcddcb5841acb34956e70b9dc696a880 /drivers/ide/ide-gd.c | |
parent | 3dab04e6978e358ad2307bca563fabd6c5d2c58b (diff) | |
parent | 9d2e157d970a73b3f270b631828e03eb452d525e (diff) |
Merge branch 'for-2.6.39/core' of git://git.kernel.dk/linux-2.6-block
* 'for-2.6.39/core' of git://git.kernel.dk/linux-2.6-block: (65 commits)
Documentation/iostats.txt: bit-size reference etc.
cfq-iosched: removing unnecessary think time checking
cfq-iosched: Don't clear queue stats when preempt.
blk-throttle: Reset group slice when limits are changed
blk-cgroup: Only give unaccounted_time under debug
cfq-iosched: Don't set active queue in preempt
block: fix non-atomic access to genhd inflight structures
block: attempt to merge with existing requests on plug flush
block: NULL dereference on error path in __blkdev_get()
cfq-iosched: Don't update group weights when on service tree
fs: assign sb->s_bdi to default_backing_dev_info if the bdi is going away
block: Require subsystems to explicitly allocate bio_set integrity mempool
jbd2: finish conversion from WRITE_SYNC_PLUG to WRITE_SYNC and explicit plugging
jbd: finish conversion from WRITE_SYNC_PLUG to WRITE_SYNC and explicit plugging
fs: make fsync_buffers_list() plug
mm: make generic_writepages() use plugging
blk-cgroup: Add unaccounted time to timeslice_used.
block: fixup plugging stubs for !CONFIG_BLOCK
block: remove obsolete comments for blkdev_issue_zeroout.
blktrace: Use rq->cmd_flags directly in blk_add_trace_rq.
...
Fix up conflicts in fs/{aio.c,super.c}
Diffstat (limited to 'drivers/ide/ide-gd.c')
-rw-r--r-- | drivers/ide/ide-gd.c | 14 |
1 files changed, 8 insertions, 6 deletions
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 | ||