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;
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
r = 1;
out:
dm_free(buf);
- if (!dev_close(area->dev))
- stack;
return r;
}
/* 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