aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLiu Bo <bo.li.liu@oracle.com>2013-10-11 04:30:23 -0400
committerChris Mason <chris.mason@fusionio.com>2013-11-11 22:01:00 -0500
commit30d133fc221a0ec50030c33aa7bf6931503894c7 (patch)
tree7621261cbc301b13d1946e5c20d68462018e50d3 /fs
parente649e587cbc66287b2a4bff8b2113ad679a2b8d8 (diff)
Btrfs: fixup error path in __btrfs_inc_extent_ref
When we fail to add a reference after a non-inline insertion by some reasons, eg. ENOSPC, we'll abort the transaction, but we don't return this error to the caller who has to walk around again to find something wrong, that's unnecessary. Also fixup other error paths to keep it simple. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/extent-tree.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 054b11dc8edf..c4971108f126 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -1979,7 +1979,6 @@ static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
1979 struct btrfs_extent_item *item; 1979 struct btrfs_extent_item *item;
1980 u64 refs; 1980 u64 refs;
1981 int ret; 1981 int ret;
1982 int err = 0;
1983 1982
1984 path = btrfs_alloc_path(); 1983 path = btrfs_alloc_path();
1985 if (!path) 1984 if (!path)
@@ -1992,14 +1991,9 @@ static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
1992 path, bytenr, num_bytes, parent, 1991 path, bytenr, num_bytes, parent,
1993 root_objectid, owner, offset, 1992 root_objectid, owner, offset,
1994 refs_to_add, extent_op); 1993 refs_to_add, extent_op);
1995 if (ret == 0) 1994 if (ret != -EAGAIN)
1996 goto out; 1995 goto out;
1997 1996
1998 if (ret != -EAGAIN) {
1999 err = ret;
2000 goto out;
2001 }
2002
2003 leaf = path->nodes[0]; 1997 leaf = path->nodes[0];
2004 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_extent_item); 1998 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_extent_item);
2005 refs = btrfs_extent_refs(leaf, item); 1999 refs = btrfs_extent_refs(leaf, item);
@@ -2021,7 +2015,7 @@ static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
2021 btrfs_abort_transaction(trans, root, ret); 2015 btrfs_abort_transaction(trans, root, ret);
2022out: 2016out:
2023 btrfs_free_path(path); 2017 btrfs_free_path(path);
2024 return err; 2018 return ret;
2025} 2019}
2026 2020
2027static int run_delayed_data_ref(struct btrfs_trans_handle *trans, 2021static int run_delayed_data_ref(struct btrfs_trans_handle *trans,