Linux-Block Archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] block: check disk flag before setting scan bit
       [not found] <20230116083832.27305-1-wangjie22@lixiang.com>
@ 2023-01-16 16:14 ` Jens Axboe
  0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2023-01-16 16:14 UTC (permalink / raw
  To: wangjie; +Cc: linux-block, linux-kernel

On 1/16/23 1:38?AM, wangjie wrote:
> No need to scan partitions for disk who has set flag GENHD_FL_NO_PART in
> driver code. In disk_scan_partitions function, the same checking is
> existing, so we believe this change is reasonable.
> 
> In our case, some virtual block devices are not managed by GPT, then scan
> partition operation is not a must. So we set GENHD_FL_NO_PART flag in
> driver intended to avoid partitions being dropped/added.
> But GD_NEED_PART_SCAN bit was still set by bdev_check_media_change, which
> causing problems here.
> 
> Signed-off-by: wangjie

Signed-off-by is in the wrong format, and the whole email is badly
mangled...

> ????????????????????????????????????????????????????
> ????????????????????????????????????????????????????
> ???????????????????????????????

This didn't quote well, but the original is also useless. You do realize
you send this email to a public list? Please get rid of it.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] block: check disk flag before setting scan bit
@ 2023-01-17  7:53 Jie Wang
  2023-01-17  8:14 ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Jie Wang @ 2023-01-17  7:53 UTC (permalink / raw
  To: axboe; +Cc: linux-block, linux-kernel, wangjie2011cs

No need to scan partitions for disk who has set flag GENHD_FL_NO_PART in
driver code. In disk_scan_partitions function, the same checking is
existing, so we believe this change is reasonable.

In our case, some virtual block devices are not managed by GPT, then scan
partition operation is not a must. So we set GENHD_FL_NO_PART flag in
driver intended to avoid partitions being dropped/added.
But GD_NEED_PART_SCAN bit was still set by bdev_check_media_change, which
causing problems here.

Signed-off-by: Jie Wang <wangjie2011cs@163.com>
---
 block/disk-events.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/block/disk-events.c b/block/disk-events.c
index aee25a7e1ab7..68d911135bc7 100644
--- a/block/disk-events.c
+++ b/block/disk-events.c
@@ -284,7 +284,8 @@ bool bdev_check_media_change(struct block_device *bdev)
 	if (__invalidate_device(bdev, true))
 		pr_warn("VFS: busy inodes on changed media %s\n",
 			bdev->bd_disk->disk_name);
-	set_bit(GD_NEED_PART_SCAN, &bdev->bd_disk->state);
+	if (!(bdev->bd_disk->flags & GENHD_FL_NO_PART))
+		set_bit(GD_NEED_PART_SCAN, &bdev->bd_disk->state);
 	return true;
 }
 EXPORT_SYMBOL(bdev_check_media_change);
@@ -310,7 +311,8 @@ bool disk_force_media_change(struct gendisk *disk, unsigned int events)
 	if (__invalidate_device(disk->part0, true))
 		pr_warn("VFS: busy inodes on changed media %s\n",
 			disk->disk_name);
-	set_bit(GD_NEED_PART_SCAN, &disk->state);
+	if (!(bdev->bd_disk->flags & GENHD_FL_NO_PART))
+		set_bit(GD_NEED_PART_SCAN, &disk->state);
 	return true;
 }
 EXPORT_SYMBOL_GPL(disk_force_media_change);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] block: check disk flag before setting scan bit
  2023-01-17  7:53 Jie Wang
@ 2023-01-17  8:14 ` Christoph Hellwig
       [not found]   ` <1a61ffce.191e.185bef2aea0.Coremail.wangjie2011cs@163.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2023-01-17  8:14 UTC (permalink / raw
  To: Jie Wang; +Cc: axboe, linux-block, linux-kernel

On Tue, Jan 17, 2023 at 03:53:29PM +0800, Jie Wang wrote:
> No need to scan partitions for disk who has set flag GENHD_FL_NO_PART in
> driver code. In disk_scan_partitions function, the same checking is
> existing, so we believe this change is reasonable.
> 
> In our case, some virtual block devices are not managed by GPT, then scan
> partition operation is not a must. So we set GENHD_FL_NO_PART flag in
> driver intended to avoid partitions being dropped/added.

What driver?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] block: check disk flag before setting scan bit
       [not found]   ` <1a61ffce.191e.185bef2aea0.Coremail.wangjie2011cs@163.com>
@ 2023-01-17  8:58     ` Christoph Hellwig
  0 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2023-01-17  8:58 UTC (permalink / raw
  To: wangjie2011cs; +Cc: Christoph Hellwig, axboe, linux-block, linux-kernel

On Tue, Jan 17, 2023 at 04:57:33PM +0800, wangjie2011cs wrote:
> Nvidia tegra_virt_storage driver, which talks with hypervisor.

Merge it upstream first and we can talk.  Until then please don't waste
our time.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-17  8:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230116083832.27305-1-wangjie22@lixiang.com>
2023-01-16 16:14 ` [PATCH] block: check disk flag before setting scan bit Jens Axboe
2023-01-17  7:53 Jie Wang
2023-01-17  8:14 ` Christoph Hellwig
     [not found]   ` <1a61ffce.191e.185bef2aea0.Coremail.wangjie2011cs@163.com>
2023-01-17  8:58     ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).