]> sourceware.org Git - lvm2.git/commitdiff
pvck: use bcache
authorDavid Teigland <teigland@redhat.com>
Thu, 15 Feb 2018 17:06:50 +0000 (11:06 -0600)
committerDavid Teigland <teigland@redhat.com>
Fri, 20 Apr 2018 16:22:47 +0000 (11:22 -0500)
lib/format_text/format-text.c
tools/pvck.c

index 8a422130475336aa0905ee754778f5e0c71b2859..ef59f071a80f6da0cc5eee1a0d09bc1c9555781b 100644 (file)
@@ -187,9 +187,6 @@ static int _pv_analyze_mda_raw (const struct format_type * fmt,
                  FMTu64, mdac->area.start, mdac->area.size);
        area = &mdac->area;
 
-       if (!dev_open_readonly(area->dev))
-               return_0;
-
        if (!(mdah = raw_read_mda_header(fmt, area, mda_is_primary(mda))))
                goto_out;
 
@@ -230,8 +227,23 @@ static int _pv_analyze_mda_raw (const struct format_type * fmt,
                if (!(buf = dm_malloc(size + size2)))
                        goto_out;
 
-               if (!dev_read_circular(area->dev, offset, size, offset2, size2, MDA_CONTENT_REASON(mda_is_primary(mda)), buf))
-                       goto_out;
+               if (!bcache_read_bytes(scan_bcache, area->dev->bcache_fd, offset, size, buf)) {
+                       log_error("Failed to read dev %s offset %llu size %llu",
+                                 dev_name(area->dev),
+                                 (unsigned long long)offset,
+                                 (unsigned long long)size);
+                       goto out;
+               }
+
+               if (size2) {
+                       if (!bcache_read_bytes(scan_bcache, area->dev->bcache_fd, offset2, size2, buf + size)) {
+                               log_error("Failed to read dev %s offset %llu size %llu",
+                                         dev_name(area->dev),
+                                         (unsigned long long)offset2,
+                                         (unsigned long long)size2);
+                               goto out;
+                       }
+               }
 
                /*
                 * FIXME: We could add more sophisticated metadata detection
@@ -268,8 +280,6 @@ static int _pv_analyze_mda_raw (const struct format_type * fmt,
        r = 1;
  out:
        dm_free(buf);
-       if (!dev_close(area->dev))
-               stack;
        return r;
 }
 
index 0fedb4a6cbc6d6086d0685c32512ead16e2174f6..634b38d1987b5412e8af70d1c36d7ec67c11a93a 100644 (file)
@@ -23,6 +23,8 @@ int pvck(struct cmd_context *cmd, int argc, char **argv)
        /* FIXME: validate cmdline options */
        /* FIXME: what does the cmdline look like? */
 
+       label_scan_setup_bcache();
+
        /*
         * Use what's on the cmdline directly, and avoid calling into
         * some of the other infrastructure functions, so as to avoid
This page took 0.041237 seconds and 5 git commands to generate.