Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
0f70abe2
Commit
0f70abe2
authored
Feb 28, 2007
by
Chris Mason
Committed by
David Woodhouse
Feb 28, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Btrfs: more return code checking
Signed-off-by:
Chris Mason
<
chris.mason@oracle.com
>
parent
aa5d6bed
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
11 deletions
+21
-11
fs/btrfs/ctree.c
fs/btrfs/ctree.c
+12
-5
fs/btrfs/extent-tree.c
fs/btrfs/extent-tree.c
+9
-6
No files found.
fs/btrfs/ctree.c
View file @
0f70abe2
...
...
@@ -1087,7 +1087,9 @@ static int del_ptr(struct ctree_root *root, struct ctree_path *path, int level)
break
;
}
level
++
;
free_extent
(
root
,
blocknr
,
1
);
wret
=
free_extent
(
root
,
blocknr
,
1
);
if
(
wret
)
ret
=
wret
;
if
(
!
path
->
nodes
[
level
])
BUG
();
}
...
...
@@ -1136,7 +1138,9 @@ int del_item(struct ctree_root *root, struct ctree_path *path)
wret
=
del_ptr
(
root
,
path
,
1
);
if
(
wret
)
ret
=
wret
;
free_extent
(
root
,
leaf_buf
->
blocknr
,
1
);
wret
=
free_extent
(
root
,
leaf_buf
->
blocknr
,
1
);
if
(
wret
)
ret
=
wret
;
}
}
else
{
int
used
=
leaf_space_used
(
leaf
,
0
,
leaf
->
header
.
nritems
);
...
...
@@ -1173,7 +1177,9 @@ int del_item(struct ctree_root *root, struct ctree_path *path)
if
(
wret
)
ret
=
wret
;
tree_block_release
(
root
,
leaf_buf
);
free_extent
(
root
,
blocknr
,
1
);
wret
=
free_extent
(
root
,
blocknr
,
1
);
if
(
wret
)
ret
=
wret
;
}
else
{
tree_block_release
(
root
,
leaf_buf
);
}
...
...
@@ -1184,7 +1190,8 @@ int del_item(struct ctree_root *root, struct ctree_path *path)
/*
* walk up the tree as far as required to find the next leaf.
* returns 0 if it found something or -1 if there are no greater leaves.
* returns 0 if it found something or 1 if there are no greater leaves.
* returns < 0 on io errors.
*/
int
next_leaf
(
struct
ctree_root
*
root
,
struct
ctree_path
*
path
)
{
...
...
@@ -1196,7 +1203,7 @@ int next_leaf(struct ctree_root *root, struct ctree_path *path)
while
(
level
<
MAX_LEVEL
)
{
if
(
!
path
->
nodes
[
level
])
return
-
1
;
return
1
;
slot
=
path
->
slots
[
level
]
+
1
;
c
=
path
->
nodes
[
level
];
if
(
slot
>=
c
->
node
.
header
.
nritems
)
{
...
...
fs/btrfs/extent-tree.c
View file @
0f70abe2
...
...
@@ -105,7 +105,7 @@ int free_extent(struct ctree_root *root, u64 blocknr, u64 num_blocks)
* ins->offset == number of blocks
* Any available blocks before search_start are skipped.
*/
int
find_free_extent
(
struct
ctree_root
*
orig_root
,
u64
num_blocks
,
static
int
find_free_extent
(
struct
ctree_root
*
orig_root
,
u64
num_blocks
,
u64
search_start
,
u64
search_end
,
struct
key
*
ins
)
{
struct
ctree_path
path
;
...
...
@@ -125,10 +125,8 @@ int find_free_extent(struct ctree_root *orig_root, u64 num_blocks,
ins
->
flags
=
0
;
start_found
=
0
;
ret
=
search_slot
(
root
,
ins
,
&
path
,
0
);
if
(
ret
<
0
)
{
release_path
(
root
,
&
path
);
return
ret
;
}
if
(
ret
<
0
)
goto
error
;
while
(
1
)
{
l
=
&
path
.
nodes
[
0
]
->
leaf
;
...
...
@@ -137,6 +135,8 @@ int find_free_extent(struct ctree_root *orig_root, u64 num_blocks,
ret
=
next_leaf
(
root
,
&
path
);
if
(
ret
==
0
)
continue
;
if
(
ret
<
0
)
goto
error
;
if
(
!
start_found
)
{
ins
->
objectid
=
search_start
;
ins
->
offset
=
num_blocks
;
...
...
@@ -187,6 +187,9 @@ int find_free_extent(struct ctree_root *orig_root, u64 num_blocks,
if
(
ins
->
offset
!=
1
)
BUG
();
return
0
;
error:
release_path
(
root
,
&
path
);
return
ret
;
}
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment