Re: [RFC PATCH] block/genhd: Notify udev about capacity change
From: Singh, Balbir
Date: Wed Dec 11 2019 - 14:36:26 EST
On Tue, 2019-12-10 at 03:01 +0000, Balbir Singh wrote:
> Allow block/genhd to notify user space (via udev) about disk size changes
> using a new helper disk_set_capacity(), which is a wrapper on top
> of set_capacity(). disk_set_capacity() will only notify via udev if
> the current capacity or the target capacity is not zero.
>
> disk_set_capacity() is not enabled for all devices, just virtio block,
> xen-blockfront, nvme and sd. Owners of other block disk devices can
> easily move over by changing set_capacity() to disk_set_capacity()
>
> Background:
>
> As a part of a patch to allow sending the RESIZE event on disk capacity
> change, Christoph (hch@xxxxxx) requested that the patch be made generic
> and the hacks for virtio block and xen block devices be removed and
> merged via a generic helper.
>
> Testing:
> 1. I did some basic testing with an NVME device, by resizing it in
> the backend and ensured that udevd received the event.
>
> Suggested-by: Christoph Hellwig <hch@xxxxxx>
> Signed-off-by: Balbir Singh <sblbir@xxxxxxxxxx>
> Signed-off-by: Someswarudu Sangaraju <ssomesh@xxxxxxxxxx>
>
Any feedback on the RFC?
Balbir Singh.