[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210520133908.98891-2-damtev@yandex-team.ru>
Date: Thu, 20 May 2021 16:39:08 +0300
From: Yury Kamenev <damtev@...dex-team.ru>
To: mst@...hat.com, jasowang@...hat.com, pbonzini@...hat.com,
stefanha@...hat.com, axboe@...nel.dk,
virtualization@...ts.linux-foundation.org,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Yury Kamenev <damtev@...dex-team.ru>
Subject: [PATCH 1/1] virtio: disable partitions scanning for no partitions block
Signed-off-by: Yury Kamenev <damtev@...dex-team.ru>
---
drivers/block/virtio_blk.c | 6 ++++++
include/uapi/linux/virtio_blk.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index b9fa3ef5b57c..17edcfee2208 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -799,6 +799,10 @@ static int virtblk_probe(struct virtio_device *vdev)
vblk->disk->flags |= GENHD_FL_EXT_DEVT;
vblk->index = index;
+ /*Disable partitions scanning for no-partitions block*/
+ if (virtio_has_feature(vdev, VIRTIO_BLK_F_NO_PS))
+ vblk->disk->flags |= GENHD_FL_NO_PART_SCAN;
+
/* configure queue flush support */
virtblk_update_cache_mode(vdev);
@@ -977,6 +981,7 @@ static unsigned int features_legacy[] = {
VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE,
VIRTIO_BLK_F_FLUSH, VIRTIO_BLK_F_TOPOLOGY, VIRTIO_BLK_F_CONFIG_WCE,
VIRTIO_BLK_F_MQ, VIRTIO_BLK_F_DISCARD, VIRTIO_BLK_F_WRITE_ZEROES,
+ VIRTIO_BLK_F_NO_PS,
}
;
static unsigned int features[] = {
@@ -984,6 +989,7 @@ static unsigned int features[] = {
VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE,
VIRTIO_BLK_F_FLUSH, VIRTIO_BLK_F_TOPOLOGY, VIRTIO_BLK_F_CONFIG_WCE,
VIRTIO_BLK_F_MQ, VIRTIO_BLK_F_DISCARD, VIRTIO_BLK_F_WRITE_ZEROES,
+ VIRTIO_BLK_F_NO_PS,
};
static struct virtio_driver virtio_blk = {
diff --git a/include/uapi/linux/virtio_blk.h b/include/uapi/linux/virtio_blk.h
index d888f013d9ff..f197d07afb05 100644
--- a/include/uapi/linux/virtio_blk.h
+++ b/include/uapi/linux/virtio_blk.h
@@ -40,6 +40,7 @@
#define VIRTIO_BLK_F_MQ 12 /* support more than one vq */
#define VIRTIO_BLK_F_DISCARD 13 /* DISCARD is supported */
#define VIRTIO_BLK_F_WRITE_ZEROES 14 /* WRITE ZEROES is supported */
+#define VIRTIO_BLK_F_NO_PS 16 /* No partitions */
/* Legacy feature bits */
#ifndef VIRTIO_BLK_NO_LEGACY
--
2.24.3 (Apple Git-128)
Powered by blists - more mailing lists