perf stat aggregation: Add separate die member
[linux-2.6-microblaze.git] / init / do_mounts.c
index aef2f24..a78e44e 100644 (file)
@@ -76,18 +76,13 @@ struct uuidcmp {
  */
 static int match_dev_by_uuid(struct device *dev, const void *data)
 {
+       struct block_device *bdev = dev_to_bdev(dev);
        const struct uuidcmp *cmp = data;
-       struct hd_struct *part = dev_to_part(dev);
-
-       if (!part->info)
-               goto no_match;
-
-       if (strncasecmp(cmp->uuid, part->info->uuid, cmp->len))
-               goto no_match;
 
+       if (!bdev->bd_meta_info ||
+           strncasecmp(cmp->uuid, bdev->bd_meta_info->uuid, cmp->len))
+               return 0;
        return 1;
-no_match:
-       return 0;
 }
 
 /**
@@ -105,13 +100,10 @@ no_match:
  */
 static dev_t devt_from_partuuid(const char *uuid_str)
 {
-       dev_t res = 0;
        struct uuidcmp cmp;
        struct device *dev = NULL;
-       struct gendisk *disk;
-       struct hd_struct *part;
+       dev_t devt = 0;
        int offset = 0;
-       bool clear_root_wait = false;
        char *slash;
 
        cmp.uuid = uuid_str;
@@ -120,52 +112,49 @@ static dev_t devt_from_partuuid(const char *uuid_str)
        /* Check for optional partition number offset attributes. */
        if (slash) {
                char c = 0;
+
                /* Explicitly fail on poor PARTUUID syntax. */
-               if (sscanf(slash + 1,
-                          "PARTNROFF=%d%c", &offset, &c) != 1) {
-                       clear_root_wait = true;
-                       goto done;
-               }
+               if (sscanf(slash + 1, "PARTNROFF=%d%c", &offset, &c) != 1)
+                       goto clear_root_wait;
                cmp.len = slash - uuid_str;
        } else {
                cmp.len = strlen(uuid_str);
        }
 
-       if (!cmp.len) {
-               clear_root_wait = true;
-               goto done;
-       }
+       if (!cmp.len)
+               goto clear_root_wait;
 
-       dev = class_find_device(&block_class, NULL, &cmp,
-                               &match_dev_by_uuid);
+       dev = class_find_device(&block_class, NULL, &cmp, &match_dev_by_uuid);
        if (!dev)
-               goto done;
-
-       res = dev->devt;
+               return 0;
 
-       /* Attempt to find the partition by offset. */
-       if (!offset)
-               goto no_offset;
+       if (offset) {
+               /*
+                * Attempt to find the requested partition by adding an offset
+                * to the partition number found by UUID.
+                */
+               struct block_device *part;
 
-       res = 0;
-       disk = part_to_disk(dev_to_part(dev));
-       part = disk_get_part(disk, dev_to_part(dev)->partno + offset);
-       if (part) {
-               res = part_devt(part);
-               put_device(part_to_dev(part));
+               part = bdget_disk(dev_to_disk(dev),
+                                 dev_to_bdev(dev)->bd_partno + offset);
+               if (part) {
+                       devt = part->bd_dev;
+                       bdput(part);
+               }
+       } else {
+               devt = dev->devt;
        }
 
-no_offset:
        put_device(dev);
-done:
-       if (clear_root_wait) {
-               pr_err("VFS: PARTUUID= is invalid.\n"
-                      "Expected PARTUUID=<valid-uuid-id>[/PARTNROFF=%%d]\n");
-               if (root_wait)
-                       pr_err("Disabling rootwait; root= is invalid.\n");
-               root_wait = 0;
-       }
-       return res;
+       return devt;
+
+clear_root_wait:
+       pr_err("VFS: PARTUUID= is invalid.\n"
+              "Expected PARTUUID=<valid-uuid-id>[/PARTNROFF=%%d]\n");
+       if (root_wait)
+               pr_err("Disabling rootwait; root= is invalid.\n");
+       root_wait = 0;
+       return 0;
 }
 
 /**
@@ -177,13 +166,12 @@ done:
  */
 static int match_dev_by_label(struct device *dev, const void *data)
 {
+       struct block_device *bdev = dev_to_bdev(dev);
        const char *label = data;
-       struct hd_struct *part = dev_to_part(dev);
-
-       if (part->info && !strcmp(label, part->info->volname))
-               return 1;
 
-       return 0;
+       if (!bdev->bd_meta_info || strcmp(label, bdev->bd_meta_info->volname))
+               return 0;
+       return 1;
 }
 
 static dev_t devt_from_partlabel(const char *label)