diff mbox series

[6/7] btrfs: add a superblock helper to read metadata_uuid or NULL

Message ID 5ab449690af1ec46c64ff6dad0d3702c5ebbe18c.1690792823.git.anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series metadata_uuid misc cleanup and fixes part2 | expand

Commit Message

Anand Jain July 31, 2023, 11:16 a.m. UTC
This is preparatory patch next two patches.

In some parts of the code, when the METADATA_UUID flag is set, we need to
use metadata_uuid otherwise NULL. Add a helper function that do it.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 fs/btrfs/volumes.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

David Sterba Aug. 11, 2023, 3:39 p.m. UTC | #1
On Mon, Jul 31, 2023 at 07:16:37PM +0800, Anand Jain wrote:
> This is preparatory patch next two patches.

There's only one more patch 7/7 and given how short the helper is it
could be done in one patch. The split for perparatory work and actual
use applies more to bigger helpers.
Anand Jain Aug. 14, 2023, 3:35 p.m. UTC | #2
On 11/08/2023 23:39, David Sterba wrote:
> On Mon, Jul 31, 2023 at 07:16:37PM +0800, Anand Jain wrote:
>> This is preparatory patch next two patches.
> 
> There's only one more patch 7/7 and given how short the helper is it
> could be done in one patch. The split for perparatory work and actual
> use applies more to bigger helpers.

  There was one more patch which used this helper initially.
  I'll merge this with 7/7.

Thanks.
diff mbox series

Patch

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 2f470404ff83..661dc69543eb 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -681,6 +681,14 @@  static int btrfs_open_one_device(struct btrfs_fs_devices *fs_devices,
 	return -EINVAL;
 }
 
+static u8 *btrfs_sb_metadata_uuid_or_null(struct btrfs_super_block *sb)
+{
+	bool has_metadata_uuid = (btrfs_super_incompat_flags(sb) &
+				  BTRFS_FEATURE_INCOMPAT_METADATA_UUID);
+
+	return has_metadata_uuid ? sb->metadata_uuid : NULL;
+}
+
 u8 *btrfs_sb_fsid_ptr(struct btrfs_super_block *sb)
 {
 	bool has_metadata_uuid = (btrfs_super_incompat_flags(sb) &