Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
transaction.h
Go to the documentation of this file.
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,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public
14  * License along with this program; if not, write to the
15  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16  * Boston, MA 021110-1307, USA.
17  */
18 
19 #ifndef __BTRFS_TRANSACTION__
20 #define __BTRFS_TRANSACTION__
21 #include "btrfs_inode.h"
22 #include "delayed-ref.h"
23 #include "ctree.h"
24 
27  /*
28  * total writers in this transaction, it must be zero before the
29  * transaction can end
30  */
33 
34  unsigned long num_joined;
35 
37  int in_commit;
39  int blocked;
40  struct list_head list;
42  unsigned long start_time;
47  int aborted;
48 };
49 
56 };
57 
62  unsigned long use_count;
63  unsigned long blocks_reserved;
64  unsigned long blocks_used;
65  unsigned long delayed_ref_updates;
69  short aborted;
70  short adding_csums;
72  /*
73  * this root is only needed to validate that the root passed to
74  * start_transaction is the same as the one passed to end_transaction.
75  * Subvolume quota depends on this
76  */
77  struct btrfs_root *root;
81 };
82 
84  struct dentry *dentry;
85  struct btrfs_root *root;
86  struct btrfs_root *snap;
88  /* block reservation for the operation */
90  /* extra metadata reseration for relocation */
91  int error;
92  bool readonly;
93  struct list_head list;
94 };
95 
96 static inline void btrfs_set_inode_last_trans(struct btrfs_trans_handle *trans,
97  struct inode *inode)
98 {
99  BTRFS_I(inode)->last_trans = trans->transaction->transid;
100  BTRFS_I(inode)->last_sub_trans = BTRFS_I(inode)->root->log_transid;
101  BTRFS_I(inode)->last_log_commit = BTRFS_I(inode)->root->last_log_commit;
102 }
103 
105  struct btrfs_root *root);
107  int num_items);
109  struct btrfs_root *root, int num_items);
116  struct btrfs_root *root);
117 
118 int btrfs_add_dead_root(struct btrfs_root *root);
119 int btrfs_defrag_root(struct btrfs_root *root, int cacheonly);
122  struct btrfs_root *root);
124  struct btrfs_root *root,
125  int wait_for_unblock);
127  struct btrfs_root *root);
129  struct btrfs_root *root);
131  struct btrfs_root *root);
132 void btrfs_throttle(struct btrfs_root *root);
134  struct btrfs_root *root);
136  struct extent_io_tree *dirty_pages, int mark);
138  struct extent_io_tree *dirty_pages, int mark);
140  struct extent_io_tree *dirty_pages, int mark);
144 #endif