From patchwork Mon Jul 31 11:16:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13334424 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0F27C00528 for ; Mon, 31 Jul 2023 11:17:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232445AbjGaLRt (ORCPT ); Mon, 31 Jul 2023 07:17:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232490AbjGaLRm (ORCPT ); Mon, 31 Jul 2023 07:17:42 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 812EF10C3 for ; Mon, 31 Jul 2023 04:17:41 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36VAiSq2009152 for ; Mon, 31 Jul 2023 11:17:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=nWKPc/BUfUg67DabtGQJk8kFA9sObk04PqH2t/XSQG8=; b=tyf/00RCNxeqhdDEzMbVm0FE2LXk5Ap9835CodTkM2NGyzZx6GEpRGuJ8WJP3X213sd9 Z5tKw87+sfg/J9NU8upWFAW/DOuO6ZCVY7oMpZvAhspzt6+3XaLE3DZtIsERAYUAflz3 XVm9g3aD5Z8T1JET8cuyp39PVmW082jYhUweoPmpzSkY3/MpEFYWTlhnoSMWFbxI/dop 5+uMP5m02agEXmyw4MfA6lCBE2otHiiRiu/I5q0wmZ/fUtlhd1KHwvs4VflpEPoVjxr2 hQoYhPDFI4xudO6S5tCGdIgCbA+TYY27OVehk4UcJS4oqAn4pgIfiT7v+g73nQFTGVsm eA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3s4uaut9y0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 31 Jul 2023 11:17:41 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36V9ijpA008576 for ; Mon, 31 Jul 2023 11:17:39 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2104.outbound.protection.outlook.com [104.47.70.104]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3s4s7aw23t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 31 Jul 2023 11:17:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iIqfonZEEBrOFBDuzzoQuP4PXGDtc/Uu3cZkqiw+1ys5pDKFf4aTmY+OiacoC/CThdCRmeVk3nHLR8Y0gUhR6d1EBjAWgVNwNayhJloLZaz4HXW/L6PhnRF4hzEHWFfjcME5HTkjmkF/UU+q2MIFKG50Zd64zlmNDnwCVzD3htHS5sYYuAbmXlmx0q/Q3w3zujj8MY0+rrdwO7BZPWej9nOtduxJ0WZyapQyDmqXwgh0OrFZj0n02x5yFCKGyew0sdr9AkTZDCV6HaZX/hIRClKAUmE+uI04t21fqERwlisBr7QWlUKmAaKMs7EG73xo92IG+GrrCyQtiNrReMyWpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nWKPc/BUfUg67DabtGQJk8kFA9sObk04PqH2t/XSQG8=; b=gxpzMumEReGBNovftNivcFKgQe4VyNFGN0ViCttqLBlmM02hMnTsFPMCymJISDGG8a/DTBpjUEdTlC8cesDJk2GA3jLKubrY4BDpib3biqLWQdS8t8gktLwpYTsRwCb/AN004kAJUMkhKYvRREpgy/rruW8V2bpG9UtFG+ghDIz8+MlhcXhBwstPsGFZrKmrIq5R0uA85XbmjJZuCFj0aLrx6WxWJkT7PsYZR05UtN9y4fA4bXoZqsdNfWpD/0dTX1cvdYuFhBMUIA5vZAQ7dKhP+kBhMZQr5Y4aPDMHlv2TInWN7TK/emTi2sHKaj2VkvTnbnZDRM86zLkES2VSZQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nWKPc/BUfUg67DabtGQJk8kFA9sObk04PqH2t/XSQG8=; b=R1fnqfaS7JnAKe+coedcwLhce21jhqxcQGPggSoGUN0Lrc5Q24DYBEMpYN6kLSyghyvcbEtmPCx0iGLGXkrX38snTy4GqyTIJxBBdyyXeha386cyuDQj0nqBVxMe5614Uny+VwQq7Vr7ldMQxqOIKquNLNmokn7hKD95XhlQ0oE= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by BY5PR10MB4113.namprd10.prod.outlook.com (2603:10b6:a03:20d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.43; Mon, 31 Jul 2023 11:17:38 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56%4]) with mapi id 15.20.6631.042; Mon, 31 Jul 2023 11:17:37 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH 1/7] btrfs: add a helper to read the superblock metadata_uuid Date: Mon, 31 Jul 2023 19:16:32 +0800 Message-Id: <1cd0b6f911758c85fd135c24d88c3b0b9f0f85a4.1690792823.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0013.apcprd02.prod.outlook.com (2603:1096:4:1f7::7) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|BY5PR10MB4113:EE_ X-MS-Office365-Filtering-Correlation-Id: 6285f2ad-40c1-49c0-62b9-08db91b7bf31 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WbU6y8LD3lu9fE3e21B5Q3ADAPmid1uCa6bYmPSvRTKLUhIrmxcVdqam/AbXmEeJkAEjIw0hgMKMJNRwBxREEIeCFLJUGTM4wlLqHAe6fCypBKMqz4EiknmD+/vLlJnG8cWlgSk2Yt/UJdhOoxvzehnXknuBtxGuH1WDNN3Ez2pRlL17rnHjPgJnj/p3bBTrhckm7Enm89uUmENgxF2F5bSXtiqtzY1koPSrcRDXWYuBA4LVI9VC6lI/aDC2FduGoWAXh1yOT00BEDtE/5XskA8aeJbvUteA1tf0bqlkpi5WsubfkABWfHYENepXlJkgpJ5a4UymDyDeBGOEnGfzix4jUzniJkQKqkVXqzVZGRuTXQZcmyAjfOT/5ptiRCC1jHUpQkTo9k7n8R/Zl/FZE5u9fhFavFsON/OjmwlVjd2QUP28LY3+YuA/14EjLv8ONg/UxmmCrrdQdHeN41CptwtjtRrq7JCtJ+VJqc4i/kEhHJlpPRxrK73i4kaYju/GfmSqfWcFPWMRUqWin72GY1/8+x6SFjZZ3FBzo+h8DDOTaz4inpS6TiPtUdFht+49 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB5706.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(366004)(39860400002)(346002)(376002)(396003)(451199021)(6512007)(6486002)(36756003)(2616005)(26005)(6506007)(83380400001)(107886003)(186003)(44832011)(66946007)(66556008)(86362001)(66476007)(316002)(4326008)(5660300002)(6916009)(8676002)(8936002)(41300700001)(38100700002)(2906002)(6666004)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4FZdbdr83ERqGAaJQQQj8v5fu2UwuxjI6arfMOUXsbnHvz7hJMbZy5RxIM5bkyb4w4gi1JSDETqaFLCqVRMw6QZcpwb2cA93qqhfnx2GWQfvM/UCkCqg8tiOkPac5quOCJjzRYj9LQe2onBF45rBBIk0Hdj4b7zSR4wQV0YxA6ZIvWYwCPEfeqcfQmrWxsUAxblhbX5Pizmj0r0d6FKcXbACOY0/oOdieq4Eyb1Rh74ENZZKobum+Y6NpMe/UZfrAH0lIrMS4yKO2Ww8GPQrq1ehjzANRe/JWG0fiuGsnwx1wS35svHnDRLbFZ9d6nV8XdJJ49XdZuDhFA1kLN7tE1JFSoTLdlQdYCT9eCKQMHdbRapJGFFqV/OxCzuAPvkYmk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T+JGlBWrG8D1ZXx31FWwBH4pnEh+i9sPWiMkQ44vq6QPMpRI8qHsEfKiwK5n66pTKqBbp0vcjRQmH4zhDQ2D1gb4GF9LpAjhGLk6+yxQGexJZN1qde0OVMdUd3K9lDkJ8PNa0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: L/N2HtHVxqupydIBnf+5S2zoWDdkUJDALYZ8q+0cSW8fe0fkCj6gZNwfp/3k7coaz/Sb9ojIT1jdyIdzvXOEBexkU4oIc1LJCDGGsj3Z1Ld9VwmW8bsPuWKkvZDYwcWER/mRNINyP9Fh8WRj/AunMgJdaAP3WBn8X+pKoFC/MNHT4LtqPQLwliBwD1vgt92WrFTfwBBl6u+peDcfXd/4sxRvry90kT+YiawYU98jIPzm/HWl1zq6g7GKmvvNR3VR7S127oj605ysepcfMLBZhlqu9wPB/bci+3FMB/WnRt2sydRpWx8+YF7NelsE3WlOL7PS7zcSI6xcnWr1k1igKFgSYCLVsqKd2EDdk9i7NNcqF8RPYgWNaehYXIs//0pUSs1TqUJlc2y0vdlbYATAxI7pu7xFmJ3p5La7Gc2URIgZNdR17kh2x8FhM/ksXHMpYSWVcRm8vaR6I458q1DDSFjBYVojnAW/FfBJ3E8b6tAeCBK4vR9LMN+v4+a7DkTvDvxJiGL+vnQK24QT93DgMuKwPBIlxNZ4eNOw957vwdxIy+a8Rlowz4kaRal8h1JqqTXhg872ppG5VQvWogASScZomt7vilGWqnWMQHo380FA4zZxdha9t0Zwhoa+bK7kMU7Or2FW3IrTBOQAWeOxIFVLhm2wXEWQriTDwqwXX++noCyS8k7uKCLI44mYeSr4p4vxJ/ALZ9RjcB9wF/BW9M/YHQ833y0wEzeoIhp8U3LhCdotYVw5JTmYqTqIuNqpkLO5OSUmlySdVnIKH8fZPg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6285f2ad-40c1-49c0-62b9-08db91b7bf31 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2023 11:17:37.9064 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 3ki6OH2IVpIjRfG/tjpSltH/lJU1x2JK7fmOV3xsiTLBnxD5qDteCtgDPUYz3IUjzESC9fiQ48ZUuHfE76tZIw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4113 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-31_04,2023-07-31_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 phishscore=0 mlxscore=0 adultscore=0 malwarescore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307310101 X-Proofpoint-ORIG-GUID: Quo136c0xaTh8nvNPw-urlDSoDxutROe X-Proofpoint-GUID: Quo136c0xaTh8nvNPw-urlDSoDxutROe Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org In some cases, we need to read the FSID from the superblock when the metadata_uuid is not set, and otherwise, read the metadata_uuid. So, add a helper. Signed-off-by: Anand Jain Reviewed-by: Johannes Thumshirn --- fs/btrfs/volumes.c | 8 ++++++++ fs/btrfs/volumes.h | 1 + 2 files changed, 9 insertions(+) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 70d69d4b44d2..2020b1fac764 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; } +u8 *btrfs_sb_fsid_ptr(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 : sb->fsid; +} + /* * Handle scanned device having its CHANGING_FSID_V2 flag set and the fs_devices * being created with a disk that has already completed its fsid change. Such diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index b8c51f16ba86..0f87057bb575 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h @@ -749,5 +749,6 @@ int btrfs_verify_dev_extents(struct btrfs_fs_info *fs_info); bool btrfs_repair_one_zone(struct btrfs_fs_info *fs_info, u64 logical); bool btrfs_pinned_by_swapfile(struct btrfs_fs_info *fs_info, void *ptr); +u8 *btrfs_sb_fsid_ptr(struct btrfs_super_block *sb); #endif From patchwork Mon Jul 31 11:16:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13334425 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21E58C001DC for ; Mon, 31 Jul 2023 11:17:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232475AbjGaLRu (ORCPT ); Mon, 31 Jul 2023 07:17:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232312AbjGaLRt (ORCPT ); Mon, 31 Jul 2023 07:17:49 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD8AABF for ; Mon, 31 Jul 2023 04:17:48 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36VAitCS000970 for ; Mon, 31 Jul 2023 11:17:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=UbZIy/MO5Br6DUs7FbAFzoJcjg1EFjWeWaRSWGyMuu0=; b=QrFOpP7PQv4h7/8WQdXLRd/l3O09Kky3X0srJtF9Pvt9qXN8bvf8uw/iD/XwhoRo65w1 sPia+NF0VGJAC2ex1k4GQQWYw3/wL0wcp7G5xgnku7vLrfUN8itF7Wj0MA61q8/Fy448 sEBp0HOhCg/m8FKBjCtnc/DuKzdqWgkP5jZeAL0aQb8WTUIBfcRNfoowLfjyX98NBYQ2 HlGWoQnzf66ennYhZkhSV6TcdOiNHQM0K4GQC4DrCL0PCCF6T/9gSoJooGPaMLqKWJyz Cga5zeoT4jQa/3zKe5xeVqkKS4nit09iPh3FgD7ZH/wrwrplGSgSfzpxAI9vTBwiYQic ow== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3s4sc2abp8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 31 Jul 2023 11:17:48 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36V9ZvUh008708 for ; Mon, 31 Jul 2023 11:17:46 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2101.outbound.protection.outlook.com [104.47.70.101]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3s4s7aw273-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 31 Jul 2023 11:17:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B4OKNsbfd/oGKOzXv1U/dYw6NEsm4UubmOHLqd5guH9CE4aTt0F86wQ/AsdxDu6+EAQPgPm5bihu3rjAAynAEkYURhebudr/wSsbtQIIKfR1GKIwJUEm18KogPKWu0UDKsOajXn2web0qgWC+uXg6B9DcxNhSebEL8s106OxfbEQ3q9MXyWoWoaGnoVy/eCzFN5WcDX5PtwNg+r+aml/BYUQ1JOhGziDofcK0UeFC2L+FYh/fmCO8DRNYWCbK/GlWydjSV89J60OI4TjAvhRMD/vDSnEEGmGE9FDVJhOqqHWVLdudG/Fd05mQTOBOeghTB5k0QWsS2pa/NWrKirDnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UbZIy/MO5Br6DUs7FbAFzoJcjg1EFjWeWaRSWGyMuu0=; b=HGuGbSzmeVsg/ZdvepkG0DOIaSPTz8dHkTqVfACoQVkk+dpi5nU1f798fIdolPLVLV/0QJQqUTnp+IXlMPGiYjrTpXOyckmdUSSC6kZG7eb9TgDS20mZD7D5/fYkoUuX7tBtY0jzzMxpEC8+XbGj6u653MecjdHaprcxhINQ83Sz7dY/vR9TVBHMTIdDz3y70cCE49V67uMY7Q0vpCV5lBG2OazNCMYSukuhTA56Z9WFRQn11mr9k8FnfH3p5zpuvHsXb34Ih1oT70nuE3NG8sTc4ENF3JSbUl1vQsdZCTuEhiy4VONDW0WP0wAkMLQU4OSJT3JTfKrotjr6SUzVFw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UbZIy/MO5Br6DUs7FbAFzoJcjg1EFjWeWaRSWGyMuu0=; b=PcnudgYuT4dUF5N4Nt6nQCZQs8pl4M3DfGHnHE4gUCpCRfLbfSGm7m8Z5/Ldx06jA49Lbjca6NwhOP0kxV8sBrB+0ThWQiDkMFQSurV+3yuJDE4sKMXGuQNq2eCA3OB3r99oWbZF85OF2RKYstWA2HrAjC2y8CJ90CKOaxf4NX8= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by BY5PR10MB4113.namprd10.prod.outlook.com (2603:10b6:a03:20d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.43; Mon, 31 Jul 2023 11:17:45 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56%4]) with mapi id 15.20.6631.042; Mon, 31 Jul 2023 11:17:45 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH 2/7] btrfs: simplify memcpy either of metadata_uuid or fsid Date: Mon, 31 Jul 2023 19:16:33 +0800 Message-Id: <371de895b777e1805002a0703dbbd4fe5a5bf3f3.1690792823.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0035.apcprd02.prod.outlook.com (2603:1096:4:195::22) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|BY5PR10MB4113:EE_ X-MS-Office365-Filtering-Correlation-Id: cc0e3d0f-a343-4157-8061-08db91b7c396 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NJnFwntumDT0adq1pcMK6PoGNyoW8NwhOAoD8FM1Agn/DKxaP6/gPTuWvWOYmTX2uSeh2nkhsHfRC7gSlPfzHdjSAKMUlg5De+qaP5fBNsHXCEecIXrJVlo6XdAlr5ybUrxBuufq8ib3ZeFVNPsDA4IGvJhc/lnA/FQ8hBhnt2+F2cr0w9kxI3Y8YRhflJP8yhWK64YUqwOgpgIT5Yk+j+enXQSwEzd6hVupKwmaX6ICeHFU7D+/x65mhne7Wx1o/PZz1mnHqgv9UtXkL4Pk9rqdkiVJ2aAVVAajJ2Tzlk5YE4+e7uq2/vofV8hNoNuF+nVg+X6pzGNUywnio/ocC5htZoz220mAsJ8jsxvjg3Pd7Y8BArh5YaM7NZDUTnpidjlORhGyJqutqPX2GvJH3JcyJGRA5UO9EkVx6F38hLxp70cmcBgbSZWdPjhgo1sty2zPwrR59dbmbjXwaj2dGUcXbDBZorc4shXH4TtMsxtgCxpFkT125IVqZIj0kMp9OAql7Pbnz/RLnEOUXm/WeTftpI68YPJO/gNNnGSDi8uAf2YMsURHVR5C4S19Ou9E X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB5706.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(366004)(39860400002)(346002)(376002)(396003)(451199021)(6512007)(6486002)(36756003)(2616005)(26005)(6506007)(83380400001)(107886003)(186003)(44832011)(66946007)(66556008)(86362001)(66476007)(316002)(4326008)(5660300002)(6916009)(8676002)(8936002)(41300700001)(38100700002)(2906002)(6666004)(478600001)(4744005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2MTRHUyJyfJQVi0Q6FqKaBdDf73UsO4xs3mZXki0/2g913mdMnuUxAvhO2iMCaZIViv4dr4z3Hw9tdobOFEC1EMkSIOglkyB0UGInuM6n5Cq5+YnS02112IcainXt3wSlqi88v+1PSwc6hvMkKD1P18zLcBDDJOteAb4LUjUj+9j3rntJnVs3FsXrIUeHx98UOK4UkO6DWs9sDhMi27jA+3aNSZi8XHJ/2P7869GOjE9dFCrpv1lMs5dpcC56VHi51l9znKyVTvdI/LpmCZEHTwURe82aiqvv9Z7eec+n63Hduq2BcyYfUgjC4d+fGIozo+Ob9vy7Eujd+++Q6UH0VdLSyApwf2v7NFMAcGVm8wlTX/XvebkLBmq4qVrDCxMQieq8h+iug4NH1hl+OpPSwMGNeBP7+fTQ1+hvWH6d4UF0jsS2R5ggh9jPVbfKyITVl6795QqH1pq2YoJDIjhRKS3312ndLe8OrAloqyDsIrfVVD+SXTh7dO/NvBoHecl6HgFdqxRlZq6oiSHiz1CmTr+mV2vVDKcjdG1wwxc1QqCr4tnmzUnJ9bgmLgouJbTcFJ3+c2B1k6XVIYCIea47t1XL9GspYdDlQ4AdT4Dwu2OV1y/7ERBSD5TpjN3m6LkKtK5jQnOuquIdhIGvapjGdU58OpgUm+HQ32bsUKcX+Lk6nIrb5q5gJkLK8K9C2ciZNgBdqAPyexWynKB8SEfyApGhnmRzEOaqMXgRNQOKKFWkxLYZDwkbaOwtN5f4cZtUQJggqQkIEg13wmXG+5CovpO0ELUYH+1mpV4ekHE8o6fKV+BBF9m2VOcviEYNgm1rq3ULm3bSYSKarrwJdA5yBOtB2T4TZmXB3DqR5UOZuIcr6BLQ3emAiffqQl+bOTujWilq4Qv0+WGXMZexOREHXsP1xm3OkaqLt4h6pTu7lk27ul4lOYqt4U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5TA1UDMo8IpxFlVK6i2UMpjDY72o0g0kU9SppSn2HaZtaA8ASMHJzpyCR7bUEmGrqFP//rd5RWfMjk87YvI4DWHb17b8eM2RK2Yu495XBT0gOO7FGQVOBhcFZgjhn//4V/TC0kaey4sm9zR5LI4udB2zzO9TUCjcUhN5gVWRoxPTsV/HiZHonULEmiSIJp2tAnLKl5qqJZCHyBcPY0qA6HfXRgM7i+yWynDdimGAwp6PoufFPbMWMkcD5rm8ZuyKs/HUWPI/p6QM8q+QFfE6pq0iENxB0Imqowmb8zkq5qkaBz8ypyjNnqVYHsdb4RmNXUzs04buaSHttzo9BFKrecLhZHIKzLGCbQ78fOodAgdl1Cw9eDFGyBUotvHfqNxyMqkA2iOt15vKGqJ4nfQ/zIRNN0Imc8Wl7XLRmEWuaC74Tqs7uCJFfrQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cc0e3d0f-a343-4157-8061-08db91b7c396 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2023 11:17:45.0644 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: y6bmMiYwFKxdXOzBGiZJU4c2FklriBMc2f5LC+BB15cNAv2rw7JgZgbSf4Te4zODkaBrli65jsfDonwK3D+JNQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4113 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-31_04,2023-07-31_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 phishscore=0 mlxscore=0 adultscore=0 malwarescore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307310101 X-Proofpoint-ORIG-GUID: gTBsaRmhuSQe56lvQKxtdmEXFy-xjvkM X-Proofpoint-GUID: gTBsaRmhuSQe56lvQKxtdmEXFy-xjvkM Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org There is a helper which provides either metadata_uuid or fsid as per METADATA_UUID flag. So use it. Signed-off-by: Anand Jain Reviewed-by: Johannes Thumshirn --- fs/btrfs/volumes.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 2020b1fac764..2f470404ff83 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -841,15 +841,8 @@ static noinline struct btrfs_device *device_list_add(const char *path, found_transid > fs_devices->latest_generation) { memcpy(fs_devices->fsid, disk_super->fsid, BTRFS_FSID_SIZE); - - if (has_metadata_uuid) - memcpy(fs_devices->metadata_uuid, - disk_super->metadata_uuid, - BTRFS_FSID_SIZE); - else - memcpy(fs_devices->metadata_uuid, - disk_super->fsid, BTRFS_FSID_SIZE); - + memcpy(fs_devices->metadata_uuid, + btrfs_sb_fsid_ptr(disk_super), BTRFS_FSID_SIZE); fs_devices->fsid_change = false; } } From patchwork Mon Jul 31 11:16:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13334426 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 378D5C001E0 for ; Mon, 31 Jul 2023 11:18:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232496AbjGaLSC (ORCPT ); Mon, 31 Jul 2023 07:18:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232520AbjGaLR4 (ORCPT ); Mon, 31 Jul 2023 07:17:56 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0941BCD for ; Mon, 31 Jul 2023 04:17:55 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36VAitCU000970 for ; Mon, 31 Jul 2023 11:17:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=E8ontY+bhkmoRt3jFnRVTjIYtiaCZ2Foa1AIJG8OvOE=; b=EwY0KyTa8CtZ2qUbqj8AkdYmVb1FXkKjGXMEflmP2I5CaQEfzGs6LRoUXmUYRBLR7xZY TDII9vG+7RBbTmtuJhPCI2dis9lCGEWV6Zk/JrExxojJ7ZYR/30sqQBK/YkSc+0bw6t4 e5sDbvW78ozl1QMfWHiGfYyfJaQ6QSqc1Ty4JkOc3yLFo+AB0bOUOh1Ll77WvnJ5ghXr 7MIy6nLsyVdv4rEbGY1Wf3FrMK3Zt1E/cJcG2ro3AKCFy3Mswb3VH6AF1N5Avc8eZNph WWDCJ0xnOGRAu5UQ7o6lTxkRXq5QZTP7qLFy0BF7uUEizPpyRhaO4MtDX7W3M+QlyQSO Iw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3s4sc2abpe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 31 Jul 2023 11:17:54 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36V9NDiJ033596 for ; Mon, 31 Jul 2023 11:17:54 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2106.outbound.protection.outlook.com [104.47.70.106]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3s4s74n228-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 31 Jul 2023 11:17:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aBu8VzMbGE1mcIKytF3MkZyiF3n84sFcsiDkuldZ9qI4Kxqb5W8GmTI8hW38I1X28XHZVWB5ArG0oJPzWBt+5ggqysmwVQ463XvKwq/p8F9TXDaSqAafBTNNhcvoDcid+wuJnvO1BKLpv7gsAqO0xQ/Ckx43TsMNY9fYCdI1ipvBU16BvEo40wCF0tVSPwHUz5Nbd+Dfv4kYmGaKchOzRWBO8+MLqQZifplu8Gzx3P4dn5+++IKC3PR2H2JFmJ2HqryxIiAHMg+Dn2+x0otaKcO+u7eamG6fsuWRlpEJCPKec7bL3Zvl1v1HL1F0JAYpMUxurJ7pq+5unMknMtmmGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=E8ontY+bhkmoRt3jFnRVTjIYtiaCZ2Foa1AIJG8OvOE=; b=hT4Qs3g8RicBTR9S9uLhgiUO48EsUrICJJmUsY0jxhNBaPSbETo+zcv8CVfiwyxY69HKFDCxGHLRsBhLxm591YW11tGwBGhTlat5tLpUeIXRN2c0eGwzau5WQdrOGhNYlONNlk+kZWbP9jy2SNfwQvhIy83D4rm90qmXEtgo7fDCn6m/fj0GVxVrWwJzXzywoGx2Y7MVFEJNCEX6vKXfAralga6yK6wrsIJeNvX+X5uOctx+6VRltz8livsSBGUojwYYQ+ZBPPzfdQjzfPX+P7y52LKq8ys+VRjTK9sC84jvpSb9LbSY2LToY4VXMdjsYBfRgWhIhNLn6t4996dtMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=E8ontY+bhkmoRt3jFnRVTjIYtiaCZ2Foa1AIJG8OvOE=; b=bPYJuPN/Z668W0+vYZrWVswxjDDc9m4es7SuFVBHlYJmJX4xV1SIhqWBV9mY0QD54L1J9x6bd6DDEs3UOej2J/HepF4KTfJePw1e6mte+mWxkS1x8k5st6YsTMMi3y90+zo4KcIk89G9m6QFOZQG8oR3ZMNAPYIkdAUlCbZc6Dk= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by BY5PR10MB4113.namprd10.prod.outlook.com (2603:10b6:a03:20d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.43; Mon, 31 Jul 2023 11:17:51 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56%4]) with mapi id 15.20.6631.042; Mon, 31 Jul 2023 11:17:51 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH 3/7] btrfs: fix fsid in btrfs_validate_super Date: Mon, 31 Jul 2023 19:16:34 +0800 Message-Id: <19310b1aee2625da1a90f59c03a8b78fbe21e8f3.1690792823.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0019.apcprd02.prod.outlook.com (2603:1096:4:195::13) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|BY5PR10MB4113:EE_ X-MS-Office365-Filtering-Correlation-Id: 3746fc85-a9bc-4813-fa5c-08db91b7c76e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6XB7HuGbvrwsMQJvRaBeVAqvpGClvl5333n1E5EbpCjWCM4cHkWpoF7oxMX9KiuMwdt2D0YM962/3xxt1Aty8ivlPxzBjd7gPnkR95Hoiu53kO1V/ZTTvkMYQJqzjcuPSlPHvjDm3L3UhaoiVnHQyoR451hewq4/5tjOXqohmuFW2BqFswoP6pszLH4TQ++GOR4W8jo6rMxr8aWkNwILB5fuKVeRMgZBhcS4VXYMuL2Y2pRQQdSZJ+2xdOYRPEtKHTxzAdDheTVCc6UP8f5VVrgA8UvCGxjg3t9mhmrt2P46hESaRI+CJvFoMWDUEnr8QuOPvZHUSncztsxcaw3EChymuMsTuyXBJeqlohtrBjTwSEbka6i+zIGnuoLthJi0qM+UPl91+OMbXSkfORMYlrujQwX0bf2UOIZMs+6O2PoFd3aXLyq1GJPNTdAuqZFLiNRnOadpun38OvcL0TPXakrJHwvg+6JGDWDYwVrlQFKh7VFK795drwRWGPjM+bPUdQ1nMEITUQU1PKrIgIA25687Fr2WhALqa16qaJxV6EFKQ63o98+jtNLc47HaidJc X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB5706.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(366004)(39860400002)(346002)(376002)(396003)(451199021)(6512007)(6486002)(36756003)(2616005)(26005)(6506007)(83380400001)(107886003)(186003)(44832011)(66946007)(66556008)(86362001)(66476007)(316002)(4326008)(5660300002)(6916009)(8676002)(8936002)(41300700001)(38100700002)(2906002)(6666004)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /uCunw1Kf6aH1MQBFcmz9g4A+rxC3UY7hUMQiv07RLL3iSaRAN79XZOJ3hWzxJJwsRPhqkpT6z449Ipz5orGWrBeyEui2aswUCuU3PUIIkGE6bh/CIdkeCsEDfWcB0FXqLbn9LgzP0hntrH+NijXEyJTf+tQWwn7Hkeovvrl0uv9/2NHvyTyXY1r9oqh+u5ahp3PgkQniA9ftdx3dJAshz+PaaQTO8qpXVVvYdwEJTvGZlq8FvPTi+Nd0fBbm1eUbrS1AL479ScYMzFlN4ZoiNhdeyNjSgHo+SOO4/IXifDOwU0om9QVV9WDKOsxFiHOWzkan40UtgGVVAG4CP7HqtJZrWX5eLZYVkLgIo9B0KbJE8U6Bywr2o/AtXGP9PyoXOMzRyyeHCVrEG+bQ98A81d0DtAwZwPpCnZPXvL0LZVYov+KY9e2KSyQigMLHujze8AzzbUCXv4quUzOzNLgyUPV64pYyajVYHAYnneEdnkBl5tRF70C4DINB0Q2oaR2AlgS+xr3iS1/cdj6QZyvTpAASkQUYNYepOFT5pAEjlUR0jcdw459SYPbp3Caf8wbrErxWbC6JeCwUDRIthGn7UW5N60/lI3yMCqJik1Fuc14GDZEh3eI77Q7PnwL4WT4tzWqmLKlgB3RVUqeHpXpsft4VmK03Lr6ZKds7iqjLLHO6u61ODld+6Ce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gYcW94u64MuYZoSLdfF5OsLl1oSAC1hE5AhJk7wnS0g8g04GBSE9SlIDx2U4hSqfH52FWy92dE8+qY2t1LmoauVYaLjRWQSy2+C914joS7nPypL1GowyrVa4ClGcSNVLKxMSClg4UWZ9puJ8JRCNplaUvhy+LoPtrX3iEgUBiCEvzIEMHaMoQkMjpVFP0usDioJB6iRE4ieD7DMt0Zf6LhZhcZJ86CebyCIcU7AyQZ2u21qIv8TVqcYg2J4zgRlkmW/GLbzYRHJRbTo//LyZczGReOY9hW5TmLVLAYxt424WB5Wifhi8wI1y9bWfXFXAIRWJL2KxX/vPvLotFLf3AcSxGxHhilM8XQq1Ge+UWMohH+aYnP7jzh6YK94CHHYUTNNno0JMrYLisuQCUTTWCOT8mhEuUoDxSL0soAthgw2fFDRXa2gLhJshCVF+LG6/srROizSzYPQoKCEsiR4dOeieUBwdCzyrtdVPw7P7avy+W55gANitWr/NoPda6Gltq79Q9ZuUFoSuZ344NSMXJqDaUIW0CSe2lOk+UfVsaoqJ5DteisZOTxARIQIGjIS7lQJsOU7+0u+TVS2V37YEjans0ihiFQdMIPVbqwr2zhgbdgWYEzlE3ivTF5wmvbns47XxepdynUv3GMsDcimaCcbh+TVFh41toDfHQuClV3+mRg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3746fc85-a9bc-4813-fa5c-08db91b7c76e X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2023 11:17:51.6796 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: EdV40JEkXjWuwhsw8cNUIv5+VcM0fRWsMSCHHyji/8xWJ8DLbBDAQ3dkpRzowpF81GSLFWiExXhlIKtEonQ9hw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4113 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-31_04,2023-07-31_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 malwarescore=0 adultscore=0 bulkscore=0 suspectscore=0 spamscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307310101 X-Proofpoint-ORIG-GUID: Soj5OrVxnRSzf1gO7Cz6MJB3As-ymaU2 X-Proofpoint-GUID: Soj5OrVxnRSzf1gO7Cz6MJB3As-ymaU2 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org The function btrfs_validate_super() should verify the fsid in the provided superblock argument. Because, all its callers expects it to do that. Such as in the following stack: write_all_supers() sb = fs_info->super_for_commit; btrfs_validate_write_super(.., sb) btrfs_validate_super(.., sb, ..) scrub_one_super() btrfs_validate_super(.., sb, ..) And check_dev_super() btrfs_validate_super(.., sb, ..) However, it currently verifies the fs_info::super_copy::fsid instead, which does not help. Fix this using the correct fsid in the superblock argument. Signed-off-by: Anand Jain Reviewed-by: Johannes Thumshirn --- fs/btrfs/disk-io.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index b4495d4c1533..f2279eb93370 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -2373,11 +2373,10 @@ int btrfs_validate_super(struct btrfs_fs_info *fs_info, ret = -EINVAL; } - if (memcmp(fs_info->fs_devices->fsid, fs_info->super_copy->fsid, - BTRFS_FSID_SIZE)) { + if (memcmp(fs_info->fs_devices->fsid, sb->fsid, BTRFS_FSID_SIZE)) { btrfs_err(fs_info, "superblock fsid doesn't match fsid of fs_devices: %pU != %pU", - fs_info->super_copy->fsid, fs_info->fs_devices->fsid); + sb->fsid, fs_info->fs_devices->fsid); ret = -EINVAL; } From patchwork Mon Jul 31 11:16:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13334427 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B60E7C001E0 for ; Mon, 31 Jul 2023 11:18:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230400AbjGaLSJ (ORCPT ); Mon, 31 Jul 2023 07:18:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232509AbjGaLSD (ORCPT ); Mon, 31 Jul 2023 07:18:03 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED174E55 for ; Mon, 31 Jul 2023 04:18:01 -0700 (PDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36VAj6kE032213 for ; Mon, 31 Jul 2023 11:18:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=ibnVrRF/6hIhuBav1zZoYNYtEf8m2cpA0E9A95Mc+bk=; b=fVzt46LDA1pVg7nfwYZ9fYrguZ5r1P9j3+LvKEdR4BVKi5xctEWTgrYFZzlJSWPscLq5 7xCWfN7U1h37BNHn0T3QfLGMuyXZ5LslVpXhett0JRT8Txocq5cfk/48LdNOLONj3h26 eK84nUO7aWBxATKODVwDRdSLh0whf/FDDOeZeh6Xgi6yn2zxX8Zt9qNMfhUempeHjUy1 tlw81rxkiCO2RXpGRpU9eYQkKIk3EYBqPhWtYxEf0aEC1uoSqyAFOdT2OD5PZ4FQdtTt DNPgoDyNIT4FzPJokB8c88Gvra3+u5pwm8NDDdk92giuYAsl2CfBXiAJK6v/hcE4O3an aA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3s4spc2bx9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 31 Jul 2023 11:18:01 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36V9OEN3038121 for ; Mon, 31 Jul 2023 11:17:59 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2173.outbound.protection.outlook.com [104.47.59.173]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3s4s7avwdu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 31 Jul 2023 11:17:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WIEpQM/FQoobKjpXDElFAYVpfFpWgkg7cRzt1alOFJu7xDLipKXq0SgDZuEAIpu/JHeHwKEREf9+F/XmPCtzEiriMi0GFwmJL5kZvQUOMTM8RkZu8cwXejFuNI4nPPNFluQ1ewwFGJOSSyg3k0MWJNXPuN3TFSIeFUB61JAe1X+CM6K7IFo8PotJ0ciNPPyL9XGtdspsSoCUO1GiFbx5Nb/p1Duy2x+GryyymJ2nybo5OPW7lTrhVFHGRPsJCZxXaKiDrK51nU977QIduW8J5YOcPjTUNMCCf0lm1/RZ6Z+SKQCfM8e45MVd4Y8L/161IKytupa5wraC6gOK+R0XUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ibnVrRF/6hIhuBav1zZoYNYtEf8m2cpA0E9A95Mc+bk=; b=ELx17u1a3GKSWncvsES0udlC+g+xhfi82H6mKK5d6n2nUyezxQ7iVdH7GehorYKrXzPfwrGh1RHiiBFFkPhwCcug/LKY0V0Zta9AXn+VtKA9XCOTwygcbursBUPOAZZE7PKRkprh18Eg+J8yVIZs4z9+InIVHGlmMMI83L3yRmKBk0bkTgxxeZaqISmxLpcCi0KLT3q3hYWC+fp1CRcNqdNyu3Un7JqJAvCNCUOjuOtH4rkRM6QhVFa7q5rBYnvoo/BUigp0an/tk6rYTmEBkR6+PAX/73l9vO0lpIwRXpFhbHvbqwxRfr9uu0HQP1ilxg7YDD2+WBrHmSvdAVGnpQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ibnVrRF/6hIhuBav1zZoYNYtEf8m2cpA0E9A95Mc+bk=; b=eUNMhA9MgUvsUgITtXVS+2MPgZywDcdYo8Z69Y7wLoeysKYBKUU9sGn7RWTDwG3fQHcd+x2oAhy8Kom8F3R2RRBybir/HDiuf2JhndejOCS8/pwkk2Z2gpNKGPJQSZUWY8MeMZYaoSeGHCJLFfVJ4FPSQBua5N3xwepH4Af6LqQ= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by BY5PR10MB4113.namprd10.prod.outlook.com (2603:10b6:a03:20d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.43; Mon, 31 Jul 2023 11:17:57 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56%4]) with mapi id 15.20.6631.042; Mon, 31 Jul 2023 11:17:57 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH 4/7] btrfs: fix metadata_uuid in btrfs_validate_super Date: Mon, 31 Jul 2023 19:16:35 +0800 Message-Id: <35e2982c9d712253aff6d5c771ed6a3820a5090f.1690792823.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0019.apcprd02.prod.outlook.com (2603:1096:4:195::13) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|BY5PR10MB4113:EE_ X-MS-Office365-Filtering-Correlation-Id: 7a3a4baa-72c1-4802-063d-08db91b7caf4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Onu7oVY1VF/cEwXoo/pf7N7OouhKtX1HLYLtfO/z5lzQTdMhvHmhje/kZSHax5uedRIs5IcKaJyUF9rPc+UIoLjWumK0gBz/uo2knkv4mkGqfi+4JFesAsJt1FhbphOzUbGRJIKb1uFEexb3dcB3/q8RWfJpHGyHpn9b9cOaiWOfP86zbaQYhJ2DRoQiBITlLsh2r0jXDLsW47PsGNt1kXSGslNBwnaeK+Mz8rkwWElDBnR6gMEr6MbbXGT87Ou3Fg/qX/WwO8TWb0uH0KKY6LJfZ69R2J5ymdWb6weFAEHWuyHqBr2kv/dnm7YU8kIGWNBFuyZiy1PnK0c/qWLkEwDWjD7/qDk0V4+RHx/E1YsikbgOjXQEOFroiCDny+Pl9nvFEDeOrLf7FVrGgA1CjpqJ2MUM0g6IonhjF7G7dpjBjHCxrfBsb4tdVnUI/lFadERNv5cO0BQlHmmS9c0668GJNFSjnuBRhuDo63tDV7n8KXUPMI1KX95BDhrZtf51CsJ56iT0XBfaHva7RZSDwQ+zsuA/83SxVVBvamoYRa8B5053BEIJf4DWzxMBWRyB X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB5706.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(366004)(39860400002)(346002)(376002)(396003)(451199021)(6512007)(6486002)(36756003)(2616005)(26005)(6506007)(83380400001)(107886003)(186003)(44832011)(66946007)(66556008)(86362001)(66476007)(316002)(4326008)(5660300002)(6916009)(8676002)(8936002)(41300700001)(38100700002)(2906002)(6666004)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8+VoZxK6hIQzXcBB+FxXNWuDPnU6qfzQErhLboH5CUPc9CRyGhvvtLpd4oAFjcUcYVJXCDhkzPxKjleH9NIs6MqrysorYRSaBzMj6oLARKj5rLzWykvZwieSERMi5yOmO+JJsERhwHvZG23DGbzwgKDZPFOIQbhEDTym1kJZCq/4ni+6JCBCZv9HEFRvst0MIJWOjvUmOoBp9O9Rz2g8BBvq1fAdpodzP31KgNZUDEZWN0NG0bAnAQqE7TAtns6Hq16vDLc38lnkwe8Tzub6dGRmqgOpfu7Kx/ZqUC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gwoP2FisOwYKslw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7a3a4baa-72c1-4802-063d-08db91b7caf4 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2023 11:17:57.5990 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +hl8UJJUv/i/Kdb32tDyo2hh3B9Ye9X8zH7ApaMMJvlu3AJSML19O/2+/cI7u2ijR/reFhQ7ucFlx3ECw0t4UQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4113 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-31_04,2023-07-31_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 malwarescore=0 adultscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307310101 X-Proofpoint-ORIG-GUID: cZ-YDGlOzGEQXxySXPYJYktrPbxg-9PY X-Proofpoint-GUID: cZ-YDGlOzGEQXxySXPYJYktrPbxg-9PY Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org The function btrfs_validate_super() should verify the metadata_uuid in the provided superblock argument. Because, all its callers expects it to do that. Such as in the following stacks: write_all_supers() sb = fs_info->super_for_commit; btrfs_validate_write_super(.., sb) btrfs_validate_super(.., sb, ..) scrub_one_super() btrfs_validate_super(.., sb, ..) And check_dev_super() btrfs_validate_super(.., sb, ..) However, it currently verifies the fs_info::super_copy::metadata_uuid instead. Fix this using the correct metadata_uuid in the superblock argument. Signed-off-by: Anand Jain Reviewed-by: Johannes Thumshirn --- fs/btrfs/disk-io.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index f2279eb93370..e2fb11e89279 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -2380,13 +2380,11 @@ int btrfs_validate_super(struct btrfs_fs_info *fs_info, ret = -EINVAL; } - if (btrfs_fs_incompat(fs_info, METADATA_UUID) && - memcmp(fs_info->fs_devices->metadata_uuid, - fs_info->super_copy->metadata_uuid, BTRFS_FSID_SIZE)) { + if (memcmp(fs_info->fs_devices->metadata_uuid, btrfs_sb_fsid_ptr(sb), + BTRFS_FSID_SIZE)) { btrfs_err(fs_info, "superblock metadata_uuid doesn't match metadata uuid of fs_devices: %pU != %pU", - fs_info->super_copy->metadata_uuid, - fs_info->fs_devices->metadata_uuid); + btrfs_sb_fsid_ptr(sb), fs_info->fs_devices->metadata_uuid); ret = -EINVAL; } From patchwork Mon Jul 31 11:16:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13334428 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0EF69C001DC for ; Mon, 31 Jul 2023 11:18:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232516AbjGaLSM (ORCPT ); Mon, 31 Jul 2023 07:18:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232502AbjGaLSJ (ORCPT ); Mon, 31 Jul 2023 07:18:09 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA124CD for ; Mon, 31 Jul 2023 04:18:08 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36VAiGH6008873 for ; Mon, 31 Jul 2023 11:18:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=L5xpPWTukGxI/M2g1D0mNuphtzIrRRndRnvHTOut1kQ=; b=hxRUXirb8z04N9Cme7d/nMw6Z6aAKTxpLL7PvUjeCpftcmw1bX3qyH8nr55W1vczs4bd 2jVxTK0hlyBXl+qUPpiIJnGom+JNqQn24eZyAI7sh0saUzeNVHoKAdC56l0yBlsepKci d0YDWHwVWAyqbp4/pHsSkstPFFm2tVJIWOXGuuYGXfDSJMxWXok+phaft5HXeHqwcnyP FNvJ21if35/AN+/AqdjdMqiHYDfPT9+nmItL4CkG5Q7PdjIPk59Jk4T8pF/OlwKRk43e gjsgLBQpDiDjU1Oti0922dvGVeL+9b35kvSjANFi8XLmpGq61GD9jIHz/bQLk/7sHObg tQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3s4tcttavb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 31 Jul 2023 11:18:07 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36VAvEsB001147 for ; Mon, 31 Jul 2023 11:18:07 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2101.outbound.protection.outlook.com [104.47.70.101]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3s4s7ad23y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 31 Jul 2023 11:18:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZJKOh17QqsiuV8hlMarUUvmJxeZFVl+OCK+fNgv1ohUF7vt/kS+FWpMlgLGA5Dmxqr5SxWu1f1W0WnKP3RaqSID1rZpkGImbXY/klq9MA64fGMAM8UvVQ0QcU/5n7QZGo7LTIkbG7xZlSk0onJUsdx7AOwYKiUO2a+lXDHNZoYFmMTQEXoPpWoZoTgMILAj6jdn+JP0iPDqcDgsos+6QyuxpcB/19xa45VvI/42mzReUvWhi4EGvTHVRjkBxT0s+K/rgkSVicR8CLzW69B7lRDiV/Ufu/VikuotlsW2oLWJcdezpPJHNAPVnau0z2go0J318PAnNElrPJ8yPiFXgtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=L5xpPWTukGxI/M2g1D0mNuphtzIrRRndRnvHTOut1kQ=; b=W8N3ovBfIPWInBM86HLPaqXyef6/HWbHwZkoKZlbyvUCQREcVjkJCd4bZuX4nCWT7fDtZAEK9HL0jPki+Mx8yBXREveahJxrEbM0nzQr7etEX8frCtHmsrAUrknhPqvo588pHbNc552CJzcn5tnGZ5bp5kq8p4IgeXPe8pilECC8N9O5+dO0AY+rplKcYthonM9v++CK5r68eGlaxKx5/8uUIS3X9H+ceLn/P/7jEQaSPv4tJal+R3SxiuFbQyxGtik5mF22wgQmxK+PAj8LwoR/6qLlPp4pCUd6zTg/ShLuXgyJG/HGxQmHQX14d/EYq9GIBahiigOHsX48VUTy1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=L5xpPWTukGxI/M2g1D0mNuphtzIrRRndRnvHTOut1kQ=; b=PGIMX9ZG65HLmqZouRDvNfJpqZfm+5yi7Yik4akLxE3D5Y0PzB0bshDoDI6/01TLnEELgYI1Txjt6N4TFKoeY/yGR/fAIXoE7tX3QUoCTk9QzC8QOHSoz2KsfBKdue+uFXmetJguXJxoepuBCuqGVQ4R7fMLr25wa2AqUTWTqsg= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by BY5PR10MB4113.namprd10.prod.outlook.com (2603:10b6:a03:20d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.43; Mon, 31 Jul 2023 11:18:05 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56%4]) with mapi id 15.20.6631.042; Mon, 31 Jul 2023 11:18:05 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH 5/7] btrfs: drop redundant check to use fs_devices::metadata_uuid Date: Mon, 31 Jul 2023 19:16:36 +0800 Message-Id: <92f71226c8eb0797931eda2c92ba243113104a69.1690792823.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0027.apcprd02.prod.outlook.com (2603:1096:4:195::14) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|BY5PR10MB4113:EE_ X-MS-Office365-Filtering-Correlation-Id: d53f5fcc-6798-4cbc-e267-08db91b7cf9b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2siKgcT+xEuWKwBRJC2NN+/oLYQLnWz6igQEdu7fNqzXEDdVsTaX0xQ7XK0/KGCkx+zKvxjhDCdr+X0F0w/HjtpwfMrXZKr9QUlYrcEB3Bge/JPzuL3kRV1ZZ4KvAj7IjiM0Wbao2xvyll6emVGUtjqxzDz0A6ZjYrDdvR+jNUc8TJSOp1gvUsj4aqVd182869VMcw/K2ZOkosO4CdQGHkw20GM6Qc2VP9KvzHg8W3m/yWvW8Rhdtl+3L2rYzhudYyWu4/B6r0FZWNRT5lgTyMPP6TyQNCA2g1TQQluZhQWtg+C7wXDJ94a7lmQrXgZk/im14HUKPc/AUZpSc3kOV6Ifwrjxh1XxjjPOd9rQ03HgEXSx5md6auIUD+Mjbb5Wh/51IN84IQ3iVZCAPn4SG5VKYd2bbKnPnsFAJATTzkVZYSM1qqKEJfINCeHw3mtCrBUa1ctCkdSk4K9DU1gkiEdQSYByElxamR4Cp98Kk2NIll7DtXIXlIK29kUgTR0nquBKpaT0ZVlnEh3kYyqdfYqa1eNT7aLrRUc06tAh7JIK+cZpX2kiGAKZA0VTUELk X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB5706.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(366004)(39860400002)(346002)(376002)(396003)(451199021)(6512007)(6486002)(36756003)(2616005)(26005)(6506007)(83380400001)(107886003)(186003)(44832011)(66946007)(66556008)(86362001)(66476007)(316002)(4326008)(5660300002)(6916009)(8676002)(8936002)(41300700001)(38100700002)(2906002)(6666004)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BwSVYQ+pmdPp4VZ35Se22N47lvt11g+sA8UjGuKiCUjRd23vltV3Cjv0r1Jd0aQ/jJt3gYblZ8KCxqz9foLXh7HH2CAoG3V0oHZ6qXOx3h6Rj2qxCnraHYKrM1KdFiCJHX/MjLzhMJrOVvk9DtH5j2ufAHZVkh91GYZ3q4wd9bar634VwMG0bqqqQKDSKQji0TFWPEAK/v7qtEa4zumgs6FhJmPcnQUowCZXI1LypNooEO+6x30P5WSKl8Wcw0do85R0p78iBZ08Y4qGnLvzCuBm1BkjLYS2BjAulCeF+7/gK8TWHOEb9/KOCTh4VDxQAL0/ngFlaCvcZsuVLdeuGVelB4dSNtMbInv5Ru3cVeltUYZJ3+xeSJ1j+4hGkyEA0coRgPJZGhfdib5vFsAMhlR50NGPWoI8cqLQ+5QpDSg+hQAQh4haJtV4cQtoUcceYY9itnVIKY3xcaGrFFUML3W0UUy6u7hCoEonuVkTr47LET7Sl6mdj//498Fnz35lx5W/wthhqoT69f1kMi8UV5rSp/aIgjSBMwKZLqsZ9Wq/cdI8JRg+epJWF0/injLr6MPWr9uVEsyk5ZJGEXVFRtoRN9BzEYqHGZDkHj9oGHkcNiHF5TPokjMD65TrvhSu6XIKbP2ZyGt9yiSOwPEq6SmNZ3lkDisKu6p+Gq8l7kLnda1vFUHXygOFZBzr0nHduGU8g3Gi7i4Y640IvNjckKlSANPmpr7gVpIgvrqOehU5FVH+l/+B1lAgmJT7Tj5Qd3sdXRXwDm/wM0U3luHX+rRGyJew3190/7yejS+kUesWuwS/La/z/W+U7mDX+L05nTg4GByLVPr9D+a2WIy5ZqNsZNA4JECg/rJDf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LtsOYGSxoVknW6FsPQOnb+veSijWAuwDLxcdQG17N0u53fcIKD+xH+RW2OHl40qKMX67vyb1uh7oxxGucORyLfZaazEv8fGLv68EzL+cbmG4ezdsmjU71RbfvGa5htynsDZAlYpuBx+rHfNHpDc1yDcjxTfuSTJE/hYu80wj3PtDsLp+kRlbaro7rQgmPrwa322/MkF7W9wzcRmW2Xl4GA5gZVTUHoBvmUKjDMY5g+XtCgpZMRCPT/01xnp7YksLDudu1EaurAFA/6tqf83K4ZZYB9E9e8w/UJNVsA8TT0QsWkgkx/ftfiQihJoWQgtgQH8hhe8hIfXxO4a8hIsjv8/bhO2NRxzdfnQI2OqGXN1GpmcyiKXaCFgWLzZQDJx29tWZPl/Mg/v/lnj+9kybvsZranl1IaCZhD5Ku83O6M4M7r9MSg/orHoZE+ycQN058HtZpUnzPhhRsxJ+pAJ0+fW1rwLFoEx+6M/lWYEDTFbybJSVAbsJ3XelLQ0JMly/f0u1UATA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d53f5fcc-6798-4cbc-e267-08db91b7cf9b X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2023 11:18:05.4128 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: fxeN/cQ8nwJsK1q2sNBmW8nMKg3cQ2MLHr3N6fSx9tcshtBV9WMMWbl5UZQtoiT/LS78mWvW+SSyP9WZ0uo9FQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4113 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-31_04,2023-07-31_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 suspectscore=0 adultscore=0 mlxlogscore=999 spamscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307310101 X-Proofpoint-GUID: oAKHTsOFubyvSbXWtVf1fbD2PDYGgjsr X-Proofpoint-ORIG-GUID: oAKHTsOFubyvSbXWtVf1fbD2PDYGgjsr Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org fs_devices::metadata_uuid value is already updated based on the super_block::METADATA_UUID flag for either fsid or metadata_uuid as appropriate. So, fs_devices::metadata_uuid can be used directly. Signed-off-by: Anand Jain Reviewed-by: Johannes Thumshirn --- fs/btrfs/disk-io.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index e2fb11e89279..902dfc4aec53 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -313,21 +313,16 @@ static bool check_tree_block_fsid(struct extent_buffer *eb) struct btrfs_fs_info *fs_info = eb->fs_info; struct btrfs_fs_devices *fs_devices = fs_info->fs_devices, *seed_devs; u8 fsid[BTRFS_FSID_SIZE]; - u8 *metadata_uuid; read_extent_buffer(eb, fsid, offsetof(struct btrfs_header, fsid), BTRFS_FSID_SIZE); + /* - * Checking the incompat flag is only valid for the current fs. For - * seed devices it's forbidden to have their uuid changed so reading - * ->fsid in this case is fine + * alloc_fs_devices() copies the fsid into metadata_uuid if the + * metadata_uuid is unset in the superblock, including for a seed device. + * So, we can use fs_devices->metadata_uuid. */ - if (btrfs_fs_incompat(fs_info, METADATA_UUID)) - metadata_uuid = fs_devices->metadata_uuid; - else - metadata_uuid = fs_devices->fsid; - - if (!memcmp(fsid, metadata_uuid, BTRFS_FSID_SIZE)) + if (!memcmp(fsid, fs_info->fs_devices->metadata_uuid, BTRFS_FSID_SIZE)) return false; list_for_each_entry(seed_devs, &fs_devices->seed_list, seed_list) From patchwork Mon Jul 31 11:16:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13334429 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EE24C001DF for ; Mon, 31 Jul 2023 11:18:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230370AbjGaLS2 (ORCPT ); Mon, 31 Jul 2023 07:18:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232526AbjGaLS0 (ORCPT ); Mon, 31 Jul 2023 07:18:26 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA86210D5 for ; Mon, 31 Jul 2023 04:18:17 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36VAiWqe009162 for ; Mon, 31 Jul 2023 11:18:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=0iphXl3wszl2ZoFjkUmhEF5Ocf+tW1ckf0BXPRikpFc=; b=EVGIOgCZxXuKMVFLJB6uEoCt5F4NiG13mbloXgKCYLNyUGy28JVURWaFnWLOAcOJKAWD xvAc8pbmeWTzLk3YeQ3lk6c1DhHaAnhYQnkWaLLB4I3RiLOicQkdsppXwtH2oA5tkFM6 sIGJEhQ3ZDWH4wryk8xUB2g9ZhXofa5mWUOX/3wzKz3SeRmm4LRYwvkvRlv/vOvaSQx/ 8GLw4RxlVmc0Sl3MmNCv3DijA5EpxFdDE50+UBq2FsjUjjeqHx3AIbqH3zNKH8D51TRN h3ITVC1S8vfwty+bzHCeaJpD2a1gPo6dRNGmOP2Yq1zU7C9v++9+lT4HmmfrD1Pr1n3Z Bg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3s4uauta0s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 31 Jul 2023 11:18:17 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36VB38U2008751 for ; Mon, 31 Jul 2023 11:18:16 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2174.outbound.protection.outlook.com [104.47.56.174]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3s4s7aw2p4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 31 Jul 2023 11:18:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H08Wic+bvDzF7RsW7e+yrb0CwnUVrP8fkQ0cym2gTXcncD7wgf/8yDCQkp0NdWFrQx2Lq5uQouCzJpNt4JxY8TmqSLAsAbgUoxhQNL5VfRMUERtQYElYCV+aCPj8y7VVQq+SzZMmfalQz838k8EH0E8zIFeOgHTAN9ltU5qM1DNv3x28ZlrkWkMe74O5j81Uz4IX7C9KGj9jBhV4ovO3tc7XLnigrUK3uPx+57WyuF5cg+PUP4dKkCBTxAVDi9SztX0bIdjCFXmhUOJqyP7Y5Cxo1np8BWtsGXoXnos9xLwnb6MyYEEsNKQlRKXYbU1qiM4NLEc87ZfzubkxrHw5og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0iphXl3wszl2ZoFjkUmhEF5Ocf+tW1ckf0BXPRikpFc=; b=EMeGB7ZGbRLXplXY7TPvKlBpwQB6kEGdJzKv+KSfxLoBeTEAtronpX8igVhKbjZn3r37SV4C9Hi6j0J32iF7X6WPwyk41AzSvx56mRSBoqAa627vjdAX27U6lFRKoyZIZVi1ooeWOsWLubLW0QSPEa2XCy5si/WJgVAwjkfSVjXJvHpqRkLjt90Y1lekTqVCIsIoQ9tQNnYf7JxDOyT/7c9yHECMP50jrlA9LOk+Zjn2A3PdcFS90i/IUEufcWk2/H+e+XeTV6auy5WW4B2lq82u3MelBEpoTyjKk487ZLw0VZf8WOtfWxUjWpBcZ07jGA+TfBROVG+2KMtaux4oXA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0iphXl3wszl2ZoFjkUmhEF5Ocf+tW1ckf0BXPRikpFc=; b=AaORQZZV82FC1lHc8ZNmycSckm4CiUR4NsITxFYR24K3oAA4mm6l9YfyezXjAdIMMFpDSqPaIYhXccb5Bph0a8+XJ09wnOdCkEWOeO0MVCWcMueDIfvfk+ErfOQ+YyZ2VHlCXv3XifBC7a1vsYasbo6PZMfeV5aiKXbEYb8BLuA= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by DS0PR10MB6798.namprd10.prod.outlook.com (2603:10b6:8:13c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.42; Mon, 31 Jul 2023 11:18:13 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56%4]) with mapi id 15.20.6631.042; Mon, 31 Jul 2023 11:18:13 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH 6/7] btrfs: add a superblock helper to read metadata_uuid or NULL Date: Mon, 31 Jul 2023 19:16:37 +0800 Message-Id: <5ab449690af1ec46c64ff6dad0d3702c5ebbe18c.1690792823.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0030.apcprd02.prod.outlook.com (2603:1096:4:195::17) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|DS0PR10MB6798:EE_ X-MS-Office365-Filtering-Correlation-Id: 7840dd03-fd26-45c3-3765-08db91b7d43a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Dm3GE7OX6KoRE32wkXG9RYN+kL3xA8dP3u+FJ53Iv0PiTYtKqmtHe5hJSvTPyBjg++wojyPDKLb51Oe0JG/RYtwG2KBXNAEZe19G4+B3m8hT2tXg8ZTfLa/7Zy7KzGburtZKz7gX7eLc33hPUQ4KQZY3TdeODi2jiYeiRgtoz2bkEyDR36SIuB/Ck6otU8sQGH77aCtbz7z5y3fknkUsHa7ukqKggDfydF01CKXnh0HKlEK8HI6KxExf/3PYoa3yZY5w15v7nO4yxyxqmUtGY4zVKUqlglxq633jInlED2RuA5pUed7JQTx/W5Ab70y3TVg1IcEBFrGLhCH2SXyvriL7Lm1aYs113+CH71S/4vjLxenFTZ8TVjFkH9ggaTImt7utOoaaB2564MITnZligblBxEXVNUF1b0I0aBI2O8+Wl4Oa0QfTXIeMxPeO6x/fX8CfrLxYbyEnfDnwOqxMfm9glT7Z0dfWvjNCW9FIpLxd+Nb7xwf7ASjMuAfQcVaxCtTrvqkfg56steErDIXgD4jthsUgz8cPZOoc1K5+IQlDUI3EoFoTu0YKm2RhVq3O X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB5706.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(366004)(39860400002)(346002)(376002)(396003)(451199021)(6512007)(6486002)(36756003)(2616005)(26005)(6506007)(83380400001)(107886003)(186003)(44832011)(66946007)(66556008)(86362001)(66476007)(316002)(4326008)(5660300002)(6916009)(8676002)(8936002)(41300700001)(38100700002)(2906002)(6666004)(478600001)(4744005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: s2oQY4j6H989kgb77tTusqKbccw3ijDNxTAb8fM4U17Gsghx+N53MsQQb3XnIGAgj7EwTGAD6PJ8U7tezWv0pTgU1icI062Y+UTDEkEYsl4Edcu/YulMRKxONQsINBUWeQJJII1FoDRRuHoolW8RMFOGd7TzXDyJfEUQE+GnTbdTqCMfNO2A1QnSZgQY0qpKgurkadF/pjHcUTumMNuBFvRaB5J5srjKC3YkN+QlLk471dmL14M9stU21MfKOnG0SuwJ8dIVUm6q/Y34lgHovj+U9iTgIzOHoprR07KRWP8aELG761YfZKtymGVpHg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dwRIYnLM5lstPajrNw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7840dd03-fd26-45c3-3765-08db91b7d43a X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2023 11:18:12.9702 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: boCiKn0AS+DTLxV0Y0AuCTcOaT64PTbbIcAxH77LxaTaBF4PDD47tt5hiUH2n1UwWvPw+pymOVTEvY6xoosWKw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6798 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-31_04,2023-07-31_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 phishscore=0 mlxscore=0 adultscore=0 malwarescore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307310101 X-Proofpoint-ORIG-GUID: 2hUGWJzHP76NRb8iempGAlZJq6Sdu4r5 X-Proofpoint-GUID: 2hUGWJzHP76NRb8iempGAlZJq6Sdu4r5 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org 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 --- fs/btrfs/volumes.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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) & From patchwork Mon Jul 31 11:16:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13334430 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79E23C001DC for ; Mon, 31 Jul 2023 11:18:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232144AbjGaLSw (ORCPT ); Mon, 31 Jul 2023 07:18:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232526AbjGaLSs (ORCPT ); Mon, 31 Jul 2023 07:18:48 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21938171F for ; Mon, 31 Jul 2023 04:18:25 -0700 (PDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36VAiB7M010014 for ; Mon, 31 Jul 2023 11:18:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=5rjWS9RLQoa5H6P0yodfjw2oQZcgeBdcjbNxjDstWyo=; b=svCljszuw27aOpphc3BCCoUK1CfDzkY9rsUN3LMHvVqswOpNgnxBdXgOdHY90x0aIU1k gOXw4QeaeplD+xSzcG27PDrZk/b2Bfv+/6mnm5Jb9bcE1kjIYe7hgB2lj0/qcqC9istS rg/XuS9w+8kmwQrmUhuYvvlTvJqDCoOhsdyBgOwhuTc1ydB2mJ2LHm1grgVuMcAjI0If LkWW0F3RRv97CaA0iMpnmVfMkUgtu8kPlFJRnM8cUxiFP9crHOvama8pQvLV8LYRwwDa T4bp1usOujkWWPJlzCV05ynJC4yjQgKtKuJQKpMgRit09ANQg4ftwizY3Du9vawvKBm8 Fw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3s4ttd2bnw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 31 Jul 2023 11:18:24 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36V9TGJ1008623 for ; Mon, 31 Jul 2023 11:18:23 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2177.outbound.protection.outlook.com [104.47.56.177]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3s4s7aw2sr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 31 Jul 2023 11:18:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bsVbeWMamMW6D83OJ5/emFpBES9CV6RuvmWieXmwBpN/aXA7bZ7cq6auhjQaUeP07MvFKN4vbG0WDBiGFIFpVkrbPNLKquafgH7qurdkTo62cSW98cef1TCStQoNMmiRgJLeqDmCre8bHpif8eX7zr7BCTSprNBdhAmf1Vuk6ErOBn4whP7rr+wyU1lqwgCoiP4GG9ROxkmIgGivLoqNNe3Hdk5GQ2BeBx93H1gpdfkIyIRR2Nmh11LIQLB13U1ej9S7X9dI36lulY/514RJKiWwFAXHLlX9JUr5MWpQbgGbl5Fa4xsAtKCC+RZ0Y5qW6SLcLFgdD7QJrmKp0a2gyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5rjWS9RLQoa5H6P0yodfjw2oQZcgeBdcjbNxjDstWyo=; b=MlYpnY4ePYFmJNdj2j0EPwg4PHKSDhjnDfQsVWGSKxX9iCKHo1qDpENhozuEqhhQJfUqkmX+NAhqkeRZSayE9MysaHY4flFCKNvjy3QehJs8vF5J9VqJHuV6SVFvdbH/k8F3NYYbfVv5bl9y7wsmcXUyQwFCMwqX2ZS1ouAZooDVjC3prFD7ZckpkAsJPxpfcm1KCai6cMadCRej+4bBJ6NLYBuMq2YOGvpBKlNCTsz9ly5zZCSa3NJYUchfdAOV9SMv6dcurKW9m/JEFHsPs2Eko6KLYpxPSFLZHBEIONlMMyuG0RpRMFAsFA9nb451jln6I/YhRm2DxEzPFP/0Lg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5rjWS9RLQoa5H6P0yodfjw2oQZcgeBdcjbNxjDstWyo=; b=qeJtfpLwjrCx+/+f3ZCZL0bPLYUxo99V/2MeEG4EHIUXlzdJkcTTnaPw/EtJZqF497sVmgAc5MrNNEVJFMIK1N4LtFXYqzvDpGVzDrpmQNdj5+upDbXbjA87qj76Ee157Hfg5/RplbpNUqSUUc4mRmozjnSLizTMgb0tGqWgExE= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by DS0PR10MB6798.namprd10.prod.outlook.com (2603:10b6:8:13c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.42; Mon, 31 Jul 2023 11:18:21 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56%4]) with mapi id 15.20.6631.042; Mon, 31 Jul 2023 11:18:21 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH 7/7] btrfs: use btrfs_sb_metadata_uuid_or_null Date: Mon, 31 Jul 2023 19:16:38 +0800 Message-Id: <69a45acb12680df22a7c7052e788450e7f780d91.1690792823.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) In-Reply-To: References: X-ClientProxiedBy: PA7P264CA0350.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:37c::25) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|DS0PR10MB6798:EE_ X-MS-Office365-Filtering-Correlation-Id: eb84f7ed-d6e5-425d-c173-08db91b7d8f2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pc6yvVaXF8tivcMGzOCYBqug8URop7dIsxsTWAj+Ht5gYn1O3ho5adch8SyW081TpHoHw0Wxvc5K6ITlI1ZotWnJi2/yP8E+egRW1AoMIKlyXQra06qYmIHrAsUw3Xmf62GFBd0KQaccxwDLC6XyyynvvQXoQDjCuTc3UnXyFAh/Pr/Kotf/oSsAJ/EJdXk5LTXmNp6MZlXIYWTK1tQXhK+m4hMCF5vSQ1z+6IL6MTn4rcBsmvhB6PPd/ZP9835HJLZjxP5n15qQyN+l//qVD1WHIfEb4qqW6FIJa60Sk/wuaiQ0tZCbc/ApMEw4XA8KYunyN70niWE6KbfdmecHczlPzgelSoItYuTBEd3hs1sk2F74+1I0hX+uelRwY/hImi6Rh0fZa4uKE15vijyBIWGwf7H/XHo253UALAY7taF4FHjeiGTOEBWiPFkLlA+ilcBA0o+z6iUOjoczRLPZLuSqiC2OyWPYRRjsz9MR7LW8g6LPFqakaJKGowao/AwoBZY+rdCTLqAX74AvEd0pSwXQYpr8C8aLNkawCZE+iX3oNSwbxxeK9m7ih3dGG3Y7 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB5706.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(366004)(39860400002)(346002)(376002)(396003)(451199021)(6512007)(6486002)(36756003)(2616005)(26005)(6506007)(83380400001)(107886003)(186003)(44832011)(66946007)(66556008)(86362001)(66476007)(316002)(4326008)(5660300002)(6916009)(8676002)(8936002)(41300700001)(38100700002)(2906002)(6666004)(478600001)(4744005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oHxoh1bWdsZW4pN1+ZJGA/2MlRA7g1ZRv2Q/mVSRcRh5aJaywKtZQUkAk/nRax17Qnhy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Bh4+rdcimV8fHSwhH0K1TXu2TMUHP+CSUjovi8kmEgXDcS8kkMEisF66NAkgp/rE4JsXdGXJla0SOGOxvM/19HV5SDDpML5GSZcEgBkNFBDSTRUB8bW3St8NS7G0E8leIeJRSstgbx83cZENGKd9REpa1QdZXK7IqWq/7yz/nqy7mN42wHg2/0v0NJwyEYpSinKxfp1cFe/p9Z9zDaDxHfvH1iN+R8T+ErlJ+JPe3VHqCqIBCmndb8Jrvg7cGI+xnJmkc50fvV2ds9vJQFgDGZSalHlBJW1x0iHc9fTSvGBb9UuvDnr7thiZQsyVDpTsuEpxoDIZd0687gx5rJt6v7fEUHF1b90r82gqV6A3r3Tzz7ATFUnmzmc9B2Mv5G54+KGzJrbfLrLa2CHtn3BX3bOE7DpcOb4lPOOUSacZP1C0gPIQWJS X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: WsnrkTPEbTQ/nRKK7fQSkN8PxjINn42x+rj//wcbxDqHhtknRZY8K2Sovno3N2xTXQyZ2xjDAcN5d1zh7jPlfdQCTAGeITt5pATCVh3sc71a5kRNaYHupCOm2qZQGa/OUrx9zYFx80JVoGgJsLw5r5DSDchT9qM5bc3bUGJpyW1qWAAizMOjWimELAao4kAuR5jwOk5t1VDKI7B40g4SGBA1YduyfFHok0R3QTdzMbcwgOWvGKj70Lv+IYwCaEnTUUCp475Wt/ydgrOb/rf9EN7IvD8TPIs/OmBZCvZM/snOlWVU2MYsDxUVmkHqtA4+34Hf2fDLQ7PtPGjqAiShGY2Li6SrlOg1L9uVwd3VIJqjY9DYdcNYxiig7PRmtaLUlbvKc69EokLvmZats3wHwtja9jmWmP/imvtd9ylPASU3Jset/1Vk7GgYYG0hqNincfA5vawHEW1acUeza2YLM91+NUB3T4RhMtJqmCa13PGapfdd/hhdsowYhjsMcknw9hbbEf7csgPnUrRUW5Y8jnMWixElos1cDaMzv25xgwCByixiUlHsQhT4n+cCgnWtviQWWqNLnmSpZl4LiGn83q9vIk3QXKlH+KblnESbo3yt3MiFk0u3ptTMwnpz1yAw8RajBTP7pvH3TK7IQWSjEI/f1NlmGH3TsiyhuEtKdHQocx0iXlIquX7uIxDMdlVvlFQWSXE2mK/Yuis2+cIIX3nzyh/SC2FdIPOqNGZdSzHY8Rc/tiLtcdpqMWmzlTTgzWe8TYwjce5X7fpX2sdEEA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: eb84f7ed-d6e5-425d-c173-08db91b7d8f2 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2023 11:18:21.0763 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LFOfL731MDPCDEKIzmWT5r3UEC9T115lkOvsDM8Zh/3reFDkgRkNMSrjposTU6lJl0ExqGZ4Ju/k9WxIlJclaw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6798 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-31_04,2023-07-31_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 phishscore=0 mlxscore=0 adultscore=0 malwarescore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307310101 X-Proofpoint-GUID: WJdNihAtsNZadUtODvBhnOplCvKz5LEE X-Proofpoint-ORIG-GUID: WJdNihAtsNZadUtODvBhnOplCvKz5LEE Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 661dc69543eb..316839d2aecc 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -821,7 +821,7 @@ static noinline struct btrfs_device *device_list_add(const char *path, if (!fs_devices) { fs_devices = alloc_fs_devices(disk_super->fsid, - has_metadata_uuid ? disk_super->metadata_uuid : NULL); + btrfs_sb_metadata_uuid_or_null(disk_super)); if (IS_ERR(fs_devices)) return ERR_CAST(fs_devices);