the uevent when attributes are added.
[1] https://lkml.org/lkml/2016/6/28/550
Fam Zheng (12):
genhd: Add "gen_uevent" parameter to add_disk
genhd: Honor gen_uevent and add disk_gen_uevents
virtio-blk: Generate uevent after attribute available
axonrom: Generate uevent after attribut
The parameter will be used to control whether add_disk should generate
the KOBJ_ADD uevent already.
Signed-off-by: Fam Zheng
---
arch/m68k/emu/nfblock.c | 2 +-
arch/powerpc/sysdev/axonram.c | 2 +-
arch/um/drivers/ubd_kern.c | 2 +-
arch
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
---
block/genhd.c | 23 +++
include/linux/genhd.h | 1 +
2 files changed, 20 insertions(
number of
virtio-blk disks.
Also in systemd, there used to be a related workaround in udev rules
called 'WAIT_FOR="serial"', but it is removed in later versions.
Now let's generate a KOBJ_CHANGE event after the attributes are ready.
Signed-off-by: Fam Zheng
---
drivers
It is documented that KOBJ_ADD should be generated after the object's
attributes and children are ready. We can achieve this with the new
disk_gen_uevents interface.
Signed-off-by: Fam Zheng
---
arch/powerpc/sysdev/axonram.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --
It is documented that KOBJ_ADD should be generated after the object's
attributes and children are ready. We can achieve this with the new
disk_gen_uevents interface.
Signed-off-by: Fam Zheng
---
drivers/block/aoe/aoeblk.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --
It is documented that KOBJ_ADD should be generated after the object's
attributes and children are ready. We can achieve this with the new
disk_gen_uevents interface.
Signed-off-by: Fam Zheng
---
drivers/block/mtip32xx/mtip32xx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
It is documented that KOBJ_ADD should be generated after the object's
attributes and children are ready. We can achieve this with the new
disk_gen_uevents interface.
Signed-off-by: Fam Zheng
---
drivers/block/pktcdvd.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --
It is documented that KOBJ_ADD should be generated after the object's
attributes and children are ready. We can achieve this with the new
disk_gen_uevents interface.
Signed-off-by: Fam Zheng
---
drivers/block/zram/zram_drv.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --
It is documented that KOBJ_ADD should be generated after the object's
attributes and children are ready. We can achieve this with the new
disk_gen_uevents interface.
Signed-off-by: Fam Zheng
---
drivers/md/md.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drive
It is documented that KOBJ_ADD should be generated after the object's
attributes and children are ready. We can achieve this with the new
disk_gen_uevents interface.
Signed-off-by: Fam Zheng
---
drivers/mmc/card/block.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --
It is documented that KOBJ_ADD should be generated after the object's
attributes and children are ready. We can achieve this with the new
disk_gen_uevents interface.
Signed-off-by: Fam Zheng
---
drivers/mtd/mtd_blkdevs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --
It is documented that KOBJ_ADD should be generated after the object's
attributes and children are ready. We can achieve this with the new
disk_gen_uevents interface.
Signed-off-by: Fam Zheng
---
drivers/nvme/host/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --
On Wed, 06/29 23:24, Christoph Hellwig wrote:
> On Thu, Jun 30, 2016 at 09:59:41AM +0800, Fam Zheng wrote:
> > Documentation/kobject.txt:
> > > Use the KOBJ_ADD action for when the kobject is first added to the kernel.
> > > This should be done only after any attributes
On Wed, 06/29 23:38, Christoph Hellwig wrote:
> On Thu, Jun 30, 2016 at 02:35:54PM +0800, Fam Zheng wrote:
> > also more code and less flexible IMO. For example, we need at least two
> > variants, for attribute_group and device_attribute separately, right?
>
> Yes, or
On Thu, 06/30 15:10, Dan Williams wrote:
> On Wed, Jun 29, 2016 at 6:59 PM, Fam Zheng wrote:
> > It is documented that KOBJ_ADD should be generated after the object's
> > attributes and children are ready. We can achieve this with the new
> > disk_gen_uevents interf
r add FIXME
comment where work is left).
Fam Zheng (15):
disk: Drop add_disk in favor of device_add_disk
genhd: Return error from register_disk()
genhd: Return error from blk_register_region
block: Return error from blk_integrity_add
genhd: Return error from disk_{add,alloc}_events
genhd
d_disk and update of related comments are done manually.
Signed-off-by: Fam Zheng
---
arch/m68k/emu/nfblock.c | 2 +-
arch/xtensa/platforms/iss/simdisk.c | 2 +-
drivers/block/DAC960.c | 2 +-
drivers/block/amiflop.c | 2 +-
drivers/block/aoe/aoeblk.c
Several operations in register_disk can fail, but the caller currently
cannot check for error due to missing return code. Change the function
return type and return -errno if any error happens.
Also add some documentation.
Signed-off-by: Fam Zheng
---
block/genhd.c | 27
blk_register_region can fail (-ENOMEM), return the error to the caller.
Signed-off-by: Fam Zheng
---
block/genhd.c | 4 ++--
include/linux/genhd.h | 10 +-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/block/genhd.c b/block/genhd.c
index 3dcecaa..8c7510d 100644
The kobject_init_and_add call in blk_integrity_add can fail, return the
error code in this case, so that it can be handled in the caller.
Signed-off-by: Fam Zheng
---
block/blk-integrity.c | 12
include/linux/genhd.h | 4 ++--
2 files changed, 10 insertions(+), 6 deletions
disk_alloc_events and disk_add_events can fail, return the error code so
the caller can handle it.
Signed-off-by: Fam Zheng
---
block/genhd.c | 24 +++-
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/block/genhd.c b/block/genhd.c
index 8c7510d..4316d2d 100644
There are a number of places in device_add_disk that can fail, and even
more to come as we extend it.
Switch the return type of the function, and return the error code when
error happens.
The WARN_ON is kept because callers are not updated to check the error
yet.
Signed-off-by: Fam Zheng
The added parameter attr_group, if not NULL, be added to the new disk.
The callers are converted with coccinelle:
@@
expression e1, e2;
@@
- device_add_disk(e1, e2);
+ device_add_disk(e1, e2, NULL);
So there is not behavior change yet.
Signed-off-by: Fam Zheng
---
arch/m68k/emu
conditionally.
device_add_disk can handle adding attribute group better, so use it.
Signed-off-by: Fam Zheng
---
drivers/nvme/host/core.c | 6 +-
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 23a795f..1921cb2 100644
--- a
conditionally.
device_add_disk can handle adding attribute group better, so use it.
Meanwhile, handle error of device_add_disk.
Signed-off-by: Fam Zheng
---
drivers/block/virtio_blk.c | 38 +++---
1 file changed, 27 insertions(+), 11 deletions(-)
diff --git a/drivers
conditionally.
device_add_disk can handle adding attribute group better, so use it.
Signed-off-by: Fam Zheng
---
drivers/mtd/mtd_blkdevs.c | 8 +---
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index 4ff9381..fc9265d 100644
--- a
conditionally.
device_add_disk can handle adding attribute group better, so use it.
Meanwhile, update the error check code and message.
Signed-off-by: Fam Zheng
---
drivers/block/zram/zram_drv.c | 7 ++-
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/block/zram/zram_drv.c b
conditionally.
device_add_disk can handle adding attribute group better, so use it.
Meanwhile, update the error check code and message.
Signed-off-by: Fam Zheng
---
drivers/block/mtip32xx/mtip32xx.c | 38 --
1 file changed, 8 insertions(+), 30 deletions(-)
diff --git
conditionally.
device_add_disk can handle adding attribute group better, so use it.
Signed-off-by: Fam Zheng
---
drivers/block/aoe/aoeblk.c | 10 ++
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
index 4edfff2..d1b7541 100644
conditionally.
device_add_disk can handle adding attribute group better, so use it.
Meanwhile, handle the error of device_add_disk.
Signed-off-by: Fam Zheng
---
arch/powerpc/sysdev/axonram.c | 23 +++
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/arch/powerpc/sysdev
Done with coccinelle:
@@
expression e1, e2, e3;
identifier rc;
@@
(
rc = device_add_disk(e1, e2, e3);
|
+ /* FIXME: handle error. */
device_add_disk(e1, e2, e3);
)
Signed-off-by: Fam Zheng
---
arch/m68k/emu/nfblock.c | 1 +
arch/um/drivers/ubd_kern.c
On Wed, 08/17 10:49, Cornelia Huck wrote:
> On Wed, 17 Aug 2016 15:15:06 +0800
> Fam Zheng wrote:
>
> > @@ -613,10 +614,8 @@ void device_add_disk(struct device *parent, struct
> > gendisk *disk)
> > disk->flags |= GENHD_FL_UP;
> >
> > r
On Wed, 08/17 11:06, Cornelia Huck wrote:
> On Wed, 17 Aug 2016 16:48:23 +0800
> Fam Zheng wrote:
>
> > On Wed, 08/17 10:49, Cornelia Huck wrote:
> > > On Wed, 17 Aug 2016 15:15:06 +0800
> > > Fam Zheng wrote:
> > >
> > > > @@ -613,1
34 matches
Mail list logo