All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	linux-nvme@lists.infradead.org,
	virtualization@lists.linux-foundation.org,
	Keith Busch <keith.busch@intel.com>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Christoph Hellwig <hch@infradead.org>,
	Shaohua Li <shli@kernel.org>, Nitin Gupta <ngupta@vflare.org>,
	famz@redhat.com, Jiri Kosina <jikos@kernel.org>,
	linux-block@vger.kernel.org, "Ed L. Cashin" <ed.cashin@acm.org>,
	Jens Axboe <axboe@kernel.dk>,
	linux-raid@vger.kernel.org, David Woodhouse <dwmw2@infradead.org>,
	linux-mmc@vger.kernel.org, Minchan Kim <minchan@kernel.org>,
	linux-mtd@lists.infradead.org,
	Brian Norris <computersforpeace@gmail.com>,
	linuxppc-dev@lists.ozlabs.org
Subject: [PATCH v2 02/12] genhd: Honor gen_uevent and add disk_gen_uevents
Date: Thu, 30 Jun 2016 09:59:43 +0800	[thread overview]
Message-ID: <20160630015953.6888-3-famz@redhat.com> (raw)
In-Reply-To: <20160630015953.6888-1-famz@redhat.com>

In add_disk(), don't send uevent to userspace when gen_uevent is true;
also export the refactored function disk_gen_uevents for later use.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 block/genhd.c         | 23 +++++++++++++++++++----
 include/linux/genhd.h |  1 +
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index 8e1bfa1..9b66953 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -506,12 +506,10 @@ static int exact_lock(dev_t devt, void *data)
 	return 0;
 }
 
-static void register_disk(struct gendisk *disk)
+static void register_disk(struct gendisk *disk, bool gen_uevent)
 {
 	struct device *ddev = disk_to_dev(disk);
 	struct block_device *bdev;
-	struct disk_part_iter piter;
-	struct hd_struct *part;
 	int err;
 
 	ddev->parent = disk->driverfs_dev;
@@ -563,6 +561,22 @@ static void register_disk(struct gendisk *disk)
 exit:
 	/* announce disk after possible partitions are created */
 	dev_set_uevent_suppress(ddev, 0);
+	if (gen_uevent)
+		disk_gen_uevents(disk);
+}
+
+/**
+ * disk_gen_uevents
+ * @disk - the disk to generate uevent
+ *
+ * Generate KOBJ_ADD uevents on the disk and partitions.
+ */
+void disk_gen_uevents(struct gendisk *disk)
+{
+	struct device *ddev = disk_to_dev(disk);
+	struct disk_part_iter piter;
+	struct hd_struct *part;
+
 	kobject_uevent(&ddev->kobj, KOBJ_ADD);
 
 	/* announce possible partitions */
@@ -571,6 +585,7 @@ exit:
 		kobject_uevent(&part_to_dev(part)->kobj, KOBJ_ADD);
 	disk_part_iter_exit(&piter);
 }
+EXPORT_SYMBOL(disk_gen_uevents);
 
 /**
  * add_disk - add partitioning information to kernel list
@@ -618,7 +633,7 @@ void add_disk(struct gendisk *disk, bool gen_uevent)
 
 	blk_register_region(disk_devt(disk), disk->minors, NULL,
 			    exact_match, exact_lock, disk);
-	register_disk(disk);
+	register_disk(disk, gen_uevent);
 	blk_register_queue(disk);
 
 	/*
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 038be80..87ad9e5 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -416,6 +416,7 @@ extern void part_round_stats(int cpu, struct hd_struct *part);
 /* block/genhd.c */
 extern void add_disk(struct gendisk *disk, bool gen_uevent);
 extern void del_gendisk(struct gendisk *gp);
+extern void disk_gen_uevents(struct gendisk *disk);
 extern struct gendisk *get_gendisk(dev_t dev, int *partno);
 extern struct block_device *bdget_disk(struct gendisk *disk, int partno);
 
-- 
2.9.0

WARNING: multiple messages have this Message-ID (diff)
From: Fam Zheng <famz@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Jens Axboe <axboe@kernel.dk>, "Ed L. Cashin" <ed.cashin@acm.org>,
	Jiri Kosina <jikos@kernel.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Minchan Kim <minchan@kernel.org>, Nitin Gupta <ngupta@vflare.org>,
	Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	Shaohua Li <shli@kernel.org>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Keith Busch <keith.busch@intel.com>,
	linuxppc-dev@lists.ozlabs.org, linux-block@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org,
	linux-mtd@lists.infradead.org, linux-nvme@lists.infradead.org,
	Christoph Hellwig <hch@infradead.org>,
	famz@redhat.com
Subject: [PATCH v2 02/12] genhd: Honor gen_uevent and add disk_gen_uevents
Date: Thu, 30 Jun 2016 09:59:43 +0800	[thread overview]
Message-ID: <20160630015953.6888-3-famz@redhat.com> (raw)
In-Reply-To: <20160630015953.6888-1-famz@redhat.com>

In add_disk(), don't send uevent to userspace when gen_uevent is true;
also export the refactored function disk_gen_uevents for later use.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 block/genhd.c         | 23 +++++++++++++++++++----
 include/linux/genhd.h |  1 +
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index 8e1bfa1..9b66953 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -506,12 +506,10 @@ static int exact_lock(dev_t devt, void *data)
 	return 0;
 }
 
-static void register_disk(struct gendisk *disk)
+static void register_disk(struct gendisk *disk, bool gen_uevent)
 {
 	struct device *ddev = disk_to_dev(disk);
 	struct block_device *bdev;
-	struct disk_part_iter piter;
-	struct hd_struct *part;
 	int err;
 
 	ddev->parent = disk->driverfs_dev;
@@ -563,6 +561,22 @@ static void register_disk(struct gendisk *disk)
 exit:
 	/* announce disk after possible partitions are created */
 	dev_set_uevent_suppress(ddev, 0);
+	if (gen_uevent)
+		disk_gen_uevents(disk);
+}
+
+/**
+ * disk_gen_uevents
+ * @disk - the disk to generate uevent
+ *
+ * Generate KOBJ_ADD uevents on the disk and partitions.
+ */
+void disk_gen_uevents(struct gendisk *disk)
+{
+	struct device *ddev = disk_to_dev(disk);
+	struct disk_part_iter piter;
+	struct hd_struct *part;
+
 	kobject_uevent(&ddev->kobj, KOBJ_ADD);
 
 	/* announce possible partitions */
@@ -571,6 +585,7 @@ exit:
 		kobject_uevent(&part_to_dev(part)->kobj, KOBJ_ADD);
 	disk_part_iter_exit(&piter);
 }
+EXPORT_SYMBOL(disk_gen_uevents);
 
 /**
  * add_disk - add partitioning information to kernel list
@@ -618,7 +633,7 @@ void add_disk(struct gendisk *disk, bool gen_uevent)
 
 	blk_register_region(disk_devt(disk), disk->minors, NULL,
 			    exact_match, exact_lock, disk);
-	register_disk(disk);
+	register_disk(disk, gen_uevent);
 	blk_register_queue(disk);
 
 	/*
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 038be80..87ad9e5 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -416,6 +416,7 @@ extern void part_round_stats(int cpu, struct hd_struct *part);
 /* block/genhd.c */
 extern void add_disk(struct gendisk *disk, bool gen_uevent);
 extern void del_gendisk(struct gendisk *gp);
+extern void disk_gen_uevents(struct gendisk *disk);
 extern struct gendisk *get_gendisk(dev_t dev, int *partno);
 extern struct block_device *bdget_disk(struct gendisk *disk, int partno);
 
-- 
2.9.0

WARNING: multiple messages have this Message-ID (diff)
From: famz@redhat.com (Fam Zheng)
Subject: [PATCH v2 02/12] genhd: Honor gen_uevent and add disk_gen_uevents
Date: Thu, 30 Jun 2016 09:59:43 +0800	[thread overview]
Message-ID: <20160630015953.6888-3-famz@redhat.com> (raw)
In-Reply-To: <20160630015953.6888-1-famz@redhat.com>

In add_disk(), don't send uevent to userspace when gen_uevent is true;
also export the refactored function disk_gen_uevents for later use.

Signed-off-by: Fam Zheng <famz at redhat.com>
---
 block/genhd.c         | 23 +++++++++++++++++++----
 include/linux/genhd.h |  1 +
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index 8e1bfa1..9b66953 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -506,12 +506,10 @@ static int exact_lock(dev_t devt, void *data)
 	return 0;
 }
 
-static void register_disk(struct gendisk *disk)
+static void register_disk(struct gendisk *disk, bool gen_uevent)
 {
 	struct device *ddev = disk_to_dev(disk);
 	struct block_device *bdev;
-	struct disk_part_iter piter;
-	struct hd_struct *part;
 	int err;
 
 	ddev->parent = disk->driverfs_dev;
@@ -563,6 +561,22 @@ static void register_disk(struct gendisk *disk)
 exit:
 	/* announce disk after possible partitions are created */
 	dev_set_uevent_suppress(ddev, 0);
+	if (gen_uevent)
+		disk_gen_uevents(disk);
+}
+
+/**
+ * disk_gen_uevents
+ * @disk - the disk to generate uevent
+ *
+ * Generate KOBJ_ADD uevents on the disk and partitions.
+ */
+void disk_gen_uevents(struct gendisk *disk)
+{
+	struct device *ddev = disk_to_dev(disk);
+	struct disk_part_iter piter;
+	struct hd_struct *part;
+
 	kobject_uevent(&ddev->kobj, KOBJ_ADD);
 
 	/* announce possible partitions */
@@ -571,6 +585,7 @@ exit:
 		kobject_uevent(&part_to_dev(part)->kobj, KOBJ_ADD);
 	disk_part_iter_exit(&piter);
 }
+EXPORT_SYMBOL(disk_gen_uevents);
 
 /**
  * add_disk - add partitioning information to kernel list
@@ -618,7 +633,7 @@ void add_disk(struct gendisk *disk, bool gen_uevent)
 
 	blk_register_region(disk_devt(disk), disk->minors, NULL,
 			    exact_match, exact_lock, disk);
-	register_disk(disk);
+	register_disk(disk, gen_uevent);
 	blk_register_queue(disk);
 
 	/*
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 038be80..87ad9e5 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -416,6 +416,7 @@ extern void part_round_stats(int cpu, struct hd_struct *part);
 /* block/genhd.c */
 extern void add_disk(struct gendisk *disk, bool gen_uevent);
 extern void del_gendisk(struct gendisk *gp);
+extern void disk_gen_uevents(struct gendisk *disk);
 extern struct gendisk *get_gendisk(dev_t dev, int *partno);
 extern struct block_device *bdget_disk(struct gendisk *disk, int partno);
 
-- 
2.9.0

  parent reply	other threads:[~2016-06-30  1:59 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-30  1:59 [PATCH v2 00/12] gendisk: Generate uevent after attribute available Fam Zheng
2016-06-30  1:59 ` Fam Zheng
2016-06-30  1:59 ` Fam Zheng
2016-06-30  1:59 ` [PATCH v2 01/12] genhd: Add "gen_uevent" parameter to add_disk Fam Zheng
2016-06-30  1:59   ` Fam Zheng
2016-06-30  1:59   ` Fam Zheng
2016-06-30  1:59 ` Fam Zheng [this message]
2016-06-30  1:59   ` [PATCH v2 02/12] genhd: Honor gen_uevent and add disk_gen_uevents Fam Zheng
2016-06-30  1:59   ` Fam Zheng
2016-06-30  3:26   ` kbuild test robot
2016-06-30  3:26     ` kbuild test robot
2016-06-30  3:26     ` kbuild test robot
2016-06-30  1:59 ` [PATCH v2 03/12] virtio-blk: Generate uevent after attribute available Fam Zheng
2016-06-30  1:59   ` Fam Zheng
2016-06-30  1:59   ` Fam Zheng
2016-06-30  1:59 ` [PATCH v2 04/12] axonrom: " Fam Zheng
2016-06-30  1:59   ` Fam Zheng
2016-06-30  1:59   ` Fam Zheng
2016-06-30 22:10   ` Dan Williams
2016-06-30 22:10     ` Dan Williams
2016-06-30 22:10     ` Dan Williams
2016-07-01  1:03     ` Fam Zheng
2016-07-01  1:03       ` Fam Zheng
2016-07-01  1:03       ` Fam Zheng
2016-06-30 22:10   ` Dan Williams
2016-06-30  1:59 ` [PATCH v2 05/12] aoeblk: " Fam Zheng
2016-06-30  1:59   ` Fam Zheng
2016-06-30  1:59   ` Fam Zheng
2016-07-01  0:57   ` Ed Cashin
2016-07-01  0:57     ` Ed Cashin
2016-07-01  0:57     ` Ed Cashin
2016-07-01  0:57   ` Ed Cashin
2016-06-30  1:59 ` [PATCH v2 06/12] mtip32xx: " Fam Zheng
2016-06-30  1:59   ` Fam Zheng
2016-06-30  1:59   ` Fam Zheng
2016-06-30  1:59 ` [PATCH v2 07/12] pktcdvd: " Fam Zheng
2016-06-30  1:59   ` Fam Zheng
2016-06-30  1:59   ` Fam Zheng
2016-06-30  1:59 ` [PATCH v2 08/12] zram: " Fam Zheng
2016-06-30  1:59   ` Fam Zheng
2016-06-30  1:59   ` Fam Zheng
2016-06-30  1:59 ` [PATCH v2 09/12] md: " Fam Zheng
2016-06-30  1:59 ` Fam Zheng
2016-06-30  1:59   ` Fam Zheng
2016-06-30  1:59 ` [PATCH v2 10/12] mmc: " Fam Zheng
2016-06-30  1:59 ` Fam Zheng
2016-06-30  1:59   ` Fam Zheng
2016-06-30  1:59 ` [PATCH v2 11/12] mtd: " Fam Zheng
2016-06-30  1:59 ` Fam Zheng
2016-06-30  1:59   ` Fam Zheng
2016-06-30  1:59 ` [PATCH v2 12/12] nvme: " Fam Zheng
2016-06-30  1:59 ` Fam Zheng
2016-06-30  1:59   ` Fam Zheng
2016-06-30  6:24 ` [PATCH v2 00/12] gendisk: " Christoph Hellwig
2016-06-30  6:24   ` Christoph Hellwig
2016-06-30  6:24   ` Christoph Hellwig
2016-06-30  6:24   ` Christoph Hellwig
2016-06-30  6:35   ` Fam Zheng
2016-06-30  6:35     ` Fam Zheng
2016-06-30  6:35     ` Fam Zheng
2016-06-30  6:38     ` Christoph Hellwig
2016-06-30  6:38       ` Christoph Hellwig
2016-06-30  6:38       ` Christoph Hellwig
2016-07-01  1:01       ` Fam Zheng
2016-07-01  1:01         ` Fam Zheng
2016-07-01  1:01         ` Fam Zheng
2016-07-01  1:29         ` Dan Williams
2016-07-01  1:29         ` Dan Williams
2016-07-01  1:29           ` Dan Williams
2016-07-01  1:29           ` Dan Williams
2016-07-01  1:29           ` Dan Williams

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=20160630015953.6888-3-famz@redhat.com \
    --to=famz@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=benh@kernel.crashing.org \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=ed.cashin@acm.org \
    --cc=hch@infradead.org \
    --cc=jikos@kernel.org \
    --cc=keith.busch@intel.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=minchan@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=mst@redhat.com \
    --cc=ngupta@vflare.org \
    --cc=paulus@samba.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=shli@kernel.org \
    --cc=virtualization@lists.linux-foundation.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.