]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
blkid: print ID_PART_ENTRY_* for small devices
authorKarel Zak <kzak@redhat.com>
Thu, 20 Oct 2011 22:12:47 +0000 (00:12 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 20 Oct 2011 22:37:06 +0000 (00:37 +0200)
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 <davidz@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/blkid.c

index 3608304a5c0a7da0655c01c0096c9645fe5dc88a..0ff89d66f5f7b1299cc4a88023f988ac9ed6e101 100644 (file)
@@ -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);