|
@@ -957,7 +957,8 @@ void bch_cached_dev_detach(struct cached_dev *dc)
|
|
|
cached_dev_put(dc);
|
|
|
}
|
|
|
|
|
|
-int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c)
|
|
|
+int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c,
|
|
|
+ uint8_t *set_uuid)
|
|
|
{
|
|
|
uint32_t rtime = cpu_to_le32(get_seconds());
|
|
|
struct uuid_entry *u;
|
|
@@ -965,7 +966,8 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c)
|
|
|
|
|
|
bdevname(dc->bdev, buf);
|
|
|
|
|
|
- if (memcmp(dc->sb.set_uuid, c->sb.set_uuid, 16))
|
|
|
+ if ((set_uuid && memcmp(set_uuid, c->sb.set_uuid, 16)) ||
|
|
|
+ (!set_uuid && memcmp(dc->sb.set_uuid, c->sb.set_uuid, 16)))
|
|
|
return -ENOENT;
|
|
|
|
|
|
if (dc->disk.c) {
|
|
@@ -1194,7 +1196,7 @@ static void register_bdev(struct cache_sb *sb, struct page *sb_page,
|
|
|
|
|
|
list_add(&dc->list, &uncached_devices);
|
|
|
list_for_each_entry(c, &bch_cache_sets, list)
|
|
|
- bch_cached_dev_attach(dc, c);
|
|
|
+ bch_cached_dev_attach(dc, c, NULL);
|
|
|
|
|
|
if (BDEV_STATE(&dc->sb) == BDEV_STATE_NONE ||
|
|
|
BDEV_STATE(&dc->sb) == BDEV_STATE_STALE)
|
|
@@ -1716,7 +1718,7 @@ static void run_cache_set(struct cache_set *c)
|
|
|
bcache_write_super(c);
|
|
|
|
|
|
list_for_each_entry_safe(dc, t, &uncached_devices, list)
|
|
|
- bch_cached_dev_attach(dc, c);
|
|
|
+ bch_cached_dev_attach(dc, c, NULL);
|
|
|
|
|
|
flash_devs_run(c);
|
|
|
|