super.c (da415a096fc06e49d1a15f7a06bcfe6ad44c5d38) | super.c (2a285686c109816ba71a00b9278262cf02648258) |
---|---|
1/* 2 * bcache setup/teardown code, and some metadata io - read a superblock and 3 * figure out what to do with it. 4 * 5 * Copyright 2010, 2011 Kent Overstreet <kent.overstreet@gmail.com> 6 * Copyright 2012 Google, Inc. 7 */ 8 --- 1384 unchanged lines hidden (view full) --- 1393 1394 if (c->gc_thread) 1395 kthread_stop(c->gc_thread); 1396 1397 if (!IS_ERR_OR_NULL(c->root)) 1398 list_add(&c->root->list, &c->btree_cache); 1399 1400 /* Should skip this if we're unregistering because of an error */ | 1/* 2 * bcache setup/teardown code, and some metadata io - read a superblock and 3 * figure out what to do with it. 4 * 5 * Copyright 2010, 2011 Kent Overstreet <kent.overstreet@gmail.com> 6 * Copyright 2012 Google, Inc. 7 */ 8 --- 1384 unchanged lines hidden (view full) --- 1393 1394 if (c->gc_thread) 1395 kthread_stop(c->gc_thread); 1396 1397 if (!IS_ERR_OR_NULL(c->root)) 1398 list_add(&c->root->list, &c->btree_cache); 1399 1400 /* Should skip this if we're unregistering because of an error */ |
1401 list_for_each_entry(b, &c->btree_cache, list) | 1401 list_for_each_entry(b, &c->btree_cache, list) { 1402 mutex_lock(&b->write_lock); |
1402 if (btree_node_dirty(b)) | 1403 if (btree_node_dirty(b)) |
1403 bch_btree_node_write(b, NULL); | 1404 __bch_btree_node_write(b, NULL); 1405 mutex_unlock(&b->write_lock); 1406 } |
1404 1405 for_each_cache(ca, c, i) 1406 if (ca->alloc_thread) 1407 kthread_stop(ca->alloc_thread); 1408 1409 cancel_delayed_work_sync(&c->journal.work); 1410 /* flush last journal entry if needed */ 1411 c->journal.work.work.func(&c->journal.work.work); --- 250 unchanged lines hidden (view full) --- 1662 if (__uuid_write(c)) 1663 goto err; 1664 1665 err = "cannot allocate new btree root"; 1666 c->root = bch_btree_node_alloc(c, 0, true); 1667 if (IS_ERR_OR_NULL(c->root)) 1668 goto err; 1669 | 1407 1408 for_each_cache(ca, c, i) 1409 if (ca->alloc_thread) 1410 kthread_stop(ca->alloc_thread); 1411 1412 cancel_delayed_work_sync(&c->journal.work); 1413 /* flush last journal entry if needed */ 1414 c->journal.work.work.func(&c->journal.work.work); --- 250 unchanged lines hidden (view full) --- 1665 if (__uuid_write(c)) 1666 goto err; 1667 1668 err = "cannot allocate new btree root"; 1669 c->root = bch_btree_node_alloc(c, 0, true); 1670 if (IS_ERR_OR_NULL(c->root)) 1671 goto err; 1672 |
1673 mutex_lock(&c->root->write_lock); |
|
1670 bkey_copy_key(&c->root->key, &MAX_KEY); 1671 bch_btree_node_write(c->root, &cl); | 1674 bkey_copy_key(&c->root->key, &MAX_KEY); 1675 bch_btree_node_write(c->root, &cl); |
1676 mutex_unlock(&c->root->write_lock); |
|
1672 1673 bch_btree_set_root(c->root); 1674 rw_unlock(true, c->root); 1675 1676 /* 1677 * We don't want to write the first journal entry until 1678 * everything is set up - fortunately journal entries won't be 1679 * written until the SET_CACHE_SYNC() here: --- 433 unchanged lines hidden --- | 1677 1678 bch_btree_set_root(c->root); 1679 rw_unlock(true, c->root); 1680 1681 /* 1682 * We don't want to write the first journal entry until 1683 * everything is set up - fortunately journal entries won't be 1684 * written until the SET_CACHE_SYNC() here: --- 433 unchanged lines hidden --- |