All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: xfs-oss <xfs@oss.sgi.com>
Subject: Re: [PATCH 1/2] xfs: create new metadata UUID field and incompat flag
Date: Fri, 15 May 2015 08:36:10 +1000	[thread overview]
Message-ID: <20150514223610.GU15721@dastard> (raw)
In-Reply-To: <55525437.9070501@sandeen.net>

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@redhat.com>

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@fromorbit.com

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

  parent reply	other threads:[~2015-05-14 22:37 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-12 19:24 [PATCH 0/2 V3] allow UUID changes on V5/CRC filesystems Eric Sandeen
2015-05-12 19:27 ` [PATCH 1/2] xfs: create new metadata UUID field and incompat flag Eric Sandeen
2015-05-14 13:36   ` Brian Foster
2015-05-14 22:36   ` Dave Chinner [this message]
2015-05-14 22:55   ` [PATCH 1/2 V4] " Eric Sandeen
2015-05-12 19:30 ` [PATCH 2/2] xfsprogs: Add new sb_meta_uuid field, update userspace tools to manipulate it Eric Sandeen
2015-05-14 13:39   ` Brian Foster
2015-05-14 16:29     ` Eric Sandeen
2015-05-14 21:54   ` [PATCH 2/2 V4] " Eric Sandeen
2015-05-14 23:00     ` [PATCH 2/2 V5] " Eric Sandeen
2015-05-18 14:35       ` Brian Foster
2015-06-03 11:14 ` [PATCH 0/2 V3] allow UUID changes on V5/CRC filesystems Linda Walsh
2015-06-03 20:31   ` Eric Sandeen
  -- strict thread matches above, loose matches on Subject: below --
2015-05-08 20:40 [PATCH 0/2] " Eric Sandeen
2015-05-08 20:48 ` [PATCH 1/2] xfs: create new metadata UUID field and incompat flag Eric Sandeen
2015-05-11 16:14   ` Brian Foster
2015-05-11 16:52     ` Eric Sandeen
2015-05-11 21:49       ` Dave Chinner
2015-05-11 23:50         ` Eric Sandeen
2015-05-12  1:58           ` Dave Chinner
2015-05-12 11:11         ` Brian Foster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150514223610.GU15721@dastard \
    --to=david@fromorbit.com \
    --cc=sandeen@sandeen.net \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.