Re: [PATCH 3/4] btrfs: Handle another split brain scenario with metadata uuid feature

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

 



On Fri, Jan 10, 2020 at 02:11:34PM +0200, Nikolay Borisov wrote:
>  	list_for_each_entry(fs_devices, &fs_uuids, fs_list) {
> -		if (memcmp(fs_devices->metadata_uuid, fs_devices->fsid,
> -			   BTRFS_FSID_SIZE) != 0 &&
> -		    memcmp(fs_devices->metadata_uuid, disk_super->metadata_uuid,
> -			   BTRFS_FSID_SIZE) == 0 &&
> -		    memcmp(fs_devices->fsid, disk_super->fsid,
> -			   BTRFS_FSID_SIZE) != 0) {
> +		bool changed_fsdevices =
> +			memcmp(fs_devices->metadata_uuid, fs_devices->fsid,
> +			       BTRFS_FSID_SIZE) != 0 &&
> +			memcmp(fs_devices->metadata_uuid,
> +			       disk_super->metadata_uuid, BTRFS_FSID_SIZE) == 0 &&
> +			memcmp(fs_devices->fsid, disk_super->fsid, BTRFS_FSID_SIZE) != 0;
> +
> +		bool unchanged_fsdevices =
> +			memcmp(fs_devices->metadata_uuid, fs_devices->fsid,
> +						  BTRFS_FSID_SIZE) == 0 &&
> +			memcmp(fs_devices->fsid, disk_super->metadata_uuid, BTRFS_FSID_SIZE) == 0;
> +		if (changed_fsdevices || unchanged_fsdevices)
>  			return fs_devices;

This is ugly, I've converted it to if (memcmp) and dropped the
variables.



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

  Powered by Linux