All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH 03/13] btrfs-progs: store BTRFS_LEAF_DATA_SIZE in the fs_info
Date: Tue, 22 Feb 2022 17:26:13 -0500	[thread overview]
Message-ID: <94cb2a8f86edb5ecbe0874ccd7ca3d5514bdab6f.1645568701.git.josef@toxicpanda.com> (raw)
In-Reply-To: <cover.1645568701.git.josef@toxicpanda.com>

This is going to be a different value based on the incompat settings of
the file system, just store this in the fs_info instead of calculating
it every time.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 kernel-shared/ctree.h   | 4 ++--
 kernel-shared/disk-io.c | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel-shared/ctree.h b/kernel-shared/ctree.h
index de5452f2..31169f33 100644
--- a/kernel-shared/ctree.h
+++ b/kernel-shared/ctree.h
@@ -363,8 +363,7 @@ static inline u32 __BTRFS_LEAF_DATA_SIZE(u32 nodesize)
 	return nodesize - sizeof(struct btrfs_header);
 }
 
-#define BTRFS_LEAF_DATA_SIZE(fs_info) \
-				(__BTRFS_LEAF_DATA_SIZE(fs_info->nodesize))
+#define BTRFS_LEAF_DATA_SIZE(fs_info) (fs_info->leaf_data_size)
 
 /*
  * this is a very generous portion of the super block, giving us
@@ -1271,6 +1270,7 @@ struct btrfs_fs_info {
 	u32 nodesize;
 	u32 sectorsize;
 	u32 stripesize;
+	u32 leaf_data_size;
 	u16 csum_type;
 	u16 csum_size;
 
diff --git a/kernel-shared/disk-io.c b/kernel-shared/disk-io.c
index f83ba884..0434ed7d 100644
--- a/kernel-shared/disk-io.c
+++ b/kernel-shared/disk-io.c
@@ -1552,6 +1552,7 @@ static struct btrfs_fs_info *__open_ctree_fd(int fp, struct open_ctree_flags *oc
 	fs_info->stripesize = btrfs_super_stripesize(disk_super);
 	fs_info->csum_type = btrfs_super_csum_type(disk_super);
 	fs_info->csum_size = btrfs_super_csum_size(disk_super);
+	fs_info->leaf_data_size = __BTRFS_LEAF_DATA_SIZE(fs_info->nodesize);
 
 	ret = btrfs_check_fs_compatibility(fs_info->super_copy, flags);
 	if (ret)
-- 
2.26.3


  parent reply	other threads:[~2022-02-22 22:26 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-22 22:26 [PATCH 00/13] btrfs-progs: cleanup btrfs_item* accessors Josef Bacik
2022-02-22 22:26 ` [PATCH 01/13] btrfs-progs: turn on more compiler warnings and use -Wall Josef Bacik
2022-03-08 16:51   ` David Sterba
2022-03-08 18:15     ` David Sterba
2022-03-08 18:26       ` David Sterba
2022-02-22 22:26 ` [PATCH 02/13] btrfs-progs: store LEAF_DATA_SIZE in the mkfs_config Josef Bacik
2022-02-22 22:26 ` Josef Bacik [this message]
2022-02-22 22:26 ` [PATCH 04/13] btrfs-progs: convert: use cfg->leaf_data_size Josef Bacik
2022-03-09 11:48   ` Nikolay Borisov
2022-03-09 14:18     ` David Sterba
2022-02-22 22:26 ` [PATCH 05/13] btrfs-progs: reduce usage of __BTRFS_LEAF_DATA_SIZE Josef Bacik
2022-02-22 22:26 ` [PATCH 06/13] btrfs-progs: btrfs_item_size_nr/btrfs_item_offset_nr everywhere Josef Bacik
2022-03-09 11:45   ` Nikolay Borisov
2022-03-09 12:27     ` Nikolay Borisov
2022-02-22 22:26 ` [PATCH 07/13] btrfs-progs: add btrfs_set_item_*_nr() helpers Josef Bacik
2022-02-22 22:26 ` [PATCH 08/13] btrfs-progs: change btrfs_file_extent_inline_item_len to take a slot Josef Bacik
2022-02-22 22:26 ` [PATCH 09/13] btrfs-progs: rename btrfs_item_end_nr to btrfs_item_end Josef Bacik
2022-02-22 22:26 ` [PATCH 10/13] btrfs-progs: remove the _nr from the item helpers Josef Bacik
2022-02-22 22:26 ` [PATCH 11/13] btrfs-progs: replace btrfs_item_nr_offset(0) Josef Bacik
2022-03-09 12:42   ` Nikolay Borisov
2022-02-22 22:26 ` [PATCH 12/13] btrfs-progs: rework the btrfs_node accessors to match the item accessors Josef Bacik
2022-02-22 22:26 ` [PATCH 13/13] btrfs-progs: make all of the item/key_ptr offset helpers take an eb Josef Bacik
2022-03-09 12:46 ` [PATCH 00/13] btrfs-progs: cleanup btrfs_item* accessors Nikolay Borisov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=94cb2a8f86edb5ecbe0874ccd7ca3d5514bdab6f.1645568701.git.josef@toxicpanda.com \
    --to=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.