summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode-item.h
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2023-04-29 16:07:18 -0400
committerDavid Sterba <dsterba@suse.com>2023-06-19 13:59:25 +0200
commitf541833c8eea17e3779e0fce81d3c92a3604d80a (patch)
tree6728ff73da193eed697ff532cc7655ab0b885b30 /fs/btrfs/inode-item.h
parent2cac5af16537f8eafaba5e525fbb5a93160ebaff (diff)
downloadlinux-stable-f541833c8eea17e3779e0fce81d3c92a3604d80a.tar.gz
linux-stable-f541833c8eea17e3779e0fce81d3c92a3604d80a.tar.bz2
linux-stable-f541833c8eea17e3779e0fce81d3c92a3604d80a.zip
btrfs: move split_flags/combine_flags helpers to inode-item.h
These are more related to the inode item flags on disk than the in-memory btrfs_inode, move the helpers to inode-item.h. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/inode-item.h')
-rw-r--r--fs/btrfs/inode-item.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/btrfs/inode-item.h b/fs/btrfs/inode-item.h
index b80aeb715701..ede43b6c6559 100644
--- a/fs/btrfs/inode-item.h
+++ b/fs/btrfs/inode-item.h
@@ -60,6 +60,22 @@ struct btrfs_truncate_control {
bool clear_extent_range;
};
+/*
+ * btrfs_inode_item stores flags in a u64, btrfs_inode stores them in two
+ * separate u32s. These two functions convert between the two representations.
+ */
+static inline u64 btrfs_inode_combine_flags(u32 flags, u32 ro_flags)
+{
+ return (flags | ((u64)ro_flags << 32));
+}
+
+static inline void btrfs_inode_split_flags(u64 inode_item_flags,
+ u32 *flags, u32 *ro_flags)
+{
+ *flags = (u32)inode_item_flags;
+ *ro_flags = (u32)(inode_item_flags >> 32);
+}
+
int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct btrfs_truncate_control *control);