aboutsummaryrefslogtreecommitdiffstats
path: root/fs/partitions/check.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/partitions/check.c')
-rw-r--r--fs/partitions/check.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index ac0df3acdcda..b60699c271ac 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -173,7 +173,7 @@ check_partition(struct gendisk *hd, struct block_device *bdev)
173 if (isdigit(state->name[strlen(state->name)-1])) 173 if (isdigit(state->name[strlen(state->name)-1]))
174 sprintf(state->name, "p"); 174 sprintf(state->name, "p");
175 175
176 state->limit = disk_max_parts(hd) + 1; 176 state->limit = disk_max_parts(hd);
177 i = res = err = 0; 177 i = res = err = 0;
178 while (!res && check_part[i]) { 178 while (!res && check_part[i]) {
179 memset(&state->parts, 0, sizeof(state->parts)); 179 memset(&state->parts, 0, sizeof(state->parts));
@@ -329,12 +329,12 @@ void delete_partition(struct gendisk *disk, int partno)
329{ 329{
330 struct hd_struct *part; 330 struct hd_struct *part;
331 331
332 part = disk->__part[partno-1]; 332 part = disk->__part[partno];
333 if (!part) 333 if (!part)
334 return; 334 return;
335 335
336 blk_free_devt(part_devt(part)); 336 blk_free_devt(part_devt(part));
337 rcu_assign_pointer(disk->__part[partno-1], NULL); 337 rcu_assign_pointer(disk->__part[partno], NULL);
338 kobject_put(part->holder_dir); 338 kobject_put(part->holder_dir);
339 device_del(part_to_dev(part)); 339 device_del(part_to_dev(part));
340 340
@@ -359,7 +359,7 @@ int add_partition(struct gendisk *disk, int partno,
359 const char *dname; 359 const char *dname;
360 int err; 360 int err;
361 361
362 if (disk->__part[partno - 1]) 362 if (disk->__part[partno])
363 return -EBUSY; 363 return -EBUSY;
364 364
365 p = kzalloc(sizeof(*p), GFP_KERNEL); 365 p = kzalloc(sizeof(*p), GFP_KERNEL);
@@ -413,7 +413,7 @@ int add_partition(struct gendisk *disk, int partno,
413 413
414 /* everything is up and running, commence */ 414 /* everything is up and running, commence */
415 INIT_RCU_HEAD(&p->rcu_head); 415 INIT_RCU_HEAD(&p->rcu_head);
416 rcu_assign_pointer(disk->__part[partno - 1], p); 416 rcu_assign_pointer(disk->__part[partno], p);
417 417
418 /* suppress uevent if the disk supresses it */ 418 /* suppress uevent if the disk supresses it */
419 if (!ddev->uevent_suppress) 419 if (!ddev->uevent_suppress)
@@ -467,7 +467,7 @@ void register_disk(struct gendisk *disk)
467 disk_sysfs_add_subdirs(disk); 467 disk_sysfs_add_subdirs(disk);
468 468
469 /* No minors to use for partitions */ 469 /* No minors to use for partitions */
470 if (!disk_max_parts(disk)) 470 if (!disk_partitionable(disk))
471 goto exit; 471 goto exit;
472 472
473 /* No such device (e.g., media were just removed) */ 473 /* No such device (e.g., media were just removed) */