Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Anand Jain <anand.jain@oracle.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2 7/9] btrfs: refactor with match_fsid_changed helper
Date: Wed, 24 May 2023 22:56:12 +0200	[thread overview]
Message-ID: <20230524205612.GD30909@twin.jikos.cz> (raw)
In-Reply-To: <f7ecb8bdf8870988b239f0df65c026c642c26218.1684928629.git.anand.jain@oracle.com>

On Wed, May 24, 2023 at 08:02:41PM +0800, Anand Jain wrote:
> We often check if the metadata_uuid is not the same as fsid, and then we
> check if the given fsid matches the metadata_uuid. This patch refactors
> this logic into function match_fsid_changed and utilize it.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
> v2: Rename helper function.
> 
>  fs/btrfs/volumes.c | 48 ++++++++++++++++++++++++++--------------------
>  1 file changed, 27 insertions(+), 21 deletions(-)
> 
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 3d426dbd1199..4ef2a8713628 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -458,6 +458,20 @@ static noinline struct btrfs_fs_devices *find_fsid(
>  	return NULL;
>  }
>  
> +/*
> + * First, checks if the metadata_uuid is different from the fsid in the
> + * given fs_devices. Then, checks if the given fsid is the same as the
> + * metadata_uuid in the fs_devices. If it is, returns true; otherwise,
> + * returns false.
> + */
> +static inline bool match_fsid_changed(struct btrfs_fs_devices *fs_devices,
> +				       u8 *fsid)

The argumetns can be const and I've changed the prefix to be 'check_',
we have similar helpers.

  reply	other threads:[~2023-05-24 21:02 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-24 12:02 [PATCH v2 0/9] btrfs: metadata_uuid refactors part1 Anand Jain
2023-05-24 12:02 ` [PATCH v2 1/9] btrfs: reduce struct btrfs_fs_devices size relocate fsid_change Anand Jain
2023-05-24 20:05   ` David Sterba
2023-05-24 12:02 ` [PATCH v2 2/9] btrfs: streamline fsid checks in alloc_fs_devices Anand Jain
2023-05-24 12:02 ` [PATCH v2 3/9] btrfs: localise has_metadata_uuid check in alloc_fs_devices args Anand Jain
2023-05-24 12:02 ` [PATCH v2 4/9] btrfs: add comment about metadata_uuid in btrfs_fs_devices Anand Jain
2023-05-24 12:02 ` [PATCH v2 5/9] btrfs: simplify check_tree_block_fsid return arg to bool Anand Jain
2023-05-24 12:02 ` [PATCH v2 6/9] btrfs: refactor with match_fsid_fs_devices helper Anand Jain
2023-05-24 20:56   ` David Sterba
2023-05-24 12:02 ` [PATCH v2 7/9] btrfs: refactor with match_fsid_changed helper Anand Jain
2023-05-24 20:56   ` David Sterba [this message]
2023-05-24 12:02 ` [PATCH v2 8/9] btrfs: consolidate uuid memcmp in btrfs_validate_super Anand Jain
2023-05-24 12:02 ` [PATCH v2 9/9] btrfs: add and fix comments in btrfs_fs_devices Anand Jain
2023-05-24 20:57 ` [PATCH v2 0/9] btrfs: metadata_uuid refactors part1 David Sterba
2023-06-27 14:55 ` Guilherme G. Piccoli
2023-06-28  3:52   ` Anand Jain
2023-06-28 13:07     ` Guilherme G. Piccoli

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=20230524205612.GD30909@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=anand.jain@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox