diff options
author | Mingming <cmm@us.ibm.com> | 2008-05-27 10:55:43 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:03 -0400 |
commit | e1b81e6761bd8419146d4bbe0aadd8b2d348a01c (patch) | |
tree | a21c101b1dddf5acfd26dc8cd09570acb193b25e /fs/btrfs/ordered-data.c | |
parent | da496f2acf61153e0d4d42ded6a53f3367939db0 (diff) |
btrfs delete ordered inode handling fix
Use btrfs_release_file instead of a put_inode call
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 | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index 3814cb0246b4..8dd8180183ff 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c | |||
@@ -231,7 +231,7 @@ int btrfs_find_del_first_ordered_inode(struct btrfs_ordered_inode_tree *tree, | |||
231 | return 1; | 231 | return 1; |
232 | } | 232 | } |
233 | 233 | ||
234 | static int __btrfs_del_ordered_inode(struct btrfs_ordered_inode_tree *tree, | 234 | static void __btrfs_del_ordered_inode(struct btrfs_ordered_inode_tree *tree, |
235 | struct inode *inode, | 235 | struct inode *inode, |
236 | u64 root_objectid, u64 objectid) | 236 | u64 root_objectid, u64 objectid) |
237 | { | 237 | { |
@@ -243,31 +243,38 @@ static int __btrfs_del_ordered_inode(struct btrfs_ordered_inode_tree *tree, | |||
243 | node = __tree_search(&tree->tree, root_objectid, objectid, &prev); | 243 | node = __tree_search(&tree->tree, root_objectid, objectid, &prev); |
244 | if (!node) { | 244 | if (!node) { |
245 | write_unlock(&tree->lock); | 245 | write_unlock(&tree->lock); |
246 | return 0; | 246 | return; |
247 | } | 247 | } |
248 | rb_erase(node, &tree->tree); | 248 | rb_erase(node, &tree->tree); |
249 | BTRFS_I(inode)->ordered_trans = 0; | 249 | BTRFS_I(inode)->ordered_trans = 0; |
250 | write_unlock(&tree->lock); | 250 | write_unlock(&tree->lock); |
251 | atomic_dec(&inode->i_count); | ||
251 | entry = rb_entry(node, struct tree_entry, rb_node); | 252 | entry = rb_entry(node, struct tree_entry, rb_node); |
252 | kfree(entry); | 253 | kfree(entry); |
253 | return 1; | 254 | return; |
254 | } | 255 | } |
255 | 256 | ||
256 | int btrfs_del_ordered_inode(struct inode *inode) | 257 | void btrfs_del_ordered_inode(struct inode *inode) |
257 | { | 258 | { |
258 | struct btrfs_root *root = BTRFS_I(inode)->root; | 259 | struct btrfs_root *root = BTRFS_I(inode)->root; |
259 | u64 root_objectid = root->root_key.objectid; | 260 | u64 root_objectid = root->root_key.objectid; |
260 | int ret = 0; | 261 | |
262 | if (!BTRFS_I(inode)->ordered_trans) { | ||
263 | return; | ||
264 | } | ||
265 | |||
266 | if (mapping_tagged(inode->i_mapping, PAGECACHE_TAG_DIRTY) || | ||
267 | mapping_tagged(inode->i_mapping, PAGECACHE_TAG_WRITEBACK)) | ||
268 | return; | ||
261 | 269 | ||
262 | spin_lock(&root->fs_info->new_trans_lock); | 270 | spin_lock(&root->fs_info->new_trans_lock); |
263 | if (root->fs_info->running_transaction) { | 271 | if (root->fs_info->running_transaction) { |
264 | struct btrfs_ordered_inode_tree *tree; | 272 | struct btrfs_ordered_inode_tree *tree; |
265 | tree = &root->fs_info->running_transaction->ordered_inode_tree; | 273 | tree = &root->fs_info->running_transaction->ordered_inode_tree; |
266 | ret = __btrfs_del_ordered_inode(tree, inode, root_objectid, | 274 | __btrfs_del_ordered_inode(tree, inode, root_objectid, |
267 | inode->i_ino); | 275 | inode->i_ino); |
268 | } | 276 | } |
269 | spin_unlock(&root->fs_info->new_trans_lock); | 277 | spin_unlock(&root->fs_info->new_trans_lock); |
270 | return ret; | ||
271 | } | 278 | } |
272 | 279 | ||
273 | int btrfs_ordered_throttle(struct btrfs_root *root, struct inode *inode) | 280 | int btrfs_ordered_throttle(struct btrfs_root *root, struct inode *inode) |