From patchwork Mon Aug 14 15:27:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13353040 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 00B03C001E0 for ; Mon, 14 Aug 2023 15:29:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232889AbjHNP3E (ORCPT ); Mon, 14 Aug 2023 11:29:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231664AbjHNP2f (ORCPT ); Mon, 14 Aug 2023 11:28:35 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4B3E10D5 for ; Mon, 14 Aug 2023 08:28:33 -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 37ECjAAJ031133 for ; Mon, 14 Aug 2023 15:28:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=z9tC+ZO2VlZA1xSM8eu+uXwgek3Uo4XpuMPRITSr9k4=; b=y6mJM1VI/g0qE5p3z/0EP9PCxxhy0OD8R8WfiPWka5nAJbkq32I5flvSlI+lNksn4omy BR0Qa6l81lf7/rxboYY9l5WBLAI1AyLbqFbwzh6NUoUdgCe5hPm3iT1tJavMu3GhoahX ivFLKJCeSnN0vz7MdN+56ymAqpDuHr9UF3/I0tUK/l0WAqagCWKMlWqRIV6867K65Wsz //Wv/DyMoG3doMjBVNhGd4AyN1QqT7k4mEUg8zbK+AMhWzGrCHAqkhfB1nBHTOgjmJWd V0A9vgx9ww7d8Y1Ww//JUL90JwBAMxs0+b9mPoGtDso4k7XOkLcMA7KkSgLYrgsXHVuL 8A== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3se2y2tx21-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:28:33 +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 37EEkjux040343 for ; Mon, 14 Aug 2023 15:28:32 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2168.outbound.protection.outlook.com [104.47.55.168]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3sey0psygg-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:28:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B2tPIzCZwWPS3Aowev9WgvHexjlHsAr15sKdpXDEHLik9l9NRSDCnJvvgnkdCNHkqFmjkKzDre/EoGT+nNPMZbm/Kg1QJJmYGC2J45ggTjMUDkh8eadRsWqEGFOZy0lAZucu5QZSkcNBSzLd8PjxDNzFIVY6x137Ngi7Qlbo+iytCl4tFlW/sWVQrVg76NO7uCe07hyN3tk+/+kWzdkl2eMokOwDG93KnX3R0u4S+k5hQwFOLypiSEXKiWqb2Mp4IBVAYe0RkTbHjkTCwtDF3AxJwT93m1LYJz2TM/HeOm95QC2fSs1T+vObfdiDCDOjMk+UW1gTHb8X4zDgYrbalw== 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=z9tC+ZO2VlZA1xSM8eu+uXwgek3Uo4XpuMPRITSr9k4=; b=UiL+xTXijDGukOZIUp20tv52psvYXxn7czGpL1SedvHWhMq2ipb7aizU5jjHgrfUGXn8vWtLkwQf54s0D4+n2qlsVv39BA+4RfXubxkayudPyEtENukCPF+wq5cEodPaMZ42D1kC+liT3kJ4SyzirhceDHS3Sd56lwP19eKx3O4ZgHjld0w+nC8as2HQPont14EQfXMQjk7vs43CfLjk+87Xw+Txp3BnWV+i1T9RyWyU4XOrNr80oiV+bo94v4Vbg/zUrgDL2W0EYKveO3qNbIkQsfgsn3M6hOF8NJ4g0WmW/mtDD3FQR4E7HE7kaOAn8pr8CVnBtP1NsdNn3bP3Ew== 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=z9tC+ZO2VlZA1xSM8eu+uXwgek3Uo4XpuMPRITSr9k4=; b=fuBR5zeFNTVbQRBhd4YMc7EG6trz60XE6l7vCh8PfipgXbjBxQCnKasVEom53u9Y14REPRh1s/SoYaREL3fVAUJJ/GaSAHu+EY4nYBUE6LnpY9DIiDeUqL1EH6Pim7fghBoHRdzfRxoC0WdN8sRf4UditjoIH045HrCEXfjxyck= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by DS7PR10MB5214.namprd10.prod.outlook.com (2603:10b6:5:3a0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.26; Mon, 14 Aug 2023 15:28:28 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56%4]) with mapi id 15.20.6678.022; Mon, 14 Aug 2023 15:28:28 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 01/16] btrfs-progs: track num_devices per fs_devices Date: Mon, 14 Aug 2023 23:27:57 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0012.apcprd02.prod.outlook.com (2603:1096:4:194::7) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|DS7PR10MB5214:EE_ X-MS-Office365-Filtering-Correlation-Id: 3e14e7cf-b72f-4eb8-8021-08db9cdb1b9e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Xt4udvhWoIGIR57SdSUZXWJ4l/WrlOGEab5TWHrIPG30iFF9NtHjmdHY/BpE3NU0H0paY2PzIjbuPie374G6IfV3x4UVfMmVRc4CUVM+bLwzj55GBaShZSBIn1iJOekLtYMBXmbcaJI4xDtgKhTFqakdsuD3Zv8/Ww/f9/3rcFzUNAcFaY7FNL7fvvpEsIjyjuLJNuQZ/Y+D0w9rbbrFmWhWwanZCDPO+hOC+8tAgOtwwGiiTnJ4OsV1uwkn7+KiCC/myPchmnQ8SS7bF93UEbUwnCNG3A7AXbzFtobXRWxaDlyGl+LVyWPJGwmcHjx9UjW6erHSeX4ptCqAzDHYnP/tjZBpincdsdk1LW/1mYIesQiv8ofMO2faC94DtmrorwnVX7jFIi+01G63vbzbtifzS5vN/ONkg2AZLU0AbbRynoH6006MoilQQfZKbyMLq90ge9CLk0hd52TGJUCPW2pchHna7OcHQ6ZIq8WyxYYrU/WPSaHN1tTMKSb1uoMadjnxasCI+ndDu922MXbc0INRAAiyBd92GrrpTVhtLZzskf0Z1QA20wENT0Mt2wma 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)(366004)(396003)(136003)(376002)(346002)(39860400002)(451199021)(1800799006)(186006)(38100700002)(6486002)(6666004)(478600001)(5660300002)(2906002)(36756003)(86362001)(44832011)(6916009)(66476007)(66556008)(66946007)(41300700001)(8936002)(8676002)(316002)(6506007)(26005)(2616005)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: M6ZG+gNOK0dU5Uu2on0WE45daKucemFVrGCN2CTv8vnluA7FzbCWuyaBtFbmSUO148U2JYs/0j+5D/syyLMlAqVwcU4bi/FaJokTVxUuwMfSN5/US4tuNZqC3Oo71kt1oNroEfZic4LsJRaBhakDNwvTkMPnpahRCAzZ/pnUG+4XN0WbEqyokPL4Xd0sPfMucvoi4JOKvohMm4AQ1QGDPvX924ess3xf0kQdECp2+osy7RWeQSdtlzVz8kh8rMI5TOPV3t6RH04MlrEt3ytePIJzhJVjDMECkTGAu80wb/SidrK3QV1Wz+C8oyiiDnwiJhwfiTyWI+B0rcxzuN1rWH9rOICb3Efgz+Z6m/ThEV95sLw23jInYm8JRJorkXzn+N1PS9aFCDNsVm31fJIyiE3Uu3lvZbiqbGOHMZfSgO7/y8gW9F9WTv2EywyV8VlltV1Iv+nL6UD7hZZGdKxA4BIB8tLGV36oEm1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p+Fy0ZT1rvIzZIO4b3WSNxL710/+rBk+PKkF4MoeF7yxBr/CmapkjqWG2OiiBVoDkFpLWXJR7Q== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: osTgn47kXEYN4SXcBXIWHdLWoiiMKJOnU3MMEDaCwRWNiLtznqk/A1oAN0LFY5OjC759g2PUFnOzg4ldaGWIVFsZFfq8bb1X/zGEZlTYyJko9QUxl4LwftWzjzBmaz/qtioXDJY+yQdOqcBb9LULH8yqFsYOghqWw3GicKCYrKeCIhfib3yVBnfPckIbRupvPLZnPT5OjUSuufC9M/71Fex+vyMvD/yEfk3bPQairdy98x29QmHbPn4MMsGR5iqCKxQ4AQHfxo5YG3Gzz6iJ8dVKcxYqEF6N7u9XmE3GygpaW/TbfB8rRJ7sVQDICDnl8D2koI7hbI70ZOrMQ+9gv9C0Fbf7rWZXvHYAkA6fPiCKT82VNyKXg82Q1iW/ZtGnHGd9XoE4Ry8rR+e6F8XCQF97xu5HcbCj1gc9rEfLvBUnDoBYLkfMc/XegDp9lYGfXI/bRhLTRs7J1HuQB6JR8lLlHxaqovjJcCoMEnLj3ephZUcVZhlSWDI/g8FKiThQBKEtfEt5T8lHPIHP/w3zAH6oAVlPw2awTjxHWQrLxD/UTgHxohq988tT+4ji1Kx7P7ojjQ3jWXLPRHuOBa5y3qJmiwW6C2y5CGjYfl4hQeqNYXc39B260sKHrnJz3fs411AgGiryQNvEtRR5hH7F5AhyjWSG1/Qwz3l15UkHTVAMzwIdIaNeLLZYxwcBXwA0XLgKHaV+4R+9QNGS6rRIEvEY27jrsGaULq+Pty75Zi8AiT/A6WFzqyalsUTYJVWhoPb/hOL7GI++Xw66axTObA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3e14e7cf-b72f-4eb8-8021-08db9cdb1b9e X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2023 15:28:27.9723 (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: AYEJhOSfmUE3w/TQyDsbCRc/zGx158ZgBCT1oiPnUb0kBLKe+h0FKOZhLoGZTbixW3N7HPt2mUJdMdOCpS9H+Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5214 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-14_12,2023-08-10_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 phishscore=0 mlxscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308140144 X-Proofpoint-ORIG-GUID: MiT3PCOD8R_6L_v9lLeeLAKFY6Z4xFLW X-Proofpoint-GUID: MiT3PCOD8R_6L_v9lLeeLAKFY6Z4xFLW Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Similar to the kernel we need to track the number of devices scanned per fs_devices. A preparation patch to fix incomplete fsid changing. Signed-off-by: Anand Jain --- kernel-shared/volumes.c | 1 + kernel-shared/volumes.h | 1 + 2 files changed, 2 insertions(+) diff --git a/kernel-shared/volumes.c b/kernel-shared/volumes.c index 946c2e7a931a..3ca7a5a62da8 100644 --- a/kernel-shared/volumes.c +++ b/kernel-shared/volumes.c @@ -406,6 +406,7 @@ static int device_list_add(const char *path, btrfs_stack_device_bytes_used(&disk_super->dev_item); list_add(&device->dev_list, &fs_devices->devices); device->fs_devices = fs_devices; + fs_devices->num_devices++; } else if (!device->name || strcmp(device->name, path)) { char *name; diff --git a/kernel-shared/volumes.h b/kernel-shared/volumes.h index c89c1659e60c..23559b43e749 100644 --- a/kernel-shared/volumes.h +++ b/kernel-shared/volumes.h @@ -88,6 +88,7 @@ struct btrfs_fs_devices { u64 latest_trans; u64 lowest_devid; + u64 num_devices; u64 missing_devices; u64 total_rw_bytes; From patchwork Mon Aug 14 15:27:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13353041 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 D1A24C04A94 for ; Mon, 14 Aug 2023 15:29:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232919AbjHNP3F (ORCPT ); Mon, 14 Aug 2023 11:29:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233024AbjHNP27 (ORCPT ); Mon, 14 Aug 2023 11:28:59 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 322DF10CE for ; Mon, 14 Aug 2023 08:28:54 -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 37ECiYGb026725 for ; Mon, 14 Aug 2023 15:28:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=T5CmfhFyMVKJeyekulbExe2BpsDbR5d9MpMvyAdYA3Y=; b=QITNsX54eQ87TfjcwV/0Lns/Mv8XDU8FAxl2MybTrLRvKjIIsZdZNIcwR3UTkT0eSKq6 iF0A8/Qo24FOn/n8mgizjUii7Pixb0HE54IQ0Pvns8EmO19xS/QTnTciyuoJCcHAuO5i kgtEgJ9+ynYlxBxjsb3NSsFDcDeT74LfuiT5qVDIJc4tgUyt0/INI8j71lIUgkN4SQOs cUq8C5XrFXVra8BSJ29lnehWn3qJKWs0x+WlR/p5vV7qB5l5lJDdZzcdubBccyQYrCAn A6LlFLhHnuEWu630U0HIjCtEUUxe1wziuOpBmmIxgdQHGIoVPbPcmQYLq+g8wKewiBK2 7g== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3se2xwjve4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:28:53 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 37EEqq1u005488 for ; Mon, 14 Aug 2023 15:28:52 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2175.outbound.protection.outlook.com [104.47.55.175]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3sey2c1s15-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:28:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SGb8Salq1t4v2KOSE2PRvDXR46KbEfG4HRDLV68co2LG+woDEaangUFYcMURyYTN3xl87TeJWerIRIlpbPOW+f1mjQj7xIrfkZjUXUI5JJ0dL2YiVzZjJq+etBNwv+DSiYd/yBT7SH34i1JAG53iiUZ1QsiNghZp/Mq57My/MVgUYsMSgjdMFxS1c4VPf83PHkDNmgFjLgCgJ45i2lIJQ8bM3b1uMCEjqPWJSoN8t+LKm6foQ116VyPTy8M6KBsR5itNOwzOULvf5FBXnQHyW9KwI+SXfCk06JmsLlTncnMuG1a3ugNr7dikdyT9253+zN2IytrqrinciVQ7x00bcw== 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=T5CmfhFyMVKJeyekulbExe2BpsDbR5d9MpMvyAdYA3Y=; b=Jxki8YITU+DruoCkSP/WYivdPf5Zcz5KEKnsG0AKNyRkXoMRaC+0DzT8uuEDUUbJhSrwIBd/1I+X7/Fp79FVfbte5yDaBY0YQjhwlhqHr0ixhtl6QNKdwPw/RXQZ1NhwGuk9vTcc4Nbi7/F+hNhT7JMLlhSDBy+jK+sQiBSQo6YOV8g8zNwUWSlXlgLkvz2HGzqWYtDWeLcy1O08Cg81ih9WSLZiDc8vUKuDvUFRwZoKa6gOayNr0DelGBuUr73bCQBEgXgyc6PZgZuAyEBdAHDhZY96FnNj8JG0rYsR0dU4Hl5Za0S8WeJXyf+Uq2tB3d3Uda8KkcySgrI433Nr3Q== 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=T5CmfhFyMVKJeyekulbExe2BpsDbR5d9MpMvyAdYA3Y=; b=WKMTbMT3FWdAHkm58Vrla4Svp3Owc8Yai7v/BSDhJzn9QcRnnx4GjUNh10/wk6ZtD4WHpgnKs0eMCT4xSAJjk5UEQGrBWYMACZLZPHVpPfH65pCtHw7CwshYJKPEF/YsU5cOhJH4TYFIxEEEM8UW6yxP6ev/8/GIkBBOQhh4pto= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by DS7PR10MB5214.namprd10.prod.outlook.com (2603:10b6:5:3a0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.26; Mon, 14 Aug 2023 15:28:36 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56%4]) with mapi id 15.20.6678.022; Mon, 14 Aug 2023 15:28:36 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 02/16] btrfs-progs: tune can use local fs_info variable Date: Mon, 14 Aug 2023 23:27:58 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SG3P274CA0010.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::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_|DS7PR10MB5214:EE_ X-MS-Office365-Filtering-Correlation-Id: feed1631-3e9d-4ae4-f6f4-08db9cdb2062 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: auE0zwDoPp/KcrTni8ucsFRptepJWacKk/tU47+XJYfz+VzvhPrX424Ui5VONk5o+uu2A2u/LeulZgs3m35CCb5xh0ExJ/vaZ7TPR1+dvm1h6V4+xyq/1RM5/a/+ZrBS9wk6h3o0Yo62NUXCGl8PaIWmqYeWKVqbdYfFEdEDrJR65RmUVO904LR0QsRt2VCG70FL2Osz3xE9ERe9YycEs+YA/78tqKQTDzgaDeQcFCF0xCD/Yax0cphOKEOicm4OSbqLUESfG0J2v7uaNLcyqaD44P36sMcEq/KVIpJhOcFN/AZOsUjfoAv0oAzD8RGTHhdjoJLhlrJeg3Hb/ST2xFnxfpcQjQPu5n2Zgjx3zHAbLGVjLmLLB9Y9yiNShqp6snnu0sDVNHGp+w+JBtFMBE/9EPEot8cMZ5EbjJJseQGYhuVHaxrTn5XvD1eDc2n8FmZpgKUQHfHz4nhIjBXBQQVv01HaUPxtxoXaJPfwZ3wMUnAWQE+y5e+IK0G9unl3sPlg9g9gsGgEEs5coWuLWRVN/o8pgww2b9HaqRsq5rPJx2j9k8FkE9alAw2ykXms 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)(366004)(396003)(136003)(376002)(346002)(39860400002)(451199021)(1800799006)(186006)(38100700002)(6486002)(6666004)(478600001)(5660300002)(2906002)(36756003)(86362001)(44832011)(6916009)(66476007)(66556008)(66946007)(41300700001)(8936002)(8676002)(316002)(6506007)(26005)(83380400001)(2616005)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gjqK6LR0DBn8VzJ3DYFI4+/bmOcVL3wXdAh2Bds3KST+iVGEVlHRA1IAf1rlSwmKOHxqOE71MhnbuIwG1KTs5qzmRVCQfBXWLeC69iJeZUP1rtYO0FBW9U/G3qe2sSKC/gqegWCau8dZvWrc1rjyPVBliv1vJIZbpJrMVMu0GkKx+17pnyiQtJg3n4oQ3BbR4PWu+nzfG9sk2pGGDeYN9uaz2h1+YKi2WZTXfRjkqSgktXQZER46nGE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qISVi+6d3hV7nNYklwDv650+CzPDxlOHM5W1MFlNjeVPwE7sm4p93034jMk/wgD1IsBRv//KEVleq2WJAn0+b1tcl6aw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: feed1631-3e9d-4ae4-f6f4-08db9cdb2062 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2023 15:28:35.9506 (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: vP6lQ7VIGCCCuzOsNnDgnEd79DXmTclZ6cY8GUuoAmpEX62ADgWN312wG7v1Qy3CflcSCgwWlfZwTpcFPImlaw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5214 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-14_12,2023-08-10_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 mlxlogscore=999 bulkscore=0 adultscore=0 spamscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308140144 X-Proofpoint-ORIG-GUID: D4X0GxAKZnK1Zo_0iO2mqpm7t4-TR0v1 X-Proofpoint-GUID: D4X0GxAKZnK1Zo_0iO2mqpm7t4-TR0v1 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Since the root pointer dereferences for the fs_info several times, it is rational to save the fs_info. Signed-off-by: Anand Jain --- tune/main.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/tune/main.c b/tune/main.c index c49c24298187..e3b199c10dad 100644 --- a/tune/main.c +++ b/tune/main.c @@ -133,6 +133,7 @@ static const struct cmd_struct tune_cmd = { int BOX_MAIN(btrfstune)(int argc, char *argv[]) { struct btrfs_root *root; + struct btrfs_fs_info *fs_info; unsigned ctree_flags = OPEN_CTREE_WRITES; int success = 0; int total = 0; @@ -296,6 +297,7 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[]) ret = 1; goto free_out; } + fs_info = root->fs_info; /* * As we increment the generation number here, it is unlikely that the @@ -309,9 +311,9 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[]) * all the partner devices. */ if ((change_metadata_uuid || random_fsid || new_fsid_str) && - root->fs_info->fs_devices->missing_devices > 0) { + fs_info->fs_devices->missing_devices > 0) { error("missing %lld device(s), failing the command", - root->fs_info->fs_devices->missing_devices); + fs_info->fs_devices->missing_devices); ret = 1; goto out; } @@ -322,17 +324,17 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[]) ret = 1; goto out; } - if (btrfs_fs_compat_ro(root->fs_info, BLOCK_GROUP_TREE)) { + if (btrfs_fs_compat_ro(fs_info, BLOCK_GROUP_TREE)) { error("the filesystem already has block group tree feature"); ret = 1; goto out; } - if (!btrfs_fs_compat_ro(root->fs_info, FREE_SPACE_TREE_VALID)) { + if (!btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE_VALID)) { error("the filesystem doesn't have space cache v2, needs to be mounted with \"-o space_cache=v2\" first"); ret = 1; goto out; } - ret = convert_to_bg_tree(root->fs_info); + ret = convert_to_bg_tree(fs_info); if (ret < 0) { error("failed to convert the filesystem to block group tree feature"); goto out; @@ -340,12 +342,12 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[]) goto out; } if (to_fst) { - if (btrfs_fs_compat_ro(root->fs_info, FREE_SPACE_TREE_VALID)) { + if (btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE_VALID)) { error("filesystem already has free-space-tree feature"); ret = 1; goto out; } - ret = convert_to_fst(root->fs_info); + ret = convert_to_fst(fs_info); if (ret < 0) error("failed to convert the filesystem to free-space-tree feature"); goto out; @@ -356,12 +358,12 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[]) ret = 1; goto out; } - if (!btrfs_fs_compat_ro(root->fs_info, BLOCK_GROUP_TREE)) { + if (!btrfs_fs_compat_ro(fs_info, BLOCK_GROUP_TREE)) { error("filesystem doesn't have block-group-tree feature"); ret = 1; goto out; } - ret = convert_to_extent_tree(root->fs_info); + ret = convert_to_extent_tree(fs_info); if (ret < 0) { error("failed to convert the filesystem from block group tree feature"); goto out; @@ -369,7 +371,7 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[]) goto out; } if (seeding_flag) { - if (btrfs_fs_incompat(root->fs_info, METADATA_UUID)) { + if (btrfs_fs_incompat(fs_info, METADATA_UUID)) { error("SEED flag cannot be changed on a metadata-uuid changed fs"); ret = 1; goto out; @@ -402,7 +404,7 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[]) if (csum_type != -1) { /* TODO: check conflicting flags */ pr_verbose(LOG_DEFAULT, "Proceed to switch checksums\n"); - ret = btrfs_change_csum_type(root->fs_info, csum_type); + ret = btrfs_change_csum_type(fs_info, csum_type); } if (change_metadata_uuid) { @@ -424,8 +426,8 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[]) } if (random_fsid || (new_fsid_str && !change_metadata_uuid)) { - if (btrfs_fs_incompat(root->fs_info, METADATA_UUID) || - root->fs_info->fs_devices->active_metadata_uuid) { + if (btrfs_fs_incompat(fs_info, METADATA_UUID) || + fs_info->fs_devices->active_metadata_uuid) { error( "Cannot rewrite fsid while METADATA_UUID flag is active. \n" "Ensure fsid and metadata_uuid match before retrying."); @@ -445,7 +447,7 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[]) goto out; } } - ret = change_uuid(root->fs_info, new_fsid_str); + ret = change_uuid(fs_info, new_fsid_str); if (!ret) success++; total++; @@ -454,7 +456,7 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[]) if (success == total) { ret = 0; } else { - root->fs_info->readonly = 1; + fs_info->readonly = 1; ret = 1; error("btrfstune failed"); } From patchwork Mon Aug 14 15:27:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13353042 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 51460C05052 for ; Mon, 14 Aug 2023 15:29:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232959AbjHNP3G (ORCPT ); Mon, 14 Aug 2023 11:29:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233035AbjHNP3B (ORCPT ); Mon, 14 Aug 2023 11:29:01 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 938C310D5 for ; Mon, 14 Aug 2023 08:28:55 -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 37ECiWhX026705 for ; Mon, 14 Aug 2023 15:28:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=AdOOm9UiiaLOenln27ZT2SdfvWpBYnduEm78splCn8I=; b=L18h1gMhiaaxGeMXl/BXVI8enCfq3aTKN4HQHTZd9dPVAdKwX76dtzKeK3wLncLCxjpi Rqs/5V18eVcJ/n138WFCg3mM9gw+oSdsWXKJETfMJw662yqIoHI/ipCdlP1bFabrjehn 9wVqAhgg9DgEs7F10I24OIl2yBs4LXrtg9bOUN+viZva7C7XLl8Q6Vcwy1v3LYynEQex 91KSJEeLnr94mNAloUdxsSL6mQkQsKlukobrwZSJLqNYJZCy/K0DQdFrf3dN7OOpGIW8 LDKjS2Hc8lDOopY8UF4KZhPuY6zGfDqj1ej7/jBJ0HymB9p2vkxvIPLlOkGkVKKQd7H/ ug== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3se2xwjve9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:28:55 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 37EEqq22005488 for ; Mon, 14 Aug 2023 15:28:53 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2175.outbound.protection.outlook.com [104.47.55.175]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3sey2c1s15-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:28:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gH28O6HSKG/v7g99ET9ed4nLjljUQIxKABNnPxq0ZLPJ2L6xEfTHZwHqYDeiQrECzsQrDaWKbetVgECIrbPOCeBka7xCsElYtt18AsQJazwuyKungTxPL+FVh2iBqxciKO4eVLByZty5EOZOB4KzXIlQTM/0271EVHbnJ19ZEyK507Kv6/NSALOnkB8tBtwzaq9JFHzgAJMqyDWC0PZ6JTuyi9XhCd5J6/WZkuglLfje8pzuFSncYhCtwu7G9GHnMUl5Aow66UJeP4vW4btK3avJc5UVsFxf3wTgvxqAhg4XCr2bacnp80t+OuWv8dME/XOj/iIX9HDPejALXmnAAA== 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=AdOOm9UiiaLOenln27ZT2SdfvWpBYnduEm78splCn8I=; b=KbaBwD79/c8Cp5MXHabWYlimFZQy7gmh5AsRfZoVTAnHHRZFKtigc34JVWBDVDzaRUchVB7dC3XR1ZpTOwUtNenhySoy1AlvWBs16mgkTr4RxOJ3e3AZRWUwIlPSn7vMVBIgH2EvncFfCxqdx342/ZcwCG66gd9KpwMniXlisYAFQ7XA7ZpyDBvpfiiZ5j4Ry+o1cXmLvoCr38bH3klEDTKSUlJwyTnQmuc6Ry8gChKeZGGEqmdSUKUIs02zxBcqBk3hj9VsrSHQA89wQ8Pt4k50WpnfnkPDuQQxRn05NbwcBad5cSUxVi4x3M/FSJxD1aAWH/ifvVivBH96VeP2hg== 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=AdOOm9UiiaLOenln27ZT2SdfvWpBYnduEm78splCn8I=; b=qUtuJ/KIA/Iar+maD1T9viLsvzig7MU1z7Lo609m+4lN+O7AZBqg86Jnw5LVXITWXj6zEvU/imyk1qrSb7ZMAtXN4o4lNB1ZWMu80GGLAgaIF6ytAa+kpYDObQwnU9VsQL78U+Uu7hDD36BCvEHe7KgMsaNF1rn4lPosmctiBW4= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by DS7PR10MB5214.namprd10.prod.outlook.com (2603:10b6:5:3a0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.26; Mon, 14 Aug 2023 15:28:41 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56%4]) with mapi id 15.20.6678.022; Mon, 14 Aug 2023 15:28:41 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 03/16] btrfs-progs: rename set_metadata_uuid arg to new_fsid_str Date: Mon, 14 Aug 2023 23:27:59 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0030.apcprd02.prod.outlook.com (2603:1096:4:1f4::8) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|DS7PR10MB5214:EE_ X-MS-Office365-Filtering-Correlation-Id: d3e82edc-c24c-498b-178a-08db9cdb23dc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gixJAnFU6to5Dx+ZTalSyybZbC+H7NXYC7mzkzLrgxqSs+S+0d5mX5IO8MXGB55QxmgS61xXN0h+ZbFiKh7nzNSm5PqB9gPi6ocd0TE3H/XRxdIft7QzXYubPQw7cI1zFxHRIwH6rel0lXEJvqAnbEh8xpzoTzLgZN+4soOL2lug5JlJFmiOEq06PKifjwqFIHGsyhTyz7WwaLrU6mpwdn9pvAPzJrPB5iRtx6jPLB0T99u9iErXjO2mR+C6Zb9t0976ticxPYyIv7QvVK+IkKxxq44hCHeLCAs7SOC0G5kOw2Hf+h61TKvYw+r50FzzlpQstbI/feTKxDuOT9G7BEMlGvhe4j+TIFRAbKZbdblo7TDUpdDzQEQuKnTLZY7ui6Kj/r5RSy+9GLvTKdRPNgkPPmAW4JY2bMzWTLui3zdLenL7qDugMIYBNKtxdVVJh4qBh8F0u/0PkCh2sKWZVPGn354u66U9UeNiImHStitpGF3GTCDk9U7tTuFpwLDwTUeJ6PJSQ3XtB3MAeqSaekf63dC8ufYdSIUeNulQyucnw9tfm3NlfjLrkO1Dhm0b 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)(366004)(396003)(136003)(376002)(346002)(39860400002)(451199021)(1800799006)(186006)(38100700002)(6486002)(6666004)(478600001)(5660300002)(2906002)(36756003)(86362001)(44832011)(6916009)(66476007)(66556008)(66946007)(41300700001)(8936002)(8676002)(316002)(6506007)(26005)(83380400001)(2616005)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tiSz/YSq5KrtLPFDoCHf6Tn4W6kM9VwT2Z7k0nW/n/xZwSQslvMKj+VbEghJcz/Y1uAHlxPI3XvNZwKUvzHHb85rjs2rU+yCeUNEioA9kDaswy02nttWBv6mJ8dFCZK74NOiqG3V4hnMXwKNGuMBi1vCZ5R25IxFkBIlfFCGCudF7Kw4LOChIvxCcsorSF2UYkd/mlq7dhptrdbf/qVsYOZHjB+uIzJ38NcYdVYCCMzwfH3z+8FgdjxgqMFeYEozZrBhae1PFMTnfB/WrTOjV1DLwD9zP16HQ7fGYmY4+nmXoPsUkY51WE6RR0JZWWV7pmIbrl/s9dC8IuwDi6OoBhcgUYYE+v+B6CtRfJgJiMQtmI1wPL2ewdxL2Tk5Ed4Oge9p278rB0GknY6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qubhLinrTmifxJr0RCKgSWB8bJ0lNffjpW2JTbO1ga8cnrbiElo3G4maQo5xrAEvcEAf6ZtfYLU2YSiaSTDFeau669Mi4hlz5vcYPUIhXTB0pcwqxNQsE9Ab8Xo/c1N3oD9MKq1EuG++8/ZPC5GJnGqzTw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: AAqWszih8NoxpN2x33Dl0x+C/8FjK2ZlySQI0RaKI5PrxT/GsKhDzVMQmEB8ZYIq/0mpQ9LvErk56FT3MsKhzNmvimZRdhCtlcNJGVZTXRXS7km33LixLVitc6eLHOyI5j3//8S2iK3l7ygrh6avC3AHeGAzBKuxSi6mmf77saV6RRwNXpEVGuVDS+eGuocxQME1832ubnKZdQODSkzOespX1Gg3FAW3OZ75be+O1hHH+nrbALQTG8CLnZiUs4zP25sWpEDuET2Pksry6ecO481sUhPh7obAHKNwH3DeCYqCTkXg6J3/9RYcLtk6JuVpYGIDyMjg+IUKdwmPpA6cTSdXJhmHL8cz+mf7AYY19LEXl9GIDPT5Gdb8ZOzt4OSdg6PhbbimXiyopzzk+1Wm1/z3un0I8w7e5E+noDzWiFcwTYB1/nF0kwywuZ7x+qXp4tlxl8KnYrAIOLlt8/pWlyzPCaMJsrLMiHad3eukfOY2O36mzcSb/5te3PwZSJu5B8L/l+ELC41OPa3ENyVmeFe4ID5hCZcKiQmXjJKnVzFmVcbhkiDehtub97DsnUXIoY+YpZCuIDh7kefE2Rn6ZU0WPibxr+cb/KyhXjGS0xRqaoFjwtxT5DLjmvVv1gPmO1sFuPGgU/vhJYYPY9KuIcOkrLw14TzIHR44zlQxjhCw3OyaBjPTVV4akZdXBBvCwwkiJ7EC9Hq543IFaafG6mCW1a1jY8jklBuON9bAmMceqqz3qYTxiaWyhdrnCOEmIb7R4S7QM3YcF7ZiVkzc5A== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d3e82edc-c24c-498b-178a-08db9cdb23dc X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2023 15:28:41.7804 (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: BPOPdOO0JgLLX63ihlmuBJ+b8nzsWh28bg10jU2XpEo8EgGwU/32ef+aCtj/lfEuqtKM6P+9GxmVF1pkdQgR1Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5214 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-14_12,2023-08-10_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 mlxlogscore=999 bulkscore=0 adultscore=0 spamscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308140144 X-Proofpoint-ORIG-GUID: gM1D0F3W87LRBL1irsK96tvKSP-LJuUM X-Proofpoint-GUID: gM1D0F3W87LRBL1irsK96tvKSP-LJuUM Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org In preparation to use check_unfinished_fsid_change() to support the ability to reunite devices after a failed 'btrfstune -m|M' command, %uuid_string arg is actually carries new fsid to be used. So just name it to %new_fsid_str. Signed-off-by: Anand Jain --- tune/change-metadata-uuid.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tune/change-metadata-uuid.c b/tune/change-metadata-uuid.c index 295308f299aa..f356de8b57ce 100644 --- a/tune/change-metadata-uuid.c +++ b/tune/change-metadata-uuid.c @@ -24,7 +24,7 @@ #include "common/messages.h" #include "tune/tune.h" -int set_metadata_uuid(struct btrfs_root *root, const char *uuid_string) +int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string) { struct btrfs_super_block *disk_super; uuid_t new_fsid, unused1, unused2; @@ -50,8 +50,8 @@ int set_metadata_uuid(struct btrfs_root *root, const char *uuid_string) return 1; } - if (uuid_string) - uuid_parse(uuid_string, new_fsid); + if (new_fsid_string) + uuid_parse(new_fsid_string, new_fsid); else uuid_generate(new_fsid); From patchwork Mon Aug 14 15:28:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13353039 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 155C5C04FDF for ; Mon, 14 Aug 2023 15:29:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232956AbjHNP3G (ORCPT ); Mon, 14 Aug 2023 11:29:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233028AbjHNP3B (ORCPT ); Mon, 14 Aug 2023 11:29:01 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 506BE10D1 for ; Mon, 14 Aug 2023 08:28: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 37ECidhA024711 for ; Mon, 14 Aug 2023 15:28:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=xGOHjhJ2zH/5xxSFKdN6JvADkFlE/J4T1BsNMNyjSyQ=; b=h8R5BsFqxw0HoXxHtb8ytPAGJ4oPcCUBI0BSsL+gB3gdh6/Zg+4rMFU6AZHpf/qao25+ rZnH/RU8jMKcZYqgJl/EQY6ymHFyyyG4ocYYeEXWKSz2Y186tIyUgDyOO8vQRnkdyccb ITTTEfwfWZ6hCG5I+7g270mPKq/gNokX4MRbO/wki2TKvJhwgtQzAI3YPN/Kd/Mb4wyv FfXvItCS0nAXEdsQIqny8Qlkyt+S8eY/ZkZYyXP/ZWSc37C+fqrOgDhFjiw/WOgDKw5X WAwx/pS8bwq0fUrSOIkHthsNa4FSfOCTVTimegn7f+QD8erXCLVvvPvRBlknntaQJB2v UQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3se3142vex-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:28:56 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 37EEqq2A005488 for ; Mon, 14 Aug 2023 15:28:55 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2175.outbound.protection.outlook.com [104.47.55.175]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3sey2c1s15-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:28:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=icHU6g7GfIF+M+dudE1Y7GYPvCu4kNpHHXG+n2Zrep+Mz5xBTni4hFTqTqWIsexwfxrcz86F+bJl1955B9RJ+m65m+r/UuzmbBaBofehL1ydWJe4Y9vR1bzJ/H4fqhRrAE/BFDiBYxncV9FzIz4cZzqm0KWUh+Kc0oMYF4+SazuA5bckt6/SePS2bKulGMVOoOz4nRFXzh6DmB1aqb9hDaN0Y9WH0MkcvBSes86aepz3KWSyEZsjLlXBSQZZRACnoniAWw0cu6gZZU8jngcFkX8H1zAkPRL2Bh58+oNRn7b7cJLSxfTVb5MrXp1itgKEKS5QvpGogOnpee0gxEMwyA== 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=xGOHjhJ2zH/5xxSFKdN6JvADkFlE/J4T1BsNMNyjSyQ=; b=WzeNnXNUOFNcELvqIQgiFCi/1qXYjMKUILHEO0Hp487q9eUYdRqyTQlxf0V/hdSKU2r3Fim5La6gaDAmxm8hT85oyEZL6l2erydws25BW/cPBYWY0eKYGZXVv+Xs6BGnpO+EK9pIgfH3wtczSX5TYJ4nCFFNLW/BpnYhkrxIMV4yzaxftLAdTuVwTVoNSYhLug791LNhZHcuKCFUytfRBLpGZPe4Q0F9ZctsHTQ9YGh2eCt+FRIwVgWekQoTIS+WB1cgHKGSWKPELuE/W2AImVcwPKc7fm6UhlqUBPAMdMblGFEbbZiLTkCncjP4WKFsVa+pRYFUGRsiJKGUefTwzQ== 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=xGOHjhJ2zH/5xxSFKdN6JvADkFlE/J4T1BsNMNyjSyQ=; b=Kbx7SwlieXIvws971tf/J3IfW/wU2v/sRfnOPCywY4Xwvo4ij3/QFqjq6NG9IWl5OgLqfW1xxbTb0azuHSI+LW6LSUs95lenV31sfxlsP7A3JolHBPCQzqUEpmSk9HXdkonoRMERXLzXdgB1FqeCyiHI1klbv5DpitE4oSJbMec= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by DS7PR10MB5214.namprd10.prod.outlook.com (2603:10b6:5:3a0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.26; Mon, 14 Aug 2023 15:28:48 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56%4]) with mapi id 15.20.6678.022; Mon, 14 Aug 2023 15:28:48 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 04/16] btrfs-progs: rename set_metadata_uuid new_fsid to fsid Date: Mon, 14 Aug 2023 23:28:00 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SG2P153CA0007.APCP153.PROD.OUTLOOK.COM (2603:1096::17) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|DS7PR10MB5214:EE_ X-MS-Office365-Filtering-Correlation-Id: 9569ba41-f353-4aa7-3e0b-08db9cdb27e4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: u4Mad+FflIN6hA1Nl12IQQW6a3szi1s2T/qB7p6T90OQmwgx6eolwUxjkNB7+WvYf0Z6A1vnGq0MXZVdC3umu9oEQvDk4n1/I1NXddhV/NQmlZbSF6Q6c91yzyxTzr9qtEUQCqWEqt+AyvB/UpmJACM+XpSx1LDRT1+lFiTHyEUkn1uvEcR4mWq53ehdqhS5fFY5SiUNlbUMuADL/fD7whLbn7JLmUfa+rKjWqzSXHbcYoSDGjin47o0a6crStdo6KUMQu2T/1oBd8VynZBYugL/brKOK4YcNbuLoqPZODNxRtguityZY8AG/g49K+Em254u5xCTMMf7YOIAAaWCNy0k/FNfU2E+iJ9V223JUrV+RpopvGLXhodaUCwPeruq2Z1ATIiFAdhIVyqlF6EM7SlOI0TL0c6oHcXVq//vj6E1AmG7JxZmW+HaJdudbPCJHdHy1V7ttKBAzg5NxPBKOCLe/D/dNwm+X0O9huqwYCUrfZAKjHn94lA70dueEkf4XwyHIaUdSSgfAYAxaHq7Z0Rbep0+BIBFV+P9UOLC7Bv70B7CfSLNj+0s99I6LlIt 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)(366004)(396003)(136003)(376002)(346002)(39860400002)(451199021)(1800799006)(186006)(38100700002)(6486002)(6666004)(478600001)(5660300002)(2906002)(36756003)(86362001)(44832011)(6916009)(66476007)(66556008)(66946007)(41300700001)(8936002)(8676002)(316002)(6506007)(26005)(83380400001)(2616005)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BcftO2uMR289+aqZpTQXVCY9jUlYQnBINSpdl0gpmxf0lCmPtxPESLO5HCvYWvsbf9DWuqRCm3NboqAGPqswC9BaBBQFNKPgCifpAO535W0Nj3hfPBYl75fZH0rODQvOE6QMJKHFctL+73469No5GHuwJptZapK6wfC1WrUQDNUY4kA0CcVcCxPfq0PFdARG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6X1PBk92OmdBxHy5UsSnRbPnlMf1Ptg6qpywfEajp8+CNzNBIYyknfF6O5Oj2dUyEJ0eLl112YHklb4s653W4xnX20juFkUhq73dfu/93mRKcXFjWydwyWdgkSLL704csUBHUdXXFHr3at4u0U7hlP16NTJMv9eaoW8smB/oShAJ1tQNz5xSIzojs9oeNOiwL31M1Pmf87RFECZuEW9ktMv4vAWM9EpBp+KbFy27ChDHayvuET/EKhQ/Lja6LOVyH6zAEtE3rMmRowWZjsntY2Uu/oJ8iIR13Dikz+mmzQxUciIaiVIVs3MIAAdhDkw4cQkOa6LdxDMuYvW5sCc5hK/Bu5A== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: mxug6EykqeDLafRqLhcRdsdRZyESo7/kUQxVwQtZYi2HT5AVpr77u40xs/2CaMNYyy1w+RXsm65SCn2Oy3xw1pzTFYsFPdrQegV2VEUaje8pMDCg82W5ZKXWQ5EKqbckIv/3PqNKOw7d3Ht16y23OGQFeBFvKjtYGxdYnJAX9uRf5Pk0+SipHm+wyv8LU3djgpkaJAmyNXKgmHQEe1smYOT931Svvoc4eKt0zLyLxyUQVC3YWjeBwlfhWti3J2QlWtwHBzMJ2Df93EmWQoYNYMG8W7TRWrZkNckdDbNUOb91L6omd/6vyjvcIh/5FLzd2xLq4FcGY0vcPCRwkyV67yk/OgSZDuZINQ2qHZait1kr3cPnprSHh1KL+tcnGR8z7cwNROf+oVlFH9g7u1LcVNyZ/TLF9QgijW8B6IUHL24uwnFMIpQ0nQTRk9UvUwmEnN5FclZN3CNyWW4OTrSTreZhZzQwoxMCYpAgE8YiZCSa8dKX1YYrx581siW2zSHRAfMZADB5aMz+LFOJUAMATJkZkhvVZgzX/DJmqdhQLsry1uyjBlwb5VvVJfsByJTj8JJFl9OPgoOPNPy+eiet3byS2I52FMJo94smcaMM60hgmGiII7h/mfZer6hWLkz3KBBigDig9dzVrauVQq9xB/cYs1vYV7B3Plv1VI96/fEdoXZbam92w1GZAFClVP97ijuNZkfWEuUwTaFetLDmmQFZhjV+83t4G78cZGXVl4inmHP/A8NG25gQw6AeV9msXFxDlNhyDK7PbJi7nZ3i0g== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9569ba41-f353-4aa7-3e0b-08db9cdb27e4 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2023 15:28:48.5461 (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: 55LBcwD6AdISg9Om6G3BvBdCcWymHYoYbC+364UlnNYCN1NlO2r9M2gfFK030g/eevL5bMer7mCwIGXGeI/YGw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5214 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-14_12,2023-08-10_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 mlxlogscore=999 bulkscore=0 adultscore=0 spamscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308140144 X-Proofpoint-GUID: S0BlYuCmZYH-t3HSwvZh7HL97R8KnHS0 X-Proofpoint-ORIG-GUID: S0BlYuCmZYH-t3HSwvZh7HL97R8KnHS0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org The %new_fsid is not only new it can be the fsid from the passed disk so just rename it to %fsid. Also, in the next patch the %new_fsid will be a bool variable to indicate if the %fsid is new from the fsid in the disk. Signed-off-by: Anand Jain --- tune/change-metadata-uuid.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tune/change-metadata-uuid.c b/tune/change-metadata-uuid.c index f356de8b57ce..0e5760194b54 100644 --- a/tune/change-metadata-uuid.c +++ b/tune/change-metadata-uuid.c @@ -27,7 +27,7 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string) { struct btrfs_super_block *disk_super; - uuid_t new_fsid, unused1, unused2; + uuid_t fsid, unused1, unused2; struct btrfs_trans_handle *trans; bool new_uuid = true; u64 incompat_flags; @@ -51,11 +51,11 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string) } if (new_fsid_string) - uuid_parse(new_fsid_string, new_fsid); + uuid_parse(new_fsid_string, fsid); else - uuid_generate(new_fsid); + uuid_generate(fsid); - new_uuid = (memcmp(new_fsid, disk_super->fsid, BTRFS_FSID_SIZE) != 0); + new_uuid = (memcmp(fsid, disk_super->fsid, BTRFS_FSID_SIZE) != 0); /* Step 1 sets the in progress flag */ trans = btrfs_start_transaction(root, 1); @@ -66,23 +66,23 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string) return ret; if (new_uuid && uuid_changed && memcmp(disk_super->metadata_uuid, - new_fsid, BTRFS_FSID_SIZE) == 0) { + fsid, BTRFS_FSID_SIZE) == 0) { /* * Changing fsid to be the same as metadata uuid, so just * disable the flag */ - memcpy(disk_super->fsid, &new_fsid, BTRFS_FSID_SIZE); + memcpy(disk_super->fsid, &fsid, BTRFS_FSID_SIZE); incompat_flags &= ~BTRFS_FEATURE_INCOMPAT_METADATA_UUID; btrfs_set_super_incompat_flags(disk_super, incompat_flags); memset(disk_super->metadata_uuid, 0, BTRFS_FSID_SIZE); } else if (new_uuid && uuid_changed && memcmp(disk_super->metadata_uuid, - new_fsid, BTRFS_FSID_SIZE)) { + fsid, BTRFS_FSID_SIZE)) { /* * Changing fsid on an already changed FS, in this case we * only change the fsid and don't touch metadata uuid as it * has already the correct value */ - memcpy(disk_super->fsid, &new_fsid, BTRFS_FSID_SIZE); + memcpy(disk_super->fsid, &fsid, BTRFS_FSID_SIZE); } else if (new_uuid && !uuid_changed) { /* * First time changing the fsid, copy the fsid to metadata_uuid @@ -91,7 +91,7 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string) btrfs_set_super_incompat_flags(disk_super, incompat_flags); memcpy(disk_super->metadata_uuid, disk_super->fsid, BTRFS_FSID_SIZE); - memcpy(disk_super->fsid, &new_fsid, BTRFS_FSID_SIZE); + memcpy(disk_super->fsid, &fsid, BTRFS_FSID_SIZE); } else { /* Setting the same fsid as current, do nothing */ return 0; From patchwork Mon Aug 14 15:28:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13353043 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 3C6EAC04FE0 for ; Mon, 14 Aug 2023 15:29:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232951AbjHNP3F (ORCPT ); Mon, 14 Aug 2023 11:29:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233034AbjHNP3B (ORCPT ); Mon, 14 Aug 2023 11:29:01 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF036130 for ; Mon, 14 Aug 2023 08:28:58 -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 37ECiYGd026725 for ; Mon, 14 Aug 2023 15:28:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=noU3gUpIjvDCcrNTyeBXuf8gz0NNiffWUDleke60jxg=; b=QCN1eLOgLVh7/H6jtsLkRa0l3xnYbMQ4yOZPkT3gsSMYXx2E34PqSKxPYul2JcYAPV51 vLHHXl+B+1kiwnnaN68+HL9AxjYBJBgVYa1XCbwMNIF2KZ5kkvqe/Feqk6BmnZrcOXGi iMmku/psBTF7eSzfXqdl564grB9ZVRB0qOmj1+vVXCcHqwxs+3xtPgt8FgTqN/Z2fwMv JWwJgYTUHyztfvdtvAeLFCFWm+PrZ+dVjNHXE4ZXcpHKbu061qz6YnPVkEiVyxXPGyvc HutXYD4RxjhKvqZD4PbeHWqGkx6ps4vZ2ejXQ39vA6T30dlpZLu94s9rIaQ0MDccBT34 Bg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3se2xwjves-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:28:58 +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 37EF8FjA040235 for ; Mon, 14 Aug 2023 15:28:58 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2176.outbound.protection.outlook.com [104.47.55.176]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3sey0pt07d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:28:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kuKzUPr9wqsJUcR43Ott6946IA96rp8nOYXHUpmW0X6ez9an4188p3Li0XIf+tay3vTvo5v1wKKxn5bftFTqMVYNYnGbDgDhxyr09FGGoL1uTHBEGjM6lIOBZrbr5L3WYXIKGAiG5sRCXcEkjgCBXPd5u9l2H+Zrz2Y7gzbotMciI/+TazcULF7FovIfiTY5Lq7Xp2vxpuxYkr59Uo4A4YLetprojgKLZLpQz3CtU6IC3tNDUOxm3MWvh5W+g/3epcNmeLuAKIL95hqoJK1Z1GY5/yJBxFf0Wdt7jRcbbWe8ghpLv7dNymSOoFatWzNT1/cEiXP2YZd40MgfAj1A/w== 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=noU3gUpIjvDCcrNTyeBXuf8gz0NNiffWUDleke60jxg=; b=CRo//Yp+lQDK5rzxKuFXlnXrNBfeXwcW6W7T9k9Yoa/5lRHA8DqTTY0lJuf3rYxcaKagZ97xZpeU9seL3Xh5h7/5OLcnGBP9yfiZB2e6CF/RELziai5w9jsegEOMdLB5wzUU+lknJPPGRazLsc8tdLR0ZU6GWIvDAEDcEHUFclg9AnG8F2oTnYfHjiFisPRGX6ueuJYqBIgIZVapsntiHWWF75Rkbdt8MTb17X6eVDnIy74kRNtBn/EEBk/eXRnNo2RA6RjFxZAhvkiUT40a3T21W/Uxs0pkfQCSfh6arVcOrwquWVfiZ9V5xfm9psgx/Lne5LnfkGhsWMzGRfV7bg== 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=noU3gUpIjvDCcrNTyeBXuf8gz0NNiffWUDleke60jxg=; b=HW8DdpaW+incXLt2Qff4VWPdCfCKgS30r9QPOhh9kzjVSikuFjIMCOFerPeTHr+7mVoWXNaDdDebPleuk8NC2SaW5m3s7fQVVCac5ttObMnjVv+CUKdwSQQr/QjTWPYavBmDAi0IhTIFOH4+zHDsWxTcOQdVFDbUjLA3ZvpJuhg= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by DS7PR10MB5214.namprd10.prod.outlook.com (2603:10b6:5:3a0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.26; Mon, 14 Aug 2023 15:28:55 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56%4]) with mapi id 15.20.6678.022; Mon, 14 Aug 2023 15:28:55 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 05/16] btrfs-progs: rename set_metadata_uuid new_uuid to new_fsid Date: Mon, 14 Aug 2023 23:28:01 +0800 Message-Id: <449fc6c18f126fed0c1376ce00bbb293ea281601.1692018849.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0057.apcprd02.prod.outlook.com (2603:1096:4:1f5::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_|DS7PR10MB5214:EE_ X-MS-Office365-Filtering-Correlation-Id: 1c42e183-c384-4fba-d884-08db9cdb2c01 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ejzf0JjkVcTmjlrlJj5ZRv+Qx4ZbBqWjAem7kDY0NeGXTQwicEYJZN9Jps+ckiVy9tGKjlmLIWQ3GLIelNfKqNDLuTzPUYsVdvAQZiQYItPZYu5rJYXxeVQZWGvgLiUyslT6YskArh0qxDsksRKAlgZWHi0XLpnAPQNuTa4eNLOPZxuHf2WKCvL0wRTvreYy71txQW8MJc6sm/LHUsHituzOq6D0OGi6gcLA7km/94Xpz9XtHyqmb6JB6WccIw7L7QWw7a1MFD4a+pXQaGb6qzjMaLDfRjpmsRcgVIQNHrhZyvmg1b61urru18ZLT50buI09PqIbUFMsBTvChB/zPc5i8G5ZJ9jAGFJF8iVXq+jWacY+pQJ8XnOKlSfpVVjP+7oN1FJsIn3cPNoi1lmC8xNRVlHrHNTXQ+vBveqOxdDp84582j4uuJ2g5yEJFI63Bdf7XiU2a10P3+32AiKeksHCQDvU252O3pTc9ZvfF8OS8HZzp44jNtb+RkmH1vrob8nO1N49CMu3Prkuh6GMuAmLJ9+2SUtacbwkrht49fvi7Gd16V0zIYv2zpmKrrl2 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)(366004)(396003)(136003)(376002)(346002)(39860400002)(451199021)(1800799006)(186006)(38100700002)(6486002)(6666004)(478600001)(5660300002)(2906002)(36756003)(86362001)(44832011)(6916009)(66476007)(66556008)(66946007)(41300700001)(8936002)(8676002)(316002)(6506007)(26005)(83380400001)(2616005)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Q8r01YcfEACBFhNdT2TjjtF/+f7v3hyUCZh75BA/CdrTK5zhoF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K7AxyyNLoKFVTbaSe9gxo8AKF9NawCm+ltiKqIUv8ebfxx9fJNRYss1SNJQSmaG353Tk+H/K21fZWr/BqRa/iXUXMhfQVKMbAn5AGGwPPgMO8yb7jJK4d0d1kO0H9Shvb7B/aFf6angKauf2Yrl5lJn2ubeTU49D/deSTuNcXndQ35jcCVJG9CHrkVmwwcs+bVtUn9pAc0Ef7TBu2fI33TzPG9KmbCUgQSAxV47vDHbIwC8BNI2x0gqL5TyzwNOj6aCwvHMNMQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1c42e183-c384-4fba-d884-08db9cdb2c01 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2023 15:28:55.6267 (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: 38GdxgxtnpE8pQnK0JQyKm/zFMruOBoTawdE3fS61oZP99ueAU57NWuk7A3vL/uN6lckGAuBrYrgjmqI7akIGw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5214 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-14_12,2023-08-10_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 phishscore=0 mlxscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308140144 X-Proofpoint-ORIG-GUID: cQhORoUS4eJDRtdWOHkpb3TdrgOX_Pky X-Proofpoint-GUID: cQhORoUS4eJDRtdWOHkpb3TdrgOX_Pky Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org %new_uuid is being used to say there is a new fsid. So why not just call it %new_fsid. Signed-off-by: Anand Jain --- tune/change-metadata-uuid.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tune/change-metadata-uuid.c b/tune/change-metadata-uuid.c index 0e5760194b54..83299f990b50 100644 --- a/tune/change-metadata-uuid.c +++ b/tune/change-metadata-uuid.c @@ -29,7 +29,7 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string) struct btrfs_super_block *disk_super; uuid_t fsid, unused1, unused2; struct btrfs_trans_handle *trans; - bool new_uuid = true; + bool new_fsid = true; u64 incompat_flags; bool uuid_changed; u64 super_flags; @@ -55,7 +55,7 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string) else uuid_generate(fsid); - new_uuid = (memcmp(fsid, disk_super->fsid, BTRFS_FSID_SIZE) != 0); + new_fsid = (memcmp(fsid, disk_super->fsid, BTRFS_FSID_SIZE) != 0); /* Step 1 sets the in progress flag */ trans = btrfs_start_transaction(root, 1); @@ -65,7 +65,7 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string) if (ret < 0) return ret; - if (new_uuid && uuid_changed && memcmp(disk_super->metadata_uuid, + if (new_fsid && uuid_changed && memcmp(disk_super->metadata_uuid, fsid, BTRFS_FSID_SIZE) == 0) { /* * Changing fsid to be the same as metadata uuid, so just @@ -75,7 +75,7 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string) incompat_flags &= ~BTRFS_FEATURE_INCOMPAT_METADATA_UUID; btrfs_set_super_incompat_flags(disk_super, incompat_flags); memset(disk_super->metadata_uuid, 0, BTRFS_FSID_SIZE); - } else if (new_uuid && uuid_changed && memcmp(disk_super->metadata_uuid, + } else if (new_fsid && uuid_changed && memcmp(disk_super->metadata_uuid, fsid, BTRFS_FSID_SIZE)) { /* * Changing fsid on an already changed FS, in this case we @@ -83,7 +83,7 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string) * has already the correct value */ memcpy(disk_super->fsid, &fsid, BTRFS_FSID_SIZE); - } else if (new_uuid && !uuid_changed) { + } else if (new_fsid && !uuid_changed) { /* * First time changing the fsid, copy the fsid to metadata_uuid */ From patchwork Mon Aug 14 15:28:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13353045 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 1B0A6C001E0 for ; Mon, 14 Aug 2023 15:30:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229799AbjHNP3g (ORCPT ); Mon, 14 Aug 2023 11:29:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232905AbjHNP3H (ORCPT ); Mon, 14 Aug 2023 11:29:07 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2591D130 for ; Mon, 14 Aug 2023 08:29:07 -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 37ECiSPN016420 for ; Mon, 14 Aug 2023 15:29:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=XMGhUPS/Kjp/jHJ45L+q6oG9UqNwc2h1IrLK1gUN4CI=; b=bVvAfkLOZSGi0t50Ob2wJRayiBPu+oMFNNchpA4HpqUdN1l0o7CsqKLyNZOlVGgH/xZf kfIs+NuN/ypfBa1YigHtIjGYafCvvRDdAlGdNJbTzu2jQ0CumNahOWR19yZ1CxBeASiZ pWt3Eelve3Mx2FT7Ku7jGShYQ8f+wmD8f06t47zsJrj2UI5OcPGusfS/IeE9ESmOPymu uVOx45/FmrkdQxN1YK/G+mpZAOC/pf3zMUfj5PdkKHw10ySOCYEoSul4FjNFlUI7tNMI SFbyEYojPjexfECSbZxc6MxQvojfy3G2MHcvwEOPZ9V+U49516/CuFqD35cKwqKr7wFe 1Q== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3se2w5turs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:29:06 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 37EF5agS005477 for ; Mon, 14 Aug 2023 15:29:05 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2170.outbound.protection.outlook.com [104.47.55.170]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3sey2c1sj7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:29:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z/CuSqNXyFQgY8y2ueWI/3iYJWcDuT4Ptd9X1+W2OdWZuYANGAMZbEh0Tnw4p3jCJTLZrqfR9DideKsrc1kAjjvpUgS6phyCxx4LwEwdpp+dT7xfAOi8to9IGcOu2idtE+B/kNVHISe4G8O5kgxYPenp0cgf4ofraIjKWU4nWCG4E1zg8+TO3NyMWjDyjL4pOYWwEudcKKmHHOFry4+bnHV/51HupvotADAnUhSHO7jwDNp9uktjwYSIjnS4QgvE4nYq4cVwgPT1/wqbkd8VHEB1EA9Yeh3I+Ve/QqWhRSQticxKC+BswWelykcUlwyIl7/nOVNxvlnqmE9ZCyQiww== 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=XMGhUPS/Kjp/jHJ45L+q6oG9UqNwc2h1IrLK1gUN4CI=; b=aUzFjSwQmNEPn1i4SQ9lYHQoQRJDQ8GAx6XK/HohFx6oIJIKlovUaMDEHzEPl9mKygQ2OWi+0nPWyfe0WeSoTBQ6hB0+NVV0FBDhL8gJGNlISqXuNw2CAXLz7xD0uWxkFsvEjtFPbSsR/jfHUS6+qDCJaoOPI2APb6H7JQEQSEaJi17Q+CPwqj1ShIzHOIpjlTs5dhLI3ib7jTcpGkBt6H28bWnwZoqQodgu9M4Z3bXZnWSNOiE11w1JyrM9GxfAPW65UMJ9JteUaAbffBlgb3/MPnP8uttxKosFkodJEePfgnzr1gfhS58n59psbC9paRDaubU/90Tlp5LyODRFRw== 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=XMGhUPS/Kjp/jHJ45L+q6oG9UqNwc2h1IrLK1gUN4CI=; b=CzyGmuovT9s2krzsmO56M4YjBZ7yNLYlVBCp6aIxcTZZfH0HnllozbHkPdJd6Luma6S5bt08wP8hfRzqZNGtCMJM7CTPFq9/5lHfiwT8WKrU95zkSfHsYRvSmhoO+WiNJBg6zI4UtcpBc6kEfpI4PsiLs+b15yUo6oB7P0RAJDs= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by DS7PR10MB5214.namprd10.prod.outlook.com (2603:10b6:5:3a0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.26; Mon, 14 Aug 2023 15:29:03 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56%4]) with mapi id 15.20.6678.022; Mon, 14 Aug 2023 15:29:03 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 06/16] btrfs-progs: rename set_metadata_uuid uuid_changed to fsid_changed Date: Mon, 14 Aug 2023 23:28:02 +0800 Message-Id: <231421d7bc2101448fe34e1661ff348b090d08ba.1692018849.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0011.apcprd02.prod.outlook.com (2603:1096:4:194::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_|DS7PR10MB5214:EE_ X-MS-Office365-Filtering-Correlation-Id: b07dfff9-0339-4b04-8aea-08db9cdb30c1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GfkUXfIR+YYLaMmoYmlqrLoJHIXOtcDm3StSNlpKqK1fcVKYxRV3DQJiBmfFBCw+T87QSk5923WqJNoeLT/PDu3hoF2q0Riy7tT5Ocyysc1EBMfYpto6qWeN/9lvS87lw3Uiee49CFtM6AoaofTA4nA+mYUrT+lOCquUq0r3nAMI5v/tiZyGnsdAeeAi/sNi662sQaKgBF8naF9/ZNKE4TehxeygXqLcEdZveebvZU+MuWokMPnQGb7A5wH8vfBaUdQmDvWWHiJ1pbta+JMSKc4xDsKYzcbDa8A8BKNaBnTRrzPK3/n74w0hhpC7CLLOn6xz4S3dFCpFezd1Mw/ye/RLmPSSqB1AyHFPqRAOjIwiToLVp45cAVmsJneV10EK46LZxNDDGwixAkKUozQTtYpQfjltZA4a2jS6Ga7C4wi8BGmcQWX0zdyXeVovqEvEjerez8RwHkqf9ppcdfwye0ZsxewCegI6keYSC1iEhOEnlUYLaF/7hzyx0CTkSQujTzooSpVVSnic7I9z0ioL1FS7kttfyT1WxYkO0haMGPZeekx9aRDWMl4A4lRltvUA 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)(366004)(396003)(136003)(376002)(346002)(39860400002)(451199021)(1800799006)(186006)(38100700002)(6486002)(478600001)(5660300002)(2906002)(36756003)(86362001)(44832011)(6916009)(66476007)(66556008)(66946007)(41300700001)(8936002)(8676002)(316002)(6506007)(26005)(83380400001)(2616005)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: T2G6YbUkx/57CQpMm7mxxsqi9cmWmYM7QlnMIITPUhCpQlsr5gb2adm1qqE7pao59cW4jIBJtLx/z9QP1UA87B58HzW0ZFtpwpPcrNwILnwd2j8Z1ojt+NY1iWWl91JE3IMd1sMZSCCAcptp+GwRz2z7hfJEi8VEODnNIC5hQ266OedWcmXcW4xyd6TxZPKwH0gFKnGahYl/4UIUxSa0m2N/5nsLrQPuYrkqa8tRblY49F02tnd3HJqp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TqZgbD6zJrDiYiKj+M+twGgJN0Nchiaywjcd1p4KDYkaB8kRvD1bKVQtKfuIoZsg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b07dfff9-0339-4b04-8aea-08db9cdb30c1 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2023 15:29:03.6578 (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: NBRgZ5cE+3UQB92XJbxFGEXcrpmde4j60C62yM0Y9uY/n/NoKLiRzkcPE+0gHCHYlbGlk3zL4b6+AhbaHG1XsA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5214 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-14_12,2023-08-10_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 mlxlogscore=999 bulkscore=0 adultscore=0 spamscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308140144 X-Proofpoint-ORIG-GUID: GlKPdn7Wf2soBaySQG3hTqr4rymOb8Se X-Proofpoint-GUID: GlKPdn7Wf2soBaySQG3hTqr4rymOb8Se Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org We never change the metadata_uuid; we only change the fsid. So '%fsid_changed' flows more appropriately than '%uuid_changed'. Signed-off-by: Anand Jain --- tune/change-metadata-uuid.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tune/change-metadata-uuid.c b/tune/change-metadata-uuid.c index 83299f990b50..7bf30da4c3b0 100644 --- a/tune/change-metadata-uuid.c +++ b/tune/change-metadata-uuid.c @@ -31,14 +31,14 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string) struct btrfs_trans_handle *trans; bool new_fsid = true; u64 incompat_flags; - bool uuid_changed; + bool fsid_changed; u64 super_flags; int ret; disk_super = root->fs_info->super_copy; super_flags = btrfs_super_flags(disk_super); incompat_flags = btrfs_super_incompat_flags(disk_super); - uuid_changed = incompat_flags & BTRFS_FEATURE_INCOMPAT_METADATA_UUID; + fsid_changed = incompat_flags & BTRFS_FEATURE_INCOMPAT_METADATA_UUID; if (super_flags & BTRFS_SUPER_FLAG_SEEDING) { error("cannot set metadata UUID on a seed device"); @@ -65,7 +65,7 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string) if (ret < 0) return ret; - if (new_fsid && uuid_changed && memcmp(disk_super->metadata_uuid, + if (new_fsid && fsid_changed && memcmp(disk_super->metadata_uuid, fsid, BTRFS_FSID_SIZE) == 0) { /* * Changing fsid to be the same as metadata uuid, so just @@ -75,7 +75,7 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string) incompat_flags &= ~BTRFS_FEATURE_INCOMPAT_METADATA_UUID; btrfs_set_super_incompat_flags(disk_super, incompat_flags); memset(disk_super->metadata_uuid, 0, BTRFS_FSID_SIZE); - } else if (new_fsid && uuid_changed && memcmp(disk_super->metadata_uuid, + } else if (new_fsid && fsid_changed && memcmp(disk_super->metadata_uuid, fsid, BTRFS_FSID_SIZE)) { /* * Changing fsid on an already changed FS, in this case we @@ -83,7 +83,7 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string) * has already the correct value */ memcpy(disk_super->fsid, &fsid, BTRFS_FSID_SIZE); - } else if (new_fsid && !uuid_changed) { + } else if (new_fsid && !fsid_changed) { /* * First time changing the fsid, copy the fsid to metadata_uuid */ From patchwork Mon Aug 14 15:28:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13353044 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 304A7C41513 for ; Mon, 14 Aug 2023 15:30:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229886AbjHNP3h (ORCPT ); Mon, 14 Aug 2023 11:29:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232963AbjHNP3N (ORCPT ); Mon, 14 Aug 2023 11:29:13 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E729B130 for ; Mon, 14 Aug 2023 08:29:12 -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 37ECiecO024721 for ; Mon, 14 Aug 2023 15:29:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=um36b7D9W0sJc82qe75RFVzMFoUGQXuMRpva0QEAl5M=; b=NbY2rKxGsVe37MNXXfYNxNK75IYtXKajHtDhAzFvkMO3UJtIoeePL6JAgJFe/O4rAr7e hJA+DjlRyAVgI/o4685UacaW3Cpsmh/t1NjYm5xzLuTlzQPERVsxKJ2EdaKlyV92h8Ah KM4P/i68XnoKBdn4xqi/tTyxWFZF0dZWOYPuANXREAwXhMLKio8/FrKpiLuE9V8HlNuU QIGluzBQqTryPdnEYOPW7vKMN3c8O5DtFKS5zcMTp8WaXw1ncsYcf9bZEaghp/G3iQP5 DMLdMcDXbz51HGRGtFew9hYEqcoHAZm8vUoSNIgzGe1j80Qibyhc3ZHfP5txiq4u1Pti Aw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3se3142vg2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:29:12 +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 37EF3cjv019807 for ; Mon, 14 Aug 2023 15:29:11 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 3sey3u9yp8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:29:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T5yRL4pfKHrOcgIIEueQtVIY8XnZNyM4NxMwHQqHCbXhoqmPIVtEjiaagSsg95s0+KL5mhgMSaCuaYgyLeWxEutKVdiNy2LC1omUdYjr1cyj7bKi+LnrrAKjc+gpQMYEpelZx51ZA2p2DGC60sbXB3eH9CQPTPk09rr3I+IexrGpeyU6vwaMB1ClNVghV+HXXYrsn66HVqAQogyaRnbesy/9PoQwi54zG9if/MT+IE8zWA3oS86LpJ/8o8PsJ/64ZSyeEv03KF2LwLkrGJ651cxBGT6I9lspJj7Ma+0av4CSWyD/8nQEDxqJ/D5VZQZD9AJwxgUMvqAtzFpLPyW4oQ== 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=um36b7D9W0sJc82qe75RFVzMFoUGQXuMRpva0QEAl5M=; b=PqlBvr5t9ERJ1UpZ1CFR0dX6RnWokGSXc0mwaUJ585JwE/6rfzBda2aRMl0EZNvpOvvmnI0Ks1JLDVVDS6lZTb2XdVEvNHHhx0N26K05ZVGTOfxalRjRE93K6mFFtvM0Aah4D+yU+hGiGBRPp57qok56//nFbyQyn1rxtfO3iUtdnDYdTAKg6Iim3n/9XP9DHPgdFPNE06jFX3eWn9kk+KA5WwXJ5OBvUJZdpzLkgH0uvOMcEo5slKv1tkK8OoeRPH4mRmZnv9Xc5ATX2KbPlnT41CqoksTzgPSFy6X/Sxi9ShdJFQJLDz2jQB3atGrMrVR6JaNRBz1Sqh+Egg3daQ== 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=um36b7D9W0sJc82qe75RFVzMFoUGQXuMRpva0QEAl5M=; b=VWDIA2IAnYpgZQqB0RyJSA2pH8YyCOif6W42ENHHYqOj2FkuvWotUNCzBvkDXXnXAjONGIad8FaaqHUI1zVQ2n+I266fGUbpY9ht7QL8BRrhu788XXbPCDCuDZtKGg+D8GoyZ3zl4yULAAAzLpolGOGzx69GNfcZS9XER1ITsW0= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by DS7PR10MB5214.namprd10.prod.outlook.com (2603:10b6:5:3a0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.26; Mon, 14 Aug 2023 15:29:09 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56%4]) with mapi id 15.20.6678.022; Mon, 14 Aug 2023 15:29:09 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 07/16] btrfs-progs: pass fsid in check_unfinished_fsid_change arg2 Date: Mon, 14 Aug 2023 23:28:03 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SG2PR03CA0119.apcprd03.prod.outlook.com (2603:1096:4:91::23) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|DS7PR10MB5214:EE_ X-MS-Office365-Filtering-Correlation-Id: 5cbf657f-ade5-49a6-434e-08db9cdb3476 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JkKK3Mx9mCHPLn6xTVMAe+DQUjJVgWXXjkBsnT/RGUgtT2LSVtLoCDFG1SETzq6dpYbZPCG2a5XhhL7+yruajrgoY2vHSY7crMbwbzv2AvuYqSBFvdGpAZTxa3rxzF1enwxENDbuplK4NLMDKhJl6frgiPt2JCtUyfefbEWjOe164y2SHYhU5KO4k8fitdW7N/H5LQx0gTiC8cplYmtB3N1nqOdZN5lG+d8kxvP8G9U1uVZLvku2hDlUEOiJiZHJSIBOT8dvxooVkmKnFsH9LDMAgsOR4jFRrVqGCBUzrzfz4G5xcgIdj1ZBBY7/qlXceX/cfuzTjDMTFgRAG+3NuLcdqJvOdStaVhqConw/DXbbgWsCECnadeDmxnUT2xkibnLlaUSd4fIKeg7k/LK9Q/Q5r+RM6AQJqSalE2nITEIM1zHyNZ45NaPO06vGG4tMgURb2s52/MNLTo5DIgfLJhcmCExa1WENDvxIPZYnPMo6D5IymXjy21OdTa+8V2dbG5c1eZLTrwEq3j7AR4cEKdN8ovaugoROYKtuyJuS+P13Xe19Ol8Roj98dQjqAgAd 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)(366004)(396003)(136003)(376002)(346002)(39860400002)(451199021)(1800799006)(186006)(38100700002)(6486002)(6666004)(478600001)(5660300002)(2906002)(36756003)(86362001)(44832011)(6916009)(66476007)(66556008)(66946007)(41300700001)(8936002)(8676002)(316002)(6506007)(26005)(83380400001)(2616005)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RVIbKHbpFOnluBwBOePZcMeEAlJSKqfi6gfYhcKeBupo61ngv5XFoTXBRmsYTF7kmD/dyYByhSXXfUpX8fnfGMYAAdZubDdZGlL3lsvBLM5P7VTkt0BxuIlkug4HMjeiuLjn9b3LGdaCN1eHkWqjXE+G6uGpmub8HSdfWrmKN72V1B3NXhEWify62q0OglpQCZxBFCPK357lpEgZrZpqAZ7OFBxVljUSc+5aD+I9pnYHMe8qoRMY2fCF0bqJXo03e4XtNb4feUojkNokFI/eFXrWh8AshPaSCNaywYmhnrwdnhxT9GeRNak/+teyBq5cr2PqQc45uFCLJrdW6EMGzHrw7G829r4Xd6lx2z1WcVnuylio7ZBFbtxGiYEutWGN1QlYo+EvQiQhWfoZZgIB+iJE3R4LT0A8jFOuMrRkTXKoaE3UacvVNLuhzP3Lada5VMcEfJxCCUU/Lsxp/7uZlYQ60OMtdgXwzRlJI7p0SoiWe3jQJ76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wlf4Lxloly5BpNc6MUzIThLrou4qVgeYx3ksI X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: ohIJBsqZA3EqrcVg+4TtyPGneoVsOuDPCAEL+gMTrxn6+pyaxxUgoJiWMNcI+lTDWSoVQD5CZz/ufIB0AT45v2w1k8Fz76ZwvygOvwV2D6PG1qaEWG5cYHvXTTiyyT8Ya5cBnONF/g4XAAcD+yQstMzYxrJt350E80AYMDZKeW/ciEV2035dVSZEdNFp3M5vHdUoH16uKNIa4qoJyII4bzp2T25JwOpAtOPQ4YT4YVbcculC5vVkWzESouOrUmCO+sJXQUJ4N3n4boCM/V0os2aFQvL/J9VMLmFdv+oYXMmBqbH1udU0QfQ+Dye3ZoNo/bJOGvbNTRA/iNmR6RWpKUvKrYeM04JQyaNWvUmcUbW03NBlMFKQEKLAwjjMsllpydusB7XzLZkdG1xgzCZcbKbuHrbXIGa1KQs5pxJEAYdtNTBiWG/M1FHof63lDKw6iRBWljqtaQWt1wWOmGQFtDRHK4+MtmktnedvT8Op5e4kYOij4BzGZVRB8eHxy8QP9aVDyrdQnVpyV4fCgbhAO94QHw3rLS7jmoiuyw8uwNDheZUugk++jxuWcfF6tgWA7o2p9MyPiK2RiFlJEaE8UV8/4Ry83hHt2JztUnwZsx8+FdQxK+O0oOqfz2UDJG6j+qYqbOMt9SjQLiDl4f8XM/OK6vTp9n+tuz69neX2QGbi2GvfqFRk+P15cyCCMRUsA7LIPm4sjAEev6a4+I/MQTwUn4sAt1f0hCm5p41/XxN0P4xkTZZ5GSLx+K3I9Ce43TN6u/rTBqGNWZpFUUSgsw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5cbf657f-ade5-49a6-434e-08db9cdb3476 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2023 15:29:09.6418 (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: 4jpCZDlu8ysNW1UxR8d9LmpGAlWFlWJO1RwLApDNScxcF0p0jYwRhxLrgTj3LJiMANwUYO93sb9UVvaSQS7twg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5214 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-14_12,2023-08-10_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 adultscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308140144 X-Proofpoint-GUID: 6bfxbGYSI7-QSBUWp7EdPBqqiB-1vA0- X-Proofpoint-ORIG-GUID: 6bfxbGYSI7-QSBUWp7EdPBqqiB-1vA0- Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org In preparation to use check_unfinished_fsid_change() to support the ability to reunite devices after a failed 'btrfstune -m|M' command, delete unused1 argument instead reuse %fsid as the function check_unfinished_fsid_change() returns the fsid. Signed-off-by: Anand Jain --- tune/change-metadata-uuid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tune/change-metadata-uuid.c b/tune/change-metadata-uuid.c index 7bf30da4c3b0..a49adda8dd29 100644 --- a/tune/change-metadata-uuid.c +++ b/tune/change-metadata-uuid.c @@ -27,7 +27,7 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string) { struct btrfs_super_block *disk_super; - uuid_t fsid, unused1, unused2; + uuid_t fsid, unused2; struct btrfs_trans_handle *trans; bool new_fsid = true; u64 incompat_flags; @@ -45,7 +45,7 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string) return 1; } - if (check_unfinished_fsid_change(root->fs_info, unused1, unused2)) { + if (check_unfinished_fsid_change(root->fs_info, fsid, unused2)) { error("UUID rewrite in progress, cannot change metadata_uuid"); return 1; } From patchwork Mon Aug 14 15:28:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13353047 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 6306AC04A94 for ; Mon, 14 Aug 2023 15:30:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231704AbjHNP3j (ORCPT ); Mon, 14 Aug 2023 11:29:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232970AbjHNP3a (ORCPT ); Mon, 14 Aug 2023 11:29:30 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0E1B10CE for ; Mon, 14 Aug 2023 08:29:29 -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 37ECieGp024718 for ; Mon, 14 Aug 2023 15:29:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=/pUN6dSftlSXBrqqTxhnEr3F4Eh1SvwpOg2p2utEnxE=; b=E1m2wSNF3xLvPhi+kBWaGW06TCL28jiSCuFgEEtsyw0e9zlyphH8uWcBxioB0gpv3vch BcAnRpRmw/P4BmfIr9xVueS3Fa6mjdhfBRprEpV2ISuVKPO1xTaAXAUzdnIz/ex/XRme fEfmYYmaEQees/RJavNdND7mL9LvFfeJfhuUnwRCuDSziRLLg7oo+i6u3LJ1BlDu6jBm NyylEoHzZ9fVOYu6AtimJgbx6Bx6Ap/IuWrkl7He3ga6RThCm/wzYQM7rRI8OlgpxM/K 5rZuR6SbHhzljjLr1/fb584ZxkrAkzeH0rUIb1XzzVVeJYGz4Sl6y4ayqsByibLbYI/9 dg== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3se3142vgf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:29:29 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 37EF6M9A006624 for ; Mon, 14 Aug 2023 15:29:19 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam04lp2173.outbound.protection.outlook.com [104.47.73.173]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3sey2c1st3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:29:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tc0orcYLxJy0x3Ndlje5sGpcJtP7LMbpns39tZDpCOqt2CfFpy5ACMLigMGnJ9wlWJDAWCQLULgIVG9+DZq8qDjXbznWr6TTSLEoR7Hh9Kqa7I+h2KpdX51Sp4pSTusdiVhUoflmZCvqLZzZ7rgQBV+SRQOYLC1naH/mwJFrB3lvH3v5vwuxm4jCJBFPgOl0X5FWWhtYvuJfHpihUZEzkelKb2jl09Ve0B2ghctRN3l8KJFL2x7UlfVd+s8PNA+hFQQ3x2caoE9Lp3wgWp/zhVyXaxu0xVfwdFgxs5ESr4I9h9Y57/2wx5jd01M+FC06nOastidqcddD09SZ9pcofg== 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=/pUN6dSftlSXBrqqTxhnEr3F4Eh1SvwpOg2p2utEnxE=; b=Ld53RZ/YiVdWQTP7QCsAgrIwXAeSKy73U5LRt0aCWgbG3xTU9+LrR0PXnbTPr4KPm5lR7B/q2A4pTsm/EfoBZkVaoe+2c7Tr6YzVrWcaqkuS/JHFFU2YXZ0j+bh6eIxeYG1dxN7/QGvtPdVc+KnMVUBKMcdlhyw4H2Xz1a7VqwLonj4TpQovjIBQ256mhUqm6DtmfsN8tS+3HJstYU62M5QVeMojlHnSMau/o1IL8kDF9+l5tLpnZSdOrLjs69mpEgDcx6IyPIGuLeiWURd4mOCcG5Ady+ycsSodgf9RERPZkwXOWBovLF8EyCe6WH1RKWnLkHmz07vqWE2NPhbOMQ== 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=/pUN6dSftlSXBrqqTxhnEr3F4Eh1SvwpOg2p2utEnxE=; b=NB8tui9dq8A2j+Q7QBR6mUhA0I95fhJ7KxJUs6z6y33L07BlYB8DIKLn/vaxvhe9m2MvyoThk75JbdazgmKxbfQh8HoNIV04qmfz+Xc2akCV89ZdcOhXiHL3U/Aur3AC78HVSGmfxS3W5iF0TTU/RuhgCAnOEPZj1RX3XTufUaQ= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SA1PR10MB6342.namprd10.prod.outlook.com (2603:10b6:806:255::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.24; Mon, 14 Aug 2023 15:29:16 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56%4]) with mapi id 15.20.6678.022; Mon, 14 Aug 2023 15:29:16 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 08/16] btrfs-progs: pass metadata_uuid in check_unfinished_fsid_change arg3 Date: Mon, 14 Aug 2023 23:28:04 +0800 Message-Id: <074f60b0f55304a5a567c4fabe17e401b061f8a3.1692018849.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SG2PR04CA0202.apcprd04.prod.outlook.com (2603:1096:4:187::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_|SA1PR10MB6342:EE_ X-MS-Office365-Filtering-Correlation-Id: 38622466-9210-4073-b721-08db9cdb388c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: odpW5mA4RgcihEOlCORr/VX7YWgAMP7Km7Mn+5LasjOj4RLvMiclOtnwHHyMet3/GA1qu2u9xvP2f1F8m1/f71YAek8lhm2ulthimJKHaM/Vy5o+ox+MAfdbvoGqYcQW1mZWPWosEeHNnAD6kZ4bf4hInX3KDUhSXnecTTOsxMiqNhODUIEffZNg/HOdEOvacUKerIA5+EJck2C9w7Do/dlCDt8gcHgEBYSdeG2K+BgPVeNogkTKNYs5j+03ufogri2qRjuE/6IQxUzkG6Rfy5O23oZFYJtQJOaDevPWsnjLLM6ojRSafM3LSx2+jvTMwhxv/x5/HfAbaWYpiRFQkt5r7v83MI2f8HqOYtsbfr6WgLKoBVwE9AetxCvG5roiyy3HJYDXLiRBi18Q9Fp41omcsRsLzHs9B+R3/b5i0KStcdgk/DiOHPA0ivlmVVxOUl+3RyWTrdi4CjMdUUH9xN8seLe4KQC7ITfPK59lQDjh8mkRixl3YHFrST6RA1mXQZJB8Ga+9xF08fUehJ0yF7SmNmv+o1vSr4M5Jo2RT88Agbbn4a2J3Cm9COssGqqd 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)(366004)(396003)(376002)(346002)(39860400002)(136003)(186006)(451199021)(1800799006)(8936002)(6512007)(86362001)(478600001)(6506007)(6486002)(316002)(8676002)(66946007)(41300700001)(66556008)(6666004)(66476007)(6916009)(5660300002)(44832011)(26005)(2616005)(36756003)(83380400001)(2906002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gMjXuL33GBsD2RzxRKn7i9yyVVdT1pjXebIGVCfaKSo+mQgMSRUhBrpCefIt4Fdb9yYXz84jr5TAyM8xJ+XWtRaAv2kVJyi2hxkxf/3oA6GfWGsyDuOGg+5Y7cRaWcqR64qh3nZhjoB5xZvBRObbOxBfTYUK7l1IkrFTCVV1lf5wQsXQq1JrEKkNnlI7fRPe0//qFAfpqoj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M94wqVjfyaFl5PmDZmuqvgik8XCZCO5u73/Zvk/LZa3Kst866U06W6hSPsb3SXYv52Ue4V6fo5FGhg9U2LmNZjKROM4iK9FTiQKYpVBV0fFPWgCNmw50x7gHpoH/F/vz0Ow== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 38622466-9210-4073-b721-08db9cdb388c X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2023 15:29:16.7101 (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: UNVeYTmbkoHzEZTtM6s1O3VMwi6MQsOwqyU8JhaJ5b15GOLM7gaaZIVSAZGJxKAurzN+43TBB1C/krr1qfjyHw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR10MB6342 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-14_12,2023-08-10_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 mlxlogscore=999 bulkscore=0 adultscore=0 spamscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308140144 X-Proofpoint-GUID: SfLag5Oa9Wb7IKvdemBnZzvozvd4uNcW X-Proofpoint-ORIG-GUID: SfLag5Oa9Wb7IKvdemBnZzvozvd4uNcW Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org In preparation to use check_unfinished_fsid_change() to support the ability to reunite devices after a failed 'btrfstune -m|M' command, rename %unused2 to %metadata_uuid as the function check_unfinished_fsid_change() write the metadata_uuid from the ctree to it. Signed-off-by: Anand Jain --- tune/change-metadata-uuid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tune/change-metadata-uuid.c b/tune/change-metadata-uuid.c index a49adda8dd29..b161f6757d13 100644 --- a/tune/change-metadata-uuid.c +++ b/tune/change-metadata-uuid.c @@ -27,7 +27,7 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string) { struct btrfs_super_block *disk_super; - uuid_t fsid, unused2; + uuid_t fsid, metadata_uuid; struct btrfs_trans_handle *trans; bool new_fsid = true; u64 incompat_flags; @@ -45,7 +45,7 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string) return 1; } - if (check_unfinished_fsid_change(root->fs_info, fsid, unused2)) { + if (check_unfinished_fsid_change(root->fs_info, fsid, metadata_uuid)) { error("UUID rewrite in progress, cannot change metadata_uuid"); return 1; } From patchwork Mon Aug 14 15:28:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13353046 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 4EB65C001DB for ; Mon, 14 Aug 2023 15:30:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231491AbjHNP3i (ORCPT ); Mon, 14 Aug 2023 11:29:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232966AbjHNP32 (ORCPT ); Mon, 14 Aug 2023 11:29:28 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DB5E10CE for ; Mon, 14 Aug 2023 08:29:28 -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 37ECiYGR026738 for ; Mon, 14 Aug 2023 15:29:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=mdbMYEk0ECi71sCN0KxUA0MNMjAQtbm17Y61d1YnU9Q=; b=xbOGlajW3mI+TePuy56rRfOS9Z9Q7RQDN62JBKqJBSkMVxlVDL9FZiduCoMueZPX2Dfm mEywtix6oojKfiLfmS+iweqCNCJa88HUfxBvaiYIoLo0ffH3RgZNOj/NmvQ4lDmWTNdc iubLtMpXRkSO5F6dMe4ZVIYY3FfhJ0SdYDh/HsxWZJY5W2/HnHoGUU8YpaAF2IgCbioZ wd5JhB0JUtL3oW7K549kqaQWJMBDCd8rDHO9Zj4Cpo8oqaAiNzvQL0E0fVM/McPiJQPv f2xL5DguuLT3+Rwhzli5MjXa5qR/GXpZdS+PzS/1hHCcRwdzAEv7AUdNJBWw0+xuYkIi oA== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3se2xwjvg4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:29:27 +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 37EEtl8u027462 for ; Mon, 14 Aug 2023 15:29:27 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3sey1r1v4h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:29:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OueSHAEI6QMMhJnGSRM82Pys6iidGsgimOFhFr3V8jh+0OSkSH1BfwuhKv16AI6MXp36j3l8tHW8Oe1h8htMWI7bGS4bDDU0PCRcWqIq0WCdElphtJjtYgiqV4mof44z/GqmTUVL2S3Nhdr9i0vIltp+qsi3boR5fs9YqJJnNNsSPSZ3O6CcB119wxauqtmGodaSg/WcThjfkvDdkkyC41JAikQeD6My7SYC3/mviTUGf+LKrkhxwk0JgKIFX7F8yYQTFLryb1TURns5DNGlVnoQXpqwHeJUtaq7LD3i0MmXHF3OnQuigX3OjBz6LPX0Iht6FqoNqIsx06fVUCn/BQ== 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=mdbMYEk0ECi71sCN0KxUA0MNMjAQtbm17Y61d1YnU9Q=; b=jvRJGUNydiWAw0qpHxlYimQvk6rTbxgAULqJMF+Lrk1ilFmvXzsVBg/5rujF5JsY1QxoagBaD4CwFvv4fwDqZT6SDnUNvEyDiWfTcKA/Wys3nIDOpzsARCnbjtym/mUsVoOq8n3rJcClbQv/+tuaq4FgbbhqGvVoN+OI9yX669bWturIovG9duoxzZxY3ZmlF8cWdxu9zjMk6i3z59mdBi5l8SPjSXZCqv714kyMtZv+/QjD4+uVN5g8RP9t9Y5SHrgpe+tdePjsOJ25gp/oicYvq1N9HiushJQs3NDxcKTKI3Y58Nk+yxVOcypHcKlrBq+j975swOVUzDj+TYNIfA== 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=mdbMYEk0ECi71sCN0KxUA0MNMjAQtbm17Y61d1YnU9Q=; b=qDej9Bn2O+Xb8axoCIPMhM4gBA2PzKIUZBjApoz8r85Jw9sjsZByzSmCi1WTHTpxLM0yNcbrxSxqI+/fzQp2JXBoi2aEqIp+OdTVAgarQuJDeXMXiuJDnXoxC84HMqN0nwtv6ZQIpQNLpN90rVXoBw8+Kc5snYl4/zDRibLF4Ys= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by DS7PR10MB5214.namprd10.prod.outlook.com (2603:10b6:5:3a0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.26; Mon, 14 Aug 2023 15:29:24 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56%4]) with mapi id 15.20.6678.022; Mon, 14 Aug 2023 15:29:24 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 09/16] btrfs-progs: fix return without flag reset commit in tune Date: Mon, 14 Aug 2023 23:28:05 +0800 Message-Id: <6b871014a82f276ee239e01c29d94450ee297350.1692018849.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SG2PR02CA0087.apcprd02.prod.outlook.com (2603:1096:4:90::27) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|DS7PR10MB5214:EE_ X-MS-Office365-Filtering-Correlation-Id: 5b15cbe1-c32e-43cd-ef6f-08db9cdb3d74 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DfK5t5TVIarvsghAGzNz3VLGT6vgnfOxNl8cv6dCDx7JmQHPmxAcedzN6ws5Ec+EkKba/jAHtkPs/0TVXzWu2IdpYj28j8eS44ggTHWdTJvBlTRBAhXTJVDjjFIi74f0m7Y4T01tE+nihVTvku3YcGyT584xZUEQn0HMmKLq9Mc/duxub/BorWymyPaw/Wqe/eMJX30TvXZkjf0TO+ByBZxsLfbQI/rQ5LUERTLM5Sj8XKVO4ePUVf0IEJs9S2UtXiImWBA5yYkiI3392KtTNv8AFgcm0FrThc9+VOnw848b5T/9qLe1TZIgBCZP+nYkG3lOMdjki4a4en4pjKLT6WlwsJzgnUQlbiMGIodjM5zgyOxPzZ/DODlGBPs1z+qqJtATo0IdwCGkTRNHm+QejDBVq5pPtxVrKCvYUokmpvdU3kMMQu3LxGe+tIv9FtwXtc9aRbDiV7hlE/WKKD/uUgvfX6PoANrNv7O8/V4Jxkqd4vZagXZMFECpktlnrM4MzZp2G14GRPBm3GAdqjUHVj88YuXlttilQFQTxUGodVoLQLM7lD1uj27dXhAE4rMo 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)(366004)(396003)(136003)(376002)(346002)(39860400002)(451199021)(1800799006)(186006)(38100700002)(6486002)(6666004)(478600001)(5660300002)(2906002)(36756003)(86362001)(44832011)(6916009)(66476007)(66556008)(66946007)(41300700001)(8936002)(8676002)(316002)(6506007)(26005)(83380400001)(2616005)(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AVzQgSr4r//SWZSdQ80mDBPJvb/cWghIW80QwfPm9rXdptSsrPwr9EVpcUhNp5yVLOPJj7lPA5m1xTmsVdwHV6W0KSX8vCf/YUOxVpgs3P4agfpimtHzd+swZ5RBGKaOcvW4wWfrxkr5y0W+yRJORVC0GkCXIw3D6Wc/NICoKlAlTiuIxQwBidivrO/rrrpyDdtC0Vnna+Qt1Ky/O0NeY3jabELQ8QWfluqf9fJMX/CTOmF2T4y0yQyJGd1e0B3XEzamd7SwklOipUMTVNAN5FJdxHRq5iFhx5lbhgqT5h5eqlwcToJOctx6MYJYBPMFgnLWY24AiftwUIygDcyCog7NBvAtIdr6eE/UE7jlODJ9Gg0u9kRbLcMUwzcH7QYxkRJ+VVBYlyVf+X7afr/fYJOsT1VAg4wT9VFw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5b15cbe1-c32e-43cd-ef6f-08db9cdb3d74 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2023 15:29:24.7645 (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: TRQJNsK4/ityh64sq2MWdK2Hds7xU/+Bmeqf+DYYPK0vya6QPDSz547d8hDu06DsZyj72s3ScDR/xjSBT7pYqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5214 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-14_12,2023-08-10_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 mlxscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308140144 X-Proofpoint-ORIG-GUID: _KE4O6HCzo4rIAe2lj4_jTDeFBxAmS7y X-Proofpoint-GUID: _KE4O6HCzo4rIAe2lj4_jTDeFBxAmS7y Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org In the function set_metadata_uuid(), we set the flag BTRFS_SUPER_FLAG_CHANGING_FSID_V2 in step 1 at line 71 as shown below: 71 super_flags |= BTRFS_SUPER_FLAG_CHANGING_FSID_V2; 72 btrfs_set_super_flags(disk_super, super_flags); 73 ret = btrfs_commit_transaction(trans, root); However, we fail to reset this flag if there is no change in the fsid on the incoming disks, as we return too early. 105 } else { 106 /* Setting the same fsid as current, do nothing */ 107 return 0; Fix this by allowing the thread to pass through the step 2, where we reset the flag. Signed-off-by: Anand Jain --- tune/change-metadata-uuid.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/tune/change-metadata-uuid.c b/tune/change-metadata-uuid.c index b161f6757d13..ada3149ad549 100644 --- a/tune/change-metadata-uuid.c +++ b/tune/change-metadata-uuid.c @@ -92,9 +92,6 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string) memcpy(disk_super->metadata_uuid, disk_super->fsid, BTRFS_FSID_SIZE); memcpy(disk_super->fsid, &fsid, BTRFS_FSID_SIZE); - } else { - /* Setting the same fsid as current, do nothing */ - return 0; } trans = btrfs_start_transaction(root, 1); From patchwork Mon Aug 14 15:28:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13353048 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 77947C04FDF for ; Mon, 14 Aug 2023 15:30:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232905AbjHNP3k (ORCPT ); Mon, 14 Aug 2023 11:29:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232972AbjHNP3f (ORCPT ); Mon, 14 Aug 2023 11:29:35 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A46410CE for ; Mon, 14 Aug 2023 08:29:34 -0700 (PDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37ECi9JQ017380 for ; Mon, 14 Aug 2023 15:29:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=/I2zok444o50YWAPS/n+0fN5mTzv3WEyXVdAKl3wRbE=; b=XTl7k6yioZOIYWgR23rzU4XoPI3FI+mtLMqyyCTr2L1Hzo/R3Jj1iBkzldF6tYBZ4QSF qd/U/NyfS9Xn/1H68yWD7kLwG6ohItsI7jwNy+Vi6J7bV2MK8u7/tP/gkqmKYNTEI1/t EaVuM8KConvKA1CDR8jbq9qnZe7Q0Jc9lvsb3S6LlrlEhKDrMl2ICbhjTzoJQdIb7zjU EraiZTU4YhLp5WdJAw6ql1BISxejjoTs9k84yT/l64L/7olqDH/ajc+ksAFf25Ms6pLB skvkGoRollQZOxokLdjLtMcBJHxrmK45DC9gUdb4OOxt8+Q/+fCqbAiVIeTKTmACge3c 1A== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3se61c2sep-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:29:33 +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 37EEqxmW019874 for ; Mon, 14 Aug 2023 15:29:32 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3sey3ua024-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:29:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eSZiBszpEdTzVgV9mGrnjJBQXpZS5ZdQqc7ycretL+Qned95viTgQcgBA20o21L2Ti1Q3cRrV79vHPwNz0kVxJog2F+tYK4afvaf91GW22/FGVr2Cvqo/QMN5VEpyfsA3rt8VMnsgF7zkCNlsByA6uhiAi3C6tBNc+6Hp/R1ILWwU5Yv7hSVKNpdkNvvXEcNj+GO0NAJa4T7T+5qOosjLtiHpUNdS7dJRe0x8GIvWAeBMBzcvr+ORSMnN3zAFlyy4kikD/ndqId4vmcBzFl1WxHrQ6JwH0kasA0GZEx0WyVCue5xYR66BhXnqKqvF3nLVDsY53HmnkijKvIZfu4aYw== 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=/I2zok444o50YWAPS/n+0fN5mTzv3WEyXVdAKl3wRbE=; b=oHpdymlRtq2tf7TJNVUt/9gZfgLuGsNr/+n+HqtZ5UEDxfzwth0zldUxSViPL5hYAjGaJObEd5hKC8hi6qHzXmdbEqff5/pfNVloGE6NtTUpSdSO/7uyThDlEDDr0gq4Ady4if99QpXYYiqJ8O80upz16jK9ms2B4FhotIAXdfr0J8OEQQLD6ofpJuWSPanqZKKqHU1wO9FOXrDSfk+x2Bh8DWmGsXy980qmR/XGKaGLpIdTGfSMIqYznXOwti4Qeft2u1FKa42WXxfL8tttQ0+D9lXLgkQ1Mo2NcZPwONLcc4XYrFgrwnNeZ9WOd9QArFIdYiO1+HFVaIM1/R+Jmg== 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=/I2zok444o50YWAPS/n+0fN5mTzv3WEyXVdAKl3wRbE=; b=v/mn4bGPL+YF390udv7A5Hi2u7Hm/h6taf8naY3Mb4tjAHPbDEaI/OugN3o2YAr7GvBl6sUlwUPimZueF+bsaCfeGBqXTv1Tg6XjP0bU41tutStDSb6uUZKD+fZjHY1fHhbE5YgtvhmiqpjeZodthsBZbe+Wj9Uu16nn2gAhUn8= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by DS7PR10MB5214.namprd10.prod.outlook.com (2603:10b6:5:3a0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.26; Mon, 14 Aug 2023 15:29:31 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56%4]) with mapi id 15.20.6678.022; Mon, 14 Aug 2023 15:29:31 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 10/16] btrfs-progs: preparing the latest device's superblock for commit Date: Mon, 14 Aug 2023 23:28:06 +0800 Message-Id: <98d2fc9f0f90b4134fe7784f5fb482c88f241599.1692018849.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2P153CA0022.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::8) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|DS7PR10MB5214:EE_ X-MS-Office365-Filtering-Correlation-Id: b1e82dd6-3225-448b-1ed8-08db9cdb4120 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Kar5EWOyuwUNYuAEUsZwIRJLBhW0ZqkC7AcY9DEbgfpCSu1+ItF6MBVVk0fwKnU8/okyU8aKgsPrjSB7NvtMqHFiUxr4HH+1yGOoyAKFD/lxV5MhyzyD/7w1+si3HJKbj2DoroUwi+1uSk+CqziPtztU7foP9lDi1hrbkt12fz4yIzTwhFd7llQmILuhQqU8EuNQAGY2Wgk7PicMrbXIg6i5EM+0sPfbtbIlnYNjQ25X+KVS37EvS7OJ/2KQKQQhh6ePBMcsPlS5dhC8Cf/I22SaRQaAXFHdBYoqMyKzAk+JRs/sxds3MtLo+HvRFCpfoUNc3XbKFQWsQgDECL5z8FyIvsNM6KDesaHOzDIxDelbBcwKnP9EW1jTDgi0kUpLpio67sDRNql+wUYHvCZw3OFstiR2Q5YH0YsOZ9oSiPEXvbvRu6deBYSddK1WUdTM9aPqgMikZiVUQYaCoajJWq/tQuWgOyVbF5CYUOQH109+C9woETuiKLJwX7DAah1P8swOd1iiv7hbK/N5PF33/gQ4VjxC6Q/dQvH5PlSpNV/OlwbHMKuk1scB9xme/R1l 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)(366004)(396003)(136003)(376002)(346002)(39860400002)(451199021)(1800799006)(186006)(38100700002)(6486002)(6666004)(478600001)(5660300002)(2906002)(36756003)(86362001)(44832011)(6916009)(66476007)(66556008)(66946007)(41300700001)(8936002)(8676002)(316002)(6506007)(26005)(83380400001)(2616005)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +fRdwGJXaka48hjsM3NtEo28R20Q1bEUTbztl1TjC4SS+Ieh41VmGHS64yepfz3+CLRWWC7ODGU2q7tw2T27lKYWpV2swFzBp+NfHbuwARON09kw/uZMLLMfJg1Ia0Ea7CFNGvB7rm3NozTSgCeneSYzdVysjF1FnUmYioDWmkxgx7cy6HQMiBrjLfqUrmsOvf6fCfPyQk0cjxExiI7xwpIdUIJQ3zjQDMcquP176jozzQLJ9vNpXyG4BGn+NkQu9nbhr75PDADf61OeP79axjjJRHgAPpE0A8ts/DllJbSzPYcpn4v5YCkVIz8BlHIH8gjXQ3KsfPMf13JMOA8sARZnFc7UBIQO3gKVviOij/a4AJsm2A2QKFelus+wFAnrdjvc0dB/h+Yip09ehkxsVz3eCUjCyKxWLwv5JrrdHZiIjuB7zFyyzvbielrTJuvAXTYeWEk3CdLkU+4cC3cHKSGALIOdv17G2dYyLsCHko9xVxH2w9zIxQ7R5WzldV3LhLJE/P8TOML7/hXQ6lXThgMM4l/Rg8qxHFA0hg6d2IscF26tjebiQ5vhj2fCGjwMabW+QBv0yNaUB5R5s9jgMGRe0R2/MGw9g4YfhyHzMcYSbK0xNbCY9kjujXNfCJQCFKT/8qy/MLlFLGf+7O33u9P5JZm/risixTVk2qCMoTb9Bnlbf5mkPz6loBEBICnCzKW6IHQJK6znUBEclzWbFOljmmdRGoG9/WXMGCdEnf0uuU+YATynBcQgsQl0oeSqsf74z4Ff0hEhXPUv6G2TehRVY0yfh/Az5Avp8fYEIWRm7zw490fPOft4GOpZT07X1sHbMn92zEr3bO2EDSDYra/HmJdYqPBMR0XFzUlFG/BptBYGoOSlhCX5nrnZpHGOT2yrjGw+xPiJN3EGzawoB5ygmajgqn0HEMNj8SyflmMfndDqgkcwL1c9iESDQZt0XIFj9qlyTchwmqQAlf0R1bb7CABPq1uGIwsD5thJmwCA5rFWj+tamyMG52gVVbdMKVg6aUhkX/wAER+dm21a3vEbPWEJTBHalHY0imWAK9PkZaKGcNC6vBgQiKnEk8Mw0x53Jw3vFIkcgsukeb8EmFqNQTAHPMUHYtCc6UM1xmHod9NLSk23a+SemjiCZJhBwaxLILh+PIuSJEpao2Mk4hKr1SwvlbV3YgsukK67Ih5wmg1Qn37LJ8EmyJ7oPGzXyt4zPl2LyXuXfzXdy/IBIDLvqQJvYKJFS/7daM4ER7TKpy/T15ZWRDLipgje2CWsFYBaJtxAuz92xg/sURhPdulwWzfTTlV4bNy3qXcjs4zM43qmSTtFXSvZpqdecF7YRpVib5+IpRdtppWzJOXPLgz440Cgy12WHpkeQ/3wvRx0YzIsxVhGGjhkcTHMuRIv3mSwheALKpoFJgSl00HfNQLk+iD7QXbE3fKCpYigeyswu+VADlcph2HkaBoxV/zdyGa5BdCAiImBSa+SZmm/caiY6LmDtq1CzLFLeygKPFX3HbGuXwA0SxWZ8v6LWyfXGvl8udgYYYNDPKwlRbmes5papRS1o3z70Qb92ulEXdqSGSVfy00DOzkFbUf1dMH5nqai28kWQMHG0Oqmd8GD8w== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: y83xdGPWveObia3RwtEBn093otQ+iZBgrfeExV5DjXr33nDf6YXX/TIWi85GTZhAk4oZbeD+mUsr3iAw4HuHeMhuIveM9VjdXfYwKJBvm1zReOnYS4p6lWiGiriXSy0ZI/sOi5iANEkHwbTBWdBjX2QzVwPnoMQbrj2fih1K6VKqFyzek/0beyJegpMm2PG3hNsn/bahT2lJGohd5jsHXRt3WtJgt412KxlVgVyH3Ni7ZeTFKeQC5sxkSxVeGFLoc+7BY3vp4oar7AT5hvjrJ4AgYXoV7sZcpgEktBl35g9AJPsS87EnZ0YH6yy4XudZ6uryOlS6pSwQzBKQ3nh7gx8MR5UfsxEhud8noBdt9GEp41PlzHL3ypvr6zlOPIAsl9mOojU3f3RP7GzZQQy98Zb9w/YWukH7z6+kuwDqR316sZaMoS0wvuLrpzFmR5yjwx7ml1AkFvSKL0WKASDWkwpQTr0+uyflJjprVWYR4GChDTW+LOj5JSLYv3km9Wi5ks77i5Jwh1KzFV+nLsw1esHcv1ciibAd2ApOqET88ruEVDo7LhIYHqm4ye2rWXxu8d9AJh2EUGdCfIvTIoZvDxEs/9mLq6V07UO6hOtnjW2xxydNmZZ7mnYNZEZT7dYCaP8B7i/W/dl8cwDGoWVx9YIL5ftPLyBH8z1yZ/tW6AxVjtf3IWsLiQg3PoCX/HARlgH6Yy5Ryp49rdHJk9n6xB1pR7GNbK5ZcRtQ7IYwXQ22JIklYk7DhvAaSPQeA4pFPz0Db6E8xDAviwYv1yzV9A== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b1e82dd6-3225-448b-1ed8-08db9cdb4120 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2023 15:29:31.0721 (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: /aD0ODsHATH7sItOnHUvCKZ7gdhSIte9Gv8st75ujCDaEf0IEe1/xd/hpHLysua5ya/DX1YOjM/3Gd9OnfKVGQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5214 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-14_12,2023-08-10_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 adultscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308140144 X-Proofpoint-GUID: c1qB64iS5sf7SeBsetPFMCGQahTk_a20 X-Proofpoint-ORIG-GUID: c1qB64iS5sf7SeBsetPFMCGQahTk_a20 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org This patch provides a flag to copy the superblock of the latest device to the fs_info::super_copy for the commit process, rather than using the superblock from the device specified in the argument. This serves as groundwork to enable recovery from an incomplete btrfstune -M|m|u|U operation. Signed-off-by: Anand Jain --- kernel-shared/disk-io.c | 3 +++ kernel-shared/disk-io.h | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/kernel-shared/disk-io.c b/kernel-shared/disk-io.c index 6a3178a84c88..1ef28ba33f28 100644 --- a/kernel-shared/disk-io.c +++ b/kernel-shared/disk-io.c @@ -1513,6 +1513,9 @@ static struct btrfs_fs_info *__open_ctree_fd(int fp, struct open_ctree_args *oca if (flags & OPEN_CTREE_RECOVER_SUPER) ret = btrfs_read_dev_super(fs_devices->latest_bdev, disk_super, sb_bytenr, SBREAD_RECOVER); + else if (flags & OPEN_CTREE_USE_LATEST_BDEV) + ret = btrfs_read_dev_super(fs_devices->latest_bdev, disk_super, + sb_bytenr, sbflags); else ret = btrfs_read_dev_super(fp, disk_super, sb_bytenr, sbflags); diff --git a/kernel-shared/disk-io.h b/kernel-shared/disk-io.h index 424b953e0363..4f9ef633227d 100644 --- a/kernel-shared/disk-io.h +++ b/kernel-shared/disk-io.h @@ -104,6 +104,11 @@ enum btrfs_open_ctree_flags { * specific checks and only do the superficial checks. */ OPEN_CTREE_SKIP_LEAF_ITEM_CHECKS = (1U << 17), + + /* + * Use the superblock of the latest device for the transaction commit. + */ + OPEN_CTREE_USE_LATEST_BDEV = (1U << 18), }; /* From patchwork Mon Aug 14 15:28:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13353050 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 7BF1EC41513 for ; Mon, 14 Aug 2023 15:30:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230410AbjHNPaH (ORCPT ); Mon, 14 Aug 2023 11:30:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232975AbjHNP3n (ORCPT ); Mon, 14 Aug 2023 11:29:43 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63C5E130 for ; Mon, 14 Aug 2023 08:29:42 -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 37ECiecZ024721 for ; Mon, 14 Aug 2023 15:29:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=9pic2CtJryYpk+bt/O0MfSzhrWvyaLWdvm9rN4ajPzQ=; b=qc/e9sa+ccAU+Yc0AM8jC91EKww7EBzHOi7FC6sgwWDbTTqTQYpdntNdmZQf66qayMM/ raX3wI3WprZr3td0zglZTEt1NHsudaPBT1EXpofIlzzIoILTEG//+mFOtesjFyoZZFd1 t4unyUZB8J1oHNcm8je8vQMLLF8WtWFswI+qZAQx8/Pzx+OgaM9p64/MtkeIKxD8TyMF ROSM+MTNb7n/AwGQI0h2nLHCmP1IxeyLB4fGQsC9qwLUXz1kU2SP1wRVw506LPz4B1ye fcEsXV5vbmPeZmE+7M0UvDBtuSUsOb3exH11euWKx4o6BimolzlSBi7AQKvSSjI2gWur VQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3se3142vhw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:29:41 +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 37EF31ca040064 for ; Mon, 14 Aug 2023 15:29:41 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3sey0pt14p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:29:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Sdpe9+lzZMgCon0/C5NkiFaiwRA7ET9veXUPTYG7IeNzTp8HCs8kb088An+MCYEHnIxtH+i6XnAYrS/gVzAxxKeP2cE8aGXOpSv2LuvK29EVA9XH6NfLm9Yh6BD0qYLPR7HoxO/An6sqVrPsJYsxeAYw6mEvG23SEgNoDgCTlQLGEXhlYriwwtVAbAjhjSmhctevcfTnbQ/YRHKuuPAhMPMwsneBHQnF7mhORuyZuCFdei/DqaKz51JV8J4SnUDJYqzEWuK0AtPuIgTWKt8lmxnOQucPcVch2LrMrS5Lth6UkSgPVGWlEvKxUavvrChkVgkbQZ1WAIy6x6MELZN5NA== 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=9pic2CtJryYpk+bt/O0MfSzhrWvyaLWdvm9rN4ajPzQ=; b=kYQaYMfZ6PctPoZT8h6HcY42JI8cWm/4CWYh6Kz9j8vYtLqNhOuQcNFsgE5onZ3ZwPhEHqMY4mqXp6cPeXUzzdlDWZoDixbfI85tL4m8KCLDiouDNppCaIwdYHoziy+1vSvyssnhe2nQV8MUTIvyzbWsmCn9MvUTBy1YvN7OgVghURGGR38T5Uz+IdcVgvbuU/U0Pxuy24PKyONic0v8IKPJMuRsyWh6CVeTQcPpARMTiFgUfd6ow5MpDjkY+m97W49rJvDZL3fPirYcnTLef0bc1z08Gd+3QsNTBISQha5cQ/SuRqhHxfP8qBSf/FvNcgBRVbrga8AJoRiGjdgKMA== 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=9pic2CtJryYpk+bt/O0MfSzhrWvyaLWdvm9rN4ajPzQ=; b=DQ1WTDTwi26bHFj9Y6jQQH8exnrO2somMTbt2qSXY4JiHTPzh6g3VaGOBPsh/RciEFa2nuVOiDAPr8EjdP39cJ/CL0ouZQ65fwdjIj5AmHS+kgLRT7zrQcC2ayXsZ/OcY3grIiKRTG2O0BCt5VxYxnKU+cVzpDeBtFEYXPcDz3Y= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by DS7PR10MB5214.namprd10.prod.outlook.com (2603:10b6:5:3a0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.26; Mon, 14 Aug 2023 15:29:39 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56%4]) with mapi id 15.20.6678.022; Mon, 14 Aug 2023 15:29:39 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 11/16] btrfs-progs: rename fs_devices::list to match the kernel Date: Mon, 14 Aug 2023 23:28:07 +0800 Message-Id: <2d576d56ebafc539c249ebf42c471a65f7b9bb73.1692018849.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SG2PR06CA0225.apcprd06.prod.outlook.com (2603:1096:4:68::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_|DS7PR10MB5214:EE_ X-MS-Office365-Filtering-Correlation-Id: 57cb573f-4ee4-4949-80c7-08db9cdb45f0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fc1VGzTRnDsu2SwvdnwEr/jVmC414blx4NkY4SjHVDbeZCNJQGk/EjgTfb7sAguFAunARBusD/rbmYhKPBDjVMFx7hqOmecc3dD7rHaZlbS/4twr+0xp9QtTmGeJS0R5KDM8p4OukCbE0WYMAm1jGXUrzaq+ATDPTGbVLxZHq3Na7KS/+aDSpkYMwQtLn9iGtOG/+GDOM/sg5JcCRG9gnbYg1Nc+EN3EdMANGHIhm58xbV8LlsrNJp8GCFqfm+kcCtCyLfynCnKWz/EiIvDekEQ/Krvq0CzbEvbxDSAfi5EHXZFXHaegihZxiWrJe8uFhfwiUKWvoiQ9SZDbZdSqACef6YsDZjZvtgfMLendGSdXcbGJ3AmUYN5N4+yrFKj0dK+Tg94vCCNigBD7APPRMNT7n1AdcC0GGQBVuztNxRJW8HzHgrBM928ZpEIDIU00ZkWhqr0j9QjsCPWr0uZ1X6U1t6xwDzQClXQhOqsrxVfs+nRlMM/di8FPg8rV8R0FFKfVLCz//+mMEfpTCP1ELxMX4O0H/2CoK4GfGz1oK82WdmmUkJGvIY6ZEt1zMVbj 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)(366004)(396003)(136003)(376002)(346002)(39860400002)(451199021)(1800799006)(186006)(38100700002)(6486002)(6666004)(478600001)(5660300002)(2906002)(36756003)(86362001)(44832011)(6916009)(66476007)(66556008)(66946007)(41300700001)(8936002)(8676002)(316002)(6506007)(26005)(83380400001)(2616005)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 26BcyGYVZgBSWHl78vesMEjurYj/e2fEv15YFcDKF3sPl+ffT3/f/6pF6SmJfFbRQGJRR2llRPckSJb6DD5EQvIIaOjC5ReYAXvIdyfzKtnYeGgZopIx3aZclEbHOGMfia1Ks33AlASGx0Sa2aP6E3WEH2Ko9wilt2zxi17N3aAOtD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Wo2wgyIfXh7Vvqmuy+q4HHRX4z+motV+mmfDJy2C5itnQLLIYlCW9rCtcCQVuli8df5kpC6erj1oJ7XU5uNSK9J89NTA6nMshojOhBIzBXkeFbB90KObZ0RCZoKccFwtC91HKSGaqqNoIzZEkUIdUEFD9GXCQhwu2VXzy3DPa6yKm/6lwVXImWgYvLBtRuOpxqROv+5ngHdPKQAdLMJovrpu8EsdUzwoCprqmrYhjB9ubW4BdY1O2GhpWqtOUHDUDyMDtEH01SxPvs+yICxwTIjyNQyAF33zxloOWMeoA2xGVwLHRw/imRDvRqsY5GSbFjg6Rcv0lMfjCXkzu9dQk1JfNU+QBbuWqkuWbZ0KQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 1bnD2sd4OIg0mLV2tJgBlSy1OnOXlZ6tax4KOZLcrz+5V7uC3xLW4PoGvyWtEWbhBXkFXH7b272tYPXDYl6kt1RrIB714hmArzgYgOqkhEw3m/V38tFWSBd9uywOcxfDATEYCXRDsm2+/S1tWZve5lMHeXSUpmnizWEwuNr5pTNvsdQVc2fqrTD5OlqIl4qqCRyKJfzNqVf4ld2PAd8BMoW3bKa5vpjtIxCycTo/ajP2634CznYecUbrMlLfOGrh4+uX27dsCLoUgon69cZITo9AjWFki9NIfiJtjID8jy3tH1yHoyPYa3STymFmzDX3od8qCdSgNXjqaDxo6Nj5ufy8wmUpvcHHtzNBpLDi28pPiImiOhye3ACtBEWume48en7OqGM4B6Mis+30iUopAGqQnyxtaQZi/7xDjrguM03wAyW7NH346VBkEmFq17cmjkjLbh1K+2tj9fYABDsU8k8wz7PfaI3tANORi/MDsHCXml10JudLNrNJq+iTn2tn/7nI7AL6xH4J9zfjLeIXR6UGb+y4zNnu2E2UT3R7z8t/9p6RyQ+NVnKOD6WvLZocMt0NHlXBWinzFDARq4tpYiWtAv+m3UDrNgHI8vzmnd2qqCAZPObh7MGMk+qL/hCrQZaG4QXu3bUYiPfBysiHnu1xzMcpmiUadWzBBzakneNWihlEykHIasfjRBL2oPdP10oJ3ROIP9UEb6Vs+WjB07St5vZ42VG2NGO9E2rnWlWCgQMS8LXFmSBHe5oAGXSX6lwU7Rqz7H12d871JY1Opg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 57cb573f-4ee4-4949-80c7-08db9cdb45f0 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2023 15:29:39.1795 (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: PgmzRYZfHzR0p5xyeaeaLXpKh7wzqMh6hWnKGTdtxNmnHXauFH+2UuqpIKZut4luoFGR60v12XvhQJXjvuwi6Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5214 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-14_12,2023-08-10_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 phishscore=0 mlxscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308140144 X-Proofpoint-GUID: bA8yFJ2Rura3Y3ngW11ri-2-BV0VxfNN X-Proofpoint-ORIG-GUID: bA8yFJ2Rura3Y3ngW11ri-2-BV0VxfNN Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Aligning with the kernel's struct btrfs_fs_devices:fs_list, rename btrfs_fs_devices::list to btrfs_fs_devices::fs_list. Signed-off-by: Anand Jain --- cmds/filesystem.c | 14 +++++++------- common/device-scan.c | 2 +- kernel-shared/volumes.c | 12 ++++++------ kernel-shared/volumes.h | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/cmds/filesystem.c b/cmds/filesystem.c index 79f3e799250a..7dad5f6a0d25 100644 --- a/cmds/filesystem.c +++ b/cmds/filesystem.c @@ -485,7 +485,7 @@ static void free_fs_devices(struct btrfs_fs_devices *fs_devices) cur_seed = next_seed; } - list_del(&fs_devices->list); + list_del(&fs_devices->fs_list); free(fs_devices); } @@ -555,7 +555,7 @@ static int find_and_copy_seed(struct btrfs_fs_devices *seed, struct list_head *fs_uuids) { struct btrfs_fs_devices *cur_fs; - list_for_each_entry(cur_fs, fs_uuids, list) + list_for_each_entry(cur_fs, fs_uuids, fs_list) if (!memcmp(seed->fsid, cur_fs->fsid, BTRFS_FSID_SIZE)) return copy_fs_devices(copy, cur_fs); @@ -591,7 +591,7 @@ static int search_umounted_fs_uuids(struct list_head *all_uuids, * The fs_uuids list is global, and open_ctree_* will * modify it, make a private copy here */ - list_for_each_entry(cur_fs, fs_uuids, list) { + list_for_each_entry(cur_fs, fs_uuids, fs_list) { /* don't bother handle all fs, if search target specified */ if (search) { if (uuid_search(cur_fs, search) == 0) @@ -616,7 +616,7 @@ static int search_umounted_fs_uuids(struct list_head *all_uuids, goto out; } - list_add(&fs_copy->list, all_uuids); + list_add(&fs_copy->fs_list, all_uuids); } out: @@ -635,7 +635,7 @@ static int map_seed_devices(struct list_head *all_uuids) fs_uuids = btrfs_scanned_uuids(); - list_for_each_entry(cur_fs, all_uuids, list) { + list_for_each_entry(cur_fs, all_uuids, fs_list) { struct open_ctree_args oca = { 0 }; device = list_first_entry(&cur_fs->devices, @@ -837,7 +837,7 @@ devs_only: goto out; } - list_for_each_entry(fs_devices, &all_uuids, list) + list_for_each_entry(fs_devices, &all_uuids, fs_list) print_one_uuid(fs_devices, unit_mode); if (search && !found) { @@ -846,7 +846,7 @@ devs_only: } while (!list_empty(&all_uuids)) { fs_devices = list_entry(all_uuids.next, - struct btrfs_fs_devices, list); + struct btrfs_fs_devices, fs_list); free_fs_devices(fs_devices); } out: diff --git a/common/device-scan.c b/common/device-scan.c index a140634f5d88..d61018a86f5c 100644 --- a/common/device-scan.c +++ b/common/device-scan.c @@ -257,7 +257,7 @@ int btrfs_register_all_devices(void) all_uuids = btrfs_scanned_uuids(); - list_for_each_entry(fs_devices, all_uuids, list) { + list_for_each_entry(fs_devices, all_uuids, fs_list) { list_for_each_entry(device, &fs_devices->devices, dev_list) { if (*device->name) err = btrfs_register_one_device(device->name); diff --git a/kernel-shared/volumes.c b/kernel-shared/volumes.c index 3ca7a5a62da8..0a3b295930f0 100644 --- a/kernel-shared/volumes.c +++ b/kernel-shared/volumes.c @@ -319,7 +319,7 @@ static struct btrfs_fs_devices *find_fsid(u8 *fsid, u8 *metadata_uuid) { struct btrfs_fs_devices *fs_devices; - list_for_each_entry(fs_devices, &fs_uuids, list) { + list_for_each_entry(fs_devices, &fs_uuids, fs_list) { if (metadata_uuid && (memcmp(fsid, fs_devices->fsid, BTRFS_FSID_SIZE) == 0) && (memcmp(metadata_uuid, fs_devices->metadata_uuid, @@ -357,7 +357,7 @@ static int device_list_add(const char *path, if (!fs_devices) return -ENOMEM; INIT_LIST_HEAD(&fs_devices->devices); - list_add(&fs_devices->list, &fs_uuids); + list_add(&fs_devices->fs_list, &fs_uuids); memcpy(fs_devices->fsid, disk_super->fsid, BTRFS_FSID_SIZE); if (metadata_uuid) memcpy(fs_devices->metadata_uuid, @@ -489,11 +489,11 @@ again: orig = fs_devices; fs_devices = seed_devices; - list_del(&orig->list); + list_del(&orig->fs_list); free(orig); goto again; } else { - list_del(&fs_devices->list); + list_del(&fs_devices->fs_list); free(fs_devices); } @@ -506,7 +506,7 @@ void btrfs_close_all_devices(void) while (!list_empty(&fs_uuids)) { fs_devices = list_entry(fs_uuids.next, struct btrfs_fs_devices, - list); + fs_list); btrfs_close_devices(fs_devices); } } @@ -2227,7 +2227,7 @@ static int open_seed_devices(struct btrfs_fs_info *fs_info, u8 *fsid) goto out; } INIT_LIST_HEAD(&fs_devices->devices); - list_add(&fs_devices->list, &fs_uuids); + list_add(&fs_devices->fs_list, &fs_uuids); memcpy(fs_devices->fsid, fsid, BTRFS_FSID_SIZE); } diff --git a/kernel-shared/volumes.h b/kernel-shared/volumes.h index 23559b43e749..2bf7b9d78b39 100644 --- a/kernel-shared/volumes.h +++ b/kernel-shared/volumes.h @@ -96,7 +96,7 @@ struct btrfs_fs_devices { int latest_bdev; int lowest_bdev; struct list_head devices; - struct list_head list; + struct list_head fs_list; struct btrfs_fs_devices *seed; From patchwork Mon Aug 14 15:28:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13353049 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 90CDAC04A94 for ; Mon, 14 Aug 2023 15:30:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232972AbjHNPaI (ORCPT ); Mon, 14 Aug 2023 11:30:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233052AbjHNP3u (ORCPT ); Mon, 14 Aug 2023 11:29:50 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D38C10DD for ; Mon, 14 Aug 2023 08:29:49 -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 37ECiTRY016429 for ; Mon, 14 Aug 2023 15:29:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=34o3ieDKQse30AQdGJtOAmaIV5a2D5SQYGVVVYdvSNc=; b=SIaCCtG/WGjNT1ba/iPLK1A4IUVbQmY4x+X2pSyXJDbFBlM4ga7+oDTfusv7gQidbnRL iqvEvLpe4tPTEbsHJQSLDZTrfK+gpPfT/jejmJQr48RWNJLn0oegF0YH1a6hF8En0lGK DYvlGo+6ip6yeeLO0c9UINs9CoTpOdgT2XxecskFkQAbJGzLFmXlni/5+vPH0Mc5ruS9 gNCawJV3GFBnDOcj9GiJz+IDI7sYVuxibaz7/hPMPQ2xwOnlrBVHrerZXUT+x3AsJN7l yILIA/v2YQRJK5rtldkyt+9BBnLPBF7V/CFSClu5FDNdmFN5GXS4ddfw+pWAiFzCHAxD Og== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3se2w5tutx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:29:48 +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 37EF4WFe027461 for ; Mon, 14 Aug 2023 15:29:48 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2170.outbound.protection.outlook.com [104.47.55.170]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3sey1r1vjn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:29:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Dshf6gIfbvLR2XKP37rAkfFnPWHSSsFZuEerJTNMRPktrOJMOIILHaGiiMPjhjBpJT+44k0IXZWdXhAG1abjJw72rl5FlewKFdsaK+IXl1bUbJIJS9qZonZgK1b8WKbHLzisVhhCzwFrPMNqOiVS4eEFIsUhk9oOIl1/cd+9QWT4qGxH7o5FxTjYnp4MLBjkx4ncUHi9+XRQeIJr+IV1Axzsn4aGRJLB9BzUGbmhfiFCYfdDQluaeyRwuswZyxhFS3zqfFEgZH50cNvpqXB9Fcfiknmri1hWu5k6cDugspUdrYF7rGFvBcUtXHTMBPbFI94jpZ+ahdV1/BriKo6sNQ== 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=34o3ieDKQse30AQdGJtOAmaIV5a2D5SQYGVVVYdvSNc=; b=FArC+f/MUBEMDGvbTwzXSomwFoRRieil8l+UsKP6+z6/hCNpg5+prcmuWcCtb4b+Qkps7Kr+/Ezy8u/zxuMdF/BB7wKTokrnOaQUA8CdBED+M8PxWzBaZn266G35G91X8ViwaT36L0hgYOiT8YDnZVHIg5Sv18HYsrEOvQxGqpSQnN1aAl6px5+amWDMjROuSlFir4wsxVqXkCAz6zZsDycxWG6l/q2u1KFUYqEGAf89FWylQFJQuV7eS5g7qHbg2RNxO1v2WGOL0AWQ+2J2YMmx4IUr9ufBv28tygBbht1l9kuoarui8yy5u4jSjib4/ElQklC082U6+m/ueT6RAQ== 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=34o3ieDKQse30AQdGJtOAmaIV5a2D5SQYGVVVYdvSNc=; b=hklKt+gC0BJrJ/SPs9ccvjrLkSKG8P/XzvKg0pX5+KLL+TbYSGHgGUYmP1XCVJFYnQDriK2tX2Huzqd8Fo3GpXSSirNm/Hh1hZjclof0A9NJOQScC93oMGlIbdKU488exKqapa2QA+arSb1x2HKTJLBnw9LZAx2G7Fuzu++jbrs= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by DS7PR10MB5214.namprd10.prod.outlook.com (2603:10b6:5:3a0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.26; Mon, 14 Aug 2023 15:29:46 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56%4]) with mapi id 15.20.6678.022; Mon, 14 Aug 2023 15:29:46 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 12/16] btrfs-progs: rename fs_devices::latest_trans to match the kernel Date: Mon, 14 Aug 2023 23:28:08 +0800 Message-Id: <56c3acf6c529847f7c1ef2efaeebd5040f341747.1692018849.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2P153CA0017.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::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_|DS7PR10MB5214:EE_ X-MS-Office365-Filtering-Correlation-Id: bdfd13bb-bc5c-4a9b-450e-08db9cdb49f6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nf2huJ7FdR0gst3OtYmcaC0FZZ1sEHBDj9sHFuWSM1/D+/GfMC2boG7/liB/nnCzExYKbc7ukZuVVxXWP0sq6oRneXWL6URm3XN5YnmdJr4uXjrK9HqVLScfkbIX2bpRG/7fkFn5QSg58KppgCLfkYgL/Y8Q1vsd18ps74k27T+LJ1Yg6Ihyq5D9ddVW7A4yTZx6Ibs0+yqNJde8Gxt/PqHkFc8z9U+A0gpBqv9dccdK3t4xH8p0JIx0hWUM/VKJ2oePpsF7K47kt25LCpOnmYxOm9WIiutZ3ojXhpzwg0zHAHxT9u6ZtB52BlOMPHzkBFnnzzWSX+7RC3O4vktEtPjIXEl/R5rUOQoIYVtOUUCAdCP2MyPKyHVXB+J9SHNJrMhl4FHGIGDI7wFgtLU5IKEo7VbdKpOj52tElCLm3bGCl0aSwy6RaTgjGxUXm1A0e9384niVaeO+OsKW+Mfhu+yyJxj2Fw4fzaoM3tEzPcza814j/4eAcZbXXPQjcw/3KcHIZtdGyU2/lXlP0N4IzkbbgJqnJaJMc79HzaDKRvhqUZpZiJ6VKEQl6OY7AdlM 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)(366004)(396003)(136003)(376002)(346002)(39860400002)(451199021)(1800799006)(186006)(38100700002)(6486002)(6666004)(478600001)(5660300002)(2906002)(36756003)(86362001)(44832011)(6916009)(66476007)(66556008)(66946007)(41300700001)(8936002)(8676002)(316002)(6506007)(26005)(83380400001)(2616005)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8MbnNWWl6Ie/Rni4zzaUQP+GPl6Wevy/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ejYKlGaM/OD9Cis+KzykGBYyMepFyG0vdlVXQAsfxkgqcsy2tACZ+1Jc8rRkc1/0dizOrKdXm0Z4LCVUyuwKJDglZ0wbC8dZncUnjNcMDG4IRjYnogpDjDpNvcltiBlCnyld693l3Z+MnTzZqs8oJO6M81OZHsbkiAKi8/2jlmYY5hoOnS0Ykaym7YaNSoeZVENjYoTC3rD0y6z/Go3r3ZP/DBuUCQBom2hJcc9UKTX24NPIaPolszs10LgRxC2rHr8595rt1Wq8srVRX1FoxL+vr5B4BQolKg2RXnfZu9TaFBEH6cDA/eC0Mld8aw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: bdfd13bb-bc5c-4a9b-450e-08db9cdb49f6 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2023 15:29:45.9097 (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: KfHuUl3pOPZf2dCmxWDahfFxOSwZB/K3xp5ZKFLgZnUwTOP8XbuuHKyEddzKp+Xa7gpH45ogl6DV1U0Y7gCecg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5214 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-14_12,2023-08-10_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 mlxscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308140144 X-Proofpoint-ORIG-GUID: ugRxz4idLN07yeuTAVE4uvOxc88cpVez X-Proofpoint-GUID: ugRxz4idLN07yeuTAVE4uvOxc88cpVez Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Aligning progs's struct btrfs_fs_devices with the kernel rename btrfs_fs_devices::latest_trans to btrfs_fs_devices::latest_generation. Signed-off-by: Anand Jain --- kernel-shared/volumes.c | 6 +++--- kernel-shared/volumes.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel-shared/volumes.c b/kernel-shared/volumes.c index 0a3b295930f0..ad006b9de315 100644 --- a/kernel-shared/volumes.c +++ b/kernel-shared/volumes.c @@ -368,7 +368,7 @@ static int device_list_add(const char *path, fs_devices->latest_devid = devid; /* Below we would set this to found_transid */ - fs_devices->latest_trans = 0; + fs_devices->latest_generation = 0; fs_devices->lowest_devid = (u64)-1; fs_devices->chunk_alloc_policy = BTRFS_CHUNK_ALLOC_REGULAR; device = NULL; @@ -438,9 +438,9 @@ static int device_list_add(const char *path, if (metadata_uuid) fs_devices->active_metadata_uuid = true; - if (found_transid > fs_devices->latest_trans) { + if (found_transid > fs_devices->latest_generation) { fs_devices->latest_devid = devid; - fs_devices->latest_trans = found_transid; + fs_devices->latest_generation = found_transid; fs_devices->total_devices = device->total_devs; } if (fs_devices->lowest_devid > devid) { diff --git a/kernel-shared/volumes.h b/kernel-shared/volumes.h index 2bf7b9d78b39..7f571bddee87 100644 --- a/kernel-shared/volumes.h +++ b/kernel-shared/volumes.h @@ -85,7 +85,7 @@ struct btrfs_fs_devices { /* the device with this id has the most recent copy of the super */ u64 latest_devid; - u64 latest_trans; + u64 latest_generation; u64 lowest_devid; u64 num_devices; From patchwork Mon Aug 14 15:28:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13353051 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 BBDD8C04FDF for ; Mon, 14 Aug 2023 15:30:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232982AbjHNPaJ (ORCPT ); Mon, 14 Aug 2023 11:30:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232960AbjHNP37 (ORCPT ); Mon, 14 Aug 2023 11:29:59 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D094110D0 for ; Mon, 14 Aug 2023 08:29:57 -0700 (PDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37ECiUmE017544 for ; Mon, 14 Aug 2023 15:29:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=3X4kVVRFRlrCshuo5UOVeuHXZoihQi5k7EjEcbS6AnI=; b=UUEVayLdaK6kAVSw4Cs+Ze+RKd64Qcm8S5ZUG/y3RUm3RqElCNiW1eJ1J9+kuvBu9hGd 6jOWxnWJSzWNggKIaLHQtV+S4pjTzScuUPp2+QZdVzctXRuFjN7NIXAuLmHRSCvfWTfs Af5VGM8gx3hIOtZ0DP3eGrlNnn9LjLELQuutXaFvnimUfrX60PsIsXGR3cPzrVkB4xn8 awL/i8+DpmZN68F4fYhSePep5JKkznljRR0blwIoKETTUjRvgUBsKIE6icdO+1tbt0EV e5i5U7j3tKqjPAmGSxfKA+fO1dF8mjM++NwQvvi7GH8xnI4Lj+9PtX2dFBRlqVmTh+iT SA== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3se61c2sfe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:29:56 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 37EFAUBa005498 for ; Mon, 14 Aug 2023 15:29:56 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam04lp2174.outbound.protection.outlook.com [104.47.73.174]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3sey2c1tm6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:29:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YQIDYHK5ph5Oz6CBxk/seVslvUuLrCnOxTspE5gQD8j9Pb8bToE934BIF9uuScl04blFZMUKv+O3ipgMvfrR34jjFOPFr8p7AW2lKQrt6qdxST4TbAqbW9myyWyhL4Vunx0e3YJTsrfkXxpHzXzbzAzS4AT/zh0R3cvl794FbEmW2KDF2MRDdcvbCfAQPaj1aRvpijEVXTewXPMNa2k5ppsqAk022fUANNk3jkQp2gB2B1Il8yyLU1hfioX/I4o3Lv/V6LdC09A44V+yqno9pavJRdnJ1QwotptnjuxE5oMeRjsyRGGn9pRl0mMqrhfmG7BkWiGMOtHIXWtyO0ye/g== 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=3X4kVVRFRlrCshuo5UOVeuHXZoihQi5k7EjEcbS6AnI=; b=gZvkhVjnAgZTb5uDsoiIC3XnWVGJ96NZ9ApkDodLMA9xyZHFCMCRE1bT68nuXJ/bVO3o8WULa8WeeLltjY4nd9Pf4G9tnS76w25R2kP4qhLupKchp3yJ45K7p7M92uNaZ11k0L9RZiE4waSAzX2i0VWYkff/4BlGg5kpYzv2sEB3keQDQWsxekzoEOwSYb085FDooxbYAiduSJAowz5+m8cstCAfdZAnuGp1eEZEScmaNEGjfNIScw1CpZDQJBvAS0kyWgtwax+dy6b+NEbNxhIgiNxmlJYH8NlJb8Fz59JplJOHsPYcKWunexd8ZLBs+eqU85dFQ9+YSX0h7usx7A== 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=3X4kVVRFRlrCshuo5UOVeuHXZoihQi5k7EjEcbS6AnI=; b=haRulPdidwNpIROOu8QYI8rQYyfTx61pZPniZeLOnHQqum01qF3275TbyS1thzWsHCDjNqyN/R8KXoNbW2iT2PhHNsFSLRAqUivUDoEJiusvfXRKtm0u4pLTMmYEK8j05C0klt+8Kiq85zInSqwQz+AQ8Gs7MhOI9ULmz6ywKI4= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SA1PR10MB6342.namprd10.prod.outlook.com (2603:10b6:806:255::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.24; Mon, 14 Aug 2023 15:29:54 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56%4]) with mapi id 15.20.6678.022; Mon, 14 Aug 2023 15:29:54 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 13/16] btrfs-progs: tune use the latest bdev in fs_devices for super_copy Date: Mon, 14 Aug 2023 23:28:09 +0800 Message-Id: <909e4475e288ce2a559d4cd7bf5a9d84206c3f36.1692018849.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SG2PR02CA0020.apcprd02.prod.outlook.com (2603:1096:3:17::32) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|SA1PR10MB6342:EE_ X-MS-Office365-Filtering-Correlation-Id: 1d7053c7-ef2c-4cd3-cabb-08db9cdb4eec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4KwFaLc0Hy32lxJ7SzxEMKxBgCljETIjWu1METBq9qOkLqf53rh39+gG5yUu8CJj1631qsIAQwGyv7p4WP98gaZAl09iQwrpHwkuF0jy0ZLtX7UlCjciP83ArH3R3t8sXN7cLs+gRU3Yut41pQo0PQ3grq1OXMQFWfp8ocs9Jz4y40RG8/29ZhzGjGCTQ7tIK+3E1y2S7evZ9vYSrcxKQisX8bTonbBc4+6vUPQxPkL3dYhVQzHuCVcxS16oh6zrvj77zfo1yL6x2DQ24RZThRIXebx5ajh8JBDSa96ANaHNht6/Y6txGWd4EzPQSULBb0c3ZzbX8DOUcyRQ4YR7RTPFB58VcgB/gZg313ruY9PSb99eNMiGQ3Q/181lmNVKWr85njetF8zEbMJKy7k7eff1ICJKZlDhhoIHJ8W6RecBi4yB+NFekrkSHWUdXrjSJEpHyuL+qlFJhI3GhfvEe/FkhRMosF92SOV0CG+gY3vxKj3MwhKHT/U4QfQcnuOuj7x0o1KVv7G6K4ppgNcz791MUTdRKriw+rwOZrJWW+T7sXlmhQRX5aCa9AFAfEvY 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)(366004)(396003)(376002)(346002)(39860400002)(136003)(186006)(451199021)(1800799006)(8936002)(6512007)(86362001)(478600001)(6506007)(6486002)(316002)(8676002)(66946007)(41300700001)(66556008)(6666004)(66476007)(6916009)(5660300002)(44832011)(26005)(2616005)(36756003)(4744005)(83380400001)(2906002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: q0slAULS0GPprdhl2Evv/4ElXBTbYQyO3YxH866lwpxg3rFZ5E6N7jzohBGJCCigVBKjS7DlJKQR9DQCrtwcOUUyFyDK9MaIH85NiSvnGsoIY3Vtfw8gmAkX3GALfoMRjVD5jOXyI+/SrMkfTIXQLCkqtckJJ4Zr43NhBZ33ABMuKpagU/mErAmW3m+oSlkmUnYqx1N4W2jKUhbtK7aSHmkRdmknBfd8W3e4gfiyVi8fNx2oiNk9Ni9cPanNd+1oGfK60JDCsMYiamFaPfDswjKJvyCWFD7HpQvIeuuA8GS19D6H7lFlQcc1yO6GXfa9CYnTaAOHEjNc6blm7yoe3SvX0F3nDo58bRVebNm+DVSSI8sYsQh65NraVRU4FN3pxyYZ7fekrJNt5bOdMDIZfiUZFHTgxUsuoRMCKmRhlTusm6yf+6e2L5qSH92W+KK2Ne5TerzPfOe4R6LXGskM4PtjtGt2TaWco2eO0B8Y6vVCO1ai0oSMHGIu0FtR6fMttXI7+L7lymYyzrlWTlyvQeLtNNa1XarOmJ/SYICyDOn4ghpgbAqVf2D0cNeuZNI5F0c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ageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: qfKYKbzsAWIxG7DxUvXVqVQ0OPIyAdFlXyZGqlrE/0gB7PVDnTrIDDJ2U3PDjB72A9xeaEY8Gcr01W+INGuPJMLN68sh86KdtXot2QJiH6F9POVBwzGA6mehegDR0t6nlhp+aD6jp+dHtamBCBM2XhG6SRLWZKagualnmkQUaKrxEpGsHR8YHVZ0OWx2OJawo0zL44llJ6xr/ofI625whTuvbUcFTPjDVe9zuuhY7eiwWotOhaDPa80WbSvI44+UOr7S7k//lVfa9mUPdaHxGFZd5UowGOeFdedf5/EJ94d7L05V129DGK6XqkQ0f/2N6XXxSmIzfJPEjoFhqhTciWQ7IaUxo6uklugqQwWVA01GypQMaVF2QdDrg9FJcwTnFPneporW3nb1iAxkfBGSVminoefym3JIDpISUPBJMuINwkKc+ZaU4iFybmI68U9xFJ3kZM/8BCu3ZUOk8HbaEW+wuqJhUTIMBKeMjdaNY5anCJyX9v+KSBo3XDZWtzWqmq030x5qvgHhxS3YhzHBq6GJoCF33241/CudLliEkPUvHAO5pkUonnU+od3kML7WAkYBAthKF9sCbEmdG/887GyjZ8D8IRJw824RsqnW1tNNTbblj+dbG+iLncEc+y0lIyQ1X6PxLK5oRW15mdQgUj5gBkVJ+nJ5S4tTHORs8QCmNKuF9gjLYg2TX9Cg21v6wpOxZE6zGFXGlKHKrdNorO8y74bNtE86xio+LxzGMGkUQZWU+woTxsCMsQDSULFxV0SqLfi91tzqLJQ1h823yw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d7053c7-ef2c-4cd3-cabb-08db9cdb4eec X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2023 15:29:54.0920 (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: zCtuj1p+a6haXMwhquOyGEvo5wPVYDxDix395jaY0ZSVfEXrnvuBdTMqTd0YsY32c036AJHg/8LesMtlSR4RYQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR10MB6342 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-14_12,2023-08-10_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 mlxlogscore=914 bulkscore=0 adultscore=0 spamscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308140144 X-Proofpoint-GUID: 51ZkpmXZkA7RNb1SI54N3vDGAhhIOtAX X-Proofpoint-ORIG-GUID: 51ZkpmXZkA7RNb1SI54N3vDGAhhIOtAX Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org btrfstune relies on the superblock of the device specified in the btrfstune argument for fs_info::super_copy. Instead, should use fs_devices::latest_bdev. To support for reuniting devices following past failures of btrfstune -m|M|u|U as in the following patch, use fs_devices::latest_bdev. btrfs-progs: add support to fix superblock with CHANGING_FSID_V2 flag btrfs-progs: recover from the failed btrfstune -m|M Signed-off-by: Anand Jain --- tune/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tune/main.c b/tune/main.c index e3b199c10dad..e47047450b24 100644 --- a/tune/main.c +++ b/tune/main.c @@ -290,6 +290,9 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[]) goto free_out; } + if (change_metadata_uuid || random_fsid || new_fsid_str) + ctree_flags |= OPEN_CTREE_USE_LATEST_BDEV; + root = open_ctree_fd(fd, device, 0, ctree_flags); if (!root) { From patchwork Mon Aug 14 15:28:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13353053 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 3DD9FC001DB for ; Mon, 14 Aug 2023 15:31:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230129AbjHNPak (ORCPT ); Mon, 14 Aug 2023 11:30:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232965AbjHNPaI (ORCPT ); Mon, 14 Aug 2023 11:30:08 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D14BB10DD for ; Mon, 14 Aug 2023 08:30: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 37ECiR23016385 for ; Mon, 14 Aug 2023 15:30:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=S3VZhSxYvFbH1ZOSZVmQS00gs7M7MXRwoQaZ4BNoqoM=; b=GlODWw5JF8Ly3A7lGvGGobZo/8533vXFxmXvK/IMc1gGn9IWyytTUdAO2hvplnjKm/uj dK/wf+yKB9SwZT/s+aHhgkuWyPR1PyH0zUUjFDyp+gUvI7803bNYt87Cdkhf5zFP4DlI qayf7AJzMMzIre4vrPAC1NH9GsDsfbdtZYyyatykJHcdrtt4NI2Cca+T88JWmCkFAZ4y 8S30YMSM6sYwEPSYvFYFCnlhEDRdXbj85w6xenuywtpPH5HqHI9LeaSrw6fkmakD6E5Y TOulzFUZNLg6io59Z98BSrcP/VKu6LRfGXQ1aoUTh/f/6DIhx+WQmLRdlu63pwLNFf9P 5Q== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3se2w5tuuu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:30:03 +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 37EF7Xnd038962 for ; Mon, 14 Aug 2023 15:30:02 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam04lp2173.outbound.protection.outlook.com [104.47.73.173]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3sey6y1s54-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:30:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GESZnLXkH5+wPlS8iWsMn+ueei0zz3A861/O/I1zsovgMJU7AE6imutlCeY+iIV+aByQDVKnE0JcJyCWTqeMtgrh0+b+/HThUuRt8FRpjQmjR7AgzYb+LAHmedqP8Q+4Tunm8Wu3ES6+kr9dhBWpPIB7I1nVFmNMc3CHzfiw4dGubihC1HuNLCtM1N8LYwmTrF+jbSQGHBdNTV71ScmRGTbHNQ8NM118G75ChuuwSbadwj2iVwU316FJUgqBYWjkESHAGjE/8QsOt/YiYQUmL1qWOdrema1V71ojzDfrhwCJ/fmQIaikxUre3dLhNj0V8bHhU/narOh0fwEyQcWDeg== 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=S3VZhSxYvFbH1ZOSZVmQS00gs7M7MXRwoQaZ4BNoqoM=; b=jK9ve3l9W92ARScpJQjYIMNVFePjpVQYVkbb7lv6XYbuYcV8xRvW7wW1y/LgPIeXAA4hAzmNU2qJv9TuqSgF6VUZCPTBA/RvzlnHU+wQXCvghHKTjRmkUsSDcgMKHGf6MszxZz1dOUUhQAGNJuPq291NZh0XVCTMSfQRtWKAU4PWtVcNKWHImTmvX+6DPdN2lovIgo1zRbinaJ2hibbZqXPfH6isY6dZvtVAb78P1R/LnhTNmUYqdcmYSc6k2+wm8bX5Wntoiv1NRy43VR5Uhody9EyiNRJ1Lq14kxiICVBF0t6m0mnTG+CJgDtFHJIG0YnSLHvEdUq6GXtd5z59IA== 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=S3VZhSxYvFbH1ZOSZVmQS00gs7M7MXRwoQaZ4BNoqoM=; b=SoCYTUulHnvG7BwEGPo6KYGYSv47o127/TFr7Gs/RMqiD3nAVBqeawM8OZ+lboS16n1kD2xiCdrFFkS/L0CUmZxH0Wb0DVMDhsAwThK/bkOnnfmcIUGB2uKib0d5DM3BpHb3WHaEdDd90DeJQeauGOuivckrapIkyC/oJd1I9Y0= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SA1PR10MB6342.namprd10.prod.outlook.com (2603:10b6:806:255::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.24; Mon, 14 Aug 2023 15:30:00 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56%4]) with mapi id 15.20.6678.022; Mon, 14 Aug 2023 15:30:00 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 14/16] btrfs-progs: add support to fix superblock with CHANGING_FSID_V2 flag Date: Mon, 14 Aug 2023 23:28:10 +0800 Message-Id: <14877be7a8208ca54419de27e02e741401cdd863.1692018849.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0004.apcprd02.prod.outlook.com (2603:1096:4:1f7::12) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|SA1PR10MB6342:EE_ X-MS-Office365-Filtering-Correlation-Id: 825b8c5b-fd4e-4ee7-32b4-08db9cdb52b2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZrirHwyONKRKJj6ZkFVo1rxlxjIIR5jO8HlWjnHyX+Zv6UCb0jhP3Z57GdvSzcGrBZtWrX1IpoaT0T5bY5pVgNzrw2EApXaZuMV6RVO+Rm+jEwJ/eOUukbqhwTowz/mTnnHN5Ci2IQVzOoZ3LFfNPVXQDctkjYU4ZVa81AcWQw7TUG5xxoIMrO9QmN00y12861mNtSbRvyKjW/Eyy1eC2EtyfrY9Jj39SU2amWxl1DLBS/CIL5naHvBGUn0P9t/afBXK/mmBbhTBHcj+fbyezXYyYxmza0HQgMi2J78wzvvtKkBLVzOOSC0ilzyAR2UQWg5tky30nmCHrXuEU7qq48ovhdxdsP6l32omdEttRIBmw/8jNNqICa6QwLJ4I0AVWkUQRaK9ItC81KkU5xshadEwmP4cI3RV46J5e3GLsFd+nIvvMZP/EycJ8Lu3x+zFreAxalu68TvL2CDHybHk6y4xCpaYBRITeijQbjbNJAFw2gvc5j/SGt/miv0jKCXTk1lsD/pCWM02osCGTbW47Yp5ibLWtIt/9h/F0Jrqt+idJQoeoR6itZkN0sIwl/XD 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)(366004)(396003)(376002)(346002)(39860400002)(136003)(186006)(451199021)(1800799006)(8936002)(6512007)(86362001)(478600001)(6506007)(6486002)(316002)(8676002)(66946007)(41300700001)(66556008)(6666004)(66476007)(6916009)(5660300002)(44832011)(26005)(2616005)(36756003)(83380400001)(2906002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NOgFmbWztEy4ok1OSqJOHFdcHOGo98GBNXutFGSvvS/c6slBKERqrPkXbFK4Iq3C7YoWl2wLpNRfCqSZW6cHZ7u+asJS86LI/DFyFwwS7qlAMmCERmZ9uu1AnoNLbxCCkE9Awdn2hjtxmCiLxvdv1gFwb6boWiKIx0P87zDs6NaMIk286WZ+vhhpYuUxfpmte9ykidDrCrummDt+FEfEz61oskvD1kA9aefHq+SEUCW80LHSuHV6fBJZQhThJLziNjhOXkgLazykqGEHG8Sc/M2Aso9x/wUen4Ax0aObEiYpc7bhJZdmrLh1ChZc/VwExE65jswGEGvS93bkZQi7inzn1mMhojnW2VMIG8SjXv10wHsIdnNaEj91g8P9kxiq+B771JjMOlsm1DrAMc67YnTfxjf3Kb8R523yUh8gdIEIPLvpioUtuvvlKKz+G96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KJROYzDGjQPUAflLBbF9sqxHcbuWEaW6N9Lk6DXui5BLE743kXYQ06/Fv4uxIQlQAIIRdoQ+bvD5/g== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 4+r7PYHEVYJL603mYUeLKmeoncLv38ERcoovODM9u3VTz9oXC53gpW+/wKIU3RcxLWhPCX+2sEE3VkFhrVmh/lZ2cmJUJ8vcGJb3PSj86/UXhGz+67v0j3kErgZD6eSf2zZOjz8m0vcNNOolT+lzY6GJKV9I3Wukr2UAZMrafJOGIxdOpscALNc5z/HZno1Y4mRgDzR5lDYJDDrvR7v3Vlg2m36dNyV2gW2Pt8C9FMz+wE0RQMoKpkRcAzxRDNeRqv8Wn+DdeHIlJ1U+99g2pSBzo/mfxTNGj8ymrFpaRsl2P7KFVCKFaj5bcGqwLEpOLKEyaVqGLf7GVxlzrzL7zaUZhPJla0bqyc2dxXi5qYuuD+js0+xkM7CH9yjeIoEfiywqPljJdprwmMuu28iHI67Bd4qRJq18Kfoxpj4JjhaQi3cCxeaMT0Ezhc1Q/lsbQIKlNQTCbizIdKlrgg6p9iZnsZxydhOAatB8mXgMBQrHJfLY+VzGiIlnnSeZGVj9zANr5Q85ex4CXQfyTOiMZ2n/MR1jlusDeZ9vB1I5lDB//9/aLAJEO5efIKmECekiDbvVjFXuYpivNQRCjC1oA6ACY6yMUFIQzrZlR9WnZRlClR3WNg30WCDGG42Bxovpk8YEwAr4m7ALUgL6R0aqKKyLWve8b4Gd17FODPsbSZ04rbcrCDcI9eRfRyPwJ4IAR1LLHMG766EaDOFdDmMm4mc2SgIfucLbZuS+ATuHitTXVT1BP7rqJztXYEXOn0YtXP5BYQJRLQCik8coQgM1ig== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 825b8c5b-fd4e-4ee7-32b4-08db9cdb52b2 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2023 15:30:00.5573 (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: Sie5Wthx/FFcI9ZIQ3ZzQKZrqopjhExwjVcCfNuw4cvZHDe+R59QLicgJ02MKHz/XjQfVljXFN3/X+NCNRJMsg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR10MB6342 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-14_12,2023-08-10_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 suspectscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308140144 X-Proofpoint-ORIG-GUID: YwX4-3I7DtQ2U-qdA0dgWyfpTfRPfUTv X-Proofpoint-GUID: YwX4-3I7DtQ2U-qdA0dgWyfpTfRPfUTv Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Most of the code and functions in this patch is copied from the kernel. Now, with this patch applied, there is no need to mount the device to complete the incomplete 'btrfstune -m|M' command (CHANING_FSID_V2 flag). Instead, the same command could be run, which will successfully complete the operation. Currently, the 'tests/misc-tests/034-metadata-uuid' tests the kernel using four sets of disk images with CHANING_FSID_V2. Now, this test case has been updated (as in the next patch) to test the the progs part. Signed-off-by: Anand Jain --- kernel-shared/volumes.c | 184 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 179 insertions(+), 5 deletions(-) diff --git a/kernel-shared/volumes.c b/kernel-shared/volumes.c index ad006b9de315..62015053afe3 100644 --- a/kernel-shared/volumes.c +++ b/kernel-shared/volumes.c @@ -332,6 +332,159 @@ static struct btrfs_fs_devices *find_fsid(u8 *fsid, u8 *metadata_uuid) return NULL; } +static u8 *btrfs_sb_fsid_ptr(struct btrfs_super_block *sb) +{ + bool has_metadata_uuid = (btrfs_super_incompat_flags(sb) & + BTRFS_FEATURE_INCOMPAT_METADATA_UUID); + + return has_metadata_uuid ? sb->metadata_uuid : sb->fsid; +} + +static bool match_fsid_fs_devices(const 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; +} + +/* + * First check if the metadata_uuid is different from the fsid in the given + * fs_devices. Then check if the given fsid is the same as the metadata_uuid + * in the fs_devices. If it is, return true; otherwise, return false. + */ +static inline bool check_fsid_changed(const struct btrfs_fs_devices *fs_devices, + const 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) +{ + + struct btrfs_fs_devices *fs_devices; + + /* + * Handle scanned device having completed its fsid change but + * belonging to a fs_devices that was created by first scanning + * a device which didn't have its fsid/metadata_uuid changed + * at all and the CHANGING_FSID_V2 flag set. + */ + list_for_each_entry(fs_devices, &fs_uuids, fs_list) { + if (!fs_devices->changing_fsid) + 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 + * has an outdated pair of fsid/metadata_uuid and + * CHANGING_FSID_V2 flag set. + */ + list_for_each_entry(fs_devices, &fs_uuids, fs_list) { + if (!fs_devices->changing_fsid) + continue; + + if (check_fsid_changed(fs_devices, disk_super->metadata_uuid)) + return fs_devices; + } + + return find_fsid(disk_super->fsid, disk_super->metadata_uuid); +} + +/* + * Handle scanned device having its CHANGING_FSID_V2 flag set and the fs_devices + * being created with a disk that has already completed its fsid change. Such + * disk can belong to an fs which has its FSID changed or to one which doesn't. + * Handle both cases here. + */ +static struct btrfs_fs_devices *find_fsid_inprogress( + struct btrfs_super_block *disk_super) +{ + struct btrfs_fs_devices *fs_devices; + + list_for_each_entry(fs_devices, &fs_uuids, fs_list) { + if (fs_devices->changing_fsid) + continue; + + if (check_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) +{ + struct btrfs_fs_devices *fs_devices; + + /* + * Handles the case where scanned device is part of an fs that had + * multiple successful changes of FSID but currently device didn't + * observe it. Meaning our fsid will be different than theirs. We need + * to handle two subcases : + * 1 - The fs still continues to have different METADATA/FSID uuids. + * 2 - The fs is switched back to its original FSID (METADATA/FSID + * are equal). + */ + list_for_each_entry(fs_devices, &fs_uuids, fs_list) { + /* Changed UUIDs */ + if (check_fsid_changed(fs_devices, disk_super->metadata_uuid) && + memcmp(fs_devices->fsid, disk_super->fsid, + BTRFS_FSID_SIZE) != 0) + return fs_devices; + + /* Unchanged UUIDs */ + if (memcmp(fs_devices->metadata_uuid, fs_devices->fsid, + BTRFS_FSID_SIZE) == 0 && + memcmp(fs_devices->fsid, disk_super->metadata_uuid, + BTRFS_FSID_SIZE) == 0) + return fs_devices; + } + + return NULL; +} + +static struct btrfs_fs_devices *find_fsid_reverted_metadata( + struct btrfs_super_block *disk_super) +{ + struct btrfs_fs_devices *fs_devices; + + /* + * Handle the case where the scanned device is part of an fs whose last + * metadata UUID change reverted it to the original FSID. At the same + * time fs_devices was first created by another constituent device + * which didn't fully observe the operation. This results in an + * btrfs_fs_devices created with metadata/fsid different AND + * btrfs_fs_devices::fsid_change set AND the metadata_uuid of the + * fs_devices equal to the FSID of the disk. + */ + list_for_each_entry(fs_devices, &fs_uuids, fs_list) { + if (!fs_devices->changing_fsid) + continue; + + if (check_fsid_changed(fs_devices, disk_super->fsid)) + return fs_devices; + } + + return NULL; +} + static int device_list_add(const char *path, struct btrfs_super_block *disk_super, struct btrfs_fs_devices **fs_devices_ret) @@ -346,11 +499,18 @@ static int device_list_add(const char *path, (BTRFS_SUPER_FLAG_CHANGING_FSID | BTRFS_SUPER_FLAG_CHANGING_FSID_V2)); - if (metadata_uuid) - fs_devices = find_fsid(disk_super->fsid, - disk_super->metadata_uuid); - else - fs_devices = find_fsid(disk_super->fsid, NULL); + if (changing_fsid) { + if (!metadata_uuid) + fs_devices = find_fsid_inprogress(disk_super); + else + fs_devices = find_fsid_changed(disk_super); + } else if (metadata_uuid) { + fs_devices = find_fsid_with_metadata_uuid(disk_super); + } else { + fs_devices = find_fsid_reverted_metadata(disk_super); + if (!fs_devices) + fs_devices = find_fsid(disk_super->fsid, NULL); + } if (!fs_devices) { fs_devices = kzalloc(sizeof(*fs_devices), GFP_NOFS); @@ -375,7 +535,21 @@ static int device_list_add(const char *path, } else { device = find_device(fs_devices, devid, disk_super->dev_item.uuid); + /* + * If this disk has been pulled into an fs devices created by + * a device which had the CHANGING_FSID_V2 flag then replace the + * metadata_uuid/fsid values of the fs_devices. + */ + if (fs_devices->changing_fsid && + found_transid > fs_devices->latest_generation) { + memcpy(fs_devices->fsid, disk_super->fsid, + BTRFS_FSID_SIZE); + memcpy(fs_devices->metadata_uuid, + btrfs_sb_fsid_ptr(disk_super), BTRFS_FSID_SIZE); + fs_devices->changing_fsid = false; + } } + if (!device) { device = kzalloc(sizeof(*device), GFP_NOFS); if (!device) { From patchwork Mon Aug 14 15:28:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13353052 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 51BB6C04A94 for ; Mon, 14 Aug 2023 15:31:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231684AbjHNPal (ORCPT ); Mon, 14 Aug 2023 11:30:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233016AbjHNPaM (ORCPT ); Mon, 14 Aug 2023 11:30:12 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9422710D5 for ; Mon, 14 Aug 2023 08:30:11 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37ECiSS0015354 for ; Mon, 14 Aug 2023 15:30:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=IjPl6RcP7txMgyozdstnmShz4wsMwb8k29ZEGfQ96+Q=; b=w2fHI2E9RPKYTs3RGf0dpiXsqGYmGVxC3VdeVojTgkPX+28Su96C0Jh2Hs8ZmIyVu9Qj eVgw05nioKk8uY82z6Jed/Kou3wT3Xl2/MXsDVTfT45rvJFe6eAMDMol+PjDgCBKgfAN KJwOKyDbi8YbhkagS3Mq8uDxX9geHNw+WVDT7KliEZIAPkT+7JYZIjzdzhrque6xKR13 9ZosV6P9WA/m/WYDKRp3AVqC6Bwtel2/h0wi4FLJJGS5Sk4DV8ICqLqIwrgksZyhPAed 5LxwKbin7zjKhLp98M9vR4skylju3FKlRix6HvixmxwpgfEFIc3wnO/p6SFDhbc6jlKO xw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3se2yfjwk3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:30:10 +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 37EF5u98003782 for ; Mon, 14 Aug 2023 15:30:10 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam04lp2176.outbound.protection.outlook.com [104.47.73.176]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3sexygt8yk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:30:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cuirVGzRsQG9Jb8M/4BE1VszEmBlIJCkcC0+ax2VNLg4CGeTEaBDmTxRKnx6vC28TwyJtnwcVhFhnm7o9dH8b0VeV6VqF2EJJihe2rl+w0NOEiT/idJKHIOyswkTHWnHf9E+zLXSBjLubXVMIqNx4aaljRpGZoIZN9yqNzTPA9U14K/i1jsO58Zl58ydgpCtH3mBMEHldlqWmFx7QPgesfa7ixi/XTI9xJS4FFtwHXQ7wUSUd/lGtyG7K2db2aFe4mVbRM7QdbfiVXmSV2sE6otoa8g/3qscQTUMakGIHx3l6voi63cXnydK1Q4rGjY0G/YllNM8LUsKHrp+RACYMg== 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=IjPl6RcP7txMgyozdstnmShz4wsMwb8k29ZEGfQ96+Q=; b=cvet9qrzwErVq52DnOT97FmknC+YBsnwd3R9R94tAX808uATtFKCgj2BbdERUXnLCb6kHCTuNCiQMnGrXdF7/U3z+kFHkHqCDhLafuo3IWQDshleiIeloQyJSDsIRDwZIG2NeEBtJ5/0SVgtj0dgJQZdkKHvmMW1ihS24QUt64lCLAf+hghXfdK1AlqU5GS9A1STOIZg5LSgdfdjLaIenpKuzjST4O1J0Q40FXx2vGW5mG9rFvoRW/UJYhd1VHobASyQq1ODegIPvb1iZqo2UWS+ejn3ns7c6Wg1GTOmlRZhNoMwpKcMi8MtXvu+0OngfIkhbmOqxYj7019hs2ArKQ== 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=IjPl6RcP7txMgyozdstnmShz4wsMwb8k29ZEGfQ96+Q=; b=jUTf/X27Z18DKZYLz3ZxkWAWeprKuCQV3bbeJqNC2as5CHG+JZhOQflIV6pVxpKxDzdQIvMUugHNnw/RnDCkI7HpHSQXhalPnbKdkXuQenPD58Qwvou/fGuTRM/K3Ob31oRntquwTeFsePzKt9bmH0Njm/ZNNpFJpfwMn8/3SE8= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SA1PR10MB6342.namprd10.prod.outlook.com (2603:10b6:806:255::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.24; Mon, 14 Aug 2023 15:30:07 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56%4]) with mapi id 15.20.6678.022; Mon, 14 Aug 2023 15:30:07 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 15/16] btrfs-progs: recover from the failed btrfstune -m|M Date: Mon, 14 Aug 2023 23:28:11 +0800 Message-Id: <5d68db431d32f2521e6541e5a8a4ed3a14f4e674.1692018849.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0023.apcprd02.prod.outlook.com (2603:1096:4:195::11) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|SA1PR10MB6342:EE_ X-MS-Office365-Filtering-Correlation-Id: 02655a28-5cf1-417b-c74d-08db9cdb570d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pUaOxM0nA9e++1YBXasKrvFa6eLR/BQWkMSajObraryoPLYzpbDWbIIc+A3AwP6nAOHcPPwMEvtVcn1aIjnUfPOpxLFXlOHFizf5FQ9NwOlUXEFXnKLVyye0J78xR4pKPCdF3KUXBCScpQewMTUJRdSsCMOABv+MXdt8ushfD2WE6KO5IoIASBQPNwa73UHrPvkU/bDosB6JZNxs1YhI7hEt6EcwwmO8BcMMX7i+dQWrVnKT9CTwJ5KS/wywsNHim0nmSCDmgEeQv69CXACoS1Ad5Xz8iOnP5iJHys5VqBs6MrzowGgMPpF0FRpnF/KNmGs0bZKPVWsWkWC9Z0Xz4ysa9pDGZiUPVPY+LFk4qq4YjDBFLP/ZbR5EPUZIyQvhFbFN9lMQHHmD2c2r+go/+DdLb+7/1QG0bhhMlAfixLmZCbidiG2dH2dxj/ESxrnhHgIuFs87evobUGaT7S0+PsMKP0bVJyzl66uZ8BX9FVm+4JaNC145BhpE/sa1MYskbAVZsCPjot89ZMhOjbmNSt2MjOFjDqv1p2qcnuEFLPlrHxr8zW/odwFlRx52ITSa 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)(366004)(396003)(376002)(346002)(39860400002)(136003)(186006)(451199021)(1800799006)(8936002)(6512007)(86362001)(478600001)(6506007)(6486002)(316002)(8676002)(66946007)(41300700001)(66556008)(6666004)(66476007)(6916009)(5660300002)(44832011)(26005)(2616005)(36756003)(83380400001)(2906002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: q6pbdpyDaXofuXPzcc5E3k3QIJM9iayphNE+Q4kYdRyIVaEn97n+ANqOZ3n9yZPWKLqNgjuat7Se4Os+BxEtoRYFAEyhi8iu7zUFHAgUQCTTx7AgAtp60epK0lrwcLKIWmmkMnh5r2h05da5H7xcPK0m57LH4pHv92nd6/l3UstWkpGYyR5g9LkBmeK67u7nhb3Hvb0B+dFTXKAT8rizE7ulWy6n97+9iNlet1UjInGRGvVLTwoUIyoFBW5RTlKz7RX0WUws14GNs6PQEgfaA2j28XNzoBVs5Pp1gylznB42TSMwZXfbPyu+qUgmKnVjo/2LjHI1GwLINhVk7tiq4KjCN+3OA86MmHOqghRMtqIc+TKidDbtFNvaVcx1YWS60zU7qWxHsGcZrcPpOrJ00OsY3y5FKdYO/Fog+cIo0iqaYCG9eBWSRnTtjWLpzgX6EdqEgEnlGBBgrj1yeEq7IvFGM/7tDRIqhidtHuoirm+OY0VYHaEkCLS2CYcHHZMVewc709Z1C//v+4Ppx1I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/mseAuxccEQfHs+owg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: LfJt/JLxewET3VjP4JCvneyPNasVG05u0uAUI+aUSVZaWUz7OmmXx1ojc67QwMfXY0YVsE/8L9F2chgRzI4fV81NycW8juwGx9+yX7yA9amt6x0HqPrOvzhpdGJESioYtVCONj+pSSqPyiilk4BIkMHao5B0iUqrwyweJ/Uw42yczagA8ymR6YoXYfLKa94YHt+UHDxqtEM4KeQpMBNXLS6Z/hmtUWa2u/e26heaU/QXcMkrAVLZRnZBQsg3+lRwaBdKyYONyDxFMvxKQ9ObAGxbWWnHS65MRLKWYYDr3tKwSsjGJ6l424yYGLcgrWeWorxC0XfB+lYyAxmX7AmMkfxnq+88FRpT1rsMixxie0qcajK5504UMm/bK7j6n3kMyBS1DJBEfL/YVcH8D/S7ddZKui74C1iroOihifvvLZTwn1wLO0CNEGc38jrMy4xBxlQTz3nR7ew33RhUV6IPvFMbOwZamsfOC6u9275pYSPP/WGYQIKBHsgwL+RxQwrTRj5GUVpThc4d6UuceoxxohfBFGNVlZwhStwoti07bzcZSMFrP5m+iGUjMAswiB8hWoOXHnrrWjjHBxDSmoRgx+UJ3CVpiANlpFQlHrnCH1EpabssRwrd+xh97pU2IqQ4cyu6st3oIGQasV1ckyeWatkJUbib5yf1MwVUJiklnXP26w2Re8nSrCVw880go7w5aN/v3YAno5ekhd9/nxEgMqsK5NZsP4sJuOlJCiKD/M/DMWl4ENJUymKaD8hJHbJ6taFXyddB6+DLObaffGjzxQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 02655a28-5cf1-417b-c74d-08db9cdb570d X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2023 15:30:07.6768 (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: UsS6gp6BPaJYI63gMIO3IsRkWg0DdwqgO6VlOl17rL1XmrWipriA3f5sMWFAz6HH6++wIvTK56qJuxLuXjYWJA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR10MB6342 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-14_12,2023-08-10_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 mlxlogscore=999 bulkscore=0 phishscore=0 suspectscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308140144 X-Proofpoint-ORIG-GUID: XWXoapB99V_hXMpA7SIl5QD4bzmhr_cF X-Proofpoint-GUID: XWXoapB99V_hXMpA7SIl5QD4bzmhr_cF Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Currently, to fix device following the write failure of one or more devices during btrfstune -m|M, we rely on the kernel's ability to reassemble devices, even when they possess distinct fsids. Kernel hinges combinations of metadata_uuid and generation number, with additional cues taken from the fsid and the BTRFS_SUPER_FLAG_CHANGING_FSID_V2 flag. This patch adds this capability to btrfs-progs. In complex scenarios (such as multiple fsids with the same metadata_uuid and matching generation), user intervention becomes necessary to resolve the situations which btrfs-prog can do better. Signed-off-by: Anand Jain --- tune/change-metadata-uuid.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/tune/change-metadata-uuid.c b/tune/change-metadata-uuid.c index ada3149ad549..371f34e679b4 100644 --- a/tune/change-metadata-uuid.c +++ b/tune/change-metadata-uuid.c @@ -46,14 +46,23 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string) } if (check_unfinished_fsid_change(root->fs_info, fsid, metadata_uuid)) { - error("UUID rewrite in progress, cannot change metadata_uuid"); - return 1; - } + if (new_fsid_string) { + uuid_t tmp; - if (new_fsid_string) - uuid_parse(new_fsid_string, fsid); - else - uuid_generate(fsid); + uuid_parse(new_fsid_string, tmp); + if (memcmp(tmp, fsid, BTRFS_FSID_SIZE)) { + error( + "new fsid %s is not the same with unfinished fsid change", + new_fsid_string); + return -EINVAL; + } + } + } else { + if (new_fsid_string) + uuid_parse(new_fsid_string, fsid); + else + uuid_generate(fsid); + } new_fsid = (memcmp(fsid, disk_super->fsid, BTRFS_FSID_SIZE) != 0); From patchwork Mon Aug 14 15:28:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13353054 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 671D4C41513 for ; Mon, 14 Aug 2023 15:31:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232974AbjHNPam (ORCPT ); Mon, 14 Aug 2023 11:30:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233039AbjHNPaT (ORCPT ); Mon, 14 Aug 2023 11:30:19 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07DE410D1 for ; Mon, 14 Aug 2023 08:30:19 -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 37ECiLT5019893 for ; Mon, 14 Aug 2023 15:30:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=tYyhi+h52Tq4bpgrknJu3UfD+TszSWwufFbKa6vUTIY=; b=iBGE+ajZNjNN6KqpAUQF62pTORD1kxv+iKopVZ6wnh6gfYDDtQ80SPdyyMRS8rKFIz+y zmcLMVfPOE7j2qMn2IJKorHAzOsJlXE+RbCGv1VGYbzzjtoBjbfDNwWcwhKUWyX9rp8l BDqnvNm2KLzjJ1qJSGDa4Qnnga+dQpdu2zGsYWfE88T+9BOp0hBExZ8JTTHs3CiOU0K+ 7XxRWOr4LkTQlwG3kWI0uUk5RmXDgnJWbOO510zrZHO7uHsQDbrCv1XE2q/x0aJsrLPg fFzyQrfGo6S50GuRIyQClbXbeI2HNFQwSRjSdqkFlKbLV2Pmbi3D6UgAWWG2G5vgKYvm ZQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3se30stvud-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:30:18 +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 37EExgv9019785 for ; Mon, 14 Aug 2023 15:30:16 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2106.outbound.protection.outlook.com [104.47.70.106]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3sey3ua0x8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Aug 2023 15:30:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YADHSsK9Z3l3K7FLkoc9pUty06XjquSACDq71XpnTwUluVv5nNyQ3yRa+O0tSSIe314nwSFSqT8+eyKxsov1dYp+RI/VzteTW/UjmDWjqno5Jq3UaxDxiiK/uAuE9eEOEJonwbO7bBsgLY9OC8CeiEx04w2QLuZza3tJburnYRcxQq+BySfoUkWHVI/TGNCeRtCdmQmwHF0Obe+Xw9jwncmPaaJ5aIHEOV8sk+3Xwt69tg8UTzs8Z8EO2Oeo86IdHapvSUN4Lu41P6aA4Zb67eDOKaWLPZlz2bHUzf4KdDMHWZieywJViJ4Pxre/oFWOsc4lW0ffV1MnPyRYE7xGjg== 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=tYyhi+h52Tq4bpgrknJu3UfD+TszSWwufFbKa6vUTIY=; b=k0LC8dyR/bxhTryp0cBufRsMzyUfcEkTA9+dgL5DO/SEEzxPov1L8YFzvRvLME5QQzyrn3h62wYGWPYyc7W5En1fOnsXWu3eR9FWo3Z/dyOCKoPtoXKaahYDtpQ0smwkn+01G/xrLxtWP51LZdxDaACU6iVJbQvOnJHNgzcOLYnnN6ZOmX3zHiX8IFdgs3fxzNZT2DXzeX1ZgiA8e8jw8MVglL8m622UNh1ODXKtELRXnSoGLo6tYZ2HhTi6qZaFt+GU/b4o0ca7oKempAt9f4KyV/ZakloG3cmirawUa4t4b70Yf+2yBxXIPlAEBpNCxfyorq2u109b6GjRM7t3qQ== 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=tYyhi+h52Tq4bpgrknJu3UfD+TszSWwufFbKa6vUTIY=; b=Taf8/lRZ2jEZjmhgnQUQW4+OdDt+LRN6cpowpmTRyxzmJ0Y+qt83JQI6sVjurR2Dq6B1kJyFKKXZ8JR4ByiJAjx5CWY84fv5doK7H4wH44z5T7/u+0JW8S58AZm20IFEcul4RZJUdNS2xhdXjhS+zaD7xvYkRCA3pbsmc4HTidk= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by DM4PR10MB7425.namprd10.prod.outlook.com (2603:10b6:8:180::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.24; Mon, 14 Aug 2023 15:30:15 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56%4]) with mapi id 15.20.6678.022; Mon, 14 Aug 2023 15:30:14 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 16/16] btrfs-progs: test btrfstune -m|M ability to fix previous failures Date: Mon, 14 Aug 2023 23:28:12 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0045.apcprd02.prod.outlook.com (2603:1096:4:1f6::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_|DM4PR10MB7425:EE_ X-MS-Office365-Filtering-Correlation-Id: eb2fcbec-ffe6-4177-64e5-08db9cdb5b0c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ymLlrN2aaBhdOT/Kvkqi24CsKs/x1kS0HtNLib/CXHIuY9j/xxARMNBRjSb0NAXT9wv7i/v/RxNKrPpN8d/pma46wn/M4ZcsXLwzAO6qnNwEr8S6saw52eTyXio5ucCFUbWcxbj0iIy9/pk36BzPxk6izHerv8KwTWunX4UnxHpIMgx2tqkG+p1iq/2n/51sj+WTOwFVZT5bCDNOVHGGFaLhLGZbjhzm7d1hgX0B/IoDUBDovA+J58sCDTH4RQUBIui+1/xv2mvveFsNipVm+ErxjLfmLEP8GmCL3JoysH8VrYfkfVSUPIj9fifqTDS+hRwXwQQOcjVTEsIKpHrqngSLDQXraZ9VwMGR7vwpaZFICJez3BFPipeBCW78KzIVG/qyFhzktQYc0M0nWd2pooXq0XRRq+2OPFBnqMV9HJy3MeSPYc2WyFrsbCJSmxLCgFWbzDJbbPUjX4DvNbnaAugWdgH0Ar1IMTMww/22evrNC5MjnHhK0UlWfBkUd6KSeltNaKxijX71v7VS1p/V5nrNa88b0I7aYeer6+SJg+w6CMVhn671zCDfqE7i3OwN 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)(366004)(346002)(396003)(136003)(39860400002)(376002)(451199021)(186006)(1800799006)(6486002)(6506007)(6512007)(36756003)(38100700002)(86362001)(83380400001)(2616005)(26005)(2906002)(478600001)(44832011)(5660300002)(66476007)(66946007)(8676002)(8936002)(41300700001)(66556008)(316002)(6916009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AsUSPOrCpIcfus4IYfA0BJ/pZE3onoVjhXtMHrmPFfXI/U9ueDs9Qj0+TVcRtWIhNxx7FQwXjZer0EGXmJB7ZcOrEoMFd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2MC8R5wm4KgtIk4kJtKpIOaYdkqMPaNVy9YfGDqgqROvcIBWltjs6oTT5Ec/Me7UihIQCNRgio4HzKtXZgs8JEL10Bo5uRXgcshuy8CQp7IhTOfhYJvNirXqO8FiBF8uZao+Z03j8m45DSPQ/7mjyRUQ99V/DhGZ8mxfAUhfCEAQAVHJrNOSbtn4oyWF/rJq7dpUn2DRpvphX04QGO90R15Lu03tu5gb43cl2V06qo5ZlwOSNqznYMQfJQis98142HSkvEA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: eb2fcbec-ffe6-4177-64e5-08db9cdb5b0c X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2023 15:30:14.5658 (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: y2AMxLVbuHX4cmLdIkipo20ODRfkNnpsCFfzIuia3YqVRGwP8GdrBVKHapgNMhq+ldvmKQQZd9jMXgyEJX3ycQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB7425 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-14_12,2023-08-10_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 adultscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308140144 X-Proofpoint-GUID: VKidIuyVJHlJhmYo950JagggGzQNuu3Y X-Proofpoint-ORIG-GUID: VKidIuyVJHlJhmYo950JagggGzQNuu3Y Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org The misc-test/034-metadata_uuid test case, has four sets of disk images to simulate failed writes during btrfstune -m|M operations. As of now, this tests kernel only. Update the test case to verify btrfstune -m|M's capacity to recover from the same scenarios. Signed-off-by: Anand Jain --- tests/misc-tests/034-metadata-uuid/test.sh | 70 ++++++++++++++++------ 1 file changed, 53 insertions(+), 17 deletions(-) diff --git a/tests/misc-tests/034-metadata-uuid/test.sh b/tests/misc-tests/034-metadata-uuid/test.sh index f2daa76304de..6aa1cdcb47ae 100755 --- a/tests/misc-tests/034-metadata-uuid/test.sh +++ b/tests/misc-tests/034-metadata-uuid/test.sh @@ -195,13 +195,42 @@ check_multi_fsid_unchanged() { check_flag_cleared "$1" "$2" } -failure_recovery() { +failure_recovery_progs() { + local image1 + local image2 + local loop1 + local loop2 + local devcount + + image1=$(extract_image "$1") + image2=$(extract_image "$2") + loop1=$(run_check_stdout $SUDO_HELPER losetup --find --show "$image1") + loop2=$(run_check_stdout $SUDO_HELPER losetup --find --show "$image2") + + run_check $SUDO_HELPER udevadm settle + + # Scan to make sure btrfs detects both devices before trying to mount + #run_check "$TOP/btrfstune" -m --noscan --device="$loop1" "$loop2" + run_check "$TOP/btrfstune" -m "$loop2" + + # perform any specific check + "$3" "$loop1" "$loop2" + + # cleanup + run_check $SUDO_HELPER losetup -d "$loop1" + run_check $SUDO_HELPER losetup -d "$loop2" + rm -f -- "$image1" "$image2" +} + +failure_recovery_kernel() { local image1 local image2 local loop1 local loop2 local devcount + reload_btrfs + image1=$(extract_image "$1") image2=$(extract_image "$2") loop1=$(run_check_stdout $SUDO_HELPER losetup --find --show "$image1") @@ -226,47 +255,55 @@ failure_recovery() { rm -f -- "$image1" "$image2" } +failure_recovery() { + failure_recovery_progs $@ + failure_recovery_kernel $@ +} + reload_btrfs() { run_check $SUDO_HELPER rmmod btrfs run_check $SUDO_HELPER modprobe btrfs } -# for full coverage we need btrfs to actually be a module -modinfo btrfs > /dev/null 2>&1 || _not_run "btrfs must be a module" -run_mayfail $SUDO_HELPER modprobe -r btrfs || _not_run "btrfs must be unloadable" -run_mayfail $SUDO_HELPER modprobe btrfs || _not_run "loading btrfs module failed" +test_progs() { + run_check_mkfs_test_dev + check_btrfstune + + run_check_mkfs_test_dev + check_dump_super_output -run_check_mkfs_test_dev -check_btrfstune + run_check_mkfs_test_dev + check_image_restore +} + +check_kernel_reloadable() { + # for full coverage we need btrfs to actually be a module + modinfo btrfs > /dev/null 2>&1 || _not_run "btrfs must be a module" + run_mayfail $SUDO_HELPER modprobe -r btrfs || _not_run "btrfs must be unloadable" + run_mayfail $SUDO_HELPER modprobe btrfs || _not_run "loading btrfs module failed" +} -run_check_mkfs_test_dev -check_dump_super_output +check_kernel_reloadable -run_check_mkfs_test_dev -check_image_restore +test_progs # disk1 is an image which has no metadata uuid flags set and disk2 is part of # the same fs but has the in-progress flag set. Test that whicever is scanned # first will result in consistent filesystem. failure_recovery "./disk1.raw.xz" "./disk2.raw.xz" check_inprogress_flag -reload_btrfs failure_recovery "./disk2.raw.xz" "./disk1.raw.xz" check_inprogress_flag # disk4 contains an image in with the in-progress flag set and disk 3 is part # of the same filesystem but has both METADATA_UUID incompat and a new # metadata uuid set. So disk 3 must always take precedence -reload_btrfs failure_recovery "./disk3.raw.xz" "./disk4.raw.xz" check_completed -reload_btrfs failure_recovery "./disk4.raw.xz" "./disk3.raw.xz" check_completed # disk5 contains an image which has undergone a successful fsid change more # than once, disk6 on the other hand is member of the same filesystem but # hasn't completed its last change. Thus it has both the FSID_CHANGING flag set # and METADATA_UUID flag set. -reload_btrfs failure_recovery "./disk5.raw.xz" "./disk6.raw.xz" check_multi_fsid_change -reload_btrfs failure_recovery "./disk6.raw.xz" "./disk5.raw.xz" check_multi_fsid_change # disk7 contains an image which has undergone a successful fsid change once to @@ -275,5 +312,4 @@ failure_recovery "./disk6.raw.xz" "./disk5.raw.xz" check_multi_fsid_change # during the process change. So disk 7 looks as if it never underwent fsid change # and disk 8 has FSID_CHANGING_FLAG and METADATA_UUID but is stale. failure_recovery "./disk7.raw.xz" "./disk8.raw.xz" check_multi_fsid_unchanged -reload_btrfs failure_recovery "./disk8.raw.xz" "./disk7.raw.xz" check_multi_fsid_unchanged