linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: jens.axboe@oracle.com, James.Bottomley@HansenPartnership.com,
	bharrosh@panasas.com, greg.freemyer@gmail.com,
	linux-scsi@vger.kernel.org, brking@linux.vnet.ibm.com,
	liml@rtr.ca, viro@f
Cc: Tejun Heo <tj@kernel.org>
Subject: [PATCH 03/13] block: move capacity from disk to part0
Date: Mon, 14 Jul 2008 16:48:03 +0900	[thread overview]
Message-ID: <1216021693-483-4-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1216021693-483-1-git-send-email-tj@kernel.org>

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>
---
 drivers/block/aoe/aoeblk.c |    2 +-
 drivers/block/aoe/aoecmd.c |    4 ++--
 drivers/block/aoe/aoedev.c |    2 +-
 fs/partitions/check.c      |    2 +-
 include/linux/genhd.h      |    5 ++---
 5 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
index 3edb6cb..aa69556 100644
--- a/drivers/block/aoe/aoeblk.c
+++ b/drivers/block/aoe/aoeblk.c
@@ -276,7 +276,7 @@ aoeblk_gdalloc(void *vp)
 	gd->first_minor = d->sysminor * AOE_PARTITIONS;
 	gd->fops = &aoe_bdops;
 	gd->private_data = d;
-	gd->capacity = d->ssize;
+	set_capacity(gd, d->ssize);
 	snprintf(gd->disk_name, sizeof gd->disk_name, "etherd/e%ld.%d",
 		d->aoemajor, d->aoeminor);
 
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 6710df3..b13e0b7 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -645,7 +645,7 @@ aoecmd_sleepwork(struct work_struct *work)
 		unsigned long flags;
 		u64 ssize;
 
-		ssize = d->gd->capacity;
+		ssize = get_capacity(d->gd);
 		bd = bdget_disk(d->gd, 0);
 
 		if (bd) {
@@ -707,7 +707,7 @@ ataid_complete(struct aoedev *d, struct aoetgt *t, unsigned char *id)
 	if (d->flags & (DEVFL_GDALLOC|DEVFL_NEWSIZE))
 		return;
 	if (d->gd != NULL) {
-		d->gd->capacity = ssize;
+		set_capacity(d->gd, ssize);
 		d->flags |= DEVFL_NEWSIZE;
 	} else
 		d->flags |= DEVFL_GDALLOC;
diff --git a/drivers/block/aoe/aoedev.c b/drivers/block/aoe/aoedev.c
index a1d813a..6a8038d 100644
--- a/drivers/block/aoe/aoedev.c
+++ b/drivers/block/aoe/aoedev.c
@@ -91,7 +91,7 @@ aoedev_downdev(struct aoedev *d)
 	}
 
 	if (d->gd)
-		d->gd->capacity = 0;
+		set_capacity(d->gd, 0);
 
 	d->flags &= ~DEVFL_UP;
 }
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index d4e677d..d504c1a 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -582,7 +582,7 @@ void del_gendisk(struct gendisk *disk)
 		delete_partition(disk, part->partno);
 	}
 	invalidate_partition(disk, 0);
-	disk->capacity = 0;
+	set_capacity(disk, 0);
 	disk->flags &= ~GENHD_FL_UP;
 	unlink_gendisk(disk);
 	disk_stat_set_all(disk, 0);
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 9018b11..0c15733 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -139,7 +139,6 @@ struct gendisk {
 	struct block_device_operations *fops;
 	struct request_queue *queue;
 	void *private_data;
-	sector_t capacity;
 
 	int flags;
 	struct device *driverfs_dev;  // FIXME: remove
@@ -397,11 +396,11 @@ static inline sector_t get_start_sect(struct block_device *bdev)
 }
 static inline sector_t get_capacity(struct gendisk *disk)
 {
-	return disk->capacity;
+	return disk->part0.nr_sects;
 }
 static inline void set_capacity(struct gendisk *disk, sector_t size)
 {
-	disk->capacity = size;
+	disk->part0.nr_sects = size;
 }
 
 #ifdef CONFIG_SOLARIS_X86_PARTITION
-- 
1.5.4.5


  parent reply	other threads:[~2008-07-14  7:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-14  7:48 [PATCHSET 2.6.26] block: unify disk/part handling and improve ext devt Tejun Heo
2008-07-14  7:48 ` [PATCH 01/13] block: implement and use {disk|part}_to_dev() Tejun Heo
2008-07-14  7:48 ` [PATCH 02/13] block: introduce partition 0 Tejun Heo
2008-07-14  7:48 ` Tejun Heo [this message]
2008-07-14  7:48 ` [PATCH 04/13] block: move __dev from disk to part0 Tejun Heo
2008-07-14  7:48 ` [PATCH 05/13] block: unify sysfs size node handling Tejun Heo
2008-07-14  7:48 ` [PATCH 06/13] block: move policy from disk to part0 Tejun Heo
2008-07-14  7:48 ` [PATCH 07/13] block: move holder_dir " Tejun Heo
2008-07-14  7:48 ` [PATCH 08/13] block: always set bdev->bd_part Tejun Heo
2008-07-14  7:48 ` [PATCH 09/13] block: kill GENHD_FL_FAIL and use part0->make_it_fail Tejun Heo
2008-07-14  7:48 ` [PATCH 10/13] block: move stats from disk to part0 Tejun Heo
2008-07-14  7:48 ` [PATCH 11/13] block: make partition array dynamic Tejun Heo
2008-07-14  7:48 ` [PATCH 12/13] block: replace @ext_minors with GENHD_FL_EXT_DEVT Tejun Heo
2008-07-14  7:48 ` [PATCH 13/13] block: allow disk to have extended device number Tejun Heo
  -- strict thread matches above, loose matches on Subject: below --
2008-08-25 10:56 [PATCHSET 3/3 blk-for-2.6.28] block: unify disk/part handling and improve ext devt, take #2 Tejun Heo
2008-08-25 10:56 ` [PATCH 03/13] block: move capacity from disk to part0 Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1216021693-483-4-git-send-email-tj@kernel.org \
    --to=tj@kernel.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=bharrosh@panasas.com \
    --cc=brking@linux.vnet.ibm.com \
    --cc=greg.freemyer@gmail.com \
    --cc=jens.axboe@oracle.com \
    --cc=liml@rtr.ca \
    --cc=linux-scsi@vger.kernel.org \
    --cc=viro@f \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).