aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2022-11-15 11:16:10 -0500
committerDavid Sterba <dsterba@suse.com>2022-12-05 18:00:58 +0100
commit1fe5ebc4e17dfbffeefe52abab75b02ad0f3a97e (patch)
treee72ecef56bfe33a4bd49ec3c6fa0be6c3b9a25d6 /fs/btrfs/ctree.h
parentbtrfs: move repair_io_failure to bio.c (diff)
downloadwireguard-linux-1fe5ebc4e17dfbffeefe52abab75b02ad0f3a97e.tar.xz
wireguard-linux-1fe5ebc4e17dfbffeefe52abab75b02ad0f3a97e.zip
btrfs: move root helpers back into ctree.h
These accidentally got brought into accessors.h, but belong with the btrfs_root definitions which are currently in ctree.h. Move these to make it easier to sync accessors.[ch] into btrfs-progs. Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 99defab7e1f6..4e58b0532b36 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -335,6 +335,23 @@ struct btrfs_root {
#endif
};
+static inline bool btrfs_root_readonly(const struct btrfs_root *root)
+{
+ /* Byte-swap the constant at compile time, root_item::flags is LE */
+ return (root->root_item.flags & cpu_to_le64(BTRFS_ROOT_SUBVOL_RDONLY)) != 0;
+}
+
+static inline bool btrfs_root_dead(const struct btrfs_root *root)
+{
+ /* Byte-swap the constant at compile time, root_item::flags is LE */
+ return (root->root_item.flags & cpu_to_le64(BTRFS_ROOT_SUBVOL_DEAD)) != 0;
+}
+
+static inline u64 btrfs_root_id(const struct btrfs_root *root)
+{
+ return root->root_key.objectid;
+}
+
/*
* Structure that conveys information about an extent that is going to replace
* all the extents in a file range.