File util-linux-lsblk-inverse-tree.patch of Package util-linux.2662
From 92abdcaee05178e18566d43022a66fc77e3800f2 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Wed, 1 Apr 2015 12:06:41 +0200
Subject: [PATCH] lsblk: follow kernel for inverse tree
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
For multi-path devices kernel defines dependence between the device
and whole-list:
$ ls /sys/block/dm-0/slaves/
sdb
but lsblk inserts partition into the tree:
$ lsblk -s -oNAME,KNAME /dev/dm-1
mpatha1 dm-1
└─mpatha dm-0
└─sdb1 sdb1 <--- !
└─sdb sdb
Signed-off-by: Karel Zak <kzak@redhat.com>
---
misc-utils/lsblk.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Index: util-linux-2.25/misc-utils/lsblk.c
===================================================================
--- util-linux-2.25.orig/misc-utils/lsblk.c
+++ util-linux-2.25/misc-utils/lsblk.c
@@ -1270,7 +1270,9 @@ static int list_deps(struct blkdev_cxt *
}
/* The dependency is a whole device. */
else if (!set_cxt(&dep, cxt, NULL, d->d_name))
- process_blkdev(&dep, cxt, 1, NULL);
+ /* For inverse tree we don't want to show partitions
+ * if the dependence is pn whle-disk */
+ process_blkdev(&dep, cxt, lsblk->inverse ? 0 : 1, NULL);
reset_blkdev_cxt(&dep);
}