diff options
author | Josef Bacik <josef@toxicpanda.com> | 2022-11-15 11:16:11 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2022-12-05 18:00:58 +0100 |
commit | 3a3178c7f7675661d7bd0c67f57420e20982bd34 (patch) | |
tree | caf19474815271435ee20255f2e7de98a08e7ea6 /fs/btrfs/extent_io.c | |
parent | 1fe5ebc4e17dfbffeefe52abab75b02ad0f3a97e (diff) | |
download | linux-3a3178c7f7675661d7bd0c67f57420e20982bd34.tar.gz linux-3a3178c7f7675661d7bd0c67f57420e20982bd34.tar.bz2 linux-3a3178c7f7675661d7bd0c67f57420e20982bd34.zip |
btrfs: move leaf_data_end into ctree.c
This is only used in ctree.c, with the exception of zero'ing out extent
buffers we're getting ready to write out. In theory we shouldn't have
an extent buffer with 0 items that we're writing out, however I'd rather
be safe than sorry so open code it in extent_io.c, and then copy the
helper into ctree.c. This will make it easier to sync accessors.[ch]
into btrfs-progs, as this requires a helper that isn't defined in
accessors.h.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r-- | fs/btrfs/extent_io.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 8528e7d3f38f..9fc9f8068069 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -2537,7 +2537,11 @@ static void prepare_eb_write(struct extent_buffer *eb) * header 0 1 2 .. N ... data_N .. data_2 data_1 data_0 */ start = btrfs_item_nr_offset(nritems); - end = BTRFS_LEAF_DATA_OFFSET + leaf_data_end(eb); + end = BTRFS_LEAF_DATA_OFFSET; + if (nritems == 0) + end += BTRFS_LEAF_DATA_SIZE(eb->fs_info); + else + end += btrfs_item_offset(eb, nritems - 1); memzero_extent_buffer(eb, start, end - start); } } |