From patchwork Tue Oct 3 03:46:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13406710 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 D9A1CE776F4 for ; Tue, 3 Oct 2023 03:46:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230126AbjJCDqo (ORCPT ); Mon, 2 Oct 2023 23:46:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230129AbjJCDqn (ORCPT ); Mon, 2 Oct 2023 23:46:43 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABCA9C6 for ; Mon, 2 Oct 2023 20:46:39 -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 3930jRRb028533; Tue, 3 Oct 2023 03:46:29 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=WHAVg0uPbjuyBlNN3MIdrdYrzUdAotOSk+WsRb1goVY=; b=qpt6I1jcttlj81eyKTpKFklepjdh5b2crsvGsGPIJ3Gx4qggUFeOXhOX01B0XKEc6o7w v7V9CjyPbW9JV045lbY04nCHppDZTeVzvMPkyAuU/LQbZJWfIjtwybHIlATyCIYIUQHi n2Yj42EgqLWwTFuBfeSn3frXEjV54hTAS1thpk+jvYM+hyZZpIjiIzYGjd7WijC4T98U CBSbSom2Mb5hC0cPU/HIDTET31gyKZTEiiAWQOO8VlXfhJnLJIVX0qJ43msyK7fVFZ8/ X+qKPApvRifgQJd21dICLBcFzElwRM9fMbytpCv4XUQEjCK0eqsFmYnH/Tqpq8/9zcbG 4A== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3tec7vbqtv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Oct 2023 03:46:29 +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 3932nOYB033614; Tue, 3 Oct 2023 03:46:28 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2169.outbound.protection.outlook.com [104.47.59.169]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3tea45ke5j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Oct 2023 03:46:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EfVLuFMz6rh1l3bZ2vEbeI3JVN6b8aZqzyi4KyUcNXjSXkoSDDW6Je5HpDB9sbdTrC3nOnvdgAgbPP9r6l/Rofk5+vDg9T+EqKv6TGghu+kaIqA/I2IkdAGwrsh73OSiRzIhJ+XM/vDEhfyIOvpE90mm7KNr1GyKnouLVswqUTy3voGtlLpgWR3qseoQ7HiP6BL4SCBgnrcpDW4HFe3eRNIGkgz0FfvX3iiNm4FqlciGOoQG2xrroqemlpEqy4l4uWfdiBiTIz04m2LK7ddxJEFaH7tDVRFLIyRRGUQqPRi+ymFtBC4xwa/xJPs9WwO+Y2quYrg/g88Uvzc/Uu/9bQ== 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=WHAVg0uPbjuyBlNN3MIdrdYrzUdAotOSk+WsRb1goVY=; b=FEJttRtz4SLfkB7UM2oLIUoDEbpy/em4rnu51pOxywpBCJDz7ZOLZ2j47pJNDgu59Byv+SNYn1frBUPBu/lvdiC8tapqJPDiXjcBXkQgoYEWfNXindzRUfmHyKnplCbw/W/o9CJ5wmTJE4tkxy2c0Gy5aFEuUBYrCk3b/Sw33DcVg78WLu+FIsibXgBvSuQInGx5jQMn9TYC/MZlPIbHopEiw1qnKXceq6lSOyqQrj2xnXJbWaYYgCsyaBhZaMedyiMqqzvn2qXdKDOgVhpN4fEzMolIg/rBTemcLNgOE0d7Jc4CBINXTOCiEeLFRR2f18gWG7NGtu5d7sCQbksdMQ== 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=WHAVg0uPbjuyBlNN3MIdrdYrzUdAotOSk+WsRb1goVY=; b=WFJx3ka+Fko+SeUHJyPdOyVy6JskpAGYu6mwsRbDIBQEn8zh/Q+QMXEhb2hheZ0BhTO2Lc7axPvxb32HlXlg3n0s/YZ+soHS8UETfJs12qj3A1Yn7hxNQVyc/a6aYnmGLbo8tMlbL+HLrgWQwzPh1vs6/7abA1+s1zNN60I5CSE= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SJ0PR10MB4511.namprd10.prod.outlook.com (2603:10b6:a03:2de::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.21; Tue, 3 Oct 2023 03:46:26 +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; Tue, 3 Oct 2023 03:46:26 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: dsterba@suse.com, gpiccoli@igalia.com Subject: [PATCH 1/2] btrfs-progs: document allowing duplicate fsid Date: Tue, 3 Oct 2023 11:46:13 +0800 Message-Id: <24bc23323d8e13b609cb854c1965c842852610a5.1696304039.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0008.apcprd04.prod.outlook.com (2603:1096:4:197::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_|SJ0PR10MB4511:EE_ X-MS-Office365-Filtering-Correlation-Id: c446df65-8295-4f29-3f10-08dbc3c35204 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WnziDooYQbLJ1IksLIvVhrGlwnISRYRP46vWZ7x1QF8tAzfj483Vu3bmx+tRE/Ik3MTV8pGR7Euchl1k09lxDhShlBUkw/05IHBQvvBpm827Mc90j4ITKEoKNmTh4w0N3BPqDXT+sToButKXDsYB/8Uy5CoKJbgF9xa/VVTOZce4s0elTBq3OeRZuszcmJgmSUjUd5NK1Tqlz1JaahWkv8ToqQmVvryAuzEwRxI3ILwzMDgCtLyrpZ1R1NPm24uE7YRDAUHWXuMudavxpuDfzZGH47Wll0fecMSnks2tTgHygNbYnO7i+vNCzdW37iNuLNc3S1joGBfMPwQbAx+m0EeZLem96Lc970Qac0hHOj0aLzeHp7tXXkal/nb139SYSh0H0ulMVLycpDckOXm1/S5/Mj6GRxvxh5fpyM3YFO7tNmxoos9zILS4M6FzZxhFlZffJn/61ZfwStRlbNvpHPTe5IPlppSIPfmWnr/2yYJdV1B2heRkAxqRYyb22/4hLOMw4ziihngyBs3kp5SeHOmjB6s3d9a/8q9t2BP/MCV+vYYiXI/F/0zgwk2TtOuK 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)(346002)(376002)(136003)(39860400002)(366004)(396003)(230922051799003)(64100799003)(451199024)(186009)(1800799009)(8936002)(41300700001)(6916009)(2616005)(86362001)(38100700002)(6512007)(66556008)(6666004)(26005)(83380400001)(6486002)(6506007)(478600001)(66476007)(5660300002)(8676002)(36756003)(316002)(2906002)(4326008)(44832011)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5ZU+LTdIQHHc+eUTfD+Xa689UOUiNDUigtKyrsUrht36LK9P+Jne2EEzPqTJau/b0MstVyPILALLGzIA/8v3Kt7oJIG2opMf7iV1eMu3v/gtowjtyL7Q80QNOvJeZzqZ6AIfDl7EqPi4IFOMeajBXbT3SnoblFUtxXWk26fGOypF77Wd1NZ5gcEBW3h4gFSMpyyYmvoTX9UYUNWLuHGhOnGRjDmxTCl8p5mu4CtAuJRat3Qghr6T6H7NOhgjftwMYJMhUeDVS4I8ZWR2rpPA+U8HzQ2q2SLHe1Mf1EmJzbA91KoGESK6yqMQic+KmFesuymvfnAdG5Ll3IHzvzrtkpyn83w5f0ZvQUH/SpnpnQFkS/vnj35ibtuheA5x8r1B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le.com X-MS-Exchange-CrossTenant-Network-Message-Id: c446df65-8295-4f29-3f10-08dbc3c35204 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2023 03:46:26.8018 (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: nDXI+piab91EPjC6yBS6TGeb2G4Dq01sYd+qf3LP4PMVctdR/lwuilv1FAdXExqjNj8SXCt+P0QgKx8c86L/fQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4511 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-10-02_16,2023-10-02_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 suspectscore=0 malwarescore=0 spamscore=0 bulkscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310030029 X-Proofpoint-ORIG-GUID: I128FV3mWMyj4Cimq1dhPs-tXcv_dIAW X-Proofpoint-GUID: I128FV3mWMyj4Cimq1dhPs-tXcv_dIAW Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org The commit ("btrfs-progs: allow duplicate fsid for single device filesystems") lets the duplicate fsid used for a new mkfs document this. Signed-off-by: Anand Jain --- David, This patch can be folded into patch: ff4c4a3a00db btrfs-progs: allow duplicate fsid for single device filesystems in your devel. Documentation/mkfs.btrfs.rst | 5 +++-- mkfs/main.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Documentation/mkfs.btrfs.rst b/Documentation/mkfs.btrfs.rst index 2ff3ed241533..95ddc5399090 100644 --- a/Documentation/mkfs.btrfs.rst +++ b/Documentation/mkfs.btrfs.rst @@ -179,8 +179,9 @@ OPTIONS Resets any previous effects of *--verbose*. -U|--uuid - Create the filesystem with the given *UUID*. The UUID must not exist on any - filesystem currently present. + Create the filesystem with the given *UUID*. For a single-device filesystem, + you can duplicate the UUID; however, for a multi-device filesystem, the UUID + must not already exist on any currently present filesystem. -v|--verbose Increase verbosity level, default is 1. diff --git a/mkfs/main.c b/mkfs/main.c index ead1edded9bf..ccab3c31b2f5 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -430,7 +430,7 @@ static const char * const mkfs_usage[] = { OPTLINE("-s|--sectorsize SIZE", "data block size (may not be mountable by current kernel)"), OPTLINE("-O|--features LIST", "comma separated list of filesystem features (use '-O list-all' to list features)"), OPTLINE("-L|--label LABEL", "set the filesystem label"), - OPTLINE("-U|--uuid UUID", "specify the filesystem UUID (must be unique)"), + OPTLINE("-U|--uuid UUID", "Specify the filesystem UUID (must be unique for a filesystem with multiple devices)"), "Creation:", OPTLINE("-b|--byte-count SIZE", "set size of each device to SIZE (filesystem size is sum of all device sizes)"), OPTLINE("-r|--rootdir DIR", "copy files from DIR to the image root directory"), From patchwork Tue Oct 3 03:46:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13406711 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 3951BE776F5 for ; Tue, 3 Oct 2023 03:46:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230133AbjJCDqx (ORCPT ); Mon, 2 Oct 2023 23:46:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230132AbjJCDqv (ORCPT ); Mon, 2 Oct 2023 23:46:51 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C030AB8 for ; Mon, 2 Oct 2023 20:46:47 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3930iurh019783; Tue, 3 Oct 2023 03:46:37 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=rJwQwH3XgjCPlb/9XP8Cmy202hutPhGE7FBSc6jxc5Y=; b=HoURPxGHdH+D+72Ykg4H31gyZc6mNb6x3qgefBoJQHLLrBnt7BU43BdxdxJV9MxK1lu2 uq1+DcSHpV+5NEvMtZUspzX4qblINc49AMnuYD0Y2TqJv6j492+fPNxUVgcBO6c5xHZs hUFHL8+voqqDQba9Uhqn16qrAbzRrh/+Y/b1vj9iZmIy8AwORygOltMDFI4PHC3ZMrA5 tWVJiZgYOWuxROjoHXWK3jPT/+mG1cyhZ479bROIEGi5WQvKpmM8i8j6h3d8dTvOmQ25 a6zaV4TjvIwBbsvv66sfrXlN/RLrbXEGuWqOat+kbtHs2dW4iASGe81B+XnLniYXQ+AN 8g== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3teaf43t7s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Oct 2023 03:46:37 +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 393328iK005824; Tue, 3 Oct 2023 03:46:36 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2175.outbound.protection.outlook.com [104.47.59.175]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3tea45djkk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Oct 2023 03:46:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oedTS2qS5OsxFVTeL3ZFgyl4encYj3AqWkG/kfNhobLVctQFGZwHwMcXowFBuSke+cs7oqJvU1UbNO7+XWJRhf9+lOk+ZHeOfNZRtIZ20YKYgGLrefaapIQHJW5M+RUqVsBP1bDisbj76HKcsZttL2M1KfvWB628L+avv+sZcwb2yRWvwvp9UI70nw9bw3BHai8lijq/8i+gwHHc7vY7iX7WHARKDpukkGeOdo81D/EsAlaUQQNqtD69pm1u10XDWYRu737sJiKO5+LSqv5PWlFKZAF9X4eG2mnV7eH1FjPnmZhMQP18ejWutVhwKyOLyk18z737dahKhq61vkAp/A== 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=rJwQwH3XgjCPlb/9XP8Cmy202hutPhGE7FBSc6jxc5Y=; b=Q8m1dW9EJH2M9adXYFI8Z498i7kzgWIAnxuaxGIbEasiWm27uP89IJva+EwjB59kp77ZLYMLA0EP9s4gw4e2JEVqkOXRpPbYrnBooqkvRNaxHim4tQQIKLFbqGvgjIKjeO+yrjAAIxvgnwDvXzJ0TWPFMmvVTto8K7EcnENR+31nZ5Vd8Am/vYO3OKfDgQK1fWpDNJ3LcGOao3vMny3k1eACaaFrbcavZ5nwOmFF6KGrJFtPPgEQq/jojmcvT/ipzSPrRW4MHoM//7ZFDDPkjasgt7bBHrX6KQI8MELze0mq4xmzLVSKzHnyqFX+bSwkVzIfURKpZoozkvuLoav49A== 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=rJwQwH3XgjCPlb/9XP8Cmy202hutPhGE7FBSc6jxc5Y=; b=wK8J6hNVW+Ik8wpxpumDkpZtIN0IxF2MmVldeDyCuAr6hTqEmdHFS2+wP36sxofrKkZK81Nuzhehrfifmm0n2FY39L2cyLEoy/B4gzY2N57pOlfoicVGvjk0Qu9QQ0Je3nOyI74Ic+vJ+4U4f+beEkzEg4EilhDZ207FIgvJU1M= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SJ0PR10MB4511.namprd10.prod.outlook.com (2603:10b6:a03:2de::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.21; Tue, 3 Oct 2023 03:46:34 +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; Tue, 3 Oct 2023 03:46:34 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: dsterba@suse.com, gpiccoli@igalia.com Subject: [PATCH 2/2 v2] btrfs-progs: add mkfs option for dev_uuid Date: Tue, 3 Oct 2023 11:46:14 +0800 Message-Id: <83954cc64b45bacb8e02835e8704234e998b3a59.1696304039.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR06CA0002.apcprd06.prod.outlook.com (2603:1096:4:186::10) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|SJ0PR10MB4511:EE_ X-MS-Office365-Filtering-Correlation-Id: 459f83f2-9271-4300-f39c-08dbc3c356a4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iUp4H0gJ43XxKchCtvl/3N0jpcaPDXD6AP/XUelylw0wvDwC/kRJ+536XTALSYoH2jF1rSl0D1dZfVq8Rzy7Jo1zUIdDjWlbM9M//YJ1I/zlV0l9OYrloqKOP80Sinlo3A/cXrsXztToHOHNavaJd5HZUu7znVy9Q39S49vYZ5goiCUmAzNnmU7hf3DVUWkvUhRMSm5yNqnOEYZpB5iNDeEZI4j9T0aR9WDXiKvTFl2TXxbjpJz4j04p0rM2U16qmI99/zJU/9oMRFL/A0w8LfDHh5F4Gn4Ftd2XyIeV7hGmLbWK5k9dwNZkysa13jd0RJdMydzS9oyx2TOwgPZpp9iEo2pp/aawL0BrD6wc15oMp1FI0mwaBWO+dZD3ULIKyNaZY8pwVjv0DjuEl4v361uHP6bvLjPCWUjG4QnZ44RHWw+zBnzPNGH91VkY7/tch1b0rc0c/5BxM5e6AqyBIcyVWZ3rA1JOCac1UVVcpYchpQP2OPjj4JaEnNs2v5WwbDyxuWQ93LLyiGMkKE1xl+ZJIi1PLbmfJyeDuW57rJ8= 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)(346002)(376002)(136003)(39860400002)(366004)(396003)(230922051799003)(64100799003)(451199024)(186009)(1800799009)(8936002)(41300700001)(6916009)(2616005)(86362001)(38100700002)(6512007)(66556008)(6666004)(26005)(83380400001)(6486002)(6506007)(966005)(478600001)(66476007)(5660300002)(8676002)(36756003)(316002)(2906002)(4326008)(44832011)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MlgxvqO6lLuw2/UI+h9qaFQDqXa6JgWJkIq4T5UDo15GOely5HsQENRVDTlHb+vz1DnVuqtRa6NlH2CHjZfHpQ1cJv1RbJPLrG84SVq/9dq42YLpNeKIQIv0uh1fd0eUVL/XCBHRXhTeVxAYgZC6ua3jiotRz7WfzVU0b3lNlo8cLzvDH/1xe/azenSGMnGdWjKaMOJz34vawPt1xiwQt831MaovLbt8R0Od8AwUH70DCVdTN00YJ8LKBR5PTuPB+ZiOJoQy16ckKfl/drZKgJjx2dztNDQZSjMKp646GcHpmsnw4kSmGGQq27knx5XVwyN2MrV/93WY1IAjLY9/nloUHAM+d2uBhx+2Mhxng4/emPB0d3dU+kDS9qPkeCH3SuDn0KUAoIp49OqA+aBSrp8ykdGvxSRwnZJzBo6TAdVVshJvOzHb4sQ/+E35ygWNYeeM4IJzbLihQ4IytUnMzBi+bUUTCqSY94jITQfcgb9mlv5LtM46T8mVacFJi7fPATUxKaHP+zxU7Evh2Y0AhtXUyhdxlZMHhtjaZHEsyBXUZEKuimewRFmZyjSPx3zHh7sXN4wqVUXMwrvNquMp3lktQAP1qmNB1jEKeGjor9TLgLADiefCAYtD8wQvao8KVqV2YlkorMq9OYk7ZKGOH7iPW7KTBudzyMby0AgzisYnjYZZJdacdKeHiuyo9e/y3HE+YzWTw6nAWYXBdts2r+f7IXY+v0pPjlTMD7UnpUYAxyNeLavJbVWmzqaRpd0z4PB+Fe398k3lRRjqUvLnNZT24AnLmLLZGYnYY7+yNqHU9m7B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iinR0p98575CFZ05poo+fzinJH2ChKnx1URiFViCbqn54OI8vM4F1NCUkUv79ae/JZ8EqSXjmWVqRcdGO2FSFod4fJdX6GHUl4eY2wtH+mevqFqU3VtFIX6uMV6ZB6ittfxi6LKXvLZQ9813xbZNf+pAa5Fop0eAImDOXo9h/tot59w1fGMA+J9o5pE3o0HMBFGin4GLnU3vqf+5vEUHdQYx0M1Q/Rz3A9zLmUHf68KEHKG2EwGY5Whglqu29jhiYEUPTtByRO6CgC2C+glsyMd0FJIK6sIGqrMVUhz6zVE9jLuVST14SvCx4w7P9um4+RaaNg7srV9T/0tc/ymH+tBsLgfx6sNTCUVdhh6mVmDjnXQD0r7gm5fhfDo/L+ePdb76nkb2IbupL4BQEo78bIDfyKof/m7yEVb1rOmtjr59Ocv7aBGD7uI/uovQVO6ti9JnmT/SGQcV2ByX0d6Zjq9MVjfbtmC9d3nNS1wHYKefLMMfkNf9IrpP2tV9bc5OgWyKA2Q+aY7x1MIOLklpZwY7cu6wRBh+hC8o/f5SfzlPpB/qsieZ0rnO//NQEQ4TmkCMToX4mTkk+17vBP4xNEWJKOQZDEDOw0jpOvXjcc2vMj+mryq6ZH3gc X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 459f83f2-9271-4300-f39c-08dbc3c356a4 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2023 03:46:34.5742 (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: F+jJ1AyXXlnjnSAIjfPGVPaHyxNJgDKQ9Phee8mkDC0pz2zDWY9f+/D7ONDjl1Gi0507hFmQ75pUpJOKZYVdTw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4511 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-10-02_16,2023-10-02_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 bulkscore=0 adultscore=0 mlxlogscore=999 phishscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310030029 X-Proofpoint-GUID: lmM5nCn6erlNzlToUFNUvm0PVorHgV1w X-Proofpoint-ORIG-GUID: lmM5nCn6erlNzlToUFNUvm0PVorHgV1w 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 --- v2: Added --help. Added comments for the dev_uuid and fs_uuid. Removed short -P option instead using only long option --device-uuid. Add error if --device-uuid is used with multi-device. For example: $ mkfs.btrfs -f --device-uuid 29e708ad-6fe5-447d-8910-a9b9f79854b5 /dev/sdc5 /dev/sdc6 btrfs-progs v6.5.1 See https://btrfs.readthedocs.io for more information. ERROR: the option --device-uuid is limited to a single device Documentation/mkfs.btrfs.rst | 5 +++++ mkfs/common.c | 8 +++++++- mkfs/common.h | 5 +++++ mkfs/main.c | 14 ++++++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/Documentation/mkfs.btrfs.rst b/Documentation/mkfs.btrfs.rst index 95ddc5399090..919bb19c3e0a 100644 --- a/Documentation/mkfs.btrfs.rst +++ b/Documentation/mkfs.btrfs.rst @@ -183,6 +183,11 @@ OPTIONS you can duplicate the UUID; however, for a multi-device filesystem, the UUID must not already exist on any currently present filesystem. +--device-uuid + Create the filesystem with the given device-uuid (also known as sub-uuid) *UUID*. + For a single-device filesystem, you can duplicate the device-uuid; however, used + for a multi-device filesystem this option will not apply presently. + -v|--verbose Increase verbosity level, default is 1. 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..554693b52aff 100644 --- a/mkfs/common.h +++ b/mkfs/common.h @@ -90,7 +90,12 @@ struct btrfs_mkfs_config { /* Logical addresses of superblock [0] and other tree roots */ u64 blocks[MKFS_BLOCK_COUNT + 1]; + + /* btrfs_super_block filesystem uuid */ char fs_uuid[BTRFS_UUID_UNPARSED_SIZE]; + + /* btrfs_dev_item device uuid */ + 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 ccab3c31b2f5..e92b43846217 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -431,6 +431,7 @@ static const char * const mkfs_usage[] = { OPTLINE("-O|--features LIST", "comma separated list of filesystem features (use '-O list-all' to list features)"), OPTLINE("-L|--label LABEL", "set the filesystem label"), OPTLINE("-U|--uuid UUID", "Specify the filesystem UUID (must be unique for a filesystem with multiple devices)"), + OPTLINE("--device-uuid UUID", "Specify the filesystem device UUID (a.k.a sub-uuid) (for single device filesystem only)"), "Creation:", OPTLINE("-b|--byte-count SIZE", "set size of each device to SIZE (filesystem size is sum of all device sizes)"), OPTLINE("-r|--rootdir DIR", "copy files from DIR to the image root directory"), @@ -1161,6 +1162,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; @@ -1187,6 +1189,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv) GETOPT_VAL_SHRINK = GETOPT_VAL_FIRST, GETOPT_VAL_CHECKSUM, GETOPT_VAL_GLOBAL_ROOTS, + GETOPT_VAL_DEVICE_UUID, }; static const struct option long_options[] = { { "byte-count", required_argument, NULL, 'b' }, @@ -1208,6 +1211,8 @@ int BOX_MAIN(mkfs)(int argc, char **argv) { "features", required_argument, NULL, 'O' }, { "runtime-features", required_argument, NULL, 'R' }, { "uuid", required_argument, NULL, 'U' }, + { "device-uuid", required_argument, NULL, \ + GETOPT_VAL_DEVICE_UUID }, { "quiet", 0, NULL, 'q' }, { "verbose", 0, NULL, 'v' }, { "shrink", no_argument, NULL, GETOPT_VAL_SHRINK }, @@ -1331,6 +1336,10 @@ int BOX_MAIN(mkfs)(int argc, char **argv) case 'q': bconf_be_quiet(); break; + case GETOPT_VAL_DEVICE_UUID: + strncpy(dev_uuid, optarg, + BTRFS_UUID_UNPARSED_SIZE - 1); + break; case GETOPT_VAL_SHRINK: shrink_rootdir = true; break; @@ -1372,6 +1381,10 @@ int BOX_MAIN(mkfs)(int argc, char **argv) error("the option -r is limited to a single device"); goto error; } + if (strlen(dev_uuid) != 0 && device_count > 1) { + error("the option --device-uuid is limited to a single device"); + goto error; + } if (shrink_rootdir && source_dir == NULL) { error("the option --shrink must be used with --rootdir"); goto error; @@ -1730,6 +1743,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;