From: Josef Bacik <josef@toxicpanda.com>
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH 15/16] btrfs: move btrfs_map_token to item-accessors
Date: Wed, 14 Sep 2022 13:18:20 -0400 [thread overview]
Message-ID: <980fa7926d0aa651c42a4ff4e58c0d644d712b7e.1663175597.git.josef@toxicpanda.com> (raw)
In-Reply-To: <cover.1663175597.git.josef@toxicpanda.com>
This is specific to the item-accessor code, move it out of ctree.h into
item-accessor.h/.c and then update the users to include the new header
file.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
fs/btrfs/ctree.c | 1 +
fs/btrfs/ctree.h | 16 ++--------------
fs/btrfs/inode.c | 1 +
fs/btrfs/item-accessors.c | 9 +++++++++
fs/btrfs/item-accessors.h | 14 ++++++++++++++
fs/btrfs/tree-log.c | 1 +
6 files changed, 28 insertions(+), 14 deletions(-)
create mode 100644 fs/btrfs/item-accessors.h
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index a5fd4e2369f1..de01c892a885 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -19,6 +19,7 @@
#include "tree-mod-log.h"
#include "tree-checker.h"
#include "fs.h"
+#include "item-accessors.h"
static struct kmem_cache *btrfs_path_cachep;
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index b6e86c1bc4b2..324400c5597f 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -46,6 +46,8 @@ struct btrfs_ref;
struct btrfs_bio;
struct btrfs_ioctl_encoded_io_args;
+struct btrfs_map_token;
+
#define BTRFS_OLDEST_GENERATION 0ULL
#define BTRFS_EMPTY_DIR_SIZE 0
@@ -1174,23 +1176,9 @@ static inline u32 BTRFS_MAX_XATTR_SIZE(const struct btrfs_fs_info *info)
return BTRFS_MAX_ITEM_SIZE(info) - sizeof(struct btrfs_dir_item);
}
-struct btrfs_map_token {
- struct extent_buffer *eb;
- char *kaddr;
- unsigned long offset;
-};
-
#define BTRFS_BYTES_TO_BLKS(fs_info, bytes) \
((bytes) >> (fs_info)->sectorsize_bits)
-static inline void btrfs_init_map_token(struct btrfs_map_token *token,
- struct extent_buffer *eb)
-{
- token->eb = eb;
- token->kaddr = page_address(eb->pages[0]);
- token->offset = 0;
-}
-
/* some macros to generate set/get functions for the struct fields. This
* assumes there is a lefoo_to_cpu for every type, so lets make a simple
* one for u8:
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index a6615106002a..ca6fa9b01785 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -56,6 +56,7 @@
#include "subpage.h"
#include "inode-item.h"
#include "fs.h"
+#include "item-accessors.h"
struct btrfs_iget_args {
u64 ino;
diff --git a/fs/btrfs/item-accessors.c b/fs/btrfs/item-accessors.c
index ec6b0436d09a..7edb59ba99fc 100644
--- a/fs/btrfs/item-accessors.c
+++ b/fs/btrfs/item-accessors.c
@@ -7,6 +7,7 @@
#include "btrfs-printk.h"
#include "ctree.h"
+#include "item-accessors.h"
static bool check_setget_bounds(const struct extent_buffer *eb,
const void *ptr, unsigned off, int size)
@@ -24,6 +25,14 @@ static bool check_setget_bounds(const struct extent_buffer *eb,
return true;
}
+void btrfs_init_map_token(struct btrfs_map_token *token,
+ struct extent_buffer *eb)
+{
+ token->eb = eb;
+ token->kaddr = page_address(eb->pages[0]);
+ token->offset = 0;
+}
+
/*
* 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
diff --git a/fs/btrfs/item-accessors.h b/fs/btrfs/item-accessors.h
new file mode 100644
index 000000000000..1f40aa503047
--- /dev/null
+++ b/fs/btrfs/item-accessors.h
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#ifndef BTRFS_ITEM_ACCESSORS_H
+#define BTRFS_ITEM_ACCESSORS_H
+
+struct btrfs_map_token {
+ struct extent_buffer *eb;
+ char *kaddr;
+ unsigned long offset;
+};
+
+void btrfs_init_map_token(struct btrfs_map_token *token,
+ struct extent_buffer *eb);
+#endif /* BTRFS_ITEM_ACCESSORS_H */
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 90cc8a97c13b..8818a2b19192 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -22,6 +22,7 @@
#include "zoned.h"
#include "inode-item.h"
#include "fs.h"
+#include "item-accessors.h"
#define MAX_CONFLICT_INODES 10
--
2.26.3
next prev parent reply other threads:[~2022-09-14 17:18 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-14 17:18 [PATCH 00/16] btrfs: split out larger chunks of ctree.h Josef Bacik
2022-09-14 17:18 ` [PATCH 01/16] btrfs: move fs wide helpers out " Josef Bacik
2022-09-16 10:34 ` Anand Jain
2022-09-14 17:18 ` [PATCH 02/16] btrfs: move larger compat flag helpers to their own c file Josef Bacik
2022-09-16 11:11 ` Anand Jain
2022-09-16 11:30 ` Anand Jain
2022-10-11 9:46 ` David Sterba
2022-09-14 17:18 ` [PATCH 03/16] btrfs: move the printk helpers out of ctree.h Josef Bacik
2022-09-16 12:13 ` Anand Jain
2022-09-14 17:18 ` [PATCH 04/16] btrfs: push extra checks into __btrfs_abort_transaction Josef Bacik
2022-09-16 12:28 ` Anand Jain
2022-10-11 9:55 ` David Sterba
2022-09-14 17:18 ` [PATCH 05/16] btrfs: move assert and error helpers out of btrfs-printk.h Josef Bacik
2022-09-16 13:21 ` Anand Jain
2022-09-14 17:18 ` [PATCH 06/16] btrfs: push printk index code into their respective helpers Josef Bacik
2022-09-19 12:24 ` Anand Jain
2022-09-14 17:18 ` [PATCH 07/16] btrfs: move BTRFS_FS_STATE* defs and helpers to fs.h Josef Bacik
2022-09-19 12:25 ` Anand Jain
2022-09-14 17:18 ` [PATCH 08/16] btrfs: move incompat and compat flag helpers to fs.c Josef Bacik
2022-09-19 12:26 ` Anand Jain
2022-10-11 10:33 ` David Sterba
2022-10-11 12:01 ` David Sterba
2022-09-14 17:18 ` [PATCH 09/16] btrfs: move mount option definitions to fs.h Josef Bacik
2022-09-19 12:26 ` Anand Jain
2022-09-14 17:18 ` [PATCH 10/16] btrfs: move fs_info->flags enum " Josef Bacik
2022-09-19 12:27 ` Anand Jain
2022-09-14 17:18 ` [PATCH 11/16] btrfs: add a BTRFS_FS_NEED_TRANS_COMMIT flag Josef Bacik
2022-09-19 12:30 ` Anand Jain
2022-09-19 12:33 ` Anand Jain
2022-09-14 17:18 ` [PATCH 12/16] btrfs: remove fs_info::pending_changes and related code Josef Bacik
2022-09-19 12:41 ` Anand Jain
2022-10-11 10:20 ` David Sterba
2022-09-14 17:18 ` [PATCH 13/16] btrfs: move the compat/incompat flag masks to fs.h Josef Bacik
2022-09-19 12:44 ` Anand Jain
2022-09-14 17:18 ` [PATCH 14/16] btrfs: rename struct-funcs.c -> item-accessors.c Josef Bacik
2022-09-19 12:46 ` Anand Jain
2022-09-14 17:18 ` Josef Bacik [this message]
2022-09-19 12:53 ` [PATCH 15/16] btrfs: move btrfs_map_token to item-accessors Anand Jain
2022-10-11 10:39 ` David Sterba
2022-10-11 11:37 ` David Sterba
2022-09-14 17:18 ` [PATCH 16/16] btrfs: move accessor helpers into item-accessors.h Josef Bacik
2022-09-15 8:27 ` Anand Jain
2022-09-15 9:51 ` [PATCH 00/16] btrfs: split out larger chunks of ctree.h Qu Wenruo
2022-10-11 10:48 ` David Sterba
2022-10-10 20:28 ` David Sterba
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=980fa7926d0aa651c42a4ff4e58c0d644d712b7e.1663175597.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox