transaction.c (03551d651e9d8ff5b310f9038581b2b030daeb87) transaction.c (8a526c44daeeb14df0f6e3147a58b4b996968830)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2007 Oracle. All rights reserved.
4 */
5
6#include <linux/fs.h>
7#include <linux/slab.h>
8#include <linux/sched.h>

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

1330 list_add_tail(&root->dirty_list,
1331 &trans->transaction->switch_commits);
1332 ret = update_cowonly_root(trans, root);
1333 if (ret)
1334 return ret;
1335 }
1336
1337 /* Now flush any delayed refs generated by updating all of the roots */
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2007 Oracle. All rights reserved.
4 */
5
6#include <linux/fs.h>
7#include <linux/slab.h>
8#include <linux/sched.h>

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

1330 list_add_tail(&root->dirty_list,
1331 &trans->transaction->switch_commits);
1332 ret = update_cowonly_root(trans, root);
1333 if (ret)
1334 return ret;
1335 }
1336
1337 /* Now flush any delayed refs generated by updating all of the roots */
1338 ret = btrfs_run_delayed_refs(trans, (unsigned long)-1);
1338 ret = btrfs_run_delayed_refs(trans, U64_MAX);
1339 if (ret)
1340 return ret;
1341
1342 while (!list_empty(dirty_bgs) || !list_empty(io_bgs)) {
1343 ret = btrfs_write_dirty_block_groups(trans);
1344 if (ret)
1345 return ret;
1346
1347 /*
1348 * We're writing the dirty block groups, which could generate
1349 * delayed refs, which could generate more dirty block groups,
1350 * so we want to keep this flushing in this loop to make sure
1351 * everything gets run.
1352 */
1339 if (ret)
1340 return ret;
1341
1342 while (!list_empty(dirty_bgs) || !list_empty(io_bgs)) {
1343 ret = btrfs_write_dirty_block_groups(trans);
1344 if (ret)
1345 return ret;
1346
1347 /*
1348 * We're writing the dirty block groups, which could generate
1349 * delayed refs, which could generate more dirty block groups,
1350 * so we want to keep this flushing in this loop to make sure
1351 * everything gets run.
1352 */
1353 ret = btrfs_run_delayed_refs(trans, (unsigned long)-1);
1353 ret = btrfs_run_delayed_refs(trans, U64_MAX);
1354 if (ret)
1355 return ret;
1356 }
1357
1358 if (!list_empty(&fs_info->dirty_cowonly_roots))
1359 goto again;
1360
1361 /* Update dev-replace pointer once everything is committed */

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

1563 *
1564 * However this isn't particularly fool proof, because there's no
1565 * synchronization keeping us from changing the tree after this point
1566 * before we do the qgroup_inherit, or even from making changes while
1567 * we're doing the qgroup_inherit. But that's a problem for the future,
1568 * for now flush the delayed refs to narrow the race window where the
1569 * qgroup counters could end up wrong.
1570 */
1354 if (ret)
1355 return ret;
1356 }
1357
1358 if (!list_empty(&fs_info->dirty_cowonly_roots))
1359 goto again;
1360
1361 /* Update dev-replace pointer once everything is committed */

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

1563 *
1564 * However this isn't particularly fool proof, because there's no
1565 * synchronization keeping us from changing the tree after this point
1566 * before we do the qgroup_inherit, or even from making changes while
1567 * we're doing the qgroup_inherit. But that's a problem for the future,
1568 * for now flush the delayed refs to narrow the race window where the
1569 * qgroup counters could end up wrong.
1570 */
1571 ret = btrfs_run_delayed_refs(trans, (unsigned long)-1);
1571 ret = btrfs_run_delayed_refs(trans, U64_MAX);
1572 if (ret) {
1573 btrfs_abort_transaction(trans, ret);
1574 return ret;
1575 }
1576
1577 ret = commit_fs_roots(trans);
1578 if (ret)
1579 goto out;

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

2399 * We needn't worry that this operation will corrupt the snapshots,
2400 * because all the tree which are snapshoted will be forced to COW
2401 * the nodes and leaves.
2402 */
2403 ret = btrfs_run_delayed_items(trans);
2404 if (ret)
2405 goto unlock_reloc;
2406
1572 if (ret) {
1573 btrfs_abort_transaction(trans, ret);
1574 return ret;
1575 }
1576
1577 ret = commit_fs_roots(trans);
1578 if (ret)
1579 goto out;

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

2399 * We needn't worry that this operation will corrupt the snapshots,
2400 * because all the tree which are snapshoted will be forced to COW
2401 * the nodes and leaves.
2402 */
2403 ret = btrfs_run_delayed_items(trans);
2404 if (ret)
2405 goto unlock_reloc;
2406
2407 ret = btrfs_run_delayed_refs(trans, (unsigned long)-1);
2407 ret = btrfs_run_delayed_refs(trans, U64_MAX);
2408 if (ret)
2409 goto unlock_reloc;
2410
2411 /*
2412 * make sure none of the code above managed to slip in a
2413 * delayed item
2414 */
2415 btrfs_assert_delayed_root_empty(fs_info);

--- 270 unchanged lines hidden ---
2408 if (ret)
2409 goto unlock_reloc;
2410
2411 /*
2412 * make sure none of the code above managed to slip in a
2413 * delayed item
2414 */
2415 btrfs_assert_delayed_root_empty(fs_info);

--- 270 unchanged lines hidden ---