aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2008-08-25 06:56:07 -0400
committerJens Axboe <jens.axboe@oracle.com>2008-10-09 02:56:07 -0400
commit80795aefb76d10c5d698e60c7e7750b5330787da (patch)
treef22a55483cb2fe77580ee1507c1124bc73b93c3d
parentb5d0b9df0ba5d9a044f3a21e7544f53d90bd1465 (diff)
block: move capacity from disk to part0
Move disk->capacity to part0->nr_sects and convert all users who directly accessed the field to use {get|set}_capacity(). This is done early to allow the __dev field to be moved. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r--drivers/block/aoe/aoeblk.c2
-rw-r--r--drivers/block/aoe/aoecmd.c4
-rw-r--r--drivers/block/aoe/aoedev.c2
-rw-r--r--fs/partitions/check.c2
-rw-r--r--include/linux/genhd.h5
5 files changed, 7 insertions, 8 deletions
diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
index 3edb6cb7d68f..aa69556c3485 100644
--- a/drivers/block/aoe/aoeblk.c
+++ b/drivers/block/aoe/aoeblk.c
@@ -276,7 +276,7 @@ aoeblk_gdalloc(void *vp)
276 gd->first_minor = d->sysminor * AOE_PARTITIONS; 276 gd->first_minor = d->sysminor * AOE_PARTITIONS;
277 gd->fops = &aoe_bdops; 277 gd->fops = &aoe_bdops;
278 gd->private_data = d; 278 gd->private_data = d;
279 gd->capacity = d->ssize; 279 set_capacity(gd, d->ssize);
280 snprintf(gd->disk_name, sizeof gd->disk_name, "etherd/e%ld.%d", 280 snprintf(gd->disk_name, sizeof gd->disk_name, "etherd/e%ld.%d",
281 d->aoemajor, d->aoeminor); 281 d->aoemajor, d->aoeminor);
282 282
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 17eed8c025d0..934800f979c9 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -645,7 +645,7 @@ aoecmd_sleepwork(struct work_struct *work)
645 unsigned long flags; 645 unsigned long flags;
646 u64 ssize; 646 u64 ssize;
647 647
648 ssize = d->gd->capacity; 648 ssize = get_capacity(d->gd);
649 bd = bdget_disk(d->gd, 0); 649 bd = bdget_disk(d->gd, 0);
650 650
651 if (bd) { 651 if (bd) {
@@ -707,7 +707,7 @@ ataid_complete(struct aoedev *d, struct aoetgt *t, unsigned char *id)
707 if (d->flags & (DEVFL_GDALLOC|DEVFL_NEWSIZE)) 707 if (d->flags & (DEVFL_GDALLOC|DEVFL_NEWSIZE))
708 return; 708 return;
709 if (d->gd != NULL) { 709 if (d->gd != NULL) {
710 d->gd->capacity = ssize; 710 set_capacity(d->gd, ssize);
711 d->flags |= DEVFL_NEWSIZE; 711 d->flags |= DEVFL_NEWSIZE;
712 } else 712 } else
713 d->flags |= DEVFL_GDALLOC; 713 d->flags |= DEVFL_GDALLOC;
diff --git a/drivers/block/aoe/aoedev.c b/drivers/block/aoe/aoedev.c
index a1d813ab0d6b..6a8038d115b5 100644
--- a/drivers/block/aoe/aoedev.c
+++ b/drivers/block/aoe/aoedev.c
@@ -91,7 +91,7 @@ aoedev_downdev(struct aoedev *d)
91 } 91 }
92 92
93 if (d->gd) 93 if (d->gd)
94 d->gd->capacity = 0; 94 set_capacity(d->gd, 0);
95 95
96 d->flags &= ~DEVFL_UP; 96 d->flags &= ~DEVFL_UP;
97} 97}
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index b60699c271ac..902b95f1f9d5 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -586,7 +586,7 @@ void del_gendisk(struct gendisk *disk)
586 disk_part_iter_exit(&piter); 586 disk_part_iter_exit(&piter);
587 587
588 invalidate_partition(disk, 0); 588 invalidate_partition(disk, 0);
589 disk->capacity = 0; 589 set_capacity(disk, 0);
590 disk->flags &= ~GENHD_FL_UP; 590 disk->flags &= ~GENHD_FL_UP;
591 unlink_gendisk(disk); 591 unlink_gendisk(disk);
592 disk_stat_set_all(disk, 0); 592 disk_stat_set_all(disk, 0);
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 9e866a2aee50..1cf828148ec6 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -138,7 +138,6 @@ struct gendisk {
138 struct block_device_operations *fops; 138 struct block_device_operations *fops;
139 struct request_queue *queue; 139 struct request_queue *queue;
140 void *private_data; 140 void *private_data;
141 sector_t capacity;
142 141
143 int flags; 142 int flags;
144 struct device *driverfs_dev; // FIXME: remove 143 struct device *driverfs_dev; // FIXME: remove
@@ -411,11 +410,11 @@ static inline sector_t get_start_sect(struct block_device *bdev)
411} 410}
412static inline sector_t get_capacity(struct gendisk *disk) 411static inline sector_t get_capacity(struct gendisk *disk)
413{ 412{
414 return disk->capacity; 413 return disk->part0.nr_sects;
415} 414}
416static inline void set_capacity(struct gendisk *disk, sector_t size) 415static inline void set_capacity(struct gendisk *disk, sector_t size)
417{ 416{
418 disk->capacity = size; 417 disk->part0.nr_sects = size;
419} 418}
420 419
421#ifdef CONFIG_SOLARIS_X86_PARTITION 420#ifdef CONFIG_SOLARIS_X86_PARTITION