[Devel] [RFC 01/54] genhd: fix CONFIG_VE=n build

Eva Kurchatova eva.kurchatova at virtuozzo.com
Wed Apr 29 22:58:01 MSK 2026


Signed-off-by: Eva Kurchatova <eva.kurchatova at virtuozzo.com>
---
 block/genhd.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index eb511bd0505f..28fdbb6d3c21 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1288,12 +1288,14 @@ const struct device_type disk_type = {
  */
 static int diskstats_show(struct seq_file *seqf, void *v)
 {
-	struct ve_struct *ve = get_exec_env();
 	struct gendisk *gp = v;
 	struct block_device *hd;
 	unsigned int inflight;
 	struct disk_stats stat;
 	unsigned long idx;
+#ifdef CONFIG_VE
+	struct ve_struct *ve = get_exec_env();
+#endif
 
 	/*
 	if (&disk_to_dev(gp)->kobj.entry == block_class.devices.next)
@@ -1307,13 +1309,13 @@ static int diskstats_show(struct seq_file *seqf, void *v)
 	xa_for_each(&gp->part_tbl, idx, hd) {
 		if (bdev_is_partition(hd) && !bdev_nr_sectors(hd))
 			continue;
-
+#ifdef CONFIG_VE
 		if (!ve_is_super(ve) &&
 		    devcgroup_device_permission(S_IFBLK, hd->bd_dev,
 						MAY_READ)) {
 			continue;
 		}
-
+#endif
 		inflight = part_in_flight(hd);
 		if (inflight) {
 			part_stat_lock();
-- 
2.54.0



More information about the Devel mailing list