@@ -39,23 +39,27 @@ static bool check_setget_bounds(const struct extent_buffer *eb,
3939}
4040
4141/*
42- * this is some deeply nasty code.
42+ * Macro templates that define helpers to read/write extent buffer data of a
43+ * given size, that are also used via ctree.h for access to item members by
44+ * specialized helpers.
4345 *
44- * The end result is that anyone who #includes ctree.h gets a
45- * declaration for the btrfs_set_foo functions and btrfs_foo functions,
46- * which are wrappers of btrfs_set_token_#bits functions and
47- * btrfs_get_token_#bits functions, which are defined in this file.
46+ * Generic helpers:
47+ * - btrfs_set_8 (for 8/16/32/64)
48+ * - btrfs_get_8 (for 8/16/32/64)
4849 *
49- * These setget functions do all the extent_buffer related mapping
50- * required to efficiently read and write specific fields in the extent
51- * buffers. Every pointer to metadata items in btrfs is really just
52- * an unsigned long offset into the extent buffer which has been
53- * cast to a specific type. This gives us all the gcc type checking.
50+ * Generic helpers with a token (cached address of the most recently accessed
51+ * page):
52+ * - btrfs_set_token_8 (for 8/16/32/64)
53+ * - btrfs_get_token_8 (for 8/16/32/64)
5454 *
55- * The extent buffer api is used to do the page spanning work required to
56- * have a metadata blocksize different from the page size.
55+ * The set/get functions handle data spanning two pages transparently, in case
56+ * metadata block size is larger than page. Every pointer to metadata items is
57+ * an offset into the extent buffer page array, cast to a specific type. This
58+ * gives us all the type checking.
5759 *
58- * There are 2 variants defined, one with a token pointer and one without.
60+ * The extent buffer pages stored in the array pages do not form a contiguous
61+ * phyusical range, but the API functions assume the linear offset to the range
62+ * from 0 to metadata node size.
5963 */
6064
6165#define DEFINE_BTRFS_SETGET_BITS (bits ) \
0 commit comments