From patchwork Thu Sep 28 01:09:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13401851 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 3061EE80ABF for ; Thu, 28 Sep 2023 01:09:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229493AbjI1BJt (ORCPT ); Wed, 27 Sep 2023 21:09:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbjI1BJs (ORCPT ); Wed, 27 Sep 2023 21:09:48 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00F6DF9 for ; Wed, 27 Sep 2023 18:09:46 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38RL7RQD003964; Thu, 28 Sep 2023 01:09:35 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=6wuU00vIVnScP8GKzijGhVd7brBgF+JQIGH6Tv5Zs1s=; b=wF3vsnMYjEo7S0Fn3Elh6fbbD2I5Pe4I/MMknoQBay38kxIxNBkXyVuscBSCCr73Uvtj wnf1r6jjsoiAZucJ+J0V1R/BTSUzBpaR3JBnWk/b3v3WwhVvdbWoKrBIBaBrWnwgt8kI GjbCJeyj+01+hVtzDrtf9gitqxXOIWfl0KRXJHtkrz+6pHTs9VTezBF9A3Lgo2h231EA 6DqjBc4snZpYFP7Vm6rj9qyiKTQigE+xT///H7o4bokXGxb+31vzyULH8PJsdr8xJqCm HEG8DnO1xr/UvB1VVWtviEj3NDnuj9QwXaY72t5XUQTa1DcXGQh8B+sSDw9BlpRI2t+a 6g== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3t9rjujynb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 28 Sep 2023 01:09:35 +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 38RMk8LO035041; Thu, 28 Sep 2023 01:09:35 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2174.outbound.protection.outlook.com [104.47.55.174]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3t9pf95hvy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 28 Sep 2023 01:09:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gGzrZpO36dxmgUNQ8S2oR1hryY2rqGhAbPWoYPLAcgZYtczjSZ+V/J2+6rzId8WEoAKDr/pQcltMyQwsj4A/l+c7yeGJ8Dutk1/OrTzHnso/+lAqz1uGRZNBXg9nc5KtxTwoyeKVyRFGOGctMF3zAFZWRWevDMQFxWLDN+L2GBEpKFZVeW5eqqJrxhKQTN0d5xgvHzK6rlFHnO6vr7v8tfmuXgDhIy2ygljszeJ26xBEmr4TKn2LDd+V2DdDScxlp1k/hD+WMQ0jNmVP48u8FASQ2tL3SWrti6MiJa6M9nrN2liywPGqvLxAdZ8sqpf42terPKM/7t6P4tA2R85a6A== 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=6wuU00vIVnScP8GKzijGhVd7brBgF+JQIGH6Tv5Zs1s=; b=SrMlsAREWzGjMGUxSt2COAC+uVtgJtTX3NgPr5Ood/JOVXbb1yn7aKgmKaAfzhjTJEUrJ+302uwoxf8GCI9A9AzLHPY+7Inq4J1mlGRqIbw36oCCRDL+cPBBsM6qSFy0B9Dq0j6zEgY4DxJM9ZKPnmIWWlh6Rve9v5qmBhlQ3FSEbMsRnA+JQQ39ZdZaQn29ooPnN9EyKXrdamHwtKDdHZvIwHjgViN9OyYJIIk+YLRQ2SmLGQYKO+vPdM3R/6Q6Ut4xMEIWHG67I2bIEaaWPVmsbDG8yJOam5cX8eQ9hVJhDC6MCoDyocooQvZGw4uAppDbEqdFb22rC7HCz/G8NQ== 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=6wuU00vIVnScP8GKzijGhVd7brBgF+JQIGH6Tv5Zs1s=; b=pwOlY+g50HZ9NvvARtXfR/MLyWvkRt8BRalVEWsR1eSRn5J/aCA/ukHpG5gmeAVhdBh7NaOqq3gP2WB8Pgk9cxysyOh7Q4bZIPZHwEjEg9mOP5PATklT8oaFBrzL9R9xN2f1swNNf4nFQ7eM8UXoaZcE/anXV5DJyaYoVvwNWw0= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by BLAPR10MB4996.namprd10.prod.outlook.com (2603:10b6:208:30c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.28; Thu, 28 Sep 2023 01:09:32 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::2bbc:60da:ba6c:f685]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::2bbc:60da:ba6c:f685%2]) with mapi id 15.20.6813.017; Thu, 28 Sep 2023 01:09:32 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: dsterba@suse.com, gpiccoli@igalia.com Subject: [PATCH 1/2] btrfs-progs: allow duplicate fsid for single device Date: Thu, 28 Sep 2023 09:09:18 +0800 Message-Id: <9a18c9a1dcf857c3e505994d488facda4bcf37f2.1695861950.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0052.apcprd02.prod.outlook.com (2603:1096:4:1f5::20) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|BLAPR10MB4996:EE_ X-MS-Office365-Filtering-Correlation-Id: 61859858-d0a4-490b-5fdb-08dbbfbf92d6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kdcWJgJkftmHh6PxcPUZwjqG5mRsgeb0D/bfszxS7oxKcC10m0TsHU5q8UJ1g+wvnePWqy3ZoG47yoxz1xGPaBdyKIeZojpwc878Sr4e0OzzUDFdnuAFhgqBeBwiE7b03payJe+BADSSznwv3DiDnV5LVpZkzijteh66gMKYPgpAr4OeC99r3U1sbA+s1MBMaQ7ZtkXtIIFGebyqgKaZS5dOHE47QwWxS0r3yeMmAZfzkEv9z1wkIp+/yA5vDRJkipzARxPIhJieeSFhUDUnN53q2NbpQpnJ8qiq9/oOLGkDSHhfkjiGdqb4nlJ5eerh1uHEwr3AHrR4e7wVIzhwOMkOYbxfphDVdg/Tj6/hx+YJkCNx075UkrmUSymiH++pfLFRW1IVSAMDxarPs5B5tNSrxMNxNPebD9z939/18WznWZfEJYQPwyoj48WUUd3G+AG3VeTh6goOFnOpHSbt9CoSYUWDLts3BzP1CK114o0qXVVo2/hvW3NbvxYCxAG4i21cefjlOuNUWy0NLQ3HN/OfcHT83rautftoZ7AYFg6oR3s8LZRcOolm3E9t9Ukb 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:(13230031)(396003)(346002)(39860400002)(136003)(366004)(376002)(230922051799003)(64100799003)(186009)(1800799009)(451199024)(6506007)(6486002)(2616005)(83380400001)(478600001)(6512007)(6666004)(26005)(2906002)(4744005)(44832011)(6916009)(5660300002)(66946007)(66476007)(41300700001)(66556008)(4326008)(316002)(8676002)(8936002)(36756003)(86362001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fjBQuVPaITfw+7vaviZP39oGTg03Db6vVyPbpsUjfQK7QlUuEFPIZ5SQK8llT8BvDC1Y8i/1pb3coIczXOYPELGRhaSKJuVpFwTcmIv9obzDkF1TF9LHiLmHZSz2t9efWt1J55owkawKtNK8pvFlZWSzl8s1BFSLgUcptQLkuvWF0U3rYXNcRbZrZ88113ji8zexCI+lxjGTrUJgoTDZ8Sg90NDrNgJ7l+bK7F62uoXSSuJiN2UVYDYnvJUABlWEMoF4y6mAodmS0mUKgyyhacgogbvIGOkxFUZMY+Og290gB7hLxD63mnqZCGfWm4ebSgAn3bhIf51NjxDyNzYY0tZTeQ8nMHLxY6dkY0CpW80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PFf0iHYVVKGtuTZbp6+P1hE8D6qkmY7hHBZYuRjQVoPdi3E1DDd1tjSdxSmXyPXTYCEOaNn1W4ueEowTL3DmH4a0wk0xE1XBV0eWI2uMqcrXhA0DNnckJ6Va4QWHRtN20jMNDnxKBB+fdmbDJq3riaw7/vTo9mz2CQxgaWWcw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: BKltix+HrFC+1fb3o1y/rwwO0UWFLekav9RHVS+OQv4O4qlqwhvTJo1sbrBeM33aRNCeAjYCyJnNeXDZuTNSMfEyOBlUdPR98SiembmLhUCzePd/ejA0OIRXzTrDTsOWrK5TvbTx0kBXDMbl3nkCrXjoYC+Tennj13CmIjPT147+OIo+9MxuMT1lVHa1KpMQ41R8dzMdMoK73fkxYHLCeUezMfP53pyC1TBgtxRjB5ZDMoMf3EW75H0EPxM7xgvBBD27PuLGwCWuOU0dhAMiFKnmJcGTXpK67v0Bn+21YPIv9woZk3jcN6kcxpND63dl3buGaEh6Se0ITnh8ZeKTS73XWEPVjWaqd/Gh2N3S8gje7DxCif73L98jR1XsYc1MY0cGvPLlcUsej5uvL/qD0zRoFaNkXYXxB4XqPXiSK0hATUSC6cimtDP98qzKhGiFENvc4YZcMHQbm/sgex/H/SDP3la9XhqAy7pigI0TCz95+OnIK+fPRcbsN1/cHaUZTyEA8B4bMCFVDK+mRkUjoS+i2dgZU8THTvOpAosF+9GZKGcYdyd0JPODn4/WeYerI/Ed6UXWRwJkDtiyzEFFU96b71sW1z8R0zMlgMwmZlHRI67mnHcSUm9ohZAWbFbukPlQzo/HRzU0z09VPvNb3Pt0QgWCKIeLBs+GUXyjcSXP6TD4qHpKMQKikr8/3fniSfguGMrNsVTy4ifXamc/+mgVQDD51Tz3IZvDYXrB2giBG/V6F+zezC497YmNGrUtuEC38SztDRi4BqAZLbET1v4Y9jPM/duTwcpA/E3b/lx3KkhjbjGxpFalSm2HRMqH X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 61859858-d0a4-490b-5fdb-08dbbfbf92d6 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2023 01:09:32.7566 (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: MYZU7oYbGm0LMtAx3NqikR7aGefUqWLr7HlhmP1PTVrbal3vY+YK6eh9ZdNQ1lHFeYFqtBHMM24sSt776FV7Zw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB4996 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-27_17,2023-09-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 phishscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2309280008 X-Proofpoint-ORIG-GUID: ThZmKDuVc6tQHyXRkokKQQidsMRwdAX0 X-Proofpoint-GUID: ThZmKDuVc6tQHyXRkokKQQidsMRwdAX0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org For single device btrfs filesystem, allow duplicate fsid to be created. Signed-off-by: Anand Jain --- mkfs/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mkfs/main.c b/mkfs/main.c index 6b38f8079bb4..68ff5d7785d3 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -1321,7 +1321,10 @@ int BOX_MAIN(mkfs)(int argc, char **argv) error("could not parse UUID: %s", fs_uuid); goto error; } - if (!test_uuid_unique(fs_uuid)) { + /* + * We allow non unique fsid for single device btrfs filesystem. + */ + if (device_count != 1 && !test_uuid_unique(fs_uuid)) { error("non-unique UUID: %s", fs_uuid); goto error; } From patchwork Thu Sep 28 01:09:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13401850 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 08C53E82CB7 for ; Thu, 28 Sep 2023 01:09:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229539AbjI1BJ5 (ORCPT ); Wed, 27 Sep 2023 21:09:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbjI1BJ4 (ORCPT ); Wed, 27 Sep 2023 21:09:56 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1ED6BF for ; Wed, 27 Sep 2023 18:09:54 -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 38RL6I2M029442; Thu, 28 Sep 2023 01:09: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=PB3BLbjaYAA8iZ2FbSAc2SKnKJnxIMM9qMc32Kb9qH0=; b=WLkOpkclFUpZiWpGXe59DFkvLcH9ZwX13dgHTuadLrf/bNCFZCJ0gBR6jN04oyCFt/LF d/oDCYxl0iRCoHn7iDZAurXns0kWWUkiq5zRiswedGukWaS3bzZiEmc0cZl+DjKHbKjr i82/bJnfr7dnh6pswW4HFEwTKOcu160xJ/GhJcmFsvXV6EDrHhErx1tksqNXS0m4molJ T8EPxyJcAeiOJ7A0JiE5AeAS6aYqaFiWiWdMCVuhhU0AiNhoictLaACabHw3ApiT80f6 20VYd9/7Pb0wcUcl2TeSvR75d6UipOJn8d11ct+8GH9TKmxU6QQMnIcHWbwfckXuEpEN mA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3t9qwbjw9d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 28 Sep 2023 01:09:43 +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 38S00pwv018004; Thu, 28 Sep 2023 01:09:42 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2175.outbound.protection.outlook.com [104.47.55.175]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3t9pfet4wb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 28 Sep 2023 01:09:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U8q21SYWCUTf62fUmp2GC1gaKQbdrHnqkGa1ofr0Yy/5NiwwRxcWdv6+mrW5qUmySwf949hCT2L3+vkq0fg8XCJyXbHJWW6nT2EYXkdKhQ1iiC+JG22x0ohj6Wz26E8whdKBRLqOGiyNqdX82E3jVJ7fJT1m5R0y0VXJQVighyU8TKPqbcKGaLVWUvnsKK+UyqF6Ctt5NAyuTHmloCzL0r4UWekVoPTWdT9EqCUOE3dGz2lHVNYPpgZc8YMWDJAPTSsZQNauKwTn4rGJCjdD5SIUC7gqFg8IHHc5gTjlI/VYPkzD/VK6o5d8TrtKsFOsdkIuf9Q5sLMfGjhEQEMpAQ== 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=PB3BLbjaYAA8iZ2FbSAc2SKnKJnxIMM9qMc32Kb9qH0=; b=in6UlieD/LWrx2BMlCO/DNm1V2+HdmTu/aFoIVae/L9HxqPQFogLoHbGDIOigOh6wn63OknvI3ExpTAxCctYKIg5hj+vmv8sJcH108zrtEqEjzShyMiH9hFfDLLxksPTKh+ea5R6Oqi89gFqVS+M98JapdJZNjIneguC/ApoZ4jG/6tPgeX/bPGrdQgDiqaBcaonZ3kky4hW6wZnOQVIxUEi0JLpf2yGi0Sctjs/9JfM8YZ2YKKHLmJgJ6PPBTzoWEnZRHn5/1gMnhNm774hNbW7DsJWW38i3YvBwY8THzkAbSas+exbdeeJGHXGEKe/sgU8i+1gzCU8DaiPUki8ZA== 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=PB3BLbjaYAA8iZ2FbSAc2SKnKJnxIMM9qMc32Kb9qH0=; b=La7K0fJ6b0aMJPWa93IbOlH03417TMQYIRQ4i2ioQBZUAagAo6ZJ37RXbASry3JJetPzASyfBQmvj3CZTkIZtomXRfRgdYWipSxOjzd2GAWZlvxrcgrtpJ0nneY70vdpW/On1vF7FSR6A5sGBm/Tsl5KT5XdBLu5zK3AbU0kUkE= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by BLAPR10MB4996.namprd10.prod.outlook.com (2603:10b6:208:30c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.28; Thu, 28 Sep 2023 01:09:40 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::2bbc:60da:ba6c:f685]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::2bbc:60da:ba6c:f685%2]) with mapi id 15.20.6813.017; Thu, 28 Sep 2023 01:09:40 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: dsterba@suse.com, gpiccoli@igalia.com Subject: [PATCH 2/2] btrfs-progs: add mkfs -P option for dev_uuid Date: Thu, 28 Sep 2023 09:09:19 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0004.apcprd04.prod.outlook.com (2603:1096:4:197::22) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|BLAPR10MB4996:EE_ X-MS-Office365-Filtering-Correlation-Id: bc119c43-8460-4588-0923-08dbbfbf9726 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hoclg6+LSRl8gKIRsOFSNKVhrSQp+wTRhxJ9uf9EzWqt9s4OHmSQ48i1zgZfUt2E8PrX6UJ0Di+P+lLvmhANzI2YsAXKtK4/4QY9lmDF7iDaaoC7bj9BrCjCBXK22nsWsX3DDEiivQVDm0CY46NAlWGFx6NVzUy1wYvyYwObWfIYy3MN1yLOovdXzAlxlR7ZzJrPMmxCUH8JVWkuMNEqRgNIq1GabOxYU+O8zrX8DBBBaNN2TY4Q4uw6KXhVwEH6Z11Pw3SU0O5Heu7MOcfOVh2RlY5nssKygPPb74VTta5e/ecbyfVTITYVENTin1XvEIoC/aId8yEDnk34L9q2iWfDGwYlI1bN87FJ+YbX0i6l56iVoDQbtctRLjnFVsOPGFn47dQoN9/rmm8YbO65dpvSU5Fzx7fiEdLP9GVw5QUAqaWpQ8WbdfDCBCxCCO6n5z1abYSOZsM5MA07i5H2wpwqw83GIGfcXFT/6OlWHN6JFE0NTLu6XGiCnvwTulwj0ngh0Z8wFHOS7xNWDvRy9HwOQny1GpEEQfAo7u8xl0jgbX3E/h2O/mcLcGH6TAa7 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:(13230031)(396003)(346002)(39860400002)(136003)(366004)(376002)(230922051799003)(64100799003)(186009)(1800799009)(451199024)(6506007)(6486002)(2616005)(83380400001)(478600001)(6512007)(6666004)(26005)(2906002)(44832011)(6916009)(5660300002)(66946007)(66476007)(41300700001)(66556008)(4326008)(316002)(8676002)(8936002)(36756003)(86362001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FI+Sd4HY9FGdR5eMPAQgclDQ8C7+ATfrW1nw3GJsSIAaxK/a0vQI5OLBeB4sxL5QkF9qVLZiIERVLzlxN+LB6JfN2kpiZfoEWNh7HCrEQcdqBZcsZScYi6jo/oq16XtkCqOe8Xaeo82HXhRgJh0oWA8wNzevvahAdIJLlIqUEu0tKb8NVEX5qay0QXct5uvFe8etgySiLZeUleznY64E+a3QhKXoALm81Qzc5eN0ZcBbfJY5id9qtLxoG0EAePBo5l0eCpDyTPXz7Ks+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oaWeMpUXhQ4PmdAQ8dwF3v1rOOeG+uj38ao025N+iSfqKiRkE+powhhGVVOHXITIpsbEE+/0zrUD1eHVkpkK6xvKXGq05s9baPYX18Ztx X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: bc119c43-8460-4588-0923-08dbbfbf9726 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2023 01:09:40.5651 (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: E16Vl6Ka76k6ZQkG7ZLkBXc0zzuyYzcUBBevOHG2yNgUbujHy22JF9hSXD+cRfoZnbiSMgeGCLE0Djy4VLnVBA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB4996 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-27_17,2023-09-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2309280008 X-Proofpoint-GUID: CkaBEgs3sXYR6cZSqsfZ3vgqv6RHy2AO X-Proofpoint-ORIG-GUID: CkaBEgs3sXYR6cZSqsfZ3vgqv6RHy2AO Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Add an option to specify the device uuid for mkfs. This is useful for creating a filesystem with a specific device uuid. This is useful for testing. Signed-off-by: Anand Jain --- mkfs/common.c | 8 +++++++- mkfs/common.h | 1 + mkfs/main.c | 9 ++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/mkfs/common.c b/mkfs/common.c index d400413c7d41..e9a2fd5e4d3e 100644 --- a/mkfs/common.c +++ b/mkfs/common.c @@ -340,6 +340,7 @@ static void mkfs_blocks_remove(enum btrfs_mkfs_block *blocks, int *blocks_nr, /* * @fs_uuid - if NULL, generates a UUID, returns back the new filesystem UUID + * @dev_uuid - if NULL, generates a UUID, returns back the new device UUID * * The superblock signature is not valid, denotes a partially created * filesystem, needs to be finalized. @@ -435,7 +436,12 @@ int make_btrfs(int fd, struct btrfs_mkfs_config *cfg) } else { uuid_parse(cfg->fs_uuid, super.fsid); } - uuid_generate(super.dev_item.uuid); + if (!*cfg->dev_uuid) { + uuid_generate(super.dev_item.uuid); + uuid_unparse(super.dev_item.uuid, cfg->dev_uuid); + } else { + uuid_parse(cfg->dev_uuid, super.dev_item.uuid); + } uuid_generate(chunk_tree_uuid); for (i = 0; i < blocks_nr; i++) { diff --git a/mkfs/common.h b/mkfs/common.h index 06ddc926390f..d512ed853987 100644 --- a/mkfs/common.h +++ b/mkfs/common.h @@ -91,6 +91,7 @@ struct btrfs_mkfs_config { /* Logical addresses of superblock [0] and other tree roots */ u64 blocks[MKFS_BLOCK_COUNT + 1]; char fs_uuid[BTRFS_UUID_UNPARSED_SIZE]; + char dev_uuid[BTRFS_UUID_UNPARSED_SIZE]; char chunk_uuid[BTRFS_UUID_UNPARSED_SIZE]; /* Superblock offset after make_btrfs */ diff --git a/mkfs/main.c b/mkfs/main.c index 68ff5d7785d3..f0ff1d6cc936 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -1097,6 +1097,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv) struct btrfs_mkfs_features features = btrfs_mkfs_default_features; enum btrfs_csum_type csum_type = BTRFS_CSUM_TYPE_CRC32; char fs_uuid[BTRFS_UUID_UNPARSED_SIZE] = { 0 }; + char dev_uuid[BTRFS_UUID_UNPARSED_SIZE] = { 0 }; u32 nodesize = 0; bool nodesize_forced = false; u32 sectorsize = 0; @@ -1144,6 +1145,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv) { "features", required_argument, NULL, 'O' }, { "runtime-features", required_argument, NULL, 'R' }, { "uuid", required_argument, NULL, 'U' }, + { "uuid", required_argument, NULL, 'P' }, { "quiet", 0, NULL, 'q' }, { "verbose", 0, NULL, 'v' }, { "shrink", no_argument, NULL, GETOPT_VAL_SHRINK }, @@ -1154,7 +1156,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv) { NULL, 0, NULL, 0} }; - c = getopt_long(argc, argv, "A:b:fl:n:s:m:d:L:R:O:r:U:VvMKq", + c = getopt_long(argc, argv, "A:b:fl:n:s:m:d:L:R:O:r:U:P:VvMKq", long_options, NULL); if (c < 0) break; @@ -1262,6 +1264,10 @@ int BOX_MAIN(mkfs)(int argc, char **argv) strncpy(fs_uuid, optarg, BTRFS_UUID_UNPARSED_SIZE - 1); break; + case 'P': + strncpy(dev_uuid, optarg, + BTRFS_UUID_UNPARSED_SIZE - 1); + break; case 'K': opt_discard = false; break; @@ -1667,6 +1673,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv) mkfs_cfg.label = label; memcpy(mkfs_cfg.fs_uuid, fs_uuid, sizeof(mkfs_cfg.fs_uuid)); + memcpy(mkfs_cfg.dev_uuid, dev_uuid, sizeof(mkfs_cfg.dev_uuid)); mkfs_cfg.num_bytes = dev_block_count; mkfs_cfg.nodesize = nodesize; mkfs_cfg.sectorsize = sectorsize;