diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-01-15 08:40:48 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:03:59 -0400 |
commit | cee36a03e8f7c6e14aefd497d3acf01bcd3ef153 (patch) | |
tree | 14195245463be27ab4314da6eb943b146e6c8591 /fs/btrfs/ordered-data.c | |
parent | 61295eb8665e723e77af91d0a1e655a4bd28344f (diff) |
Rework btrfs_drop_inode to avoid scheduling
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ordered-data.c')
-rw-r--r-- | fs/btrfs/ordered-data.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index 411aba84d305..b56011baa17c 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c | |||
@@ -219,3 +219,39 @@ int btrfs_find_del_first_ordered_inode(struct btrfs_ordered_inode_tree *tree, | |||
219 | kfree(entry); | 219 | kfree(entry); |
220 | return 1; | 220 | return 1; |
221 | } | 221 | } |
222 | |||
223 | static int __btrfs_del_ordered_inode(struct btrfs_ordered_inode_tree *tree, | ||
224 | u64 root_objectid, u64 objectid) | ||
225 | { | ||
226 | struct tree_entry *entry; | ||
227 | struct rb_node *node; | ||
228 | struct rb_node *prev; | ||
229 | |||
230 | write_lock(&tree->lock); | ||
231 | node = __tree_search(&tree->tree, root_objectid, objectid, &prev); | ||
232 | if (!node) { | ||
233 | write_unlock(&tree->lock); | ||
234 | return 0; | ||
235 | } | ||
236 | rb_erase(node, &tree->tree); | ||
237 | write_unlock(&tree->lock); | ||
238 | entry = rb_entry(node, struct tree_entry, rb_node); | ||
239 | kfree(entry); | ||
240 | return 1; | ||
241 | } | ||
242 | |||
243 | int btrfs_del_ordered_inode(struct inode *inode) | ||
244 | { | ||
245 | struct btrfs_root *root = BTRFS_I(inode)->root; | ||
246 | u64 root_objectid = root->root_key.objectid; | ||
247 | |||
248 | spin_lock(&root->fs_info->new_trans_lock); | ||
249 | if (root->fs_info->running_transaction) { | ||
250 | struct btrfs_ordered_inode_tree *tree; | ||
251 | tree = &root->fs_info->running_transaction->ordered_inode_tree; | ||
252 | __btrfs_del_ordered_inode(tree, root_objectid, inode->i_ino); | ||
253 | } | ||
254 | spin_unlock(&root->fs_info->new_trans_lock); | ||
255 | return 0; | ||
256 | } | ||
257 | |||