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
4beb1b8b
Commit
4beb1b8b
authored
Mar 14, 2007
by
Chris Mason
Committed by
David Woodhouse
Mar 14, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Btrfs: add leaf data casting helper
Signed-off-by:
Chris Mason
<
chris.mason@oracle.com
>
parent
71087494
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
9 deletions
+8
-9
fs/btrfs/ctree.h
fs/btrfs/ctree.h
+4
-0
fs/btrfs/extent-tree.c
fs/btrfs/extent-tree.c
+2
-6
fs/btrfs/print-tree.c
fs/btrfs/print-tree.c
+2
-3
No files found.
fs/btrfs/ctree.h
View file @
4beb1b8b
...
...
@@ -401,6 +401,10 @@ static inline void btrfs_set_super_blocksize(struct btrfs_super_block *s,
s
->
blocksize
=
cpu_to_le16
(
val
);
}
/* helper function to cast into the data area of the leaf. */
#define btrfs_item_ptr(leaf, slot, type) \
((type *)((leaf)->data + btrfs_item_offset((leaf)->items + (slot))))
struct
btrfs_buffer
*
btrfs_alloc_free_block
(
struct
btrfs_root
*
root
);
int
btrfs_inc_ref
(
struct
btrfs_root
*
root
,
struct
btrfs_buffer
*
buf
);
int
btrfs_free_extent
(
struct
btrfs_root
*
root
,
u64
blocknr
,
u64
num_blocks
);
...
...
fs/btrfs/extent-tree.c
View file @
4beb1b8b
...
...
@@ -41,9 +41,7 @@ static int inc_block_ref(struct btrfs_root *root, u64 blocknr)
BUG
();
BUG_ON
(
ret
!=
0
);
l
=
&
path
.
nodes
[
0
]
->
leaf
;
item
=
(
struct
btrfs_extent_item
*
)(
l
->
data
+
btrfs_item_offset
(
l
->
items
+
path
.
slots
[
0
]));
item
=
btrfs_item_ptr
(
l
,
path
.
slots
[
0
],
struct
btrfs_extent_item
);
refs
=
btrfs_extent_refs
(
item
);
btrfs_set_extent_refs
(
item
,
refs
+
1
);
...
...
@@ -69,9 +67,7 @@ static int lookup_block_ref(struct btrfs_root *root, u64 blocknr, u32 *refs)
if
(
ret
!=
0
)
BUG
();
l
=
&
path
.
nodes
[
0
]
->
leaf
;
item
=
(
struct
btrfs_extent_item
*
)(
l
->
data
+
btrfs_item_offset
(
l
->
items
+
path
.
slots
[
0
]));
item
=
btrfs_item_ptr
(
l
,
path
.
slots
[
0
],
struct
btrfs_extent_item
);
*
refs
=
btrfs_extent_refs
(
item
);
btrfs_release_path
(
root
->
extent_root
,
&
path
);
return
0
;
...
...
fs/btrfs/print-tree.c
View file @
4beb1b8b
...
...
@@ -26,11 +26,10 @@ void btrfs_print_leaf(struct btrfs_leaf *l)
btrfs_item_size
(
item
));
printf
(
"
\t\t
item data %.*s
\n
"
,
btrfs_item_size
(
item
),
l
->
data
+
btrfs_item_offset
(
item
));
ei
=
(
struct
btrfs_extent_item
*
)(
l
->
data
+
btrfs_item_offset
(
item
));
ei
=
btrfs_item_ptr
(
l
,
i
,
struct
btrfs_extent_item
);
printf
(
"
\t\t
extent data refs %u owner %Lu
\n
"
,
btrfs_extent_refs
(
ei
),
btrfs_extent_owner
(
ei
));
ri
=
(
struct
btrfs_root_item
*
)
ei
;
ri
=
btrfs_item_ptr
(
l
,
i
,
struct
btrfs_root_item
)
;
printf
(
"
\t\t
root data blocknr %Lu refs %u
\n
"
,
btrfs_root_blocknr
(
ri
),
btrfs_root_refs
(
ri
));
fflush
(
stdout
);
...
...
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