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
583e4a23
Commit
583e4a23
authored
May 06, 2020
by
David Sterba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
btrfs: update documentation of set/get helpers
Signed-off-by:
David Sterba
<
dsterba@suse.com
>
parent
f472d3c2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
13 deletions
+17
-13
fs/btrfs/struct-funcs.c
fs/btrfs/struct-funcs.c
+17
-13
No files found.
fs/btrfs/struct-funcs.c
View file @
583e4a23
...
...
@@ -39,23 +39,27 @@ static bool check_setget_bounds(const struct extent_buffer *eb,
}
/*
* this is some deeply nasty code.
* Macro templates that define helpers to read/write extent buffer data of a
* given size, that are also used via ctree.h for access to item members by
* specialized helpers.
*
* The end result is that anyone who #includes ctree.h gets a
* declaration for the btrfs_set_foo functions and btrfs_foo functions,
* which are wrappers of btrfs_set_token_#bits functions and
* btrfs_get_token_#bits functions, which are defined in this file.
* Generic helpers:
* - btrfs_set_8 (for 8/16/32/64)
* - btrfs_get_8 (for 8/16/32/64)
*
* These setget functions do all the extent_buffer related mapping
* required to efficiently read and write specific fields in the extent
* buffers. Every pointer to metadata items in btrfs is really just
* an unsigned long offset into the extent buffer which has been
* cast to a specific type. This gives us all the gcc type checking.
* Generic helpers with a token (cached address of the most recently accessed
* page):
* - btrfs_set_token_8 (for 8/16/32/64)
* - btrfs_get_token_8 (for 8/16/32/64)
*
* The extent buffer api is used to do the page spanning work required to
* have a metadata blocksize different from the page size.
* The set/get functions handle data spanning two pages transparently, in case
* metadata block size is larger than page. Every pointer to metadata items is
* an offset into the extent buffer page array, cast to a specific type. This
* gives us all the type checking.
*
* There are 2 variants defined, one with a token pointer and one without.
* The extent buffer pages stored in the array pages do not form a contiguous
* phyusical range, but the API functions assume the linear offset to the range
* from 0 to metadata node size.
*/
#define DEFINE_BTRFS_SETGET_BITS(bits) \
...
...
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