@@ -385,9 +385,11 @@ struct btrfs_header {
385
385
sizeof(struct btrfs_key_ptr))
386
386
#define __BTRFS_LEAF_DATA_SIZE (bs ) ((bs) - sizeof(struct btrfs_header))
387
387
#define BTRFS_LEAF_DATA_SIZE (r ) (__BTRFS_LEAF_DATA_SIZE(r->nodesize))
388
+ #define BTRFS_FILE_EXTENT_INLINE_DATA_START \
389
+ (offsetof(struct btrfs_file_extent_item, disk_bytenr))
388
390
#define BTRFS_MAX_INLINE_DATA_SIZE (r ) (BTRFS_LEAF_DATA_SIZE(r) - \
389
391
sizeof(struct btrfs_item) - \
390
- offsetof(struct btrfs_file_extent_item, disk_bytenr) )
392
+ BTRFS_FILE_EXTENT_INLINE_DATA_START )
391
393
#define BTRFS_MAX_XATTR_SIZE (r ) (BTRFS_LEAF_DATA_SIZE(r) - \
392
394
sizeof(struct btrfs_item) -\
393
395
sizeof(struct btrfs_dir_item))
@@ -896,6 +898,8 @@ struct btrfs_file_extent_item {
896
898
/*
897
899
* disk space consumed by the extent, checksum blocks are included
898
900
* in these numbers
901
+ *
902
+ * At this offset in the structure, the inline extent data start.
899
903
*/
900
904
__le64 disk_bytenr ;
901
905
__le64 disk_num_bytes ;
@@ -3043,14 +3047,12 @@ BTRFS_SETGET_STACK_FUNCS(stack_file_extent_compression,
3043
3047
static inline unsigned long
3044
3048
btrfs_file_extent_inline_start (struct btrfs_file_extent_item * e )
3045
3049
{
3046
- unsigned long offset = (unsigned long )e ;
3047
- offset += offsetof(struct btrfs_file_extent_item , disk_bytenr );
3048
- return offset ;
3050
+ return (unsigned long )e + BTRFS_FILE_EXTENT_INLINE_DATA_START ;
3049
3051
}
3050
3052
3051
3053
static inline u32 btrfs_file_extent_calc_inline_size (u32 datasize )
3052
3054
{
3053
- return offsetof( struct btrfs_file_extent_item , disk_bytenr ) + datasize ;
3055
+ return BTRFS_FILE_EXTENT_INLINE_DATA_START + datasize ;
3054
3056
}
3055
3057
3056
3058
BTRFS_SETGET_FUNCS (file_extent_disk_bytenr , struct btrfs_file_extent_item ,
@@ -3080,9 +3082,7 @@ BTRFS_SETGET_FUNCS(file_extent_other_encoding, struct btrfs_file_extent_item,
3080
3082
static inline u32 btrfs_file_extent_inline_item_len (struct extent_buffer * eb ,
3081
3083
struct btrfs_item * e )
3082
3084
{
3083
- unsigned long offset ;
3084
- offset = offsetof(struct btrfs_file_extent_item , disk_bytenr );
3085
- return btrfs_item_size (eb , e ) - offset ;
3085
+ return btrfs_item_size (eb , e ) - BTRFS_FILE_EXTENT_INLINE_DATA_START ;
3086
3086
}
3087
3087
3088
3088
/* this returns the number of file bytes represented by the inline item.
0 commit comments