All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miao Xie <miaox@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>
Subject: [PATCH 1/5] block: export disk_class and disk_type for btrfs
Date: Wed, 3 Sep 2014 21:36:29 +0800	[thread overview]
Message-ID: <1409751393-5403-2-git-send-email-miaox@cn.fujitsu.com> (raw)
In-Reply-To: <1409751393-5403-1-git-send-email-miaox@cn.fujitsu.com>

Btrfs can make filesystem cross several disks/partitions, in order to
load all the disks/partitions which belong to the same filesystem, we
need scan the system and find all the devices, and then register them
into the kernel. Currently, we do it by user tool. But if we forget to
do it, we can not mount the filesystem. So I want btrfs scan the system
and find all the devices by itself in the kernel. In order to implement
it, we need disk_class and disk_type, so export them.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
---
 block/genhd.c         | 7 +++++--
 include/linux/genhd.h | 1 +
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index 791f419..8371c09 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -34,7 +34,7 @@ struct kobject *block_depr;
 static DEFINE_MUTEX(ext_devt_mutex);
 static DEFINE_IDR(ext_devt_idr);
 
-static struct device_type disk_type;
+struct device_type disk_type;
 
 static void disk_check_events(struct disk_events *ev,
 			      unsigned int *clearing_ptr);
@@ -1107,9 +1107,11 @@ static void disk_release(struct device *dev)
 		blk_put_queue(disk->queue);
 	kfree(disk);
 }
+
 struct class block_class = {
 	.name		= "block",
 };
+EXPORT_SYMBOL(block_class);
 
 static char *block_devnode(struct device *dev, umode_t *mode,
 			   kuid_t *uid, kgid_t *gid)
@@ -1121,12 +1123,13 @@ static char *block_devnode(struct device *dev, umode_t *mode,
 	return NULL;
 }
 
-static struct device_type disk_type = {
+struct device_type disk_type = {
 	.name		= "disk",
 	.groups		= disk_attr_groups,
 	.release	= disk_release,
 	.devnode	= block_devnode,
 };
+EXPORT_SYMBOL(disk_type);
 
 #ifdef CONFIG_PROC_FS
 /*
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index ec274e0..a701ace 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -22,6 +22,7 @@
 #define part_to_dev(part)	(&((part)->__dev))
 
 extern struct device_type part_type;
+extern struct device_type disk_type;
 extern struct kobject *block_depr;
 extern struct class block_class;
 
-- 
1.9.3


  reply	other threads:[~2014-09-03 13:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-03 13:36 [PATCH RFC 0/5] Scan all devices to build fs device list Miao Xie
2014-09-03 13:36 ` Miao Xie [this message]
2014-09-03 13:36 ` [PATCH 2/5] Btrfs: don't return btrfs_fs_devices if the caller doesn't want it Miao Xie
2014-09-03 13:36 ` [PATCH 3/5] Btrfs: restructure btrfs_scan_one_device Miao Xie
2014-09-03 13:36 ` [PATCH 4/5] Btrfs: restructure btrfs_get_bdev_and_sb and pick up some code used later Miao Xie
2014-09-03 13:36 ` [PATCH 5/5] Btrfs: scan all the devices and build the fs device list by btrfs's self Miao Xie
2014-09-06 11:48   ` Goffredo Baroncelli
2014-09-09  4:06     ` Miao Xie
2014-09-06 20:05 ` [PATCH RFC 0/5] Scan all devices to build fs device list Chris Mason
2014-09-08  9:09   ` David Sterba
2014-09-08 11:04     ` Anand Jain
2014-09-08 17:15       ` Goffredo Baroncelli
2014-09-09  3:26         ` Anand Jain
2014-09-09 20:31           ` Goffredo Baroncelli
2014-09-10  6:06             ` Anand Jain
2014-09-08 16:59     ` Goffredo Baroncelli

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=1409751393-5403-2-git-send-email-miaox@cn.fujitsu.com \
    --to=miaox@cn.fujitsu.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.