super.c (ebaa1ac12b0c97337a5bad1d57334056791aaa88) super.c (6f9414e0f6f35c7669dad5ac1a838ce323302f03)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * bcache setup/teardown code, and some metadata io - read a superblock and
4 * figure out what to do with it.
5 *
6 * Copyright 2010, 2011 Kent Overstreet <kent.overstreet@gmail.com>
7 * Copyright 2012 Google, Inc.
8 */

--- 1955 unchanged lines hidden (view full) ---

1964 LIST_HEAD(journal);
1965 struct journal_replay *l;
1966
1967 closure_init_stack(&cl);
1968
1969 c->nbuckets = ca->sb.nbuckets;
1970 set_gc_sectors(c);
1971
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * bcache setup/teardown code, and some metadata io - read a superblock and
4 * figure out what to do with it.
5 *
6 * Copyright 2010, 2011 Kent Overstreet <kent.overstreet@gmail.com>
7 * Copyright 2012 Google, Inc.
8 */

--- 1955 unchanged lines hidden (view full) ---

1964 LIST_HEAD(journal);
1965 struct journal_replay *l;
1966
1967 closure_init_stack(&cl);
1968
1969 c->nbuckets = ca->sb.nbuckets;
1970 set_gc_sectors(c);
1971
1972 if (CACHE_SYNC(&c->sb)) {
1972 if (CACHE_SYNC(&c->cache->sb)) {
1973 struct bkey *k;
1974 struct jset *j;
1975
1976 err = "cannot allocate memory for journal";
1977 if (bch_journal_read(c, &journal))
1978 goto err;
1979
1980 pr_debug("btree_journal_read() done\n");

--- 106 unchanged lines hidden (view full) ---

2087 bch_btree_set_root(c->root);
2088 rw_unlock(true, c->root);
2089
2090 /*
2091 * We don't want to write the first journal entry until
2092 * everything is set up - fortunately journal entries won't be
2093 * written until the SET_CACHE_SYNC() here:
2094 */
1973 struct bkey *k;
1974 struct jset *j;
1975
1976 err = "cannot allocate memory for journal";
1977 if (bch_journal_read(c, &journal))
1978 goto err;
1979
1980 pr_debug("btree_journal_read() done\n");

--- 106 unchanged lines hidden (view full) ---

2087 bch_btree_set_root(c->root);
2088 rw_unlock(true, c->root);
2089
2090 /*
2091 * We don't want to write the first journal entry until
2092 * everything is set up - fortunately journal entries won't be
2093 * written until the SET_CACHE_SYNC() here:
2094 */
2095 SET_CACHE_SYNC(&c->sb, true);
2095 SET_CACHE_SYNC(&c->cache->sb, true);
2096
2097 bch_journal_next(&c->journal);
2098 bch_journal_meta(c, &cl);
2099 }
2100
2101 err = "error starting gc thread";
2102 if (bch_gc_thread_start(c))
2103 goto err;

--- 29 unchanged lines hidden (view full) ---

2133 const char *err = "cannot allocate memory";
2134 struct cache_set *c;
2135
2136 list_for_each_entry(c, &bch_cache_sets, list)
2137 if (!memcmp(c->set_uuid, ca->sb.set_uuid, 16)) {
2138 if (c->cache)
2139 return "duplicate cache set member";
2140
2096
2097 bch_journal_next(&c->journal);
2098 bch_journal_meta(c, &cl);
2099 }
2100
2101 err = "error starting gc thread";
2102 if (bch_gc_thread_start(c))
2103 goto err;

--- 29 unchanged lines hidden (view full) ---

2133 const char *err = "cannot allocate memory";
2134 struct cache_set *c;
2135
2136 list_for_each_entry(c, &bch_cache_sets, list)
2137 if (!memcmp(c->set_uuid, ca->sb.set_uuid, 16)) {
2138 if (c->cache)
2139 return "duplicate cache set member";
2140
2141 if (!CACHE_SYNC(&ca->sb))
2142 SET_CACHE_SYNC(&c->sb, false);
2143
2144 goto found;
2145 }
2146
2147 c = bch_cache_set_alloc(&ca->sb);
2148 if (!c)
2149 return err;
2150
2151 err = "error creating kobject";

--- 752 unchanged lines hidden ---
2141 goto found;
2142 }
2143
2144 c = bch_cache_set_alloc(&ca->sb);
2145 if (!c)
2146 return err;
2147
2148 err = "error creating kobject";

--- 752 unchanged lines hidden ---