Commit ef6a31d0 authored by Mark Harmstone's avatar Mark Harmstone Committed by David Sterba
Browse files

btrfs: add definitions and constants for remap-tree



Add an incompat flag for the new remap-tree feature, and the constants
and definitions needed to support it.

Reviewed-by: default avatarBoris Burkov <boris@bur.io>
Signed-off-by: default avatarMark Harmstone <mark@harmstone.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent c208aa0e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1010,6 +1010,10 @@ BTRFS_SETGET_STACK_FUNCS(stack_verity_descriptor_encryption,
BTRFS_SETGET_STACK_FUNCS(stack_verity_descriptor_size,
			 struct btrfs_verity_descriptor_item, size, 64);

BTRFS_SETGET_FUNCS(remap_address, struct btrfs_remap_item, address, 64);
BTRFS_SETGET_STACK_FUNCS(stack_remap_address, struct btrfs_remap_item,
			 address, 64);

/* Cast into the data area of the leaf. */
#define btrfs_item_ptr(leaf, slot, type)				\
	((type *)(btrfs_item_nr_offset(leaf, 0) + btrfs_item_offset(leaf, slot)))
+1 −0
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ static struct btrfs_lockdep_keyset {
	{ .id = BTRFS_FREE_SPACE_TREE_OBJECTID,	DEFINE_NAME("free-space") },
	{ .id = BTRFS_BLOCK_GROUP_TREE_OBJECTID, DEFINE_NAME("block-group") },
	{ .id = BTRFS_RAID_STRIPE_TREE_OBJECTID, DEFINE_NAME("raid-stripe") },
	{ .id = BTRFS_REMAP_TREE_OBJECTID,      DEFINE_NAME("remap") },
	{ .id = 0,				DEFINE_NAME("tree")	},
};

+3 −0
Original line number Diff line number Diff line
@@ -299,6 +299,8 @@ BTRFS_FEAT_ATTR_INCOMPAT(zoned, ZONED);
BTRFS_FEAT_ATTR_INCOMPAT(extent_tree_v2, EXTENT_TREE_V2);
/* Remove once support for raid stripe tree is feature complete. */
BTRFS_FEAT_ATTR_INCOMPAT(raid_stripe_tree, RAID_STRIPE_TREE);
/* Remove once support for remap tree is feature complete. */
BTRFS_FEAT_ATTR_INCOMPAT(remap_tree, REMAP_TREE);
#endif
#ifdef CONFIG_FS_VERITY
BTRFS_FEAT_ATTR_COMPAT_RO(verity, VERITY);
@@ -331,6 +333,7 @@ static struct attribute *btrfs_supported_feature_attrs[] = {
#ifdef CONFIG_BTRFS_EXPERIMENTAL
	BTRFS_FEAT_ATTR_PTR(extent_tree_v2),
	BTRFS_FEAT_ATTR_PTR(raid_stripe_tree),
	BTRFS_FEAT_ATTR_PTR(remap_tree),
#endif
#ifdef CONFIG_FS_VERITY
	BTRFS_FEAT_ATTR_PTR(verity),
+2 −4
Original line number Diff line number Diff line
@@ -913,12 +913,10 @@ int btrfs_check_chunk_valid(const struct btrfs_fs_info *fs_info,
			  length, btrfs_stripe_nr_to_offset(U32_MAX));
		return -EUCLEAN;
	}
	if (unlikely(type & ~(BTRFS_BLOCK_GROUP_TYPE_MASK |
			      BTRFS_BLOCK_GROUP_PROFILE_MASK))) {
	if (unlikely(type & ~BTRFS_BLOCK_GROUP_VALID)) {
		chunk_err(fs_info, leaf, chunk, logical,
			  "unrecognized chunk type: 0x%llx",
			  ~(BTRFS_BLOCK_GROUP_TYPE_MASK |
			    BTRFS_BLOCK_GROUP_PROFILE_MASK) & type);
			  type & ~BTRFS_BLOCK_GROUP_VALID);
		return -EUCLEAN;
	}

+5 −0
Original line number Diff line number Diff line
@@ -57,6 +57,11 @@ enum btrfs_tree_block_status {
	BTRFS_TREE_BLOCK_WRITTEN_NOT_SET,
};


#define BTRFS_BLOCK_GROUP_VALID	(BTRFS_BLOCK_GROUP_TYPE_MASK | \
				 BTRFS_BLOCK_GROUP_PROFILE_MASK | \
				 BTRFS_BLOCK_GROUP_REMAPPED)

/*
 * Exported simply for btrfs-progs which wants to have the
 * btrfs_tree_block_status return codes.
Loading