public inbox for linux-kernel@vger.kernel.org
 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@ftp.linux.org.uk, linux-kernel@vger.kernel.org,
	linux-ide@vger.kernel.org
Cc: Tejun Heo <tj@kernel.org>
Subject: [PATCH 07/13] block: move holder_dir from disk to part0
Date: Mon, 14 Jul 2008 16:48:07 +0900	[thread overview]
Message-ID: <1216021693-483-8-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1216021693-483-1-git-send-email-tj@kernel.org>

Move disk->holder_dir to part0->holder_dir.  Kill now mostly
superflous bdev_get_holder().

Signed-off-by: Tejun Heo <tj@kernel.org>
---
 fs/block_dev.c        |   10 +---------
 fs/partitions/check.c |   20 +++++++-------------
 include/linux/genhd.h |    1 -
 3 files changed, 8 insertions(+), 23 deletions(-)

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 4fd822d..a563e71 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -548,14 +548,6 @@ static struct kobject *bdev_get_kobj(struct block_device *bdev)
 		return kobject_get(&disk_to_dev(bdev->bd_disk)->kobj);
 }
 
-static struct kobject *bdev_get_holder(struct block_device *bdev)
-{
-	if (bdev->bd_contains != bdev)
-		return kobject_get(bdev->bd_part->holder_dir);
-	else
-		return kobject_get(bdev->bd_disk->holder_dir);
-}
-
 static int add_symlink(struct kobject *from, struct kobject *to)
 {
 	if (!from || !to)
@@ -608,7 +600,7 @@ static int bd_holder_grab_dirs(struct block_device *bdev,
 	if (!bo->sdev)
 		goto fail_put_hdev;
 
-	bo->hdir = bdev_get_holder(bdev);
+	bo->hdir = kobject_get(bdev->bd_part->holder_dir);
 	if (!bo->hdir)
 		goto fail_put_sdev;
 
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index bb969a0..e247b81 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -304,23 +304,17 @@ struct device_type part_type = {
 	.release	= part_release,
 };
 
-static inline void partition_sysfs_add_subdir(struct hd_struct *p)
+static inline void partition_sysfs_add_subdir(struct hd_struct *part)
 {
-	struct kobject *k;
-
-	k = kobject_get(&part_to_dev(p)->kobj);
-	p->holder_dir = kobject_create_and_add("holders", k);
-	kobject_put(k);
+	part->holder_dir = kobject_create_and_add("holders",
+						  &part_to_dev(part)->kobj);
 }
 
 static inline void disk_sysfs_add_subdirs(struct gendisk *disk)
 {
-	struct kobject *k;
-
-	k = kobject_get(&disk_to_dev(disk)->kobj);
-	disk->holder_dir = kobject_create_and_add("holders", k);
-	disk->slave_dir = kobject_create_and_add("slaves", k);
-	kobject_put(k);
+	partition_sysfs_add_subdir(&disk->part0);
+	disk->slave_dir = kobject_create_and_add("slaves",
+						 &disk_to_dev(disk)->kobj);
 }
 
 static void delete_partition_rcu_cb(struct rcu_head *head)
@@ -588,7 +582,7 @@ void del_gendisk(struct gendisk *disk)
 	disk_stat_set_all(disk, 0);
 	disk->stamp = 0;
 
-	kobject_put(disk->holder_dir);
+	kobject_put(disk->part0.holder_dir);
 	kobject_put(disk->slave_dir);
 	disk->driverfs_dev = NULL;
 #ifndef CONFIG_SYSFS_DEPRECATED
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 0edef09..bf3d7e3 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -142,7 +142,6 @@ struct gendisk {
 
 	int flags;
 	struct device *driverfs_dev;  // FIXME: remove
-	struct kobject *holder_dir;
 	struct kobject *slave_dir;
 
 	struct timer_rand_state *random;
-- 
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 ` [PATCH 03/13] block: move capacity from disk to part0 Tejun Heo
2008-07-14  7:48 ` [PATCH 04/13] block: move __dev " 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 ` Tejun Heo [this message]
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 07/13] block: move holder_dir 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-8-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-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=viro@ftp.linux.org.uk \
    /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