From patchwork Fri Nov 15 14:54:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13876344 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0488B1D434F for ; Fri, 15 Nov 2024 14:54:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731682497; cv=fail; b=R6AlhAUXyv5wDOnm/d2FEfcHqj9V2/wOCe57Fz5qkqUHX+xxFSr8vEB14Nt2sz9XMPeKQSoM4tG0Mkt+GEpzl35rPaLjQbeqPS8U1pHsV8FTNkmL2tNMDSfDzz5utkkA8VaLzQXizCPZe5VqTt/1l3zX3XAjHK4JTo4i4tPPBII= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731682497; c=relaxed/simple; bh=Lw2iDC7XXh+onZIOQTBiup5+qAibmxX7SsKdBBnhVzM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=Cr/uiwApX5Tkr7o7I+WbJhZ2MNA0kJIIk3P1+B0c5t8DHoBQebgTMVTHQEvWuCfTstxjq/pCWpU7vpNlEUazXs5KYYT3e2Ojk6tFEvASaYI5k8aFMHJurpzyy61ubUhukkwoQBCbYoJsha7Kr51Kd7I5D3cPIPqbd+n8ggusdRQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=M6I14GID; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=IL7vdODO; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="M6I14GID"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="IL7vdODO" Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AFDCSq2020915; Fri, 15 Nov 2024 14:54:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=kXAh4z31vZlSM7vhXotBhdwi6/2Uix44w+DRpnRqKko=; b= M6I14GIDujgVUunQQ6W4N2vE69FCF2HO9zhpifsKRMPUZKHqea1XPNrjuFA6z2oE gVlT0gJL1LSRcquSnNdwNKCnZo8GJuCOmbWCBhzjdArkVdXaWG5w/ttoZPB54UWp GYIs4lRgR1XCFOyqu7cbEBWgHmFpt2JAN8Gj7ja/i9C05ozf0Xj1mHYLZns8jQNm nTvxxnq7gE0hKWy1ePIxLNBfLRHkFMXtQ6FFouvBoUpeyEPXplXuyUVOKGHAv34C lQ8KdNeJUXO7VZEzHZfL22CVpYo7WGfixEECVhf3Q24jWSBjrkWBL9o80YV2slym 81Rcwi0ETM6WQVu/7/OtDw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42t0kc3mut-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Nov 2024 14:54:46 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4AFEeTPh025914; Fri, 15 Nov 2024 14:54:45 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2048.outbound.protection.outlook.com [104.47.56.48]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42sx6ca3ay-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Nov 2024 14:54:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Nj/4rTRND5RNRYIwzpc4ES1fiUgfz3hRcTqHgOFke11gDojIUcSxfGerEo4nO2dXlLi3tbrFk5CqXF15atbX2wRmOCfYKibpGclq47UEZIETxSFAyYTPcV1btgRY+JoT0+U1LXaWGLMYi1nAKf9YtzmEN11U+HOCrD7ukOKa+oQEKKLwJZAendEeB3ItwAX18B5QSwIIAHP8gH5tG1CVFY9SeemxPT2QQifG+6dy+8/TTzizW7coXmye+dFUO+Z8Wg/afpwIB4bJYw/OBwfRY5fKk5tmSY8nJcukEsNu/GkbhskZj8GrMAMe1acTisJLYLvJ4BGPz79tncp+xGtg8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=kXAh4z31vZlSM7vhXotBhdwi6/2Uix44w+DRpnRqKko=; b=hEyypI5pENovrw2t+STEpwUB2zYh/6m1nLyGP5G9gsichygXL/Ejv5MPXisMuupb39ZU9ScT/Xi0rhbvltOwewuSGDygAMbHpWZSbymMVDisVDit+DhJeEMybgWIWnxBKQ8uaV+5HQ87/MZ/d1Yial+U/ScNWUiWnasfb1tGJrQvjRNUOzUis6vB2OMEjuC6R7ouYhdNwi0+F3hZXQSoLEyHqRQsjSRPo7QMvUS7O5AlBJpsNu1fTkJiOnZYOTaVwwwFC3pjkS0tpZPq+1QUtL44n0ZR5m+gocSqb2IfT3jOSHpAnt/a2xDfTVv4uQUB+7t7Jlg4fXaL3VKnRGrGJw== 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=kXAh4z31vZlSM7vhXotBhdwi6/2Uix44w+DRpnRqKko=; b=IL7vdODObj72bW4/aX/X/LtV/2Xa/CS+rsXIkwVEaBlw+Wn/uu+IXrvD5TS+5RsJEUrekzP8OOZQFtgMgyvAjU2p93PbnBuCsDTIcCzD5rf+DTlO8YcKz0eyjoKEASVtu+Vo0ZixodABQB4xfDxz3zF2yydSWrVOhZRHMplOFb0= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by IA0PR10MB6913.namprd10.prod.outlook.com (2603:10b6:208:433::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.17; Fri, 15 Nov 2024 14:54:41 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::fea:df00:2d94:cb65]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::fea:df00:2d94:cb65%4]) with mapi id 15.20.8158.017; Fri, 15 Nov 2024 14:54:41 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: dsterba@suse.com, wqu@suse.com, hrx@bupt.moe, waxhead@dirtcellar.net Subject: [PATCH v3 01/10] btrfs: initialize fs_devices->fs_info earlier Date: Fri, 15 Nov 2024 22:54:01 +0800 Message-ID: X-Mailer: git-send-email 2.46.1 In-Reply-To: References: X-ClientProxiedBy: SGAP274CA0010.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b6::22) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|IA0PR10MB6913:EE_ X-MS-Office365-Filtering-Correlation-Id: d43279d6-5be0-44ed-4642-08dd05856f7b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014; X-Microsoft-Antispam-Message-Info: yQORdRL4h82v07Jodbi0KNzsdDPtVdoITVPyBdh9pjm5jJ93FS2XKteHgTWRaoYbQcdRZpScF4f4KWoAioyT0eP4Jjqb2O9z4Pr/E4aQbpgCElAXf9MnPoayUQGfm3lL5G34jExGDsam7RxDajXDRC12cnm+jcfv13aJaGwj1sRQGZYv1tn5rb/V1AYhvIp+DCJ+Hf6uWcq1FislZ6vhQ6va7GQKX8QFsoKklFpROpnWnMICjkrx1WS8lVnWhvD/u/oPtKB2CuBogab6VuNprOfZREkBX7F68iDmFwY1OOwoLPOMk+cH86HH1DqlWgxNKTGlPefdgPltPGtEK/S4x4nfCnPvNLrfwX1Es+ot9Wb6bFYqyLKTFjo/GDQNSYJvGTKoA//K5l2Lmn2Oq39g3NTwS4FtwedPRJ7/3/WILB/nQFDCay16sB8zBqkEXv0kZaZ0I2htnaeTxNpjuLvM502vuulHQgwdTGpwIMjcpOQcOKpnSkGK7nBvkgSnvthXaB+rYsFSLmMPYSdJcJgF3lCU0oDPtiplxDKTyhefNBrZurMqu6i7mMl54rKZ/CKY6sWIGrn8DP2BGN8vb5MJMW2YFK9+kyKfCD920FuI8LnXo1OzL/aWV0DmYHRlWB4EVS8nRBUL7Oovg5hvyleIyxV8aYL4jTtum3ezzP+8D4cKeyi4Y2DlGruGplkyiEilJsJiuCKm7avRECizttWekqcE8s4QvHPctKbzsGHU6aEYgl/d9JSWYuSEbBmtYK7Sfj479HLWzUmkINhFX6jRWWy17dFOevVxfzElb5q07uHxcrUnKgU4e4/uKAI8Z29Anfe7wry1TEm05OJRJN5HOIZ0NT8ynmnNvssYw0acAC1vG7hAQpYrkBpZAChE6W/+Zab/R9sl1ynzFCnMcfakezdNXtYJnoqicWrmpPBOG1n6NxSFbfW5e9IE+YG2RsmJAnx7rK7M+0NavxvSN1lSx46ig+51XTBx3Gsz6C8maEFSdxnkI2SDJwkHaOhzSzIF7xOV6e5B7fuBHGaubdzzVTyaVjrqOPKuRGH1L3nJvyizYy+RlC8LY0I0/dkSe9Frut7X2mme/3PjfQcz0miV8fPw604lzxqIp2I9Sq9VVoNQbjCwkBF3akYq6ke5RQXya4RjpuMP29xmE9xElMUnHUAU82aCGzxesyjakkDycd5bVabH/JDUpDDSAI9anXuiUW5y7WJ/jNy1kOiqvyosN1LqmMwrOdjBofh0lxxxIesuhYdARQYM3CecN1ZKGtyGAvHx+afhnQYjaxvLPoANWMXgML2er7bnvqLnH9EkVv8Lnn7Z46qwU94t8vnlH43c 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:(13230040)(366016)(1800799024)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZxqIcoS3CzWyvEawjVhW2bc1JCHVQtWiXU8Ry4Ns9rNlYdRKbZstuyXVXe2HgM+XPZXMyI5eyrIfpabE31iZLDv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9exsKdG1/glU0T9FsxtcxCEkkuCZ2QJMPE4pyD8AsDZF2m9PSD/NmNy8+ApmMHmN5tiBeCdN+PKSbvDhJ9CT3A0vCNtBdp+vHennLEktXwJR8BPvTqKgm+ltMib2d8r9YW8pvt50rTAkOtQKb9prFlVWFPD16Ea7ii9GunFylSaxmA0mFruq5q+/t8ADf4LUK/Po5JW2keh7lYW5lHgXTjYyDW3rL5dxFxnIe53BiEa6QPEzUa2G0bRV8ZNllSEg8C5ZAxlxPcHLtoStyNhs7emqgNsR9GMEIjQIGDJrbdbRBOord6ftnjvjIQxGOJV1a7TSsT6WCDsjb0IXeEc5j9+qBGXdzSuKrukjtXud9/EfyNgO9vdtslDak1i2K2HbcNwoX78ux/VVDCnXU5jBUf36ncBSWdbJrj8UfT+6GsjujM X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: g2BoJQ1CHnuL322JiKehg+ezvHMpKVmLz913VSxAZWcKHBuTKo12vIy7iDCrpneG2H8xx2+byHagt/c+1GpYlMlXStLVW43c5oaXTTQZww/aGHSZurB1UT9YIrjC8lksNaGjrlwu20h04ZvrFZVvfZtGJ0jHEW/WUXukdaicKr5tMUTYubhlk5imlXp20DMstjpKhZvAMeau5d11aVo4r8obRKhYqem7s8n0Xxbc1ODvkckYNFqPne3heBKg1hX69FbKAjyTOiGb4/vHwEU0zWFB+tdHHCMS10T56ORFWTatlBZNE4djNw3XK6xWJgCgOg3V3bUZcpQs8UcAj2BnKSBAObd+Au6kZKrPV8Htnp7y5CdVHc7YSdIOprS13tdOsspjmupw1UgJF6oCu1f/aXGbSbAs1q5ln1B3iwOTZM4+YSFyTFst7km86JK4XMg6VZRL8PmYp9leP3C+/E5o44l6q7hpHp4Kv5WLHT5jDxUWJ6KSRVtbozd1T75UXeHTzBiJmbhP41jb+ppOSpg6yofhO5V39kAkttzlOz3Rq4FY7lVbTaKKfyK67l4hBrccMGiyAKeEXOBNj2TWeE/DhfWLN0ISkDjHsMJ4IwsrOZM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d43279d6-5be0-44ed-4642-08dd05856f7b X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Nov 2024 14:54:41.8392 (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: RUQ5kPDgvMB5zj5XFzHdxFjHcAjpLmAMIcqrjEOxWOV8Wf6SBjimttzRFSKPuZ8+MM2rzMEIdXJrlEIcR4RjZg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR10MB6913 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-14_05,2024-11-14_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 spamscore=0 bulkscore=0 phishscore=0 mlxscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411150127 X-Proofpoint-GUID: a9Z8aZbqBYbluGDuww95R2dJgnGh32tN X-Proofpoint-ORIG-GUID: a9Z8aZbqBYbluGDuww95R2dJgnGh32tN Currently, fs_devices->fs_info is initialized in btrfs_init_devices_late(), but this occurs too late for find_live_mirror(), which is invoked by load_super_root() much earlier than btrfs_init_devices_late(). Fix this by moving the initialization to open_ctree(), before load_super_root(). Signed-off-by: Anand Jain --- fs/btrfs/disk-io.c | 1 + fs/btrfs/volumes.c | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 814320948645..ab45b02df957 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -3321,6 +3321,7 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device fs_info->sectors_per_page = (PAGE_SIZE >> fs_info->sectorsize_bits); fs_info->csums_per_leaf = BTRFS_MAX_ITEM_SIZE(fs_info) / fs_info->csum_size; fs_info->stripesize = stripesize; + fs_info->fs_devices->fs_info = fs_info; /* * Handle the space caching options appropriately now that we have the diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 1cccaf9c2b0d..fe5ceea2ba0b 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -7568,8 +7568,6 @@ int btrfs_init_devices_late(struct btrfs_fs_info *fs_info) struct btrfs_device *device; int ret = 0; - fs_devices->fs_info = fs_info; - mutex_lock(&fs_devices->device_list_mutex); list_for_each_entry(device, &fs_devices->devices, dev_list) device->fs_info = fs_info;