Lines Matching refs:fs_info

134 			btrfs_err(transaction->fs_info,  in btrfs_put_transaction()
162 struct btrfs_fs_info *fs_info = trans->fs_info; in switch_commit_roots() local
171 down_write(&fs_info->commit_root_sem); in switch_commit_roots()
173 if (test_bit(BTRFS_FS_RELOC_RUNNING, &fs_info->flags)) in switch_commit_roots()
174 fs_info->last_reloc_trans = trans->transid; in switch_commit_roots()
193 btrfs_drop_and_free_fs_root(fs_info, root); in switch_commit_roots()
198 up_write(&fs_info->commit_root_sem); in switch_commit_roots()
235 struct btrfs_fs_info *fs_info = trans->fs_info; in btrfs_trans_release_chunk_metadata() local
240 btrfs_block_rsv_release(fs_info, &fs_info->chunk_block_rsv, in btrfs_trans_release_chunk_metadata()
248 static noinline int join_transaction(struct btrfs_fs_info *fs_info, in join_transaction() argument
253 spin_lock(&fs_info->trans_lock); in join_transaction()
256 if (BTRFS_FS_ERROR(fs_info)) { in join_transaction()
257 spin_unlock(&fs_info->trans_lock); in join_transaction()
261 cur_trans = fs_info->running_transaction; in join_transaction()
264 spin_unlock(&fs_info->trans_lock); in join_transaction()
268 spin_unlock(&fs_info->trans_lock); in join_transaction()
274 spin_unlock(&fs_info->trans_lock); in join_transaction()
275 btrfs_lockdep_acquire(fs_info, btrfs_trans_num_writers); in join_transaction()
276 btrfs_lockdep_acquire(fs_info, btrfs_trans_num_extwriters); in join_transaction()
279 spin_unlock(&fs_info->trans_lock); in join_transaction()
298 btrfs_lockdep_acquire(fs_info, btrfs_trans_num_writers); in join_transaction()
299 btrfs_lockdep_acquire(fs_info, btrfs_trans_num_extwriters); in join_transaction()
301 spin_lock(&fs_info->trans_lock); in join_transaction()
302 if (fs_info->running_transaction) { in join_transaction()
307 btrfs_lockdep_release(fs_info, btrfs_trans_num_extwriters); in join_transaction()
308 btrfs_lockdep_release(fs_info, btrfs_trans_num_writers); in join_transaction()
311 } else if (BTRFS_FS_ERROR(fs_info)) { in join_transaction()
312 spin_unlock(&fs_info->trans_lock); in join_transaction()
313 btrfs_lockdep_release(fs_info, btrfs_trans_num_extwriters); in join_transaction()
314 btrfs_lockdep_release(fs_info, btrfs_trans_num_writers); in join_transaction()
319 cur_trans->fs_info = fs_info; in join_transaction()
346 if (!list_empty(&fs_info->tree_mod_seq_list)) in join_transaction()
348 if (!RB_EMPTY_ROOT(&fs_info->tree_mod_log)) in join_transaction()
350 atomic64_set(&fs_info->tree_mod_seq, 0); in join_transaction()
366 list_add_tail(&cur_trans->list, &fs_info->trans_list); in join_transaction()
367 extent_io_tree_init(fs_info, &cur_trans->dirty_pages, in join_transaction()
369 extent_io_tree_init(fs_info, &cur_trans->pinned_extents, in join_transaction()
371 fs_info->generation++; in join_transaction()
372 cur_trans->transid = fs_info->generation; in join_transaction()
373 fs_info->running_transaction = cur_trans; in join_transaction()
375 spin_unlock(&fs_info->trans_lock); in join_transaction()
390 struct btrfs_fs_info *fs_info = root->fs_info; in record_root_in_trans() local
409 spin_lock(&fs_info->fs_roots_radix_lock); in record_root_in_trans()
411 spin_unlock(&fs_info->fs_roots_radix_lock); in record_root_in_trans()
414 radix_tree_tag_set(&fs_info->fs_roots_radix, in record_root_in_trans()
417 spin_unlock(&fs_info->fs_roots_radix_lock); in record_root_in_trans()
450 struct btrfs_fs_info *fs_info = root->fs_info; in btrfs_add_dropped_root() local
459 spin_lock(&fs_info->fs_roots_radix_lock); in btrfs_add_dropped_root()
460 radix_tree_tag_clear(&fs_info->fs_roots_radix, in btrfs_add_dropped_root()
463 spin_unlock(&fs_info->fs_roots_radix_lock); in btrfs_add_dropped_root()
469 struct btrfs_fs_info *fs_info = root->fs_info; in btrfs_record_root_in_trans() local
484 mutex_lock(&fs_info->reloc_mutex); in btrfs_record_root_in_trans()
486 mutex_unlock(&fs_info->reloc_mutex); in btrfs_record_root_in_trans()
502 static void wait_current_trans(struct btrfs_fs_info *fs_info) in wait_current_trans() argument
506 spin_lock(&fs_info->trans_lock); in wait_current_trans()
507 cur_trans = fs_info->running_transaction; in wait_current_trans()
510 spin_unlock(&fs_info->trans_lock); in wait_current_trans()
512 btrfs_might_wait_for_state(fs_info, BTRFS_LOCKDEP_TRANS_UNBLOCKED); in wait_current_trans()
513 wait_event(fs_info->transaction_wait, in wait_current_trans()
518 spin_unlock(&fs_info->trans_lock); in wait_current_trans()
522 static int may_wait_transaction(struct btrfs_fs_info *fs_info, int type) in may_wait_transaction() argument
524 if (test_bit(BTRFS_FS_LOG_RECOVERING, &fs_info->flags)) in may_wait_transaction()
535 struct btrfs_fs_info *fs_info = root->fs_info; in need_reserve_reloc_root() local
537 if (!fs_info->reloc_ctl || in need_reserve_reloc_root()
551 struct btrfs_fs_info *fs_info = root->fs_info; in start_transaction() local
552 struct btrfs_block_rsv *delayed_refs_rsv = &fs_info->delayed_refs_rsv; in start_transaction()
561 if (BTRFS_FS_ERROR(fs_info)) in start_transaction()
578 if (num_items && root != fs_info->chunk_root) { in start_transaction()
579 struct btrfs_block_rsv *rsv = &fs_info->trans_block_rsv; in start_transaction()
582 qgroup_reserved = num_items * fs_info->nodesize; in start_transaction()
595 num_bytes = btrfs_calc_insert_metadata_size(fs_info, num_items); in start_transaction()
606 num_bytes += fs_info->nodesize; in start_transaction()
610 ret = btrfs_block_rsv_add(fs_info, rsv, num_bytes, flush); in start_transaction()
614 btrfs_migrate_to_delayed_refs_rsv(fs_info, rsv, in start_transaction()
630 ret = btrfs_delayed_refs_rsv_refill(fs_info, flush); in start_transaction()
652 sb_start_intwrite(fs_info->sb); in start_transaction()
654 if (may_wait_transaction(fs_info, type)) in start_transaction()
655 wait_current_trans(fs_info); in start_transaction()
658 ret = join_transaction(fs_info, type); in start_transaction()
660 wait_current_trans(fs_info); in start_transaction()
670 cur_trans = fs_info->running_transaction; in start_transaction()
675 h->fs_info = root->fs_info; in start_transaction()
682 may_wait_transaction(fs_info, type)) { in start_transaction()
689 trace_btrfs_space_reservation(fs_info, "transaction", in start_transaction()
691 h->block_rsv = &fs_info->trans_block_rsv; in start_transaction()
709 btrfs_chunk_alloc(h, btrfs_get_alloc_profile(fs_info, flags), in start_transaction()
736 sb_end_intwrite(fs_info->sb); in start_transaction()
740 btrfs_block_rsv_release(fs_info, &fs_info->trans_block_rsv, in start_transaction()
818 btrfs_wait_for_commit(root->fs_info, 0); in btrfs_attach_transaction_barrier()
827 struct btrfs_fs_info *fs_info = commit->fs_info; in wait_for_commit() local
836 btrfs_might_wait_for_state(fs_info, BTRFS_LOCKDEP_TRANS_COMPLETED); in wait_for_commit()
838 btrfs_might_wait_for_state(fs_info, BTRFS_LOCKDEP_TRANS_SUPER_COMMITTED); in wait_for_commit()
855 spin_lock(&fs_info->trans_lock); in wait_for_commit()
856 commit = list_first_entry_or_null(&fs_info->trans_list, in wait_for_commit()
860 spin_unlock(&fs_info->trans_lock); in wait_for_commit()
865 spin_unlock(&fs_info->trans_lock); in wait_for_commit()
869 int btrfs_wait_for_commit(struct btrfs_fs_info *fs_info, u64 transid) in btrfs_wait_for_commit() argument
875 if (transid <= fs_info->last_trans_committed) in btrfs_wait_for_commit()
879 spin_lock(&fs_info->trans_lock); in btrfs_wait_for_commit()
880 list_for_each_entry(t, &fs_info->trans_list, list) { in btrfs_wait_for_commit()
892 spin_unlock(&fs_info->trans_lock); in btrfs_wait_for_commit()
899 if (transid > fs_info->last_trans_committed) in btrfs_wait_for_commit()
905 spin_lock(&fs_info->trans_lock); in btrfs_wait_for_commit()
906 list_for_each_entry_reverse(t, &fs_info->trans_list, in btrfs_wait_for_commit()
916 spin_unlock(&fs_info->trans_lock); in btrfs_wait_for_commit()
927 void btrfs_throttle(struct btrfs_fs_info *fs_info) in btrfs_throttle() argument
929 wait_current_trans(fs_info); in btrfs_throttle()
934 struct btrfs_fs_info *fs_info = trans->fs_info; in should_end_transaction() local
936 if (btrfs_check_space_for_delayed_refs(fs_info)) in should_end_transaction()
939 return !!btrfs_block_rsv_check(&fs_info->global_block_rsv, 5); in should_end_transaction()
956 struct btrfs_fs_info *fs_info = trans->fs_info; in btrfs_trans_release_metadata() local
966 ASSERT(trans->block_rsv == &fs_info->trans_block_rsv); in btrfs_trans_release_metadata()
967 trace_btrfs_space_reservation(fs_info, "transaction", in btrfs_trans_release_metadata()
969 btrfs_block_rsv_release(fs_info, trans->block_rsv, in btrfs_trans_release_metadata()
977 struct btrfs_fs_info *info = trans->fs_info; in __btrfs_end_transaction()
1042 int btrfs_write_marked_extents(struct btrfs_fs_info *fs_info, in btrfs_write_marked_extents() argument
1047 struct address_space *mapping = fs_info->btree_inode->i_mapping; in btrfs_write_marked_extents()
1052 atomic_inc(&BTRFS_I(fs_info->btree_inode)->sync_writers); in btrfs_write_marked_extents()
1088 atomic_dec(&BTRFS_I(fs_info->btree_inode)->sync_writers); in btrfs_write_marked_extents()
1098 static int __btrfs_wait_marked_extents(struct btrfs_fs_info *fs_info, in __btrfs_wait_marked_extents() argument
1103 struct address_space *mapping = fs_info->btree_inode->i_mapping; in __btrfs_wait_marked_extents()
1136 static int btrfs_wait_extents(struct btrfs_fs_info *fs_info, in btrfs_wait_extents() argument
1142 err = __btrfs_wait_marked_extents(fs_info, dirty_pages); in btrfs_wait_extents()
1143 if (test_and_clear_bit(BTRFS_FS_BTREE_ERR, &fs_info->flags)) in btrfs_wait_extents()
1153 struct btrfs_fs_info *fs_info = log_root->fs_info; in btrfs_wait_tree_log_extents() local
1160 err = __btrfs_wait_marked_extents(fs_info, dirty_pages); in btrfs_wait_tree_log_extents()
1162 test_and_clear_bit(BTRFS_FS_LOG1_ERR, &fs_info->flags)) in btrfs_wait_tree_log_extents()
1166 test_and_clear_bit(BTRFS_FS_LOG2_ERR, &fs_info->flags)) in btrfs_wait_tree_log_extents()
1186 struct btrfs_fs_info *fs_info = trans->fs_info; in btrfs_write_and_wait_transaction() local
1190 ret = btrfs_write_marked_extents(fs_info, dirty_pages, EXTENT_DIRTY); in btrfs_write_and_wait_transaction()
1192 ret2 = btrfs_wait_extents(fs_info, dirty_pages); in btrfs_write_and_wait_transaction()
1220 struct btrfs_fs_info *fs_info = root->fs_info; in update_cowonly_root() local
1221 struct btrfs_root *tree_root = fs_info->tree_root; in update_cowonly_root()
1253 struct btrfs_fs_info *fs_info = trans->fs_info; in commit_cowonly_roots() local
1266 eb = btrfs_lock_root_node(fs_info->tree_root); in commit_cowonly_roots()
1267 ret = btrfs_cow_block(trans, fs_info->tree_root, eb, NULL, in commit_cowonly_roots()
1290 while (!list_empty(&fs_info->dirty_cowonly_roots)) { in commit_cowonly_roots()
1292 next = fs_info->dirty_cowonly_roots.next; in commit_cowonly_roots()
1325 if (!list_empty(&fs_info->dirty_cowonly_roots)) in commit_cowonly_roots()
1329 fs_info->dev_replace.committed_cursor_left = in commit_cowonly_roots()
1330 fs_info->dev_replace.cursor_left_last_write_of_item; in commit_cowonly_roots()
1339 void btrfs_maybe_wake_unfinished_drop(struct btrfs_fs_info *fs_info) in btrfs_maybe_wake_unfinished_drop() argument
1346 spin_lock(&fs_info->trans_lock); in btrfs_maybe_wake_unfinished_drop()
1347 if (!list_empty(&fs_info->dead_roots)) { in btrfs_maybe_wake_unfinished_drop()
1348 struct btrfs_root *root = list_first_entry(&fs_info->dead_roots, in btrfs_maybe_wake_unfinished_drop()
1352 spin_unlock(&fs_info->trans_lock); in btrfs_maybe_wake_unfinished_drop()
1356 spin_unlock(&fs_info->trans_lock); in btrfs_maybe_wake_unfinished_drop()
1358 btrfs_wake_unfinished_drop(fs_info); in btrfs_maybe_wake_unfinished_drop()
1368 struct btrfs_fs_info *fs_info = root->fs_info; in btrfs_add_dead_root() local
1370 spin_lock(&fs_info->trans_lock); in btrfs_add_dead_root()
1376 list_add(&root->root_list, &fs_info->dead_roots); in btrfs_add_dead_root()
1378 list_add_tail(&root->root_list, &fs_info->dead_roots); in btrfs_add_dead_root()
1380 spin_unlock(&fs_info->trans_lock); in btrfs_add_dead_root()
1389 struct btrfs_fs_info *fs_info = trans->fs_info; in commit_fs_roots() local
1400 spin_lock(&fs_info->fs_roots_radix_lock); in commit_fs_roots()
1402 ret = radix_tree_gang_lookup_tag(&fs_info->fs_roots_radix, in commit_fs_roots()
1420 radix_tree_tag_clear(&fs_info->fs_roots_radix, in commit_fs_roots()
1423 spin_unlock(&fs_info->fs_roots_radix_lock); in commit_fs_roots()
1441 ret2 = btrfs_update_root(trans, fs_info->tree_root, in commit_fs_roots()
1446 spin_lock(&fs_info->fs_roots_radix_lock); in commit_fs_roots()
1450 spin_unlock(&fs_info->fs_roots_radix_lock); in commit_fs_roots()
1460 struct btrfs_fs_info *info = root->fs_info; in btrfs_defrag_root()
1506 struct btrfs_fs_info *fs_info = src->fs_info; in qgroup_account_snapshot() local
1514 if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags)) in qgroup_account_snapshot()
1575 btrfs_handle_fs_error(fs_info, ret, in qgroup_account_snapshot()
1603 struct btrfs_fs_info *fs_info = trans->fs_info; in create_pending_snapshot() local
1606 struct btrfs_root *tree_root = fs_info->tree_root; in create_pending_snapshot()
1642 pending->error = btrfs_block_rsv_add(fs_info, in create_pending_snapshot()
1657 trace_btrfs_space_reservation(fs_info, "transaction", in create_pending_snapshot()
1780 pending->snap = btrfs_get_new_fs_root(fs_info, objectid, pending->anon_dev); in create_pending_snapshot()
1875 static void update_super_roots(struct btrfs_fs_info *fs_info) in update_super_roots() argument
1880 super = fs_info->super_copy; in update_super_roots()
1882 root_item = &fs_info->chunk_root->root_item; in update_super_roots()
1887 root_item = &fs_info->tree_root->root_item; in update_super_roots()
1891 if (btrfs_test_opt(fs_info, SPACE_CACHE)) in update_super_roots()
1893 else if (test_bit(BTRFS_FS_CLEANUP_SPACE_CACHE_V1, &fs_info->flags)) in update_super_roots()
1895 if (test_bit(BTRFS_FS_UPDATE_UUID_TREE_GEN, &fs_info->flags)) in update_super_roots()
1927 struct btrfs_fs_info *fs_info = trans->fs_info; in btrfs_commit_transaction_async() local
1931 set_bit(BTRFS_FS_COMMIT_TRANS, &fs_info->flags); in btrfs_commit_transaction_async()
1932 wake_up_process(fs_info->transaction_kthread); in btrfs_commit_transaction_async()
1944 btrfs_might_wait_for_state(fs_info, BTRFS_LOCKDEP_TRANS_COMMIT_START); in btrfs_commit_transaction_async()
1945 wait_event(fs_info->transaction_blocked_wait, in btrfs_commit_transaction_async()
1953 struct btrfs_fs_info *fs_info = trans->fs_info; in cleanup_transaction() local
1960 spin_lock(&fs_info->trans_lock); in cleanup_transaction()
1969 if (cur_trans == fs_info->running_transaction) { in cleanup_transaction()
1971 spin_unlock(&fs_info->trans_lock); in cleanup_transaction()
1977 btrfs_might_wait_for_event(fs_info, btrfs_trans_num_writers); in cleanup_transaction()
1981 spin_lock(&fs_info->trans_lock); in cleanup_transaction()
1994 spin_unlock(&fs_info->trans_lock); in cleanup_transaction()
1996 btrfs_cleanup_one_transaction(trans->transaction, fs_info); in cleanup_transaction()
1998 spin_lock(&fs_info->trans_lock); in cleanup_transaction()
1999 if (cur_trans == fs_info->running_transaction) in cleanup_transaction()
2000 fs_info->running_transaction = NULL; in cleanup_transaction()
2001 spin_unlock(&fs_info->trans_lock); in cleanup_transaction()
2004 sb_end_intwrite(fs_info->sb); in cleanup_transaction()
2008 trace_btrfs_transaction_commit(fs_info); in cleanup_transaction()
2012 btrfs_scrub_cancel(fs_info); in cleanup_transaction()
2023 struct btrfs_fs_info *fs_info = trans->fs_info; in btrfs_cleanup_pending_block_groups() local
2027 btrfs_delayed_refs_rsv_release(fs_info, 1); in btrfs_cleanup_pending_block_groups()
2032 static inline int btrfs_start_delalloc_flush(struct btrfs_fs_info *fs_info) in btrfs_start_delalloc_flush() argument
2051 if (btrfs_test_opt(fs_info, FLUSHONCOMMIT)) in btrfs_start_delalloc_flush()
2052 try_to_writeback_inodes_sb(fs_info->sb, WB_REASON_SYNC); in btrfs_start_delalloc_flush()
2056 static inline void btrfs_wait_delalloc_flush(struct btrfs_fs_info *fs_info) in btrfs_wait_delalloc_flush() argument
2058 if (btrfs_test_opt(fs_info, FLUSHONCOMMIT)) in btrfs_wait_delalloc_flush()
2059 btrfs_wait_ordered_roots(fs_info, U64_MAX, 0, (u64)-1); in btrfs_wait_delalloc_flush()
2077 lockdep_assert_held(&trans->fs_info->trans_lock); in add_pending_snapshot()
2083 static void update_commit_stats(struct btrfs_fs_info *fs_info, ktime_t interval) in update_commit_stats() argument
2085 fs_info->commit_stats.commit_count++; in update_commit_stats()
2086 fs_info->commit_stats.last_commit_dur = interval; in update_commit_stats()
2087 fs_info->commit_stats.max_commit_dur = in update_commit_stats()
2088 max_t(u64, fs_info->commit_stats.max_commit_dur, interval); in update_commit_stats()
2089 fs_info->commit_stats.total_commit_dur += interval; in update_commit_stats()
2094 struct btrfs_fs_info *fs_info = trans->fs_info; in btrfs_commit_transaction() local
2102 btrfs_trans_state_lockdep_acquire(fs_info, BTRFS_LOCKDEP_TRANS_COMMIT_START); in btrfs_commit_transaction()
2146 mutex_lock(&fs_info->ro_block_group_mutex); in btrfs_commit_transaction()
2150 mutex_unlock(&fs_info->ro_block_group_mutex); in btrfs_commit_transaction()
2159 spin_lock(&fs_info->trans_lock); in btrfs_commit_transaction()
2165 spin_unlock(&fs_info->trans_lock); in btrfs_commit_transaction()
2171 btrfs_trans_state_lockdep_release(fs_info, in btrfs_commit_transaction()
2185 wake_up(&fs_info->transaction_blocked_wait); in btrfs_commit_transaction()
2186 btrfs_trans_state_lockdep_release(fs_info, BTRFS_LOCKDEP_TRANS_COMMIT_START); in btrfs_commit_transaction()
2188 if (cur_trans->list.prev != &fs_info->trans_list) { in btrfs_commit_transaction()
2198 spin_unlock(&fs_info->trans_lock); in btrfs_commit_transaction()
2208 spin_unlock(&fs_info->trans_lock); in btrfs_commit_transaction()
2211 spin_unlock(&fs_info->trans_lock); in btrfs_commit_transaction()
2218 if (BTRFS_FS_ERROR(fs_info)) { in btrfs_commit_transaction()
2232 ret = btrfs_start_delalloc_flush(fs_info); in btrfs_commit_transaction()
2245 btrfs_lockdep_release(fs_info, btrfs_trans_num_extwriters); in btrfs_commit_transaction()
2246 btrfs_might_wait_for_event(fs_info, btrfs_trans_num_extwriters); in btrfs_commit_transaction()
2253 btrfs_lockdep_release(fs_info, btrfs_trans_num_writers); in btrfs_commit_transaction()
2257 btrfs_wait_delalloc_flush(fs_info); in btrfs_commit_transaction()
2264 btrfs_might_wait_for_event(fs_info, btrfs_trans_pending_ordered); in btrfs_commit_transaction()
2268 btrfs_scrub_pause(fs_info); in btrfs_commit_transaction()
2274 spin_lock(&fs_info->trans_lock); in btrfs_commit_transaction()
2277 spin_unlock(&fs_info->trans_lock); in btrfs_commit_transaction()
2284 btrfs_lockdep_release(fs_info, btrfs_trans_num_writers); in btrfs_commit_transaction()
2285 btrfs_might_wait_for_event(fs_info, btrfs_trans_num_writers); in btrfs_commit_transaction()
2295 btrfs_trans_state_lockdep_acquire(fs_info, BTRFS_LOCKDEP_TRANS_COMPLETED); in btrfs_commit_transaction()
2296 btrfs_trans_state_lockdep_acquire(fs_info, BTRFS_LOCKDEP_TRANS_SUPER_COMMITTED); in btrfs_commit_transaction()
2297 btrfs_trans_state_lockdep_acquire(fs_info, BTRFS_LOCKDEP_TRANS_UNBLOCKED); in btrfs_commit_transaction()
2304 clear_bit(BTRFS_FS_COMMIT_TRANS, &fs_info->flags); in btrfs_commit_transaction()
2308 btrfs_trans_state_lockdep_release(fs_info, BTRFS_LOCKDEP_TRANS_UNBLOCKED); in btrfs_commit_transaction()
2316 mutex_lock(&fs_info->reloc_mutex); in btrfs_commit_transaction()
2349 btrfs_assert_delayed_root_empty(fs_info); in btrfs_commit_transaction()
2361 btrfs_apply_pending_changes(fs_info); in btrfs_commit_transaction()
2366 btrfs_free_log_root_tree(trans, fs_info); in btrfs_commit_transaction()
2389 cur_trans = fs_info->running_transaction; in btrfs_commit_transaction()
2391 btrfs_set_root_node(&fs_info->tree_root->root_item, in btrfs_commit_transaction()
2392 fs_info->tree_root->node); in btrfs_commit_transaction()
2393 list_add_tail(&fs_info->tree_root->dirty_list, in btrfs_commit_transaction()
2396 btrfs_set_root_node(&fs_info->chunk_root->root_item, in btrfs_commit_transaction()
2397 fs_info->chunk_root->node); in btrfs_commit_transaction()
2398 list_add_tail(&fs_info->chunk_root->dirty_list, in btrfs_commit_transaction()
2401 if (btrfs_fs_incompat(fs_info, EXTENT_TREE_V2)) { in btrfs_commit_transaction()
2402 btrfs_set_root_node(&fs_info->block_group_root->root_item, in btrfs_commit_transaction()
2403 fs_info->block_group_root->node); in btrfs_commit_transaction()
2404 list_add_tail(&fs_info->block_group_root->dirty_list, in btrfs_commit_transaction()
2412 update_super_roots(fs_info); in btrfs_commit_transaction()
2414 btrfs_set_super_log_root(fs_info->super_copy, 0); in btrfs_commit_transaction()
2415 btrfs_set_super_log_root_level(fs_info->super_copy, 0); in btrfs_commit_transaction()
2416 memcpy(fs_info->super_for_commit, fs_info->super_copy, in btrfs_commit_transaction()
2417 sizeof(*fs_info->super_copy)); in btrfs_commit_transaction()
2421 clear_bit(BTRFS_FS_LOG1_ERR, &fs_info->flags); in btrfs_commit_transaction()
2422 clear_bit(BTRFS_FS_LOG2_ERR, &fs_info->flags); in btrfs_commit_transaction()
2434 mutex_lock(&fs_info->tree_log_mutex); in btrfs_commit_transaction()
2436 spin_lock(&fs_info->trans_lock); in btrfs_commit_transaction()
2438 fs_info->running_transaction = NULL; in btrfs_commit_transaction()
2439 spin_unlock(&fs_info->trans_lock); in btrfs_commit_transaction()
2440 mutex_unlock(&fs_info->reloc_mutex); in btrfs_commit_transaction()
2442 wake_up(&fs_info->transaction_wait); in btrfs_commit_transaction()
2443 btrfs_trans_state_lockdep_release(fs_info, BTRFS_LOCKDEP_TRANS_UNBLOCKED); in btrfs_commit_transaction()
2447 btrfs_handle_fs_error(fs_info, ret, in btrfs_commit_transaction()
2449 mutex_unlock(&fs_info->tree_log_mutex); in btrfs_commit_transaction()
2460 ret = write_all_supers(fs_info, 0); in btrfs_commit_transaction()
2465 mutex_unlock(&fs_info->tree_log_mutex); in btrfs_commit_transaction()
2475 btrfs_trans_state_lockdep_release(fs_info, BTRFS_LOCKDEP_TRANS_SUPER_COMMITTED); in btrfs_commit_transaction()
2480 btrfs_clear_space_info_full(fs_info); in btrfs_commit_transaction()
2482 fs_info->last_trans_committed = cur_trans->transid; in btrfs_commit_transaction()
2489 btrfs_trans_state_lockdep_release(fs_info, BTRFS_LOCKDEP_TRANS_COMPLETED); in btrfs_commit_transaction()
2491 spin_lock(&fs_info->trans_lock); in btrfs_commit_transaction()
2493 spin_unlock(&fs_info->trans_lock); in btrfs_commit_transaction()
2499 sb_end_intwrite(fs_info->sb); in btrfs_commit_transaction()
2501 trace_btrfs_transaction_commit(fs_info); in btrfs_commit_transaction()
2505 btrfs_scrub_continue(fs_info); in btrfs_commit_transaction()
2512 update_commit_stats(fs_info, interval); in btrfs_commit_transaction()
2517 mutex_unlock(&fs_info->reloc_mutex); in btrfs_commit_transaction()
2518 btrfs_trans_state_lockdep_release(fs_info, BTRFS_LOCKDEP_TRANS_UNBLOCKED); in btrfs_commit_transaction()
2520 btrfs_trans_state_lockdep_release(fs_info, BTRFS_LOCKDEP_TRANS_SUPER_COMMITTED); in btrfs_commit_transaction()
2521 btrfs_trans_state_lockdep_release(fs_info, BTRFS_LOCKDEP_TRANS_COMPLETED); in btrfs_commit_transaction()
2522 btrfs_scrub_continue(fs_info); in btrfs_commit_transaction()
2528 btrfs_warn(fs_info, "Skipping commit of aborted transaction."); in btrfs_commit_transaction()
2536 btrfs_lockdep_release(fs_info, btrfs_trans_num_extwriters); in btrfs_commit_transaction()
2537 btrfs_lockdep_release(fs_info, btrfs_trans_num_writers); in btrfs_commit_transaction()
2541 btrfs_trans_state_lockdep_release(fs_info, BTRFS_LOCKDEP_TRANS_COMMIT_START); in btrfs_commit_transaction()
2556 int btrfs_clean_one_deleted_snapshot(struct btrfs_fs_info *fs_info) in btrfs_clean_one_deleted_snapshot() argument
2561 spin_lock(&fs_info->trans_lock); in btrfs_clean_one_deleted_snapshot()
2562 if (list_empty(&fs_info->dead_roots)) { in btrfs_clean_one_deleted_snapshot()
2563 spin_unlock(&fs_info->trans_lock); in btrfs_clean_one_deleted_snapshot()
2566 root = list_first_entry(&fs_info->dead_roots, in btrfs_clean_one_deleted_snapshot()
2569 spin_unlock(&fs_info->trans_lock); in btrfs_clean_one_deleted_snapshot()
2571 btrfs_debug(fs_info, "cleaner removing %llu", root->root_key.objectid); in btrfs_clean_one_deleted_snapshot()
2585 void btrfs_apply_pending_changes(struct btrfs_fs_info *fs_info) in btrfs_apply_pending_changes() argument
2590 prev = xchg(&fs_info->pending_changes, 0); in btrfs_apply_pending_changes()
2596 btrfs_debug(fs_info, "pending commit done"); in btrfs_apply_pending_changes()
2600 btrfs_warn(fs_info, in btrfs_apply_pending_changes()