transaction.c (e18e4809b10e6c9efb5fe10c1ddcb4ebb690d517) | transaction.c (d1310b2e0cd98eb1348553e69b73827b436dca7b) |
---|---|
1/* 2 * Copyright (C) 2007 Oracle. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public 6 * License v2 as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, --- 56 unchanged lines hidden (view full) --- 65 init_waitqueue_head(&cur_trans->commit_wait); 66 cur_trans->in_commit = 0; 67 cur_trans->use_count = 1; 68 cur_trans->commit_done = 0; 69 cur_trans->start_time = get_seconds(); 70 INIT_LIST_HEAD(&cur_trans->pending_snapshots); 71 list_add_tail(&cur_trans->list, &root->fs_info->trans_list); 72 btrfs_ordered_inode_tree_init(&cur_trans->ordered_inode_tree); | 1/* 2 * Copyright (C) 2007 Oracle. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public 6 * License v2 as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, --- 56 unchanged lines hidden (view full) --- 65 init_waitqueue_head(&cur_trans->commit_wait); 66 cur_trans->in_commit = 0; 67 cur_trans->use_count = 1; 68 cur_trans->commit_done = 0; 69 cur_trans->start_time = get_seconds(); 70 INIT_LIST_HEAD(&cur_trans->pending_snapshots); 71 list_add_tail(&cur_trans->list, &root->fs_info->trans_list); 72 btrfs_ordered_inode_tree_init(&cur_trans->ordered_inode_tree); |
73 extent_map_tree_init(&cur_trans->dirty_pages, | 73 extent_io_tree_init(&cur_trans->dirty_pages, |
74 root->fs_info->btree_inode->i_mapping, 75 GFP_NOFS); 76 } else { 77 cur_trans->num_writers++; 78 cur_trans->num_joined++; 79 } 80 81 return 0; --- 66 unchanged lines hidden (view full) --- 148 149 150int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans, 151 struct btrfs_root *root) 152{ 153 int ret; 154 int err; 155 int werr = 0; | 74 root->fs_info->btree_inode->i_mapping, 75 GFP_NOFS); 76 } else { 77 cur_trans->num_writers++; 78 cur_trans->num_joined++; 79 } 80 81 return 0; --- 66 unchanged lines hidden (view full) --- 148 149 150int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans, 151 struct btrfs_root *root) 152{ 153 int ret; 154 int err; 155 int werr = 0; |
156 struct extent_map_tree *dirty_pages; | 156 struct extent_io_tree *dirty_pages; |
157 struct page *page; 158 struct inode *btree_inode = root->fs_info->btree_inode; 159 u64 start; 160 u64 end; 161 unsigned long index; 162 163 if (!trans || !trans->transaction) { 164 return filemap_write_and_wait(btree_inode->i_mapping); --- 440 unchanged lines hidden (view full) --- 605int btrfs_commit_transaction(struct btrfs_trans_handle *trans, 606 struct btrfs_root *root) 607{ 608 unsigned long joined = 0; 609 unsigned long timeout = 1; 610 struct btrfs_transaction *cur_trans; 611 struct btrfs_transaction *prev_trans = NULL; 612 struct list_head dirty_fs_roots; | 157 struct page *page; 158 struct inode *btree_inode = root->fs_info->btree_inode; 159 u64 start; 160 u64 end; 161 unsigned long index; 162 163 if (!trans || !trans->transaction) { 164 return filemap_write_and_wait(btree_inode->i_mapping); --- 440 unchanged lines hidden (view full) --- 605int btrfs_commit_transaction(struct btrfs_trans_handle *trans, 606 struct btrfs_root *root) 607{ 608 unsigned long joined = 0; 609 unsigned long timeout = 1; 610 struct btrfs_transaction *cur_trans; 611 struct btrfs_transaction *prev_trans = NULL; 612 struct list_head dirty_fs_roots; |
613 struct extent_map_tree *pinned_copy; | 613 struct extent_io_tree *pinned_copy; |
614 DEFINE_WAIT(wait); 615 int ret; 616 617 INIT_LIST_HEAD(&dirty_fs_roots); 618 619 mutex_lock(&root->fs_info->trans_mutex); 620 if (trans->transaction->in_commit) { 621 cur_trans = trans->transaction; --- 12 unchanged lines hidden (view full) --- 634 mutex_lock(&root->fs_info->fs_mutex); 635 return 0; 636 } 637 638 pinned_copy = kmalloc(sizeof(*pinned_copy), GFP_NOFS); 639 if (!pinned_copy) 640 return -ENOMEM; 641 | 614 DEFINE_WAIT(wait); 615 int ret; 616 617 INIT_LIST_HEAD(&dirty_fs_roots); 618 619 mutex_lock(&root->fs_info->trans_mutex); 620 if (trans->transaction->in_commit) { 621 cur_trans = trans->transaction; --- 12 unchanged lines hidden (view full) --- 634 mutex_lock(&root->fs_info->fs_mutex); 635 return 0; 636 } 637 638 pinned_copy = kmalloc(sizeof(*pinned_copy), GFP_NOFS); 639 if (!pinned_copy) 640 return -ENOMEM; 641 |
642 extent_map_tree_init(pinned_copy, | 642 extent_io_tree_init(pinned_copy, |
643 root->fs_info->btree_inode->i_mapping, GFP_NOFS); 644 645 trans->transaction->in_commit = 1; 646 cur_trans = trans->transaction; 647 if (cur_trans->list.prev != &root->fs_info->trans_list) { 648 prev_trans = list_entry(cur_trans->list.prev, 649 struct btrfs_transaction, list); 650 if (!prev_trans->commit_done) { --- 178 unchanged lines hidden --- | 643 root->fs_info->btree_inode->i_mapping, GFP_NOFS); 644 645 trans->transaction->in_commit = 1; 646 cur_trans = trans->transaction; 647 if (cur_trans->list.prev != &root->fs_info->trans_list) { 648 prev_trans = list_entry(cur_trans->list.prev, 649 struct btrfs_transaction, list); 650 if (!prev_trans->commit_done) { --- 178 unchanged lines hidden --- |