bcache: check and set sync status on cache's in-memory super block
[platform/kernel/linux-starfive.git] / drivers / md / bcache / super.c
index 1450c06..9632340 100644 (file)
@@ -1969,7 +1969,7 @@ static int run_cache_set(struct cache_set *c)
        c->nbuckets = ca->sb.nbuckets;
        set_gc_sectors(c);
 
-       if (CACHE_SYNC(&c->sb)) {
+       if (CACHE_SYNC(&c->cache->sb)) {
                struct bkey *k;
                struct jset *j;
 
@@ -2092,7 +2092,7 @@ static int run_cache_set(struct cache_set *c)
                 * everything is set up - fortunately journal entries won't be
                 * written until the SET_CACHE_SYNC() here:
                 */
-               SET_CACHE_SYNC(&c->sb, true);
+               SET_CACHE_SYNC(&c->cache->sb, true);
 
                bch_journal_next(&c->journal);
                bch_journal_meta(c, &cl);
@@ -2138,9 +2138,6 @@ static const char *register_cache_set(struct cache *ca)
                        if (c->cache)
                                return "duplicate cache set member";
 
-                       if (!CACHE_SYNC(&ca->sb))
-                               SET_CACHE_SYNC(&c->sb, false);
-
                        goto found;
                }