Re: [PATCH 1/2] xfs: create new metadata UUID field and incompat flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 12, 2015 at 02:27:51PM -0500, Eric Sandeen wrote:
> This adds a new superblock field, sb_meta_uuid.  If set, along with
> a new incompat flag, the code will use that field on a V5 filesystem
> to compare to metadata UUIDs, which allows us to change the user-
> visible UUID at will.  Userspace handles the setting and clearing
> of the incompat flag as appropriate, as the UUID gets changed; i.e.
> setting the user-visible UUID back to the original UUID (as stored in
> the new field) will remove the incompatible feature flag.
> 
> If the incompat flag is not set, this copies the user-visible UUID into
> into the meta_uuid slot in memory when the superblock is read from disk;
> the meta_uuid field is not written back to disk in this case.
> 
> The remainder of this patch simply switches verifiers, initializers,
> etc to use the new sb_meta_uuid field.
> 
> Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>

Couple of minor things:
>  
>  /*
> + * XFS_SB_FEAT_INCOMPAT_META_UUID indicates that the metadata UUID
> + * is stored separately from the user-visible UUID; this allows the
> + * user-visible UUID to be changed on V5 filesystems which have a
> + * filesystem UUID stamped into every piece of metadata.
> + */
> +static inline int xfs_sb_version_hasmetauuid(xfs_sb_t *sbp)

bool, struct xfs_sb.

> +++ b/fs/xfs/libxfs/xfs_sb.c
> @@ -377,6 +377,17 @@ __xfs_sb_from_disk(
>  	to->sb_pad = 0;
>  	to->sb_pquotino = be64_to_cpu(from->sb_pquotino);
>  	to->sb_lsn = be64_to_cpu(from->sb_lsn);
> +	/*
> +	 * sb_meta_uuid is only on disk if it differs from sb_uuid and the
> +	 * feature flag is set; if not set we keep it only in memory.
> +	 */
> +	if (xfs_sb_version_hasmetauuid(to)) {
> +		memcpy(&to->sb_meta_uuid, &from->sb_meta_uuid,
> +					sizeof(to->sb_meta_uuid));
> +	} else {
> +		memcpy(&to->sb_meta_uuid, &from->sb_uuid,
> +					sizeof(to->sb_meta_uuid));
> +	}

uuid_copy()

>  	/* Convert on-disk flags to in-memory flags? */
>  	if (convert_xquota)
>  		xfs_sb_quota_from_disk(to);
> @@ -518,6 +529,10 @@ xfs_sb_to_disk(
>  				cpu_to_be32(from->sb_features_log_incompat);
>  		to->sb_pad = 0;
>  		to->sb_lsn = cpu_to_be64(from->sb_lsn);
> +		if (xfs_sb_version_hasmetauuid(from)) {
> +			memcpy(&to->sb_meta_uuid, &from->sb_meta_uuid,
> +						sizeof(to->sb_meta_uuid));
> +		}

uuid_copy() here, too.

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs




[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux