From patchwork Wed May 24 12:02: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: 13253837 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 BC981C77B7A for ; Wed, 24 May 2023 12:03:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232708AbjEXMDU (ORCPT ); Wed, 24 May 2023 08:03:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229622AbjEXMDS (ORCPT ); Wed, 24 May 2023 08:03:18 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDD67130 for ; Wed, 24 May 2023 05:03:15 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34OBxUUA029336 for ; Wed, 24 May 2023 12:03:15 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=bybIQWoO8Oz2Q5c99gRBqSHugQ0oOHipxRuQmQyK7Pw=; b=Hm6LOiwtXoxfLSQ8vBWjU0/6zYAL2n/FJOPREXuYZiMV0EDdvUt4Ll4mxFuoKXQ/mBZM l0yl0C+E+vvYdv6JUryQ9bQKcRUnLoDRrHIzYIY9dMo2Z7iC/aCqY2ozzlEH64izy4A3 Ioikt73aV5IWj+gevhLDB4u4G7NA/PIHHi2K9S5IPsCFqOoi3nKB3N8EaY8uABmvd3/g rRs5SPl6mGw9tRxuic4+zAcTgEUOkdp0ktwMUgY19T1NG1JHSeXS93oQqlaiiAyQyKMm mXdFH1+QjohqsL9xLJ/BhSIuFt5caYLkAi7pJ0AOs4ursEPVy5iCVmobO828pnGs1p4+ Ig== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qsj27r0nw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 24 May 2023 12:03:15 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 34OBCIb3029007 for ; Wed, 24 May 2023 12:03:14 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2104.outbound.protection.outlook.com [104.47.70.104]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3qqk2c5gt3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 24 May 2023 12:03:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SqprIWkZGD+HVf/xlhDUi2pPv03avaUK9wFQB2QV4yZb1O/jPvUTV1dyccPy5aH14CdM5RTE/vBExsJs+sElkV2rWqJt4ci47F6m+qkwa/a1Ekj7PZYwwjr9FJB8fsolBAToz97o4VvI4k/IhQH0VfUMGFZ5F+Q5XkVCRmNZ2yP8h2Qz9Q0WDtFxS0pQYHzTtaCkDQQ+NrIk826AMBYoLCQIZ37tEiHe5mFospCKRkobC1Dk3DYwBbgck3RMi/MrQYgV6kHBejoegLlZWjZm6vsERGvEy5fI5yjqFa8ndtW88zXln7mub3YB/sEEGWjTBO6YHIwdD33WBX+fCW9xjA== 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=bybIQWoO8Oz2Q5c99gRBqSHugQ0oOHipxRuQmQyK7Pw=; b=PL4HhDroHSLPzoqnd92AjRu1A8t0Rns+f7DaRMu12M5tUrFN6961W8mRtjRE7NiGtaaCJ6nYgsVm7zbfjCYpkcGpK5FmObxL4OV//nQHkbcIRSLJ9NqWR/AmVzGuCLPpEPqTHZp41E75k7X6Mtn0zxfg2NAbVnYXslUsuVu8KbM1c7PqJ8aAJggrBwXmt9QNFETPkx4ii067EQfBBDzm81N7UR5hqJiPX05IvkvdZOkCCr+71R29GsWMdwN7ufCoUb+Qy03lWX3m76dMlU1bjd4pbw7OPY4zUiBYVKbR4Z3cz+eT3Q1Mti7SLcCgXNYgXRYE+IlE1NI4jVQb1a2MLA== 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=bybIQWoO8Oz2Q5c99gRBqSHugQ0oOHipxRuQmQyK7Pw=; b=NfvWoI3dp6O/uiytYYGdKQzInL9d3bVrPBDEA7STT4N3dpLYAf/+Vg9RwRVJan+zJY59vPd60ULdxyc1e8TasHL/lms2T6lhy5CgQIeuAwQj8wtH8bwmDxKYnDD/s2fwKaZrb3OlQHkVLm1EbvnF9c0R0EWtwRCGQwQX9k5tQ6Q= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by IA0PR10MB7622.namprd10.prod.outlook.com (2603:10b6:208:483::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15; Wed, 24 May 2023 12:03:12 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::bc67:ac75:2c91:757e]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::bc67:ac75:2c91:757e%7]) with mapi id 15.20.6411.028; Wed, 24 May 2023 12:03:12 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH v2 1/9] btrfs: reduce struct btrfs_fs_devices size relocate fsid_change Date: Wed, 24 May 2023 20:02:35 +0800 Message-Id: <7587a86c31528295d77a707f5c1d795eaec4fe06.1684928629.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SG2PR02CA0096.apcprd02.prod.outlook.com (2603:1096:4:90::36) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|IA0PR10MB7622:EE_ X-MS-Office365-Filtering-Correlation-Id: d5c03875-2b45-4029-2650-08db5c4ed8f5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gbiUPb5WIxwRrMFNRSF3clFGDiZKQW/lU6knpgCY6Epuc/NvB47If1sJpl2aQu7WrQL78Q7EVtd26i63HiBANo01uTq2GINUglq1II4Dkb+evCe7WvCXW1gI868CTCcAtCnc0lOZGVaAGDirB2RK9z4HGpc6WOglNXPzKYHo5H1CXNHr5SxdHtHyP0guoQR+lcRoVzBV/qc/wCjM2NXcQtPiV1msH7HrYrJuXIjnR3ByJqE3rulndtChPvDD2O/2al+IjlCosXUBfe1m3lxeAFbVO1t8PTRlxgeLn6E7oBiB9Ta/sYxiIljSybfU4KKIZYhT2dy2gfDxWfeDkCZJJMXj5LioJ5Lctxd8BiSb0PmSX8TKH7tt70J4mVMbAZRqUEnSSE4DJ7s3lnTaSrlhUjFw4iTAdUZtSzSu+z/sAXMOv1qv2O1Y4BU9poVvd9Jj8lan0DaVsw8StTVrxx922w62K5f0b2iMyc4ZuaQ9DBq0HL8OuKS8xmGyY96hsIvFWCI4VwXERQ+2WFDafDdWn3FLDexmNADJNFmiIgcp6msmYi8D8qXvMbxcGx2SIp1b 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)(396003)(346002)(366004)(376002)(39860400002)(451199021)(41300700001)(6486002)(6666004)(316002)(8676002)(8936002)(186003)(36756003)(38100700002)(26005)(6506007)(6512007)(107886003)(44832011)(5660300002)(2906002)(2616005)(66476007)(66946007)(66556008)(6916009)(478600001)(4326008)(83380400001)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fhi13wLd9mJeWTrII91uhwQUCoPEVgffvmPX4BmzrhkWR6hYJ/8DQKuxn3v2YumKLyztQ78QQmRRgOfe3twEB2wzLJk3UBHjj/c8/BY66oKiXB8MgEnCvrY85XDVIckTdFX2ZauJEzRlso6LxiweebRxEPxSGg3U4l1cyDvHB+7KyTxYubbUqMlY4bZBLraEJ+c4qDd7br3ijOU54N9aLZEbxNRz3j5JtXdWYuLr8To9L0MjbWpD70S1Vo6ik1rt7mwQ5Zm3LNNbRlidf1VZVdkozRZdsSxSXb2IjQAsFYXtEZiNx+agqTXViq1bkwKvipfj8gHZgdNfosBuSkGLLH9wbgvq3uxvB7yosqkS5kvVC1y9HDqhGzi3MFJX4YBD9j4UHSQPfopPbviW/W2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lhof2pYjmCzyCssDbfCK8XKMGtRPyYr8N30E2zF0Q3GrRmGfOpnF88Upre8m1W/ulHeilm+QqIFhdze9iv/xqWc10ie6ilPR2oLG59wsQ6/FkwzV0fu1E05QyFdPn4EVtYb7nMSWIxuh X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: oNuIEfCP7th844k03+1fKw4jTZQer6vvWALxuMM+CxNgGXgMuDbkcbcKfpRdQEpnOLfuvhWyhIgNw5MF22tY3BlPvsicQb+yBV5ttJ4YUq20gvMfEKMpaRdfhv2pYAebEI4cSJ/3r8FKd+BODWX1Kg/wZ23KGUpX1RrINEjUtfIkMH46pPGimb+JT9fp9EOewf6hjr1UnYLik8MPFQr28Lmc3fM9YcjBjYPo/c0RYkc1Eei27EW1+gFcvThUGF+3uLIA4rk7kHyp//T55g2cpWKahYjmpLCRA4jF/R3vgD7+/8GsmoBffYItLCIVTLJnoZkog17Nhz/hMp4eCeD+2+2Q3uc7UStmn2yucSQIQ+yUkavFfAA5is8ZfPQ2oSVwHQri4180GZc40l8Qsh0FG/otjw5EjCKkWrco7i3lGEjwX4GYvPvjCQLvVFO0c+keq5cGddWD3ZxmDUVg9iNFHvgI1yWJmWZNBLeAxP+Bz9VM+0THbQsVns9ChMfwbyl8UQtaKEIB2b6IUva4QhHT/Web62e2bDG7zIUDuDftVINGSlZFQ6kv3Nplh+cOm/Sk6IRHuvXWEH69Ud6PxNMmBfCMzkvI+y0pEiEoD113sYKwVy8UPXFWYlht2xShffejiubHmPyRkgbHDya0I+VENwLgd9BYIzLzl2J8c1AtvF0+1immoyd5FPPNYnJdBLbxM05EdRFoD/zYCaE5ajJUMYy6/wTRBbjlQLmpiG2SXXBXdiS7WG0YIjhh15EhfCO4bk2nF0XT2enAVPX4ruqIUQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d5c03875-2b45-4029-2650-08db5c4ed8f5 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2023 12:03:12.1423 (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: wgEATMhZeUiKo7Xu5SCLjMAYpcV1dzoEjW7BzMq0JZsPKflZaOFmypL6MXRNOtBhasPdp6V/ZgpBSJfiwO2+vw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR10MB7622 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-24_07,2023-05-24_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 mlxlogscore=999 phishscore=0 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305240101 X-Proofpoint-GUID: eojR2QK-pRnnygSS2JuNW2PP61WCNKoQ X-Proofpoint-ORIG-GUID: eojR2QK-pRnnygSS2JuNW2PP61WCNKoQ Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Pack bool fsid_change and bool seeding with other bool declarations in the struct btrfs_fs_devices, approximately 6 bytes is saved. before: 512 bytes after: 496 bytes Signed-off-by: Anand Jain --- v2: Removed added code comments in v1. fs/btrfs/volumes.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index 5cbbee32748c..236ae696c984 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h @@ -281,7 +281,6 @@ enum btrfs_read_policy { struct btrfs_fs_devices { u8 fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */ u8 metadata_uuid[BTRFS_FSID_SIZE]; - bool fsid_change; struct list_head fs_list; /* @@ -337,7 +336,6 @@ struct btrfs_fs_devices { struct list_head alloc_list; struct list_head seed_list; - bool seeding; int opened; @@ -347,6 +345,8 @@ struct btrfs_fs_devices { bool rotating; /* Devices support TRIM/discard commands */ bool discardable; + bool fsid_change; + bool seeding; struct btrfs_fs_info *fs_info; /* sysfs kobjects */ From patchwork Wed May 24 12:02: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: 13253838 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 96BFBC77B7A for ; Wed, 24 May 2023 12:03:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232688AbjEXMD3 (ORCPT ); Wed, 24 May 2023 08:03:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230027AbjEXMD2 (ORCPT ); Wed, 24 May 2023 08:03:28 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C351F198 for ; Wed, 24 May 2023 05:03:22 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34OC15Oa030572 for ; Wed, 24 May 2023 12:03:22 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=XXUrY2kyCAzaG33AM7TfDIjEhmVV+LrKlRcBXx+4vkM=; b=k6da1tWEbKl3thcwXKge4HnbdDLjLWHvtTQsYebLW1TO3fk9//jVYnx5lHA2HPXXD8L0 VZtwDks55ZDaN2WRRv9ZdKIQ1vOcv9ZPDnxdGnRIjyo4V6xVofON4wS7A3uSZ9m8CU6O AJLnsiBmPwxSTYsZdpdo6HokCHKI96zvYcMBccfWZJ3yTMQfYTaNL8xv0Kq9cGt6a8lP gGv7COY4QOasDvqhskYsoHmpk6OH5umdOCwCuPZfpYo813HA7K7sNulx37ujMopss7La U6l0MQodDkSaKt+UaEAeMm5q7XCbIMRlbuzUENFyadD8fExyLw0ATtemFqCWwFpXcYgH 2w== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qsj27r0pb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 24 May 2023 12:03:22 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 34OAN2Gb027108 for ; Wed, 24 May 2023 12:03:21 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2105.outbound.protection.outlook.com [104.47.70.105]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3qqk2evjtd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 24 May 2023 12:03:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Sz1nM9OydGIiFqjD3P5BM1SYho6KcQU1Nu/G2PpHt+eyAnwNN00PVM5lAPmrDB19an/h40WqC8H2AXyPHOyi8qBkbPUAAj+Tahc/OyrmLEBF+9Nr407VQ/RBeXxhj5HuzcHW2Qzf75Ltzf+ou/cJIpUF6GiXgngJ3Xm7qMDc2PcI46GqDu1mpHMeKJTMIXy9P2Vj4hLqfND+wjCid364pAjSPro/0dMr259Zyz3kITtwD3MN/bpSvQ2QYDWw5UHOf29HmODQUSY42Tv3jc/pPLaLbKCyA0e2GB8ulLs80wu+pW9vm4l3hoo/7MvPD8D1IAkE3dKbddjdxe3R6pUsDw== 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=XXUrY2kyCAzaG33AM7TfDIjEhmVV+LrKlRcBXx+4vkM=; b=RvnXqnc5q2l9/JvLRAufEs7BoOY1PsUq2xwuh+c2F5rcAaTE86ezKClyJjqdeEX76CLijkmheXMHPDKhQxCb4gtx85wlV3VzNbTLccZu8Mln0ppp55dzpRxQupzKTNNQYgfzagmie3griX5tPmwo/ugBI9cmIh6xUUCRbYJ4aqeobxBMZN+0mdFw7EmapEzlNR39k1bpOo2SHW2+p7joO8wF2DupZXbHv8hMLuETrAk/UnYlmHdvzZMVNlAU8/cmDd/PDCmFcA9rV9+E+WlM6h4UDpzH/6QiIYpRmVM5xi22RMhSDUhV2/Zsx3y5v6mK0yB3EO4z68JpDAc+eN0n4w== 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=XXUrY2kyCAzaG33AM7TfDIjEhmVV+LrKlRcBXx+4vkM=; b=NXPevbB/RMP9670IdbTzha43KFcGToGvkvevCdntCCVSfbvFKK/vcntRPQ7+GXZrYOHS6o259j35OZ9OZyX3hnYDf+0S7TefpFluUGu6g2HiJFUDACU35RpYM5XSdjApfV2DqwJzbxkhMDUbWzQA2WbuLZRcedeIsRxxk+8m9fw= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by IA0PR10MB7622.namprd10.prod.outlook.com (2603:10b6:208:483::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15; Wed, 24 May 2023 12:03:19 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::bc67:ac75:2c91:757e]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::bc67:ac75:2c91:757e%7]) with mapi id 15.20.6411.028; Wed, 24 May 2023 12:03:19 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH v2 2/9] btrfs: streamline fsid checks in alloc_fs_devices Date: Wed, 24 May 2023 20:02:36 +0800 Message-Id: <3b7b4844919ad7d988c3f8a0e83ac9a63d0ee4d2.1684928629.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0027.apcprd02.prod.outlook.com (2603:1096:4:1f4::18) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|IA0PR10MB7622:EE_ X-MS-Office365-Filtering-Correlation-Id: 89abd749-ecac-41a8-26de-08db5c4edcf6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HCE94snAq2zAVTonyGmU8TAjoV0a4iO3/GD34YwLU0zKXsNUdfPlYBBBfmRgK14n69WhmluR6QfoAJbQpv1QVAqPBfNj230oi8jxW8/c5/0OslCk/B/LAGcmfRwQprTxPPr8ie69aqtVOHEiBGS6eL0oUE9MWDjNzS6gYtpDtPgsWZdhXafDesajNANQpohkNWPEwcWpUj/BleswEjQlD669DbOBKpwofOsQcYv2TkV7d0BUEIwU0pJKl8my4RNTVaBEPXPGYsbHoEIP9as3BJD5BKzNMGK4ht77OHO19pX79PL1jUy3h5jA10Hn70jxa7PjM+6jP466T4LsfZe5T/obKjE6HKVICUxaurjpBc6T6caBFfTaSecc4fHMNT/99xYaBbMSVlM+IhivpSlUrO7tFUsBta0C4m1ZC8XmmSJ1G3JU0GeehmZxb4lV/rwGkTYW8GKb8AnVQ1P+9pXCKFq25J0ipldk4AgegW/4PDktTPzRJ/V8zpt4fCd1MxKGngmz6ZHQ8VQzxhROvCoNa+nAdzx2s6i9qs0tKdoYh6VvHVYa3r9vPHZhnoQDZDHB 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)(396003)(346002)(366004)(376002)(39860400002)(451199021)(41300700001)(6486002)(6666004)(316002)(8676002)(8936002)(186003)(36756003)(38100700002)(26005)(6506007)(6512007)(107886003)(44832011)(5660300002)(2906002)(2616005)(66476007)(66946007)(66556008)(6916009)(478600001)(4326008)(83380400001)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mBwcIemBD7wvRVFz+GMyYHuR39NrLMbDvnJZ8i/zIt+SFvW5GBf4GVEwhfaUOiwvos9MH+H6MiS8O9YmDJHo5dStQbHd27R4xqbTk5U+eS3gHweMGXV1Qd0pYwK+tJBMXe7rD6M9A2HSM2O82I/HH/ma7bVzwF8TbZWRaiUYpDZhP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w6KuSz5ypmywwZx/OkEKrdZQob+5N2GHy1MPJir9MUtkU0VpneZQilhXKyZIW6eABWflgmNyb+l2+nDegyYSK+gBhwtfjr8q/kU78YoX+gFkSTRStsofG4Cw9WSZz9L+6ej1/PNmz0+6qzgr19pTyPM7GiPhM9VmRaM5zuoGir262lH0B/nqTT9doNtzBGGK5ouwcJqF49XEHta79uU6nOgFXCiMWDxBxIc4YDGSX44/Ys8OZ5805ggStN1GuwqfZHsadPrJq8NpUDgs/5MpxOgYivfnX2/dToCQQRyxMDzfl8Nc1tjhF07GKkd/Zv8K0+o9vExwYjRkusFlwQRNANkQD4 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: E40ktHauqwfwCdAQ8Edpk/8BDcpscsYh89LrHSLHLK9RLNtrUED59B7fFxW9ihpXNti0HtB6Un7ygcy/90sWvlRcwmf1j2d7SVonm27s5TtqqONDunTzBaqnVs0ST/c4OvFsenjrFcHmU2zghch0ubrAwfq0WvvY0t9f+PHZb44EOf5yt41o/CEIaZL31rWWw5XTfWE9xsUl6QiG3MlUoGHCs7JgzL4D65JzDHMtUt259qCa3206qhFCxpEP8WU+OSLKA6B0IDL+JGBCJ6Y5iyNYnUW2iMzOSkOXkkQ/IPXATqIJJuaPU7V2izpYx8I5UwZtvSRanBuv8PHGyfaVeUxhE+mZL/Ub7M4W4xs7Fj/kdg5XZAvv67Fu7+2BWN4IbcJuccyM8Utf+Qf+825F7lgz+ceyJdUydSTC7yEhp3KUSSIeDJpkgEXNRlBORmMa5a7pCPKAhpOtxGZwsQ4V3drasamWNYrP+SRAjkacxXLsf0wpTzP+4THXDktLnHjncSAaKet1IM7FacveZ1CPqJ/RiPryuCJWEpAkEYOnTKFabuSShtxdZkfU0GSg6mUaY7u1xBvCuzFnwIvQkMtj3ttJaAMW+nbkTKWdixNoglOkABahob3zxnnBA0y60+FzQ5Txbc/p6L+RO7j0My68IP9pQED8oUUsj63JrXy0gPyL6zyJZf5ZUBZsXida+kD0kDFgvNJHH+DfYMX006KT7nJ0y9THDZjuuQuKAzbDa9onCEIC3wANTJ6SwZ5sI/ABvMw25juMaXESOiAPRR9C9A== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 89abd749-ecac-41a8-26de-08db5c4edcf6 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2023 12:03:19.0278 (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: /gqkFLyNLQ5rqzph8NL9UFUhQCaMFWpm5z8xdR+Pd/VIlbVDukQSSO6OpM8+YylvtIgUPn2g0QhKnjQZgLW79g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR10MB7622 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-24_07,2023-05-24_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 suspectscore=0 spamscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305240101 X-Proofpoint-GUID: _cV8X-4rxw1X2q9nub3lu3izZd_k0sS3 X-Proofpoint-ORIG-GUID: _cV8X-4rxw1X2q9nub3lu3izZd_k0sS3 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org We currently have redundant checks for the non-null value of fsid simplify it. And, no one is using alloc_fs_devices() with a NULL metadata_uuid while fsid is not NULL, add an assert() to verify this condition. Signed-off-by: Anand Jain --- v2: Simplify ASSERT condition. Fix space before open brackets. fs/btrfs/volumes.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 1a7620680f50..4b35b28c8746 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -370,6 +370,8 @@ static struct btrfs_fs_devices *alloc_fs_devices(const u8 *fsid, { struct btrfs_fs_devices *fs_devs; + ASSERT(fsid || !metadata_fsid); + fs_devs = kzalloc(sizeof(*fs_devs), GFP_KERNEL); if (!fs_devs) return ERR_PTR(-ENOMEM); @@ -380,13 +382,12 @@ static struct btrfs_fs_devices *alloc_fs_devices(const u8 *fsid, INIT_LIST_HEAD(&fs_devs->alloc_list); INIT_LIST_HEAD(&fs_devs->fs_list); INIT_LIST_HEAD(&fs_devs->seed_list); - if (fsid) - memcpy(fs_devs->fsid, fsid, BTRFS_FSID_SIZE); - if (metadata_fsid) - memcpy(fs_devs->metadata_uuid, metadata_fsid, BTRFS_FSID_SIZE); - else if (fsid) - memcpy(fs_devs->metadata_uuid, fsid, BTRFS_FSID_SIZE); + if (fsid) { + memcpy(fs_devs->fsid, fsid, BTRFS_FSID_SIZE); + memcpy(fs_devs->metadata_uuid, + metadata_fsid ? metadata_fsid : fsid, BTRFS_FSID_SIZE); + } return fs_devs; } From patchwork Wed May 24 12:02: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: 13253839 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 F1D28C77B73 for ; Wed, 24 May 2023 12:03:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232707AbjEXMDe (ORCPT ); Wed, 24 May 2023 08:03:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229622AbjEXMDc (ORCPT ); Wed, 24 May 2023 08:03:32 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CDCB130 for ; Wed, 24 May 2023 05:03:31 -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 34OBx9eQ011561 for ; Wed, 24 May 2023 12:03:31 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=zYogcXFnOTNkFf53H8FmBfojrQpj6PpldmuKHtyls+U=; b=VBc5fIkkoQz1c4EZmR5peqnmjqi3sgvsFf41sitYmmpX2vUZjviTuiUgPNNREVAfPGmv K8xi3AatPUNgaVOpoSWvRgiGGAZW9QKDp7hUy9RK23FwipbAp1yI4Fy3Sc3Q0zkQRtDf NXcftihJktVJXzvUeAwr8zuN28MBZbbwe/IJPHmhoGBl2kVjCDtWqIHwfw7aYdKE1VG/ nwlHO3PbCwMxmRNAkXC7TH2LgYHezBwfLRe+CM6puUd4ZapHKuo0yAqJFckOUFWTwag+ xAnu7WcIf1ssySrfMeCMrrFqLa5Wz+mXlXPfYwQW+iPoNnZmLPQl03LHBsTOjve+Y91G hg== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qsj2bg0nx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 24 May 2023 12:03:31 +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 34OAHjjq013202 for ; Wed, 24 May 2023 12:03:29 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2168.outbound.protection.outlook.com [104.47.55.168]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3qqk7g5u59-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 24 May 2023 12:03:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eroB59jh2A33HI5grWzCi7o8nElBb2Bb1IEL/oGrMSNDF4Ajs5xYi52AB7dgh1umKH7hnui2bPVG8znRv+LLzgh4YEwhRk/IHD3GeFgEwL0fwrcRj3/GLK5vt183MJMpHLfCxOLg5/+8by11A7LZzzJcgpovXvF4smLjgSHwCvab+3X+0CIabcK6y+tMusZXxk5edZx12rZMgog1ZKxzBBadJMZnDADmiAu/iSZjs7hRiER79J9lS1Ha0UYS72MSCFqdBxmJiuy4iSoFSfvw/bBy6h/2xu4UjfFE3tJfVqfGX3fLeoWlAPRlFmMoZZ0OVzvKdRkwyARYx6iYUiVYKg== 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=zYogcXFnOTNkFf53H8FmBfojrQpj6PpldmuKHtyls+U=; b=R1D9Gf7ChcXNqEgmobzZOO7JzpI4DHAU72x39QdCbSX1mwvT/PtjJrP5qKEm9gjDd3hQXw9IDlfxstB6U8jrIGTAjxV+YFBfojsNYavjbk8soTW4nbmfzo0nyA28ZtsiEYLH2GFpUkiiWEKHhTO2YwTc4DPY9ujZWBOhXE8tKQ8evEqETB5hnsGj47YVmIEXqNwBLSmFURxq0H/Ej7vFDQWFAboj+XerhmeuLbco49Us06gXzP4B8ABRNPX10RH4lEt0wPTvTFRCLQ4KEKaUFqYC9hOlwY0KQWfYzIMLGKQv8ROK1forbK5mPpQ/l7f1bXpnEW/cu8onIZFXcyRHnA== 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=zYogcXFnOTNkFf53H8FmBfojrQpj6PpldmuKHtyls+U=; b=LoI8G/lf7vUD6hWiPHNAQbLxY7tZd6iTmCg09hpfjU9TbgwjOFd9oQ+VnJ7db2OlSt19o/IgtrlDO4upWdZhkjC+pkNIBYvnMfNS31MUr9GElcwUQsRuLu0v0RWkyFelCfU7aSfVNE1Vd5jfICwytJuHLd1uzgt1KiKUYyCOpyM= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by DS0PR10MB6893.namprd10.prod.outlook.com (2603:10b6:8:135::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.28; Wed, 24 May 2023 12:03:27 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::bc67:ac75:2c91:757e]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::bc67:ac75:2c91:757e%7]) with mapi id 15.20.6411.028; Wed, 24 May 2023 12:03:27 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH v2 3/9] btrfs: localise has_metadata_uuid check in alloc_fs_devices args Date: Wed, 24 May 2023 20:02:37 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR01CA0032.apcprd01.prod.exchangelabs.com (2603:1096:4:192::18) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|DS0PR10MB6893:EE_ X-MS-Office365-Filtering-Correlation-Id: 6d78e13a-2728-41c9-d207-08db5c4ee1f3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Kuh7fkUqW5DXB45qlUSm96+RlvYuZdwvWTT3O62chEZiyVs0KMSHy4Ks7ZUyt02jh9Ri18JqZ2mKQKRgBooUKMIjAwtpWSsQwyuWePHT/oz/eUtQlX515NMblawXCHs5GwlNPUq55euBq4YJBz2wJ3v8lTigdPrssVlDNCiYrLGiHltfIOX/HAIhASHIKKEUpifJEbOw7z2dqSxfoQScndJ9FBwJg4gyQpiy0Hw3E8jkspcBTnC9CaftotL8EzBO7HPuSHpGLqcHcc4KIvViDgxUH3xvDAGDi2BRj94rhiHScYgqkpaAJ5KOVHtl9lG5//FUuXCzk2vsY2DnggcWo0QKPSX/gLvebJIQKJxbikCo8f3dbhkX10f3XB+PWu+5t8lqv9+4jd/T4zXccZnQGwvPCsHO1MGRLKAs8E3PvdGazOBynZq/+Rhpv6gUhJRN0S+XNa64ptrSDOZFs529GY6pFIdyXa0RLTwXudNWkSy/eJaux75b4LNNPwDgIGlCheo425TC8f1pOzEQIxo/H/2LCnLaYhXjJvqDlA6ePLCY2fq/XeKcBVgj16YCUSBA 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)(396003)(366004)(39860400002)(376002)(346002)(451199021)(38100700002)(6512007)(83380400001)(26005)(6506007)(107886003)(44832011)(36756003)(2616005)(186003)(2906002)(4744005)(316002)(4326008)(66476007)(6666004)(66946007)(6916009)(66556008)(41300700001)(6486002)(478600001)(8676002)(86362001)(8936002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yOuZCGTqDiELmys9OMaZFYc3FC4SCR8zflP1Oc5qTc028tmm2VhrVu/AfVGlbptoS5WR7WeS4nDeLVLdWphxb26bpqgQjRAq88owYI6T37ABfMKfWUPavUve6SQ11dbTd+QZvc6Brsw1bCLcsFdywWZap8yJfbGextt+5+iZFmjqSQCMwumzu5aJGoZDEg8UJ7XN3L8CSyy/R7SHOGH/VEPUCjW06bcvbMvxIkzRrFufRkk5xNiUBvbzTGgeM8S9hbasJnmjPFVgDGfngE0tmOlz0294kNNs3cTD/dKyxrAdabxQdHovt6jevKKgbtUnBTjd+5jLmJVsG3Zq6K2kgrkVxVs7eLg7481rxBBfA0FoouUB6WeoZsfc55tGuXHipTh6gmOo0LsV2fLB5TP5yofq44kEDuJO2DvlAmVVuf7Y4KeWbivH+QiZvk7jVFXnKkqZGR1CaQefUdbSYKOwTTabBbJ8z9cguO+WA+oVIjGh3I7WtH8FqicihwH4WFQ8JizDn7iA1HPF8GCNK7O34dzEU056v9EV4ZZdLASVtMlfK3JO2CMJsMyye87A5eEPOZABkD7e7atu4wq3loT9WtfNYeC66aUFX0dYWHrYrceET/XmVXHeh7D766GIazyphgdCyoL/EmGUSaHStACh8OKkKpWnohtoTliS4L1aOAELpA3LfgIU6Ntn5XR8/oSR2DPbdMZFSThp0e7bJPtE5i0ZH0jTIigroieQ//y6oD79lt1pNmTexpt7wef2T/Vwh5dMAsujzYOL/sELv5N8k28rTfJa1vSMSLRqzlHdb5KQVW4QQfOpb+j1Q8ADHivPoNnIh8Oa43P6jrF0s2Lt4fje9cizaI10dmno3TSTmVMW0KFEkn6c9mkQ6Y+QViUiKBSXWyTRf119XvWSdU261Kj1jJbr6Kc1naJ56HckbhRjrY83mNKgNSVUsfGBnnqvWxrgBCsSN5HWarDnEeIVb5B8jpPbdQycVEW/KtmxWKr/qSxboTSVzJDar4j5lz0edU6hyIROJXIjcvdAulDHY+7DCwkSyXoUjIy3khWMxnHfX7NWIhWuaOo6ww/9Bj7LzYRjYkSDQBU2mS94xTFMIMrs6sUEsIt+HQtrucp/EjNNPFKleB4QgGHTceMZtiSjCog6G8h5eWkuKaKm5+BM5CtSIZBbd4DprIoTTadlZ/WCVfHpMLxAL57F/1tMFRD4bAbxAHCvvwH1aiIEurHbsaje7RwkSa6FXisqj0rsTtfxoyGikcxEsG4brEznzpUvf8yhV7lqERQoPw/dnBU0oZjxJAeb/1rxe6Y0j1F+7m7UxdJS+YBHgr7CmqV5QiIzpTCMj1YOeWWhV2bDrAegACO57ENM94mpOUzmcayfpTH23V0xlLCkz0WQp6F3NMRgVvdjKjlSWqEEn07erO+lLSzSE28a2c3gKTGPELPrQszXkY55yusITZQBucm+IJnjsY3R+0Uf8/PJOoc81MrOa9wEygPtfDXEtu+Dpc6jFL1U4gt7Niakl5f2UM+dodNqdajD0G6vXnFOK7J3rbWWQmWXd+eFthn0bmH334aRyvnlHpmSJrJgb+2sfrUdrg2qD2Zj4+uioePpCMpW3+bc7w== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: m1O/VgpQAgNUdaQdPXTpQ5iYdZn67SDoAiebC+vaCIVIKxoZ8AYnZWIYEC73SvsItQ7RdxSQ1psXyWmzUHREbT73ASexPShBMXm/fdxQHcvF1akaX6IERbadfRt2BeXI7GLSRBDPP65ldFYx9raFbkDehBLhm86fJHrxR4qr+FwU+Hr4j3ghrTMc5wsRu1g4fE5jySGGIjKeQYM6XrT9durBdTJKd8j4KezQ+VpzlBRiA3H2Jwm8BxqqoXOshrx1sWijfKeX265laxLfxwUDIcWHLDo2d4Zbiq9VB59y+HTdPB1PEi6c4CFFhGmo+AhUFY2E2jYlQYdO5cjlmYgxq7UtGV4tkrqnMN32FbmgumcmQENt74G1XTjlxSN0Ll1HGyFl/km1ygdB1fQ5CTsylwqHb0Sq6J0/bXwYe169GZnceuPTXi4ywxiq6hOFjimIHouF59IIqkHm2IXte2NrK4nLPKvDNoztbychZTAwN+0TURat0YfhJUJBuPWIWqFQ0Bk60m5id9ehN7W4zNLweCzA8BRSWzQoZ9T2qKnmV9wj4IMJpLs9KHhwkQlxeyp7g5PZ/XCpztQvjMcZcy5ppQ+OMX5gV0tAm4TQg8cTvpc1wU4jMmseC0leuGFmvO0HtY9GAUAGbFyRDWeq5v0IACF+WwHsx8pnEPaLUfaT279VC7Tq9AtOfAxLisrFJETri6tnOq5ASpQzUFHxEIrcy8na7KFgPoFGdurp9bdTsJ/lsjWwetPsKUAix8MskmNXFhitC8s1bcTbip1mtmmQQg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6d78e13a-2728-41c9-d207-08db5c4ee1f3 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2023 12:03:27.2198 (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: g1J+5/RP5ixEkBV3n7953Y9LZ/9Ly+o7ehwP5lxQ4uciPoJ4L7KkEXtFsWVvXgTEGFwX+/7PIZSn6GT5UPvhnw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6893 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-24_07,2023-05-24_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 adultscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305240101 X-Proofpoint-GUID: KzSjGmivGhRxyxlqJx1AhlttgoQJRsOd X-Proofpoint-ORIG-GUID: KzSjGmivGhRxyxlqJx1AhlttgoQJRsOd Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Simplify %has_metadata_uuid checks - by localizing the %has_metadata_uuid checked within alloc_fs_devices()'s second argument, it improves the code readability. Signed-off-by: Anand Jain --- v2: None. fs/btrfs/volumes.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 4b35b28c8746..f573f93024b0 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -791,12 +791,9 @@ static noinline struct btrfs_device *device_list_add(const char *path, if (!fs_devices) { - if (has_metadata_uuid) - fs_devices = alloc_fs_devices(disk_super->fsid, - disk_super->metadata_uuid); - else - fs_devices = alloc_fs_devices(disk_super->fsid, NULL); - + fs_devices = alloc_fs_devices(disk_super->fsid, + has_metadata_uuid ? + disk_super->metadata_uuid : NULL); if (IS_ERR(fs_devices)) return ERR_CAST(fs_devices); From patchwork Wed May 24 12:02: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: 13253840 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 B0CA7C77B73 for ; Wed, 24 May 2023 12:03:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231981AbjEXMDj (ORCPT ); Wed, 24 May 2023 08:03:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229542AbjEXMDh (ORCPT ); Wed, 24 May 2023 08:03:37 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAAF9130 for ; Wed, 24 May 2023 05:03:36 -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 34OBx8rh011508 for ; Wed, 24 May 2023 12:03:36 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=dwUevjbkhdL0sC5QDO2G48LLgZLYR4GfFIZA5GaYrMs=; b=d75UgIcjG1ORo1M50PBDfvwuE2QMZ5GgV0ZLw3OkWjK1pxJIdUHkLX60UAycwT1dHMIG A1Kr5WHCtKbSGoYNykZFvM3Ie4lnkuWOrOtHuRcxsqN1yyQBn8YvL01ptN2aO7h9sUL4 8HfjJSPZwvxD2AcDvY72cen69m/orgGA2nhCgrjsByfbjkODIx0m66CJuqeCQY7ci+ye jpFWYAD69EhNNKP1z5mQun7vDikjJWAQOP5cvl3lrILJ4FR+snqfPG/+xVuO/Gcm+c5B Nmx7QFPaAv/oHzrgPAGDUYUvqMUMhJ8dDBTL3rMyKzRrCn9FTiUTi7gPT/6UHr5ONaXM ag== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qsj2bg0p5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 24 May 2023 12:03:36 +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 34O9xYIr015938 for ; Wed, 24 May 2023 12:03:35 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2171.outbound.protection.outlook.com [104.47.55.171]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3qqk6knxhx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 24 May 2023 12:03:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZRwjx05n9oQ1iPtSPpa2gRkff2k2lqFSeYs2tEasTv0orD1OBjJ2liw3wbQqFH+QIwEuN1yVAJJtsf1u7PORIX2UAhh/RCXrv229Xx8YXQlqgm8vfD9dxBbBf0ImuWbId5OQDWdxs27NYug7iWzRMALV2JsBANjGLS3FLrw2CJ0CV7bcRTrcS3VTncxRHAEBNnCLISYefDjXwF+fKXvWlLiWPXnSB/eylBbh+ptgOIeednZoTOKH0JM38k6NTdlNfp4HwSTH+MA5LQy1yjasykmpo7fmwHfVkVZN9j62Vf4fa6R845xpi9A6cTfPAxoSHqiGYPnbt2OOPPVhY+Sn5Q== 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=dwUevjbkhdL0sC5QDO2G48LLgZLYR4GfFIZA5GaYrMs=; b=JdT06jGcbtUk5GKQNGE43BUxJa87MIu7KCbIY/Q9L5k5JsgR8v0u8cm6BesndpLFrGnWleWDCqhJLpIhWl/Tc7OV2eVpp0sOnUh+koZPP4XZMidR7UMjrADywlcbGzVuuZ22XZL5/kqdN5wQ9G8ILd7KeW+KEhDoNWXh7443k6sZCWd5lRkFn8bWy7R3vRz7UQB7/CUtuMDE4VCR7dxa4AcMgFcGQkB3zU/akVnUYugJT5k8Oedgh2FMQqPTEdgXic5SRN82Aoi1k4R0NtNmEKqXw+wh4j0wRwoo1AeCr9jcPrOJj2OjEx3C76jIktqA6qUfhJfCaSt2pbvaVAP/5A== 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=dwUevjbkhdL0sC5QDO2G48LLgZLYR4GfFIZA5GaYrMs=; b=YLD0mV7JxV1x5JsluBDFBIQbhcojDz704vTrLCenzY8cBhCJcxSLQxIQtT3sBTThWPAQHIhinrEMcQOH6o5CO3h1QXcDyGUqTNrO72aqduMQQvDCr41bm1kGLCAFfOozSUoIdAh8U+JV71FpwpGHSlxd7dBNIo39JUSrVxq+/ww= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by DS0PR10MB6893.namprd10.prod.outlook.com (2603:10b6:8:135::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.28; Wed, 24 May 2023 12:03:33 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::bc67:ac75:2c91:757e]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::bc67:ac75:2c91:757e%7]) with mapi id 15.20.6411.028; Wed, 24 May 2023 12:03:33 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH v2 4/9] btrfs: add comment about metadata_uuid in btrfs_fs_devices Date: Wed, 24 May 2023 20:02:38 +0800 Message-Id: <4541c4ddf5f49ad5fc3a9d22b5c1e0e17d3f1579.1684928629.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SG2PR01CA0144.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::24) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|DS0PR10MB6893:EE_ X-MS-Office365-Filtering-Correlation-Id: a27abc4a-435d-4b4f-1076-08db5c4ee5b2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1m1UTdMhUphsWNhJ1RNYFcjnkt/55gFAQEKCIbngaK38JRGajiDgnaYMsekg9erqvR9GubavimIzDlzQfhw6iOXt0RFOlgumdsci7t4BWnZ1Cw+GaTGivyxST5VRjb2aG0+EFAmKQeeqi8FauQAtM/J9rsXSYU8v43bJhMwqsSMnKA2AwQ0zqBnt5lriyTEHOXc5H67OANWg4umGQnkm4Mmwrbp21I696/t1mhqwqSF3+Z/mZP3aeaiz3MzpZdESlodGAr/b5896yY106NYss7xAwdgUYKEXsKPmrXpEl2ZSGc1A+7LNH7H8ljiOG+7IRUndzC/subNkkrFsSXnBjvLYyJhXDmuBrIuuYi1+Q+XJjc4emhfqR8QWnfb4UMtDhYHuzHzE89CLvSiR36je6r60iOfJiU1v1cAzceimADmJEoCAQ+qm6fqrWAdSdnApbF1S9EcwEg2r3KSKnuilid4cV3wUnN3XkB66fRfVVBQ4ifsQbeUsrJfE5w+CDev2/eNZ4bFxEAmoi/C+9gYjKvB4wndPdKuBvYsKDXOv0hi519QNo8O0Tw/z0FWnzVJD 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)(396003)(366004)(39860400002)(376002)(346002)(451199021)(38100700002)(6512007)(83380400001)(26005)(6506007)(107886003)(44832011)(36756003)(2616005)(186003)(2906002)(4744005)(316002)(4326008)(66476007)(66946007)(6916009)(66556008)(41300700001)(6486002)(478600001)(8676002)(86362001)(8936002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xd7zklUgJrXvlW2KARzArg+8TjUe5iy+s5bjVIoV28/XXQVVb0I2LfpdEbJufmFvBhGER9wVHUJegTEiF8tNStkQA4oEc4YEo+tfU8jBoHSYNAV/Du0qhO7c1tdNHogtc489fTNq9ZDYfeQ189aCV0TDsmMLqMlPGDo6Gf0P1fjJaIUiGstQkysyyMKQAIscP1owAcPRY4YaPDqGUp1LOS4HwVYOaaaIifiitxfTj3j4rSZnqMe23YxKj8U41Lf2z8r4w1xsPbDwzF8QIip8DelE7Jf8Eyld18l2FUyUYYkMAdfsFK5HkVL0zCwp72vpQ2UjOTZmypmd2q0K57grZnkUW7F/881PytVUQ+4xd4699dzYeQ8ZDFrOBoo11c9Aib9hiiU5T2sApYIPxNml1YfU/fcfloZ1iA+yYtD/yCUxLuz207KObhPwGKtkSHk8jtcQCLfHR1RBmTMnsnU16MPzX9NPlzLzVb89vku8Ln62aYovOLAh4U7s4BTvhQMILXYYuvlQUxah+sPgfM7B/PP7Rm7ekMa3T4Hoi4YrnTersAH6ow5vm1Qyp+Cvc9g6dnRfwEJs/iytEcdNbVkCwrsEbUXCr8bvWsGR7SB5CQ9cL/2/Ut6Q5I6hR88rmubazjA+gqjW4G8gmVtwJS5utPs2dbuiU8E4DEoKRCz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BORfUXdOLpmUiXfnod5MortVuOdTQHHWu8cWxi6Mrg4SHxO8L94/qauucIN70hQ7k+ks+DHB5TSX6yS3B23fIXV1z3Lj7tPIKnh+VARcn1TAjtK0ET5D8mydW0Na/Qbi6tMef6UgsSArkwWslDgyJrbs2K6itzmxd4e8VeYe26YeqatRWKGXs1OFdilXXjl0hiWcudfQpMSkyo3g+j6gMGvni9by9cR8RJ7zYit8Zms9CS1V4aQtwh0glqt/AjyE7KZ/Las9P5YdWZ1ms8YCF1aheqK2K3GqlFLwqthGHPz5MdODXS52dlmrMZFDm8aLBSC9+PsqYDm/8zULUyqFRbZA/BnkHtUPafEa13FNiNiiKgxnHQMjujaGwDKtMq0pY2VSDaHGVvdNu/p9fB1GArbufcDXWCNLwZCe/1AdI4UY0dpbV7UqUmWG6zOWIq3jBqULqN94k6pdS9PmSaLwglUvtfMB5rn95XSBv98s+iU8HQGLiX1ZZhBBcMefNNiqq+igsTJ+0grb1CJRcGckQhBuNrlfPrHzL6AJMLde/J9yvCYCdbfmcsIM/TqZJxnlyswwaqXL0691U5+un5scaA1yKsUnksLqISdnZL93kijCtPHk1hPL7y7fBydQMEEBHAOB9Z3ncInnoG9AL1zPVMyWgQOceaW7T3zjHDNmiGabLZexMGT0CXhWOSScbKv5odh0mfR1tCzf75EGgamvryiaXoJw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a27abc4a-435d-4b4f-1076-08db5c4ee5b2 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2023 12:03:33.5118 (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: KVktdSehgBMt+rH+ivJaca6BWtK3wCPQEB7gIHPL6+fUsVu4r60VUF3nAjHSVna3t97RR69JS6oaVocM/DMxGA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6893 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-24_07,2023-05-24_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305240101 X-Proofpoint-GUID: 3OcTs0Q1zQEx2WfrQGec5FQaCHh-Vm6a X-Proofpoint-ORIG-GUID: 3OcTs0Q1zQEx2WfrQGec5FQaCHh-Vm6a Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Add comment about metadata_uuid in btrfs_fs_devices. No functional change. Signed-off-by: Anand Jain --- v2: Fix added code comment style. fs/btrfs/volumes.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index 236ae696c984..56633d4f9b31 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h @@ -280,7 +280,17 @@ enum btrfs_read_policy { struct btrfs_fs_devices { u8 fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */ + + /* + * UUID written into the btree blocks: + * If metadata_uuid != fsid then sb must have + * BTRFS_FEATURE_INCOMPAT_METADATA_UUID flag set. + * Following shall be true at all times. + * metadata_uuid == btrfs_header::fsid + * metadata_uuid == btrfs_dev_item::fsid + */ u8 metadata_uuid[BTRFS_FSID_SIZE]; + struct list_head fs_list; /* From patchwork Wed May 24 12:02:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13253841 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 03ED7C77B73 for ; Wed, 24 May 2023 12:03:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232718AbjEXMDq (ORCPT ); Wed, 24 May 2023 08:03:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229542AbjEXMDp (ORCPT ); Wed, 24 May 2023 08:03:45 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E450135 for ; Wed, 24 May 2023 05:03:44 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34OBxWlu029406 for ; Wed, 24 May 2023 12:03:44 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=nflhDjwWvOsueNJn1liNidurl0zQjbQcgZW984XGYtY=; b=LYaqtZFbmNXyBbDyUQiVTeSeujFD6445szlbVkHt8hX+tPJnIgRJeA+O3eDB8TvyoPgl MWqFxQCkFX4d/m8rQeA7Fn2j0iT3NZ09zIxB5qlM8JWop1/74PTfhdxxJOl2KNWKi/ob uFfBzEvJBnYLBocISfN9WgNgx1h7fWpdzj4Nm+YUR6Z0Jri7PUPL8luDW5WbBZzFKBG8 CM0qb2QJTuipEdSY3ZYem0XMUDYVDXODacMoDB6HNJllFYaXEQazHcUOd9Z1agCsYxZS XdQfcEgH5mrSYiZ9YCkS0tmxcWHuNPTTVdb2LN6E+AKLV1JnNQRQ2ipQlSXA47k60XC6 WQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qsj27r0qm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 24 May 2023 12:03:44 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 34OAX66W027071 for ; Wed, 24 May 2023 12:03:43 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2171.outbound.protection.outlook.com [104.47.55.171]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3qqk2evka1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 24 May 2023 12:03:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cMmXM7EP2E/QX59J1A4BU3ERzIjTvU/kce1Oes0K74GQCPRte0KLX8n7rDdao0At12lG6HdrwrJf2oouVtZ3/lEvlnjjjkeI+VvLUuGjXO2ndmLjW5MQdtaLoUz8bwVl1IvVR8dvg8cDRuHp//ekoyTpRxnMK5fQ/rF0kCi/YZulAc04flwZPRLDdV6Sa4Ilh84jPgj14fesEiNCKzOsIEeaTQbBbFoEjhLDB3zc93Zq8GTaonPUj2C2JpYCzgkrZMt+Cfl3WvGbVH0VzO093CNAi2IxrCpUHRsBAgEaKnjH0vLR3hW/vR7V5cDGNFeJaBUBMbWj3K0H5RcnIOJx4w== 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=nflhDjwWvOsueNJn1liNidurl0zQjbQcgZW984XGYtY=; b=fCpvej6lXHEJDtcN32FTPKYTPTfjcEIG/6Q9VOcQFRKU+P1BhBqY+JOvv1IUuzh4VNr/O9FVhmRCdYv/9tzX3+jXs2ykQ7IMB1KcDHYkaulmQ8/gK2GrEhVtubfxzlHVvpPaU6VYBLbtN93tJRobd5K/9G5h2hg6S67qPmNwbMGmmy6xM6Sjzku59/d8zja2R8Mijfp+ZYQEGkqjYKUmZ9jyWUoofHJ73jVrP1oiGK+pke0myBGxncXU8yFrFKkTOdoHSH4STVwtQPZZdt+/0yJ2HgzzWkPJce2AttflDakeJ/a0rO3rnp/ZGgg576k63sT8OlfF5osNoQXHrwPvPQ== 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=nflhDjwWvOsueNJn1liNidurl0zQjbQcgZW984XGYtY=; b=g8o9MYgliBHZ0OFbYtHWbxC4Ju8BLeklIDWrvP4+vSNP3fnwVx9Mo9G0urJBIoAE8r0uV/PPesjThD8Fk5d1TxYIZQgi4KwP0UFEOAuPNlnhcruwx5oDNFgCXu0XwqlCYcJi/kBIf8bW7WYe/VPCJzdBXTTYxhY3eIpLlCUstaQ= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by DS0PR10MB6893.namprd10.prod.outlook.com (2603:10b6:8:135::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.28; Wed, 24 May 2023 12:03:41 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::bc67:ac75:2c91:757e]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::bc67:ac75:2c91:757e%7]) with mapi id 15.20.6411.028; Wed, 24 May 2023 12:03:41 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH v2 5/9] btrfs: simplify check_tree_block_fsid return arg to bool Date: Wed, 24 May 2023 20:02:39 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0016.apcprd02.prod.outlook.com (2603:1096:4:194::9) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|DS0PR10MB6893:EE_ X-MS-Office365-Filtering-Correlation-Id: ef8b8ff9-af86-46e4-f144-08db5c4eea1b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Cun2huUu7Cor2Rqzo3j5K4XMgMkK6doPkVJWbKl4yckhcveLQW+aQdpLCf9pFHiqDNWdQwqXYSiNg9i+E6OZwixBs0H7R2p5u3RRXJh+NOPvT7IdUV8trivaUm32EYWDk4Ie7oiG8JqeMOm8EtljSQ6BU9K70BNjf4tjDT0MqWOb4z7ABQmKecwOSgXo986CjIbw/U+4pZBULgpeIamTpWFDUh2zgjhTV0o9M7NmOWXnVWkQOtzWhnt+41fhFb7lkt4OU0PL18BPuPtaOwIL09JNN7zIesd/oQ0ZYMUlbRPL+9N/ZpZdSpd0tBDzRo/DAxgUmQ1vF6JtdYrapEnChm4Hx1qF77lopWp8K2Xb2iFylsL3WBoAYKqu5sgSuqY2Dk38cXp4Q5uBtftiaiNsW2Dg01J8odQyqyPb9wf+CT/8CvX+2ll3dYp4adVh+TZu/Ij/n7zFIyhyu/YTMrx0Mtzo5sOx8S2fT0cbWViC3RshfEp3FEAX+n0dSKbcq6mRLGqYWZrkBLxlt04QWhhaaVY6pzTBD0vKLfV4i4KHjOmVTtoYZVjUt5Yg5P9BrrFJ 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)(396003)(366004)(39860400002)(376002)(346002)(451199021)(38100700002)(6512007)(83380400001)(26005)(6506007)(107886003)(44832011)(36756003)(2616005)(186003)(2906002)(316002)(4326008)(66476007)(66946007)(6916009)(66556008)(41300700001)(6486002)(478600001)(8676002)(86362001)(8936002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: r9EdD2EuiltMdIo/WbjicooA0+yPjJO1ieE0V+x1H4Y1FTOYpvz1BXirfW2DU+NQNaVGbJgBUG9uu+iqthNykrS5HE5XUoyNfQod9uIHLjDQSGgQmlcNLEK1YJDWz7QHT1qMavmoUcuI2RzRXlJalqTvK+nqVvX3vU+3PkkywDMvMmbv3F10OiVEAtzXs2baVGIO6Q1R/+H2LJo2dXTFajJXc3aVYS0GYsXVfQbvfqdUQiNXtSP4rY3Df7z08ZHrCUtmfszYeFDjcwPgk7fEpzmrHxjjBpkaxd6szqC5/rX/MiQPIHkAxnVjcxBLTA9WcRbuutAIjWPa1lzl/kVwsYYqnbWkqXlbL5oZcI6pzCw/13+Du6gTIL+EaqOaEGPXdV43WbFbIoKcBRMhKBIf4NqHAn9V0xnFfn8eT0ogI4CY8qF0zt36Rr6s2VEnriADmh/HUj3H1/cYd95ATz2LOAx/lyEJDzFf80RNTP1RnEKhLIDcb69jZ0i8rwA2v3gMiOpXQugbhgBTyc3ZJiMcRdjI9NRs2xbmyGBFxn/YDOYpZ05c+YZ94g6la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am-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: SCDpR4UfBD3WQl92JscbxYMk0dOdocnv/IqfMw5KzJlXrbhMHTOGIz/FSkXfg4BupZlVg7c62IKr8ZUUPrUc4P+TtDkFUbbsddJyyQpfVk75S38W7xdCY4nPLb3RBT4L4z3omlHMRIzh85qAX0N75dkj3PAVDJyphv8+EeDU+CoQ/LYPkosIv13l+Y6s+2sc3W6t3nZpM6QkW7AE0JdO93h7pcbJ4tGLjsUByAUYLj1QUXAKuIY1Lziozi6oryDjbr6IzD+6k3630wxVzcKmDg3ql00yPDLtLIdYM8zpeOyY3nL0AKSdxhRjmKEv/hoJeQHB+IuJi7c3ydEldOJeSfH3zuOqrdl9cjvSSBT2OJjhRvxUMlOdXnpnOmNp3l2SCEkGeonhqg8y+8lcJtPRxZDpUsJXNFT6JqXc5D8K7HOeTBkRKWDOz2SLOx5CJaksitnfz1qzqxE7FEUFclD0FQo0ydf/6zKl9alyR4W+fjP3gP3KwTY0mDAp5DKP6ARvy20Eilvw8bohlRyWPaqjjykLvll5VCCgdpffSNPGplAwzMD/h2EmmY9jSxFYrJ/G+g96TGcx/gJyFq5J2xm/nSVqOcmsrxRhFRy7tyB21/7pffhxFe3pLt6kIOpuKDsC4BnIWcRCLPGJ/k7gplYNxl5Z9Mgk9yVyGZfb6uUe1J19opTKLtov4fyLkZVL41oX3yrh3L1qSgfwoP6IFkytY9Gww6ha5WeGBy4ERnvfp0PDElflliF6UBi0e65xdZ6fretFby3rI7hEcWKeFKwxKA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ef8b8ff9-af86-46e4-f144-08db5c4eea1b X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2023 12:03:41.0927 (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: nRR8wRcRCQc7/7hHpFvBQ1sLaKobJYKW11Py2NvQnsjrckFhRI80xZaVoT0r6Mya2JdvMydLnL5YXBieBqDKjA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6893 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-24_07,2023-05-24_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 suspectscore=0 spamscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305240101 X-Proofpoint-GUID: iJPrs9duYR06bt9BHRIV8B4LiTcxq9Tg X-Proofpoint-ORIG-GUID: iJPrs9duYR06bt9BHRIV8B4LiTcxq9Tg Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Simplify the return type of the static function check_tree_block_fsid() from int (1 or 0) to bool. Its only user is interested in knowing the success or failure. Signed-off-by: Anand Jain --- v2: None. fs/btrfs/disk-io.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 52caaf4b0678..6681e82900b0 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -315,7 +315,7 @@ blk_status_t btree_csum_one_bio(struct btrfs_bio *bbio) return errno_to_blk_status(ret); } -static int check_tree_block_fsid(struct extent_buffer *eb) +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; @@ -335,13 +335,13 @@ static int check_tree_block_fsid(struct extent_buffer *eb) metadata_uuid = fs_devices->fsid; if (!memcmp(fsid, metadata_uuid, BTRFS_FSID_SIZE)) - return 0; + return false; list_for_each_entry(seed_devs, &fs_devices->seed_list, seed_list) if (!memcmp(fsid, seed_devs->fsid, BTRFS_FSID_SIZE)) - return 0; + return false; - return 1; + return true; } /* Do basic extent buffer checks at read time */ From patchwork Wed May 24 12:02:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13253842 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 5A610C77B7A for ; Wed, 24 May 2023 12:03:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232769AbjEXMDz (ORCPT ); Wed, 24 May 2023 08:03:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232745AbjEXMDx (ORCPT ); Wed, 24 May 2023 08:03:53 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05FDF184 for ; Wed, 24 May 2023 05:03:52 -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 34OC19cW020012 for ; Wed, 24 May 2023 12:03:51 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=ReEmUnVPsBUYwcPRgw3J2dhS96tL2szo1iLQdzK4kF8=; b=zyYjqIIMlIlFrqwV4672Y5ZV82jJ9CI+NSipBcfHNNHFKFd3D6ubXRHEPHffOQN1jCX7 pKdLHExU/8MBCvDNxkL9msdijEf3zfNjK9EpVhzDmkICwmAEQio6Phbk53dT3972DPEb O7aqCG7SmTR/IhSSPv4PxS2N1DQf7OVTqJzF2iLjAVGkBuVpwL3X48Juwsu0tYH+cc6N IpcZomtzxX/a6w6DuqouZNNUGvRGEZqM0HBMkv/zt0kw4MzFjT0KQljTzVVGxT09P70b H1Fyt0lpkx57QSMIquGnrHJEo49NlO4PdDEd1Eqek8e8MrrejLZmmslI/d8qFznHdq3Z ew== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qsj2980q4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 24 May 2023 12:03:51 +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 34OAQbna028715 for ; Wed, 24 May 2023 12:03:50 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2104.outbound.protection.outlook.com [104.47.58.104]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3qqk2sd0uh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 24 May 2023 12:03:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mxP0JvA/tZKaiWmJJJ8N+7BFYt0QxF6MM8iXwYnS8NC56JjI82HpUl3JSMyWLxQ5PmqEb/yHrxMKXvxU/BWx1iR3wtJQRZ7m5AFVyER6A29Ro4qa39tdqUYFCVQr0KWf5012tem2GcMklbZ5xz+cT2DoWh2dPfFTbn8uY5etzCFJMej4REYTTNqgFL5txLxkP9ygszor/D9yIuUoJPTmdrxWM0mVssMvvslIbb2rjXpSY+21g1k/dVUCHHEHzxDYvtr3QAf0ANKd3zu4ezNEYtXRPiAEnvu64aXmKvjVRDiquz/5EP8rIo+2h2L4T/+p+ZGqbioLAVILScjP4wmMkw== 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=ReEmUnVPsBUYwcPRgw3J2dhS96tL2szo1iLQdzK4kF8=; b=Tpa6TismHgnE+5VDZ5RA/IcKqgjqPIgOyf2oMrkXCBdrY/sBuFYd3Qxm83bOSEoptzUOeWpNeDKhuw2poSDT+mkw8/9o2BIQtutNT1GvI0TrXSNv/C2ICxOKueIf4nXFzvZ1mPSQVrCRsm3HtK5599RK+YP1rAY3znjIZQkThCY5AdfSdRHuh31J8m13GqD0jrVJkvRrFmC+AComnaikocKhzO9qHo8bKwJ9AjoZCmwYjxsxAHh83WQi9xS4a3cQLT5uPZjtOZCRc0IKm1leWlMhHIR8YKvrYKMDgy+NmdSpJ+d7Eu0HaHM+JN1fJmnbFTav0/X64pAFastPDBWOtg== 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=ReEmUnVPsBUYwcPRgw3J2dhS96tL2szo1iLQdzK4kF8=; b=KBu5HJOVGvECcGkD+g+rMxdbhRdfkWRr5q6ZoRWl2s+9RKeVeqWR6TVaiUK0VYSclCCZne7k7GVFppNzZqurJ+ebhDuxeMgHC/NLciZytLat4aVwdQ/TyJZuFgYy3ZFRopCd3v3SjHdHoO7pV05oDMdUEatNkATFCqPuepJrD34= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by CH0PR10MB5098.namprd10.prod.outlook.com (2603:10b6:610:da::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15; Wed, 24 May 2023 12:03:48 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::bc67:ac75:2c91:757e]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::bc67:ac75:2c91:757e%7]) with mapi id 15.20.6411.028; Wed, 24 May 2023 12:03:47 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH v2 6/9] btrfs: refactor with match_fsid_fs_devices helper Date: Wed, 24 May 2023 20:02:40 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SG3P274CA0021.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::33) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|CH0PR10MB5098:EE_ X-MS-Office365-Filtering-Correlation-Id: 88ca4a1c-aeab-42b0-e14d-08db5c4eedea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bEvmtPx+VjV5sYQxDVpMV8XkfGHX0VJmJhtLEvUJRq5HCBd4LjeKrrVnQObl4+yM1jK0GoEvWiK1aCsGsFj59u8bFCt9fwuJwEA7KKLb1V8UK2RzmSAgEUBAWOLGMPMKgQEXSWTH3sYKZyh6MGfL/47nZCyERErclEbOAqoSLi50LrWMBsMJl+FH9AfAWP4hUln+shvQh0e73Sf9uUkv97qAtyZ7FHMG4rSYRFvmqMy/VtucBQTjg6aVB1ahtj1tHNTpim1Mr2u7lvAgulI846IQiAj084o7mNv/rpQb3YKeOpV4u18dqW8FrH5c2R3Y0qlZn2uusgGy9VOBu0cgnLLZnkjJ3QZLnFcVeMZniYK/OX3QkS18SAI4k7s2nCnYBtq4+3B3OH0zhlYepwmpRV1istusE1M+p8DI9CIOKOj0J/sE1lbp7WWMJ42xc/8TzX20NjRC2oMNMhniHYjJt9I4tdBmRCtjdwejB8tOaPDcDFPDBsNyfvKjSdV2Zn7PtVQm1rkqEQPtRObb87seyeAX0y1i3OzGwTvf1tDce5WfhWZoR3V81ZFqXERuW3wF 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)(396003)(346002)(366004)(39860400002)(376002)(451199021)(8936002)(8676002)(44832011)(5660300002)(83380400001)(107886003)(6512007)(6506007)(2616005)(186003)(26005)(86362001)(38100700002)(41300700001)(6486002)(6916009)(6666004)(66946007)(66556008)(66476007)(316002)(4326008)(36756003)(478600001)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: o9eMvk3JPxKL2LmIsjeAynX/dN9bBMHVBfklLbbD680DR2FnS6FN1KX1E4IwPyy3AN7OZnxiB7wqHQ9IBbEHRAI12XijJ4xauddnBM6xQSfvJW67eBc32iyq+1IyAJWzEmlJQ7PJa95ghxup/tc44fSl+nVGRmb9uHQFCGq/7wNLrPFlumNzTNBUdMrAFwC73GDBewMWuWppTGmrU8ySG24DSYsBgdZ9rCYfX9n9obR42wRtjjZx2bQVHbb9ZpRXLSJj9AurWdeLfRJq4a4xK/g8lp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lEe3zNsOIhEVhnOpyBuuXb/4p5azInBmhi9yuHhKsU1N2aN5o4n7LQpkh/9nWvg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 88ca4a1c-aeab-42b0-e14d-08db5c4eedea X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2023 12:03:47.3076 (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: R56JIcDEpeayKrKGWT3I20JDA42mrshwFLhlYbks7RvE0h2jxR182+XDVSw2CqbT1MQPF3ozf4TZLeLoyM3AtA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5098 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-24_07,2023-05-24_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 malwarescore=0 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305240101 X-Proofpoint-GUID: h64W6bbPI2Gnk7oZbZKVMD-ewDk6icP3 X-Proofpoint-ORIG-GUID: h64W6bbPI2Gnk7oZbZKVMD-ewDk6icP3 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Refactor the functions find_fsid() and find_fsid_with_metadata_uuid(), as they currently share a common set of code to compare the fsid and metadata_uuid. Create a common helper function, match_fsid_fs_devices(). Signed-off-by: Anand Jain --- v2: Rename helper function. fs/btrfs/volumes.c | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index f573f93024b0..3d426dbd1199 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -427,6 +427,22 @@ void __exit btrfs_cleanup_fs_uuids(void) } } +static bool match_fsid_fs_devices(struct btrfs_fs_devices *fs_devices, + const u8 *fsid, const u8 *metadata_fsid) +{ + if (memcmp(fsid, fs_devices->fsid, BTRFS_FSID_SIZE) != 0) + return false; + + if (!metadata_fsid) + return true; + + if (memcmp(metadata_fsid, fs_devices->metadata_uuid, BTRFS_FSID_SIZE) != + 0) + return false; + + return true; +} + static noinline struct btrfs_fs_devices *find_fsid( const u8 *fsid, const u8 *metadata_fsid) { @@ -436,15 +452,8 @@ static noinline struct btrfs_fs_devices *find_fsid( /* Handle non-split brain cases */ list_for_each_entry(fs_devices, &fs_uuids, fs_list) { - if (metadata_fsid) { - if (memcmp(fsid, fs_devices->fsid, BTRFS_FSID_SIZE) == 0 - && memcmp(metadata_fsid, fs_devices->metadata_uuid, - BTRFS_FSID_SIZE) == 0) - return fs_devices; - } else { - if (memcmp(fsid, fs_devices->fsid, BTRFS_FSID_SIZE) == 0) - return fs_devices; - } + if (match_fsid_fs_devices(fs_devices, fsid, metadata_fsid)) + return fs_devices; } return NULL; } @@ -462,14 +471,15 @@ static struct btrfs_fs_devices *find_fsid_with_metadata_uuid( * at all and the CHANGING_FSID_V2 flag set. */ list_for_each_entry(fs_devices, &fs_uuids, fs_list) { - if (fs_devices->fsid_change && - memcmp(disk_super->metadata_uuid, fs_devices->fsid, - BTRFS_FSID_SIZE) == 0 && - memcmp(fs_devices->fsid, fs_devices->metadata_uuid, - BTRFS_FSID_SIZE) == 0) { + if (!fs_devices->fsid_change) + continue; + + if (match_fsid_fs_devices(fs_devices, + disk_super->metadata_uuid, + fs_devices->fsid)) return fs_devices; - } } + /* * Handle scanned device having completed its fsid change but * belonging to a fs_devices that was created by a device that From patchwork Wed May 24 12:02:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13253843 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 3D781C77B7A for ; Wed, 24 May 2023 12:04:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232784AbjEXMEA (ORCPT ); Wed, 24 May 2023 08:04:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232745AbjEXMD7 (ORCPT ); Wed, 24 May 2023 08:03:59 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBEE7139 for ; Wed, 24 May 2023 05:03:57 -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 34OBxUlt017804 for ; Wed, 24 May 2023 12:03:57 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=3DW2E7Ky7iw834kM5+TtO8NvalbppMF3Pg+kV6vuACQ=; b=cq6tZyCpldFsyaT2XLzNlUzbzh1+BOYUB/YzdwXApo+wzdbYzp3NOZGSmdCDhll9mnRA /tLGv2qk6L+Jrd3LWLDMMtXBFmh11335edkF6JDWf9f3UN0h6O1o18RlrTGluEXlhiqi jYlS+49EhHsvcHxheTlmZi249Ni4dsRFmICvYc6ZlUJxyAKaucMx8OE76t2s9zfTOUt2 fdu7FD3S5brhbi+uZiqhPOcZYB35wSRH9xq4EXi1u6sKEwl8m12qDIX22L/ftlDVKBKj DfPnxWtMQiYQV3ViUDh4yGwhcu6EzldPNd3Tki88uJo8fIDVv5dg6Gg9eS9jqdO7s3LE sw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qsj2980qd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 24 May 2023 12:03:57 +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 34OAFh1L013193 for ; Wed, 24 May 2023 12:03:56 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3qqk7g5unt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 24 May 2023 12:03:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RMT5j6CtNIvvghlFfUyrjWYzsNzLzMAILV/YBzuVXXBJi8GIB5Wb69bHgz4/kbPBFhEywY3mmntmbxfmcShmbIm2d5O55TN4GbZX3+E8BCYyLcPPbQtMy9TgUfJJAt/00IhS4SbYxmt4PYlnGXOMlSkL8CmcgA4DabIrctjjDL3NCnmndJdj/VXszz+wfGdCs0Xv23fsrx6OwMKpcoEOgNuo6KwdE4B0ny83krOo8T4tzLLzz2juAHE/yrsPdNNr8IeBgMFOKhWDErxzlBzE64tILplZ5zlxWICF8ECsNwQhKcJDlThF34fAzPYkLoY7o5SD4Z9ZlFUo68Yam3YeUQ== 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=3DW2E7Ky7iw834kM5+TtO8NvalbppMF3Pg+kV6vuACQ=; b=Q9h+rY7r8o4AZMrFDR9YESVzqErmsFnyKBN3lIknxEOtaiADxRTJkcDx5VM4evKKX34odKnTUa1x7pIFtCpAI0DPZtTfNnrCG0ybYLowp0kJfTeQv3BThAE+S1CRNW7uG1L3OpW8bE42GFy9nob9C+DXQb8ODPLTM30CBgN5vGt1LdBbKcAcSnmuaeumuDGMGn0S98ypdrritTGntNbX9FgOM2LQJQnvEasrGxSGGh+yyUTIwL8PswGfAY8hy3sxG1N5/WuKdG6D3rZ4lzG5VxenfEmmWHU7E/WsfN7Aw281XY37i5k1L00PsnwgGLXtBljhrSFgzZ2xLRLs2AKIYw== 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=3DW2E7Ky7iw834kM5+TtO8NvalbppMF3Pg+kV6vuACQ=; b=pk3RESZv63K2EPYN1ZHsrGs5TwzUqS6W4O9t04B1mgRj9czdmHvR//+5LK6PnnKGztdf+CfkYrmOBgCM5L+vDnlKe//nE3lpDc6TZiSpQYJgI1p2Py4efMJ2+TxBk1zfejD9mdRbI1r10Qz9ezruCxZxciRzzUPVb/eWigsdFsU= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by CH0PR10MB5098.namprd10.prod.outlook.com (2603:10b6:610:da::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15; Wed, 24 May 2023 12:03:54 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::bc67:ac75:2c91:757e]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::bc67:ac75:2c91:757e%7]) with mapi id 15.20.6411.028; Wed, 24 May 2023 12:03:54 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH v2 7/9] btrfs: refactor with match_fsid_changed helper Date: Wed, 24 May 2023 20:02:41 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR01CA0026.apcprd01.prod.exchangelabs.com (2603:1096:4:192::16) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|CH0PR10MB5098:EE_ X-MS-Office365-Filtering-Correlation-Id: a8f754c9-0c66-4d85-80d0-08db5c4ef1ca X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: btBILOuVeFh5LDewHjmE3Gt5ukBBEmXGYDfDpe5XsvD4cf+JKIL3Lu7S+3F+u/bjUajQ+mUO/knCCWJCLUO96LVCu2jygoxxC+qcFpIeyAcdaDEczBkIOwPOLAEGVaDS8jpJwF3u3b/i03ZF8NvzzDgIgVbU64HkBg1UsQbG/H6WpdGj1hlboAUvI1WDaBwQhvachgic51r7BcX6oY7VB/ZygE7pwOkPHrPpkoCE4p3ADldVABTHN0tJ9wmQWptUtcZhf6UaOesDvFR7iA0O7DF4C3Jz2DmuXeS8Vy4bNSOHDPpbRAXO9ZPWBIxkCanBRV+TSuvyqLUAbiNXXCfbCK5kLY4KQzAroKcA3J+BgUNFIYVM2znwJ5DSodO/fC6kwNokC3VcRwbi1nrbgHJwkodBzr0SkkwwIUcHCabFUbUbBtLR5H5pijzZp4IR7Mc9pW3AOiHv8UDO/IT5zOzxnadD6C7hhZyeo8Ld5Jf3uHdPJPUfxQ0kPi4ftRyQYgJL4uNV74s8xXqBRQcxyw/fRrN3J1/FdXQtsUETETpqhFFnTzB7IxK/mVtr67G7jsxg 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)(396003)(346002)(366004)(39860400002)(376002)(451199021)(8936002)(8676002)(44832011)(5660300002)(83380400001)(107886003)(6512007)(6506007)(2616005)(186003)(26005)(86362001)(38100700002)(41300700001)(6486002)(6916009)(6666004)(66946007)(66556008)(66476007)(316002)(4326008)(36756003)(478600001)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: b3fuOuWsYCIR2HbRTT+u3yLdpx09X+K6soPICOi5OHz48VKZsZ+oFISPXY9lRy3hf/tC5Q5GTL6fNmVsJ39sZhej6llPAliOJG8YOfc/QJKLTBtzeVpk1jO+/24IYqnaNrQkyKFcPe6cNmM0JFnznpV4QRTZewYt9UqyKu5cX2UgkaeLtrOg7BCgfRI6hsP1IQlPvU1L1sONyJF8vhiuD32+zvvrcWdmgpAhkR5dqxclZt3DUuaP3JOuOos8X+lLT+8dS0o3FYMgFi6PBYVKlBXibAd30HGIffU5kbC402B84aI7FQKPvgWnys2c3K72v7PPYdPp9cQ3veEK17Erle8tt4vfyVuBrm8W/uMtG06bZ3HxOFP6kW5UbNZ+mf3+CKL/VkL13FjEXxclGSyTdtm7dgRsW8nrQSqq8R2hBOrJCh4kXG+tqNKSkRhtILoSTF/PcHsivKtXxT3VRSUx1GyS+wS21GDJYk4DR+i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NyYj0UV810feGaEC6QLyIAVk39XwyZTs0bcAE3WtunnP+yEB3xSSaiz0ZRA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 42ujNJJvgM5++h72Ze3InZbQ4MYXYBxUGMMVlQ+bbq9l/P6Eom763ijQLDtrVnHD/hco4/t4mVc250rCMjWCC55ITb1MjIyyGPzOsKZcjqLBEl1puDKiOgvaX6ECis0HCKywdftM+Q1BMN1Iygr/pYH5619bgmkvLmDTPmd/ZMnStuhJ1tS/WJg6jMgtVELkS8NRglKU0CEFMsDpVxRzqYbDzG7LOap26rLPrGyurzCbXR3h/+ilq2B7iukalb5w6YU3rud9UPECLZiLfUp2O4eoCHShDUqwlEayVUGNAcY3mr572j8w9n/NNDNd45xjB8mUXwStyBpDRYeMmQEF2+VydwSeS2zeLfPr6LUWNVGImbQFjQHaMi5vsexgF97tP0x0VkX5+YBNMBfHyj7dTzjLqvu0+D96vioiAn257ViZRWTumFWdC4d2YJDa8ifjOekqYRvu0GLynECXFxD/G4uRUqISQzZdbDylh1jzeZZPb9lzwhdRaK5kBcl25IOfwvzx/3dOfIVmuv160Mtik7KWFLNgzOyXsJmP5j18vlTjWwWEclkP8qq2U7u55YviMAVQ6OLmt5i2U3NAgVQWjq31Qmnk7fhFG/V01JXmj8vMv03SdM9+j+pq6EkazRTZiVSZGeXmClg3GHCsRfHlhhsnvOM3AOEtfNvpl+46voc6nxK0o+90RM5DxGbgCwi/E5aVXlPooA0Q1oWzv8sgb1EFYR4MBRbsJX1/Fwbz7qpKbpC04iYo7YZnhVLivH0mRtiNtsOa7aY0B/N/fznUnw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8f754c9-0c66-4d85-80d0-08db5c4ef1ca X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2023 12:03:53.9689 (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: jAZo4j5QyNao6OBPDf9zgjykgGP6tDTcG4WB6GSxybK+ruF124zed+NeC7m++/Fdi3wT1ZZEud5W6hX2pbDSSQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5098 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-24_07,2023-05-24_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 adultscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305240101 X-Proofpoint-GUID: SiinyD-SuUvyvveCEtmuEsjE63tyH990 X-Proofpoint-ORIG-GUID: SiinyD-SuUvyvveCEtmuEsjE63tyH990 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org 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 --- 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) +{ + return memcmp(fs_devices->fsid, fs_devices->metadata_uuid, + BTRFS_FSID_SIZE) != 0 && + memcmp(fs_devices->metadata_uuid, fsid, BTRFS_FSID_SIZE) == 0; +} + static struct btrfs_fs_devices *find_fsid_with_metadata_uuid( struct btrfs_super_block *disk_super) { @@ -487,13 +501,11 @@ static struct btrfs_fs_devices *find_fsid_with_metadata_uuid( * CHANGING_FSID_V2 flag set. */ list_for_each_entry(fs_devices, &fs_uuids, fs_list) { - if (fs_devices->fsid_change && - memcmp(fs_devices->metadata_uuid, - fs_devices->fsid, BTRFS_FSID_SIZE) != 0 && - memcmp(disk_super->metadata_uuid, fs_devices->metadata_uuid, - BTRFS_FSID_SIZE) == 0) { + if (!fs_devices->fsid_change) + continue; + + if (match_fsid_changed(fs_devices, disk_super->metadata_uuid)) return fs_devices; - } } return find_fsid(disk_super->fsid, disk_super->metadata_uuid); @@ -684,18 +696,16 @@ static struct btrfs_fs_devices *find_fsid_inprogress( struct btrfs_fs_devices *fs_devices; 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->fsid, - BTRFS_FSID_SIZE) == 0 && !fs_devices->fsid_change) { + if (fs_devices->fsid_change) + continue; + + if (match_fsid_changed(fs_devices, disk_super->fsid)) return fs_devices; - } } return find_fsid(disk_super->fsid, NULL); } - static struct btrfs_fs_devices *find_fsid_changed( struct btrfs_super_block *disk_super) { @@ -712,10 +722,7 @@ static struct btrfs_fs_devices *find_fsid_changed( */ list_for_each_entry(fs_devices, &fs_uuids, fs_list) { /* Changed UUIDs */ - 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 && + if (match_fsid_changed(fs_devices, disk_super->metadata_uuid) && memcmp(fs_devices->fsid, disk_super->fsid, BTRFS_FSID_SIZE) != 0) return fs_devices; @@ -746,11 +753,10 @@ static struct btrfs_fs_devices *find_fsid_reverted_metadata( * fs_devices equal to the FSID of the disk. */ list_for_each_entry(fs_devices, &fs_uuids, fs_list) { - if (memcmp(fs_devices->fsid, fs_devices->metadata_uuid, - BTRFS_FSID_SIZE) != 0 && - memcmp(fs_devices->metadata_uuid, disk_super->fsid, - BTRFS_FSID_SIZE) == 0 && - fs_devices->fsid_change) + if (!fs_devices->fsid_change) + continue; + + if (match_fsid_changed(fs_devices, disk_super->fsid)) return fs_devices; } From patchwork Wed May 24 12:02:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13253844 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 5387BC77B7A for ; Wed, 24 May 2023 12:04:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232888AbjEXMEG (ORCPT ); Wed, 24 May 2023 08:04:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230273AbjEXMEE (ORCPT ); Wed, 24 May 2023 08:04:04 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB7289D for ; Wed, 24 May 2023 05:04:03 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34OBxeLK029508 for ; Wed, 24 May 2023 12:04:03 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=md6ik/li0xugefKE28vF1l7w4i02GhDSa3Zdws5DPb8=; b=LlvTvdz9+l0ElQN0OrSJGt1A6TPhbKn0+zJT96LpK0E5pY+JlU8aNtMHVXUHON/RPdZy gzfHWniJqqfteMLER8mH7jTUFYQpTMyFcdZTd/PvEOXed3JDemop3EhungaPy8uQZyZZ SZL/veYryGLfkjG3Y0AHhf26Qt1tzJlmN802ypeoCHvxYmAgUiABPNtL2taJY0T6QLCE +GIGkrrDhONvSzpJS24fxFK4HkzqzBG3fmG6w+lqNoCNKp5C1CPQG5uy4mNgr7LFWis5 E506ETa0eZ06i+QEI+X/ReiGeetWdevwxJSgDYvpF7e0dZNhYe8ZFgjkZyL0ZOBJ+imb 3g== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qsj27r0se-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 24 May 2023 12:04:03 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 34OB6Uj2027324 for ; Wed, 24 May 2023 12:04:02 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2104.outbound.protection.outlook.com [104.47.55.104]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3qqk2evkqp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 24 May 2023 12:04:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e9i9J3swn7I9UdN4OcJjkm73IsYAnfB3SowFyrCvhQBnIk9isqReW164V0BL1m5fxiUibIcoF7acjfVUCHaRCCEDDdmyxB4YgAxGm+5Y/82EcTsl69/qy/JhGmbSKHlL/DhP9jA1mXrWCQ0fGeMAPxIp+kQ4RSg6e8ypCEUHq3uqiDjTMNIZzh7i57NT3VBbVRg6shdU8FcXDjcH+PfSmCQZf90Zd6LQHsB2B/qb3mFmq+7wzmANz82qPZ14TiFmZYE0o7+XlK+TQglYget1rYsFAckTEpARw4KpHLHX1evtypjhWbJNKpTxS4MrO2iBhejhEMaoFAUluAJ18ACK2g== 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=md6ik/li0xugefKE28vF1l7w4i02GhDSa3Zdws5DPb8=; b=GXjhlj7oBY2cjOJIhAvCS/knO8UdLOCtjfDqr2xCHmA/Iivl1dcsPIUHrdYqGB6HJinhPD+wCKy5pnBNGxoQK2oLtJ6DpbOV1EPHtSCV8qd3SZSkODGvv4SuLnsORr54c/O3qpI5PfJ27MNhhKG5WyZ9Qafvq65M1vt12ru6h8PxtuSEU+uLMWRFNNH8XZu6WGb+ot/JQ9z2DG0R5wbaDTgtB92Fpxj6YrcCoSZPbbPrd6d29fEIFtl7/zlwMRtvcpG8cpBxcKg5Clzf9AVYIYI5hQoskd8SqAdAhMLxwQPJnutg7TgimyPKlW81/XUC/qDy64mraFZaWgxP0AUI3g== 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=md6ik/li0xugefKE28vF1l7w4i02GhDSa3Zdws5DPb8=; b=PFTNHDrdnJNSc8Doswx2WB+IBXrzwLLUSkBV0BylKJEYM4dtbMUm07WqZmG2a1e95Mxs5k3fvqvys5rwMZKllGRiJsxeuYTgTwDRAoIpDd2WETzDtGt9+RsReb34N0j3d0NKCl5FOKvBl618XzQ2yYzfqVLlijyDQFsguSYiM4Y= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by PH8PR10MB6338.namprd10.prod.outlook.com (2603:10b6:510:1cd::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.17; Wed, 24 May 2023 12:04:00 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::bc67:ac75:2c91:757e]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::bc67:ac75:2c91:757e%7]) with mapi id 15.20.6411.028; Wed, 24 May 2023 12:04:00 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH v2 8/9] btrfs: consolidate uuid memcmp in btrfs_validate_super Date: Wed, 24 May 2023 20:02:42 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SG2PR06CA0189.apcprd06.prod.outlook.com (2603:1096:4:1::21) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|PH8PR10MB6338:EE_ X-MS-Office365-Filtering-Correlation-Id: 71f18a70-292a-4b0e-be28-08db5c4ef5a7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2ubb7pK0Z2d4v6aYI4r3cJj6bW5Wnx+gz2GIA2xxMbFv+HLWuGWPXUgzPzAoTs1aGVoE1ACCXPmZZAzGK3w6WFUKMu2NKMHr4FRYfbWpjSKuTQtaQaay0m2VcfXKmsXR9N7e4Pqx4qXLJohCGjxEVE9QP4VOBXriRtVp8dA8CaXVhs4XSlhLJAXmw5eeKKgFZcJvy5VGzq17Jq+p+T6wSmAbNyl465PPBzNl4KUyyWP1or/PSwZHad750Hj5oLTbyeKePu2GnZApQhOpDU2KcpMzhbHfScbdS3ce80GKRiCqyRQt7R5eBgEuDQ8pwRhWeqhIuQJxL4z7Fkl+3uwccbg1KMQwyi7NA1amywjiRJ5hFmECcyQDNkDWuUCBlkNrHaLcChZoBtBo87RQCr6e3wbPZkauyAvFUYf5J7rUg/dpCCq0oFAR6PFAm2dlISuSUBqMKy4tvfoyVZvbGoHSO/3G0s5i1N6Dk94KDnOpGvPdlx7Iq5wpiBMy1XKW7tavD05FNCfc8gvbgdnK7yNx0ReHhRoJecweSnPgArOIESKmZ1s+0GnhYSukkD0uA2g8 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)(346002)(366004)(396003)(376002)(39860400002)(136003)(451199021)(83380400001)(86362001)(478600001)(38100700002)(2616005)(186003)(66476007)(66946007)(6916009)(4326008)(66556008)(2906002)(26005)(316002)(6666004)(6512007)(6506007)(6486002)(44832011)(107886003)(41300700001)(8936002)(5660300002)(8676002)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: I5EuaoHr6g0nOkegCjFmXp4PPN62zWpWVScwKYfqIKA5xXrNNrt69/lFJUX6UxZuyj8jK73c7BoPvSFVvwAKYJiCPCJgacotYC2Vt7h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D/Egw5vCRLRE77kKKwR8xqC4uS6+5KeHFeN7fvuxgcWqpMzdM/Wv19514G094bdS841sLBQv7xk1DX2/gVXWxomvDzYlvhZqbp/eI/4tU9fBCVtrSA+3NC+mP3ivr5y64PhxkmbQ/TrCDbpJsPARZjd4Ul/ECh4lcl4jGPigjsWsczHqflQ1hETfpGZpVU3jvZVaHmfrgvVNmPHmF+e8OViS7EScU7Ul9vOLcL0jYygf5i8MnGRwzti/z+OTvOYyae8n7K+NnqNVxgiQVjlEyG6bz8Q3j56e1nXuel0hvrY3zZTbNl3QqGjyGJmk/trr2/uNlYc3arubhqQQCId1/Zep522mweN5lofKQ6/58gKOFdNHqzCx+doJ3OgioupOYNwZlp6ALJ2V8gnx1liLv86jagIvLffcX5eZSxAMs3appXBN/Nn3lWA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: uFd3ZX31ruTQUy+SESwgz/ywaKqvP1PGiydj7PhPqnCK8tILOEcQcTVekFBY6ZrxdidhH/sKsiUF/PZLVzHiuZQEaeJjXuHE2cyTjIxdwC8fWRgjmFGoeog0Q9v7jkRtWrgK/lzrrzNFbwvDsAABclD0gp2tB8+VZjq6uYrxc8wJvQZ09sr2gQHipUIxEFUQOuXoYBkRYrPkkEby2DPr3Dcj6NBheYc+vm77XdOizwiUON0qlhcd8s/+AzSDGSGTXND9XOQsNPS9MfHwyyLiViiDWHmXNCc6/eiq8rnUJpAohmFMziOj46455PIkFIMZ1H1TdLNQCvA8EnsvmnmE0OoQvj7OJaTahfjkbBp/hiXPIV3YLxGP/BTz/MBtoXsk2jRwlFRFI/6lGGe31KJP444eYDdqSzlu+pE60FUnpDxyrIeZ2xK4cmf+hLzikZJfVcADhNcWpIOBnK1a94BkTJHYXM301eWTJ2K7knkJYS9BDNmHa3Jj6VbXndVJ55T48wDNKMShiZrx+o8uwBjk5QXY0PYJqGiTlDiRo3cMIY2pyEowKA9ByGz+/arh1A/Ugsg1Y/uNMN+75aHfwBjQNm78sspS/NAADulv+Uyp8l9U9kv2gc8ELtiP+PnYkpvSdzzkUhkPKMvWGk2MKlFgVE9a4YX4MA64/uit4QLFBBKc5rPvI6vowcYMz5NXZPPlghiltLKTe18JktyPu4CXFEl9I4sC0q8Hj+IgNOHQpSp60FBk1dN62y2FrSYnX0ARcpudZEyUkGSO8ZdKAhThhw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 71f18a70-292a-4b0e-be28-08db5c4ef5a7 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2023 12:04:00.4804 (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: 5tHPmKqigWN/BuEpSeGX8/uX3csO1LN7e5xEV9TlKSwgFN7SLb9xl9lUxrE6Tp57i1+P8nTj8Accysb20mRE3Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR10MB6338 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-24_07,2023-05-24_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 suspectscore=0 spamscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305240101 X-Proofpoint-GUID: lMaK5RHzW5aIqDLAXHIxR6jnZ68IxRpX X-Proofpoint-ORIG-GUID: lMaK5RHzW5aIqDLAXHIxR6jnZ68IxRpX Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org There are three ways the fsid is validated in btrfs_validate_super(): First, it verifies that super_copy::fsid is the same as fs_devices::fsid. Second, if the metadata_uuid flag is set, it verifies if super_copy::metadata_uuid and fs_devices::metadata_uuid are the same. Third, a few lines below, often missed out, it verifies if dev_item::fsid is the same as fs_devices::metadata_uuid. The function btrfs_validate_super() contains multiple if-statements with memcmp() to check UUIDs. This patch consolidates them into a single location. Signed-off-by: Anand Jain --- v2: None. fs/btrfs/disk-io.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 6681e82900b0..d09f767c7bda 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -2392,6 +2392,14 @@ int btrfs_validate_super(struct btrfs_fs_info *fs_info, ret = -EINVAL; } + if (memcmp(fs_info->fs_devices->metadata_uuid, sb->dev_item.fsid, + BTRFS_FSID_SIZE) != 0) { + btrfs_err(fs_info, + "dev_item UUID does not match metadata fsid: %pU != %pU", + fs_info->fs_devices->metadata_uuid, sb->dev_item.fsid); + ret = -EINVAL; + } + /* * Artificial requirement for block-group-tree to force newer features * (free-space-tree, no-holes) so the test matrix is smaller. @@ -2404,14 +2412,6 @@ int btrfs_validate_super(struct btrfs_fs_info *fs_info, ret = -EINVAL; } - if (memcmp(fs_info->fs_devices->metadata_uuid, sb->dev_item.fsid, - BTRFS_FSID_SIZE) != 0) { - btrfs_err(fs_info, - "dev_item UUID does not match metadata fsid: %pU != %pU", - fs_info->fs_devices->metadata_uuid, sb->dev_item.fsid); - ret = -EINVAL; - } - /* * Hint to catch really bogus numbers, bitflips or so, more exact checks are * done later From patchwork Wed May 24 12:02:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13253845 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 6EE57C77B7A for ; Wed, 24 May 2023 12:04:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232838AbjEXMEP (ORCPT ); Wed, 24 May 2023 08:04:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230273AbjEXMEN (ORCPT ); Wed, 24 May 2023 08:04:13 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADEC3139 for ; Wed, 24 May 2023 05:04:12 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34OBxUUR029336 for ; Wed, 24 May 2023 12:04:12 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=VKyUa4+RO5HozZeKCJR5f0vBGxykm8kHD0vrh3GfwW0=; b=K2y4rEBAAYrHzCg6MVcD5HYM9jrAqG053iqyjV6/2aw60z9oFRVR1HD0i7PEpD7NhK9Y 3ajTxvxr2aX4ewoUMu17ij2XTeVKok78FaKYC9xJNT73OtzU1pFVoEZIvjuGWhMrH6rh moQNelj/lRKM+g5SMgg7WXke5VsyAcLZ5GfF/ocZUVMCyQODBMrhzCrABOcyhhJvFDTD XMFZFYgxi/Qru1baRa+O6QGRgxYcsi5sPtw/YNomC+X4CbFDSLm+3gNZ2ijxBZ0flcKj WbcO4Hbh/wE6sb0RdFP3a52ag/m42YYirN/AZ6SCrHFwfkzAQm8omyMPKZZwAkpuDV1m +w== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qsj27r0tj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 24 May 2023 12:04:11 +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 34OC2Jsh028536 for ; Wed, 24 May 2023 12:04:10 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2177.outbound.protection.outlook.com [104.47.59.177]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3qqk2sd1bs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 24 May 2023 12:04:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UcS06BbdjX7myee9oz8texbGnY1OvR03T83MEJHeu7LRWHYwSm8OyZGbhJlVUWDzCEV7RGvt2G6KE880Y9I3OpErQlXYSl/gSUlX9g59SReij1mnDlmJQ4Ul3i+cJN5QgB3qV1sqX7bLIGvJXRjce4E+1a5L9P/ghswoKLLrBsf/1i0fK6NdaA07Z7sHqs2qk5y53BM7b9J5/+ITkFUJ/AtLHXuY3jQYUndcBsJdCcK8YSgloEpRoR1kEzcJk37o+okoCx2/I0ABn7EUyam60oMifwBwF7qf/uQixe1gWhlsE71ss9TyEDXv3UNGJ6x1ehvAQUtAq9sFGCzKt/h4ew== 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=VKyUa4+RO5HozZeKCJR5f0vBGxykm8kHD0vrh3GfwW0=; b=Ebb8lLZ0d2d38dOBTADpL1H+Y4JyOIvkpvg08ROQwtQqSK/hliGO0fIR5ES5v1pn6kjxQ0dsQnxoMVRvbn3pLNhQD3qb6s7SzRdjydM11sSjD3/dlu5KOsgOpdt5FKp21WE6R0w996ZBBLKCh8HiW3Vtp+eKFpRLQ6zBLZ5dj/+quw7KkYUph+PLmhxLRcG56nd5mALXBW2sfhXwVDUPhL28gtXmbikYcac/yPZ38Pae2Hzg+WFjomsqsYj326rum7j4VLRcK8MgDvomIGTJUnYi0Ow/zRAwN0mcQ+8kBbPq1NQAoEWEKh7842ZXNH+WQIURiCRN0ipcHhHP2kTcyg== 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=VKyUa4+RO5HozZeKCJR5f0vBGxykm8kHD0vrh3GfwW0=; b=bedqvDCCv6cPrgZ1DMnuA2H6uoGh6ioICJJxgKvbbKRUbElOKHJ/QtN+JFJjE3eqR880mc5/v2JyGudeq6X8zstFj3GN6CuqTaDDIGKwY/1qKN0saZDHu3wuoEktOuxEHGc1DzlfpXqAsXVcH5G01X2uZvV/971ZGvYwMEO3B1w= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by PH8PR10MB6338.namprd10.prod.outlook.com (2603:10b6:510:1cd::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.17; Wed, 24 May 2023 12:04:08 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::bc67:ac75:2c91:757e]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::bc67:ac75:2c91:757e%7]) with mapi id 15.20.6411.028; Wed, 24 May 2023 12:04:08 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH v2 9/9] btrfs: add and fix comments in btrfs_fs_devices Date: Wed, 24 May 2023 20:02:43 +0800 Message-Id: <54c6ec15f994a563cbe33ea75666bccf82ad3683.1684928629.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0015.apcprd02.prod.outlook.com (2603:1096:4:1f7::18) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|PH8PR10MB6338:EE_ X-MS-Office365-Filtering-Correlation-Id: e9af6292-8eff-437c-98e9-08db5c4efa4f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sjCyb+lnsWAeiLD+8gK6rKeEi2bQQBfbysgz39xibVHHPwJ04MRc3RSUBigbJnipXv2i9XyGaA/mTP1x6duxoebfvi64cLLTpRNWkRbFQpHNlPnGYC2UMAgI1B1Ex0o69jTwqK12Qb7B89qcFuDEfFSRCTiTZAWATQutd6jlquGfhYc0lqi1dHXLL4WwsWC0zaBBSPtxdo0DmlrhD3MO35nVzEwkaibANFrFr80N92rikyZf9MQSf037H1SHEqlEYgVlrWUT3JfollO5hEPk7nPjjxZGJIQPMJBmoJhjERQp0jRs1M+/ZVhWl0tTjSq1LDBzi1DEVWnz5esq/xIVImG5YYVcjBW4f9ie6EPtTLMfibHV9S6xFeSHBCTvThqkzwYjmN0yIDoBFpAeGsHBNDLunWHoK1xEnHwTvI/Nv3+Wlmrxk0zJbAi72t9WPRxPdbbdSWzf9Gpulrvr22SuUS3IMjNaCuxe5ez0J/VA6+2aAMLXgrtM8Fqhg4AO9IP9JQQwJwVo0J+kPsgOg8dzzjFWDRO8GuVJOze65+zs/lKAlOPHLqRYmY2YIXU7fz5h 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)(346002)(366004)(396003)(376002)(39860400002)(136003)(451199021)(83380400001)(86362001)(478600001)(38100700002)(2616005)(186003)(66476007)(66946007)(6916009)(4326008)(66556008)(2906002)(26005)(316002)(6666004)(6512007)(6506007)(6486002)(44832011)(107886003)(41300700001)(8936002)(5660300002)(8676002)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9b2v6Geulb6cJ7XBfHqNLVsMe+a2Ufj11DIpL9hSTVioUVwZAyGQBkZqAqHNcXETGnLTN2GgP9a2IpWnVnchsbrXxkO+M33v1BF9LaIEGIVX6t7kqx92TVz11gO44XBzCMmAvuS3jz2S5byTPSbG/9zlQn9SMOfWYuTp2qgRuMo6uYF7ivEFacBpQUDqnYbI2GgVyZ3V1grR+IUv/DhiqDfzLOmCpxBd62ET7ScMCT2QStVmNkvJU9+tbSv0ATtbHuFzhhc8EXgjXKME//K5WU9ENN0WnXGy0Y4jJ6ySV5XVuqQthUgMBiVAwMDfKqbvJmxjmNQbAYqcJ43PVNpcY0qV6rlIAyIL1oWosfmDePw7zTVp8AU086xvkU86AJ+n2udpbqgxxasDCysc7UxtPufu+Zc75+Ug7gJhj7DY0iMZlR6qzTgGisBdjYrp9gARspP9HQsLGGfJ845Skqokv/I5zhDh6fDw7gDqlu5JSUBGMp3p8iDyU/kNijvdWFNWWNnYSssvu8chojqOwxjUQGqAjTVVsFg4dRxusbuWpRX4u0Ono5dVQGUAAHbukCaK2FgXCO3GX8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ount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: LspN7qrDkXPwqqo+4gccCzDNK2nTHBPW/7qymLRdRsVYnLniQVvviGccYhJbMpXkKkuy9PbggMzvSH0kyY79Fos3SrQAP1ucOX0mPhX/Oig+F1SthpZxG05pFwg/zQKvbq2pu82QyyaQStAynFZZgk3eBsfBu5ww7feVetLP3q7qo1HKo417ktRO5Ac0SPXEljb1BzI+xQOn65iPVhc3HENDpPN0tnpjGbwluYqkcf8DZMJtYEKf7f5drdFlcDnu7KvXN2e6iBWHrzUw1fQhdBLDpwRfTVd5C1qrljlDQD+xbNp5qhX9jPzZ+Av7g9K3/g3z4uf+Sc40RO+E5IUt8rm/QyDXNM7pLf1JgxN4c6fmqT/dxyyETv5P6zXiTGmG8TvhLFax+QqnE/Q9g79YQ/TKLkMR42HNXkB1GZynjibEXaZQwmVmMPGN4wLiuXo9i8Nv9O0gqib2u2t4Jcs4n0mtgOTtJcNIOhKJwTWZfyTl+qVaaMq96d9alVuF48F1ciceww9ZWWtrP9xPn72XZXB2tjFCG1XbC0D+NSnhDFWCvBsaRNUU3ho/G7SCT91ovrHIzUm7KCPagnZgHA6AcEs+Yn35kXHYUCtI+PXiwIwsFA/dLqWY0tIbn0pobrZgBc6StM3vpGwYA6/XpZ52xYWa1yGCxc7Z7fioju/uH5B9DeSs3lhPNrNWFGxcJzQryRG4AOQeaqbt3cffNII9Sykp+iOkcNGQsEIFnYOr5KDg+/waY+fusorGJIj0hVfl5KwbTpWqttxtsS52e9IpWw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e9af6292-8eff-437c-98e9-08db5c4efa4f X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2023 12:04:08.2718 (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: 5YFG5OQNzkTETj/VV8qlyuCgbGJwehbH1lXQz9Qv0in5R1lL3oXffjEZ+sa4wviN/M5heyCdM6PEqE1Px/piKA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR10MB6338 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-24_07,2023-05-24_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 malwarescore=0 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305240101 X-Proofpoint-GUID: 6yABuLDhr3bLQ5CdrQxOsykgpjfkUIM3 X-Proofpoint-ORIG-GUID: 6yABuLDhr3bLQ5CdrQxOsykgpjfkUIM3 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org (No functional changes.) Signed-off-by: Anand Jain --- v2: New patch. Part of this is from v1:patch1. fs/btrfs/volumes.h | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index 56633d4f9b31..f64d480aed0f 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h @@ -328,11 +328,11 @@ struct btrfs_fs_devices { */ struct btrfs_device *latest_dev; - /* all of the devices in the FS, protected by a mutex - * so we can safely walk it to write out the supers without - * worrying about add/remove by the multi-device code. - * Scrubbing super can kick off supers writing by holding - * this mutex lock. + /* + * All of the devices in the FS, protected by a mutex so we can safely + * walk it to write out the supers without worrying about add/remove by + * the multi-device code. Scrubbing super can kick off supers writing by + * holding this mutex lock. */ struct mutex device_list_mutex; @@ -341,21 +341,24 @@ struct btrfs_fs_devices { /* * Devices which can satisfy space allocation. Protected by - * chunk_mutex + * chunk_mutex. */ struct list_head alloc_list; struct list_head seed_list; + /* Count fs-devices opened. */ int opened; - /* set when we find or add a device that doesn't have the - * nonrot flag set + /* + * Set when we find or add a device that doesn't have the nonrot flag + * set. */ bool rotating; - /* Devices support TRIM/discard commands */ + /* Devices support TRIM/discard commands. */ bool discardable; bool fsid_change; + /* fsid is a seed filesystem. */ bool seeding; struct btrfs_fs_info *fs_info; @@ -367,7 +370,7 @@ struct btrfs_fs_devices { enum btrfs_chunk_allocation_policy chunk_alloc_policy; - /* Policy used to read the mirrored stripes */ + /* Policy used to read the mirrored stripes. */ enum btrfs_read_policy read_policy; };