Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
9aca1d51
Commit
9aca1d51
authored
Mar 13, 2007
by
Chris Mason
Committed by
David Woodhouse
Mar 13, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Btrfs: make some funcs static
Signed-off-by:
Chris Mason
<
chris.mason@oracle.com
>
parent
234b63a0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
19 deletions
+44
-19
fs/btrfs/ctree.c
fs/btrfs/ctree.c
+8
-8
fs/btrfs/extent-tree.c
fs/btrfs/extent-tree.c
+36
-11
No files found.
fs/btrfs/ctree.c
View file @
9aca1d51
...
@@ -34,7 +34,7 @@ void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p)
...
@@ -34,7 +34,7 @@ void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p)
memset
(
p
,
0
,
sizeof
(
*
p
));
memset
(
p
,
0
,
sizeof
(
*
p
));
}
}
int
btrfs_cow_block
(
struct
btrfs_root
*
root
,
static
int
btrfs_cow_block
(
struct
btrfs_root
*
root
,
struct
btrfs_buffer
*
buf
,
struct
btrfs_buffer
*
buf
,
struct
btrfs_buffer
*
parent
,
struct
btrfs_buffer
*
parent
,
int
parent_slot
,
int
parent_slot
,
...
@@ -96,7 +96,7 @@ int btrfs_leaf_free_space(struct btrfs_leaf *leaf)
...
@@ -96,7 +96,7 @@ int btrfs_leaf_free_space(struct btrfs_leaf *leaf)
/*
/*
* compare two keys in a memcmp fashion
* compare two keys in a memcmp fashion
*/
*/
int
comp_keys
(
struct
btrfs_disk_key
*
disk
,
struct
btrfs_key
*
k2
)
static
int
comp_keys
(
struct
btrfs_disk_key
*
disk
,
struct
btrfs_key
*
k2
)
{
{
struct
btrfs_key
k1
;
struct
btrfs_key
k1
;
...
@@ -117,7 +117,7 @@ int comp_keys(struct btrfs_disk_key *disk, struct btrfs_key *k2)
...
@@ -117,7 +117,7 @@ int comp_keys(struct btrfs_disk_key *disk, struct btrfs_key *k2)
return
0
;
return
0
;
}
}
int
check_node
(
struct
btrfs_path
*
path
,
int
level
)
static
int
check_node
(
struct
btrfs_path
*
path
,
int
level
)
{
{
int
i
;
int
i
;
struct
btrfs_node
*
parent
=
NULL
;
struct
btrfs_node
*
parent
=
NULL
;
...
@@ -146,7 +146,7 @@ int check_node(struct btrfs_path *path, int level)
...
@@ -146,7 +146,7 @@ int check_node(struct btrfs_path *path, int level)
return
0
;
return
0
;
}
}
int
check_leaf
(
struct
btrfs_path
*
path
,
int
level
)
static
int
check_leaf
(
struct
btrfs_path
*
path
,
int
level
)
{
{
int
i
;
int
i
;
struct
btrfs_leaf
*
leaf
=
&
path
->
nodes
[
level
]
->
leaf
;
struct
btrfs_leaf
*
leaf
=
&
path
->
nodes
[
level
]
->
leaf
;
...
@@ -186,7 +186,7 @@ int check_leaf(struct btrfs_path *path, int level)
...
@@ -186,7 +186,7 @@ int check_leaf(struct btrfs_path *path, int level)
return
0
;
return
0
;
}
}
int
check_block
(
struct
btrfs_path
*
path
,
int
level
)
static
int
check_block
(
struct
btrfs_path
*
path
,
int
level
)
{
{
if
(
level
==
0
)
if
(
level
==
0
)
return
check_leaf
(
path
,
level
);
return
check_leaf
(
path
,
level
);
...
@@ -202,7 +202,7 @@ int check_block(struct btrfs_path *path, int level)
...
@@ -202,7 +202,7 @@ int check_block(struct btrfs_path *path, int level)
*
*
* slot may point to max if the key is bigger than all of the keys
* slot may point to max if the key is bigger than all of the keys
*/
*/
int
generic_bin_search
(
char
*
p
,
int
item_size
,
struct
btrfs_key
*
key
,
static
int
generic_bin_search
(
char
*
p
,
int
item_size
,
struct
btrfs_key
*
key
,
int
max
,
int
*
slot
)
int
max
,
int
*
slot
)
{
{
int
low
=
0
;
int
low
=
0
;
...
@@ -233,7 +233,7 @@ int generic_bin_search(char *p, int item_size, struct btrfs_key *key,
...
@@ -233,7 +233,7 @@ int generic_bin_search(char *p, int item_size, struct btrfs_key *key,
* simple bin_search frontend that does the right thing for
* simple bin_search frontend that does the right thing for
* leaves vs nodes
* leaves vs nodes
*/
*/
int
bin_search
(
struct
btrfs_node
*
c
,
struct
btrfs_key
*
key
,
int
*
slot
)
static
int
bin_search
(
struct
btrfs_node
*
c
,
struct
btrfs_key
*
key
,
int
*
slot
)
{
{
if
(
btrfs_is_leaf
(
c
))
{
if
(
btrfs_is_leaf
(
c
))
{
struct
btrfs_leaf
*
l
=
(
struct
btrfs_leaf
*
)
c
;
struct
btrfs_leaf
*
l
=
(
struct
btrfs_leaf
*
)
c
;
...
@@ -250,7 +250,7 @@ int bin_search(struct btrfs_node *c, struct btrfs_key *key, int *slot)
...
@@ -250,7 +250,7 @@ int bin_search(struct btrfs_node *c, struct btrfs_key *key, int *slot)
return
-
1
;
return
-
1
;
}
}
struct
btrfs_buffer
*
read_node_slot
(
struct
btrfs_root
*
root
,
st
atic
st
ruct
btrfs_buffer
*
read_node_slot
(
struct
btrfs_root
*
root
,
struct
btrfs_buffer
*
parent_buf
,
struct
btrfs_buffer
*
parent_buf
,
int
slot
)
int
slot
)
{
{
...
...
fs/btrfs/extent-tree.c
View file @
9aca1d51
...
@@ -365,8 +365,9 @@ error:
...
@@ -365,8 +365,9 @@ error:
*
*
* returns 0 if everything worked, non-zero otherwise.
* returns 0 if everything worked, non-zero otherwise.
*/
*/
int
alloc_extent
(
struct
btrfs_root
*
root
,
u64
num_blocks
,
u64
search_start
,
static
int
alloc_extent
(
struct
btrfs_root
*
root
,
u64
num_blocks
,
u64
search_end
,
u64
owner
,
struct
btrfs_key
*
ins
)
u64
search_start
,
u64
search_end
,
u64
owner
,
struct
btrfs_key
*
ins
)
{
{
int
ret
;
int
ret
;
int
pending_ret
;
int
pending_ret
;
...
@@ -425,7 +426,12 @@ struct btrfs_buffer *btrfs_alloc_free_block(struct btrfs_root *root)
...
@@ -425,7 +426,12 @@ struct btrfs_buffer *btrfs_alloc_free_block(struct btrfs_root *root)
return
buf
;
return
buf
;
}
}
int
walk_down_tree
(
struct
btrfs_root
*
root
,
struct
btrfs_path
*
path
,
int
*
level
)
/*
* helper function for drop_snapshot, this walks down the tree dropping ref
* counts as it goes.
*/
static
int
walk_down_tree
(
struct
btrfs_root
*
root
,
struct
btrfs_path
*
path
,
int
*
level
)
{
{
struct
btrfs_buffer
*
next
;
struct
btrfs_buffer
*
next
;
struct
btrfs_buffer
*
cur
;
struct
btrfs_buffer
*
cur
;
...
@@ -437,6 +443,9 @@ int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path, int *level)
...
@@ -437,6 +443,9 @@ int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path, int *level)
BUG_ON
(
ret
);
BUG_ON
(
ret
);
if
(
refs
>
1
)
if
(
refs
>
1
)
goto
out
;
goto
out
;
/*
* walk down to the last node level and free all the leaves
*/
while
(
*
level
>
0
)
{
while
(
*
level
>
0
)
{
cur
=
path
->
nodes
[
*
level
];
cur
=
path
->
nodes
[
*
level
];
if
(
path
->
slots
[
*
level
]
>=
if
(
path
->
slots
[
*
level
]
>=
...
@@ -467,7 +476,13 @@ out:
...
@@ -467,7 +476,13 @@ out:
return
0
;
return
0
;
}
}
int
walk_up_tree
(
struct
btrfs_root
*
root
,
struct
btrfs_path
*
path
,
int
*
level
)
/*
* helper for dropping snapshots. This walks back up the tree in the path
* to find the first node higher up where we haven't yet gone through
* all the slots
*/
static
int
walk_up_tree
(
struct
btrfs_root
*
root
,
struct
btrfs_path
*
path
,
int
*
level
)
{
{
int
i
;
int
i
;
int
slot
;
int
slot
;
...
@@ -491,9 +506,15 @@ int walk_up_tree(struct btrfs_root *root, struct btrfs_path *path, int *level)
...
@@ -491,9 +506,15 @@ int walk_up_tree(struct btrfs_root *root, struct btrfs_path *path, int *level)
return
1
;
return
1
;
}
}
/*
* drop the reference count on the tree rooted at 'snap'. This traverses
* the tree freeing any blocks that have a ref count of zero after being
* decremented.
*/
int
btrfs_drop_snapshot
(
struct
btrfs_root
*
root
,
struct
btrfs_buffer
*
snap
)
int
btrfs_drop_snapshot
(
struct
btrfs_root
*
root
,
struct
btrfs_buffer
*
snap
)
{
{
int
ret
;
int
ret
=
0
;;
int
wret
;
int
level
;
int
level
;
struct
btrfs_path
path
;
struct
btrfs_path
path
;
int
i
;
int
i
;
...
@@ -506,18 +527,22 @@ int btrfs_drop_snapshot(struct btrfs_root *root, struct btrfs_buffer *snap)
...
@@ -506,18 +527,22 @@ int btrfs_drop_snapshot(struct btrfs_root *root, struct btrfs_buffer *snap)
path
.
nodes
[
level
]
=
snap
;
path
.
nodes
[
level
]
=
snap
;
path
.
slots
[
level
]
=
0
;
path
.
slots
[
level
]
=
0
;
while
(
1
)
{
while
(
1
)
{
ret
=
walk_down_tree
(
root
,
&
path
,
&
level
);
w
ret
=
walk_down_tree
(
root
,
&
path
,
&
level
);
if
(
ret
>
0
)
if
(
w
ret
>
0
)
break
;
break
;
ret
=
walk_up_tree
(
root
,
&
path
,
&
level
);
if
(
wret
<
0
)
if
(
ret
>
0
)
ret
=
wret
;
wret
=
walk_up_tree
(
root
,
&
path
,
&
level
);
if
(
wret
>
0
)
break
;
break
;
if
(
wret
<
0
)
ret
=
wret
;
}
}
for
(
i
=
0
;
i
<=
orig_level
;
i
++
)
{
for
(
i
=
0
;
i
<=
orig_level
;
i
++
)
{
if
(
path
.
nodes
[
i
])
{
if
(
path
.
nodes
[
i
])
{
btrfs_block_release
(
root
,
path
.
nodes
[
i
]);
btrfs_block_release
(
root
,
path
.
nodes
[
i
]);
}
}
}
}
return
ret
;
return
0
;
}
}
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