From: Karel Zak Date: Thu, 20 Oct 2011 22:12:47 +0000 (+0200) Subject: blkid: print ID_PART_ENTRY_* for small devices X-Git-Tag: v2.21-rc1~327 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6a2f2f58a428890a33b382876bab78c608cc7c1c;p=thirdparty%2Futil-linux.git blkid: print ID_PART_ENTRY_* for small devices The current optimization for small devices (1.4MiB) is broken. It checks for partition table, but if nothing is detected then details (ID_PART_ENTRY_*) about the current partition are not gathered. The optimization should be enabled for small *whole* disks only. Reported-by: David Zeuthen Signed-off-by: Karel Zak --- diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c index 3608304a5c..0ff89d66f5 100644 --- a/misc-utils/blkid.c +++ b/misc-utils/blkid.c @@ -454,9 +454,9 @@ static int lowprobe_superblocks(blkid_probe pr) return -1; blkid_probe_enable_partitions(pr, 1); - blkid_probe_set_partitions_flags(pr, BLKID_PARTS_ENTRY_DETAILS); - if (!S_ISCHR(st.st_mode) && blkid_probe_get_size(pr) <= 1024 * 1440) { + if (!S_ISCHR(st.st_mode) && blkid_probe_get_size(pr) <= 1024 * 1440 && + blkid_probe_is_wholedisk(pr)) { /* * check if the small disk is partitioned, if yes then * don't probe for filesystems. @@ -469,11 +469,9 @@ static int lowprobe_superblocks(blkid_probe pr) if (blkid_probe_lookup_value(pr, "PTTYPE", NULL, NULL) == 0) return 0; /* partition table detected */ - - /* small whole-disk is unpartitioned, probe for filesystems only */ - blkid_probe_enable_partitions(pr, 0); } + blkid_probe_set_partitions_flags(pr, BLKID_PARTS_ENTRY_DETAILS); blkid_probe_enable_superblocks(pr, 1); return blkid_do_safeprobe(pr);