int r = 0;
- if (lvmetad_used())
+ if (lvmetad_used()) {
+ if (!label_scan_setup_bcache())
+ return 0;
return 1;
+ }
/* Avoid recursion when a PVID can't be found! */
if (_scanning_in_progress)
{
struct device_list *devl;
- if (!scan_bcache) {
- /*
- * This is only needed when commands are using lvmetad, in
- * which case they don't do an initial label_scan, but may
- * later need to rescan certain devs from disk and call this
- * function.
- * FIXME: is there some better number to choose here?
- */
- if (!_setup_bcache(32))
- return 0;
- }
-
dm_list_iterate_items(devl, devs) {
if (_in_bcache(devl->dev)) {
bcache_invalidate_fd(scan_bcache, devl->dev->bcache_fd);
label_read(dev, NULL, 0);
}
+/*
+ * This is only needed when commands are using lvmetad, in which case they
+ * don't do an initial label_scan, but may later need to rescan certain devs
+ * from disk and call this function. FIXME: is there some better number to
+ * choose here?
+ */
+
+int label_scan_setup_bcache(void)
+{
+ if (!scan_bcache) {
+ if (!_setup_bcache(32))
+ return 0;
+ }
+
+ return 1;
+}
+
int label_read(struct device *dev, struct label **labelp, uint64_t unused_sector);
int label_read_sector(struct device *dev, struct label **labelp, uint64_t scan_sector);
void label_scan_confirm(struct device *dev);
+int label_scan_setup_bcache(void);
#endif