mbox series

[v2,0/4] Add invalidate_disk() helper for drivers to invalidate the gendisk

Message ID 20210922123711.187-1-xieyongji@bytedance.com (mailing list archive)
Headers show
Series Add invalidate_disk() helper for drivers to invalidate the gendisk | expand

Message

Yongji Xie Sept. 22, 2021, 12:37 p.m. UTC
This series comes from Christoph Hellwig's suggestion [1]. Some block
device drivers such as loop driver and nbd driver need to invalidate
the gendisk when the backend is detached so that the gendisk can be
reused by the new backend. Now the invalidation is done in device
driver with their own ways. To avoid code duplication and hide
some internals of the implementation, this series adds a block layer
helper and makes both loop driver and nbd driver use it.

[1] https://lore.kernel.org/all/YTmqJHd7YWAQ2lZ7@infradead.org/

V1 to V2:
- Rename invalidate_gendisk() to invalidate_disk()
- Add a cleanup patch to remove bdev checks and bdev variable in __loop_clr_fd()

Xie Yongji (4):
  block: Add invalidate_disk() helper to invalidate the gendisk
  loop: Use invalidate_disk() helper to invalidate gendisk
  loop: Remove the unnecessary bdev checks and unused bdev variable
  nbd: Use invalidate_disk() helper on disconnect

 block/genhd.c         | 20 ++++++++++++++++++++
 drivers/block/loop.c  | 15 ++++-----------
 drivers/block/nbd.c   | 12 +++---------
 include/linux/genhd.h |  2 ++
 4 files changed, 29 insertions(+), 20 deletions(-)

Comments

Yongji Xie Oct. 21, 2021, 3:41 a.m. UTC | #1
Ping

On Wed, Sep 22, 2021 at 8:37 PM Xie Yongji <xieyongji@bytedance.com> wrote:
>
> This series comes from Christoph Hellwig's suggestion [1]. Some block
> device drivers such as loop driver and nbd driver need to invalidate
> the gendisk when the backend is detached so that the gendisk can be
> reused by the new backend. Now the invalidation is done in device
> driver with their own ways. To avoid code duplication and hide
> some internals of the implementation, this series adds a block layer
> helper and makes both loop driver and nbd driver use it.
>
> [1] https://lore.kernel.org/all/YTmqJHd7YWAQ2lZ7@infradead.org/
>
> V1 to V2:
> - Rename invalidate_gendisk() to invalidate_disk()
> - Add a cleanup patch to remove bdev checks and bdev variable in __loop_clr_fd()
>
> Xie Yongji (4):
>   block: Add invalidate_disk() helper to invalidate the gendisk
>   loop: Use invalidate_disk() helper to invalidate gendisk
>   loop: Remove the unnecessary bdev checks and unused bdev variable
>   nbd: Use invalidate_disk() helper on disconnect
>
>  block/genhd.c         | 20 ++++++++++++++++++++
>  drivers/block/loop.c  | 15 ++++-----------
>  drivers/block/nbd.c   | 12 +++---------
>  include/linux/genhd.h |  2 ++
>  4 files changed, 29 insertions(+), 20 deletions(-)
>
> --
> 2.11.0
>
Jens Axboe Oct. 21, 2021, 4:12 p.m. UTC | #2
On Wed, 22 Sep 2021 20:37:07 +0800, Xie Yongji wrote:
> This series comes from Christoph Hellwig's suggestion [1]. Some block
> device drivers such as loop driver and nbd driver need to invalidate
> the gendisk when the backend is detached so that the gendisk can be
> reused by the new backend. Now the invalidation is done in device
> driver with their own ways. To avoid code duplication and hide
> some internals of the implementation, this series adds a block layer
> helper and makes both loop driver and nbd driver use it.
> 
> [...]

Applied, thanks!

[1/4] block: Add invalidate_disk() helper to invalidate the gendisk
      commit: f059a1d2e23a165bf86e33673c6a7535a08c6341
[2/4] loop: Use invalidate_disk() helper to invalidate gendisk
      commit: e515be8f3b3e63be4c5e91dc6620483ed0990a0c
[3/4] loop: Remove the unnecessary bdev checks and unused bdev variable
      commit: 19f553db2ac03cb8407ec8efb8e140951afdfb87
[4/4] nbd: Use invalidate_disk() helper on disconnect
      commit: 435c2acb307f19acc791b4295e29cc53a82bd24d

Best regards,