diff options
Diffstat (limited to 'fs/partitions')
-rw-r--r-- | fs/partitions/check.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 7ef1f094de91..2ef313a96b66 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c | |||
@@ -329,6 +329,7 @@ void delete_partition(struct gendisk *disk, int part) | |||
329 | p->ios[0] = p->ios[1] = 0; | 329 | p->ios[0] = p->ios[1] = 0; |
330 | p->sectors[0] = p->sectors[1] = 0; | 330 | p->sectors[0] = p->sectors[1] = 0; |
331 | devfs_remove("%s/part%d", disk->devfs_name, part); | 331 | devfs_remove("%s/part%d", disk->devfs_name, part); |
332 | sysfs_remove_link(&p->kobj, "subsystem"); | ||
332 | if (p->holder_dir) | 333 | if (p->holder_dir) |
333 | kobject_unregister(p->holder_dir); | 334 | kobject_unregister(p->holder_dir); |
334 | kobject_uevent(&p->kobj, KOBJ_REMOVE); | 335 | kobject_uevent(&p->kobj, KOBJ_REMOVE); |
@@ -363,6 +364,7 @@ void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len) | |||
363 | kobject_add(&p->kobj); | 364 | kobject_add(&p->kobj); |
364 | if (!disk->part_uevent_suppress) | 365 | if (!disk->part_uevent_suppress) |
365 | kobject_uevent(&p->kobj, KOBJ_ADD); | 366 | kobject_uevent(&p->kobj, KOBJ_ADD); |
367 | sysfs_create_link(&p->kobj, &block_subsys.kset.kobj, "subsystem"); | ||
366 | partition_sysfs_add_subdir(p); | 368 | partition_sysfs_add_subdir(p); |
367 | disk->part[part-1] = p; | 369 | disk->part[part-1] = p; |
368 | } | 370 | } |
@@ -398,6 +400,7 @@ static void disk_sysfs_symlinks(struct gendisk *disk) | |||
398 | kfree(disk_name); | 400 | kfree(disk_name); |
399 | } | 401 | } |
400 | } | 402 | } |
403 | sysfs_create_link(&disk->kobj, &block_subsys.kset.kobj, "subsystem"); | ||
401 | } | 404 | } |
402 | 405 | ||
403 | /* Not exported, helper to add_disk(). */ | 406 | /* Not exported, helper to add_disk(). */ |
@@ -481,6 +484,10 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev) | |||
481 | sector_t from = state->parts[p].from; | 484 | sector_t from = state->parts[p].from; |
482 | if (!size) | 485 | if (!size) |
483 | continue; | 486 | continue; |
487 | if (from + size > get_capacity(disk)) { | ||
488 | printk(" %s: p%d exceeds device capacity\n", | ||
489 | disk->disk_name, p); | ||
490 | } | ||
484 | add_partition(disk, p, from, size); | 491 | add_partition(disk, p, from, size); |
485 | #ifdef CONFIG_BLK_DEV_MD | 492 | #ifdef CONFIG_BLK_DEV_MD |
486 | if (state->parts[p].flags) | 493 | if (state->parts[p].flags) |
@@ -496,8 +503,8 @@ unsigned char *read_dev_sector(struct block_device *bdev, sector_t n, Sector *p) | |||
496 | struct address_space *mapping = bdev->bd_inode->i_mapping; | 503 | struct address_space *mapping = bdev->bd_inode->i_mapping; |
497 | struct page *page; | 504 | struct page *page; |
498 | 505 | ||
499 | page = read_cache_page(mapping, (pgoff_t)(n >> (PAGE_CACHE_SHIFT-9)), | 506 | page = read_mapping_page(mapping, (pgoff_t)(n >> (PAGE_CACHE_SHIFT-9)), |
500 | (filler_t *)mapping->a_ops->readpage, NULL); | 507 | NULL); |
501 | if (!IS_ERR(page)) { | 508 | if (!IS_ERR(page)) { |
502 | wait_on_page_locked(page); | 509 | wait_on_page_locked(page); |
503 | if (!PageUptodate(page)) | 510 | if (!PageUptodate(page)) |
@@ -548,5 +555,6 @@ void del_gendisk(struct gendisk *disk) | |||
548 | put_device(disk->driverfs_dev); | 555 | put_device(disk->driverfs_dev); |
549 | disk->driverfs_dev = NULL; | 556 | disk->driverfs_dev = NULL; |
550 | } | 557 | } |
558 | sysfs_remove_link(&disk->kobj, "subsystem"); | ||
551 | kobject_del(&disk->kobj); | 559 | kobject_del(&disk->kobj); |
552 | } | 560 | } |