diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-02-28 16:46:22 -0500 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-02-28 16:46:22 -0500 |
commit | 0f70abe2b39d19171d4133d2ffdf77fb9113106a (patch) | |
tree | 98e6b00b38579385e64c085be43c65ab66780772 /fs/btrfs/extent-tree.c | |
parent | aa5d6bed255d7f8c655a8f10d760f4247bc8385c (diff) |
Btrfs: more return code checking
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 97715bae7847..074f4b182f16 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -105,8 +105,8 @@ int free_extent(struct ctree_root *root, u64 blocknr, u64 num_blocks) | |||
105 | * ins->offset == number of blocks | 105 | * ins->offset == number of blocks |
106 | * Any available blocks before search_start are skipped. | 106 | * Any available blocks before search_start are skipped. |
107 | */ | 107 | */ |
108 | int find_free_extent(struct ctree_root *orig_root, u64 num_blocks, | 108 | static int find_free_extent(struct ctree_root *orig_root, u64 num_blocks, |
109 | u64 search_start, u64 search_end, struct key *ins) | 109 | u64 search_start, u64 search_end, struct key *ins) |
110 | { | 110 | { |
111 | struct ctree_path path; | 111 | struct ctree_path path; |
112 | struct key *key; | 112 | struct key *key; |
@@ -125,10 +125,8 @@ check_failed: | |||
125 | ins->flags = 0; | 125 | ins->flags = 0; |
126 | start_found = 0; | 126 | start_found = 0; |
127 | ret = search_slot(root, ins, &path, 0); | 127 | ret = search_slot(root, ins, &path, 0); |
128 | if (ret < 0) { | 128 | if (ret < 0) |
129 | release_path(root, &path); | 129 | goto error; |
130 | return ret; | ||
131 | } | ||
132 | 130 | ||
133 | while (1) { | 131 | while (1) { |
134 | l = &path.nodes[0]->leaf; | 132 | l = &path.nodes[0]->leaf; |
@@ -137,6 +135,8 @@ check_failed: | |||
137 | ret = next_leaf(root, &path); | 135 | ret = next_leaf(root, &path); |
138 | if (ret == 0) | 136 | if (ret == 0) |
139 | continue; | 137 | continue; |
138 | if (ret < 0) | ||
139 | goto error; | ||
140 | if (!start_found) { | 140 | if (!start_found) { |
141 | ins->objectid = search_start; | 141 | ins->objectid = search_start; |
142 | ins->offset = num_blocks; | 142 | ins->offset = num_blocks; |
@@ -187,6 +187,9 @@ check_pending: | |||
187 | if (ins->offset != 1) | 187 | if (ins->offset != 1) |
188 | BUG(); | 188 | BUG(); |
189 | return 0; | 189 | return 0; |
190 | error: | ||
191 | release_path(root, &path); | ||
192 | return ret; | ||
190 | } | 193 | } |
191 | 194 | ||
192 | /* | 195 | /* |