From patchwork Mon Dec 16 18:13:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13910198 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.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 2E79220767A for ; Mon, 16 Dec 2024 18:14:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734372847; cv=fail; b=bnyG79YusMHHykvBvQQ5ZA9MPlEvhVkNQpmXDEKh1SokA+6YyRaaU4GmY/t9NntxoceqQpEVjZBdaxVjIEXFJEOvFMWaGbRhkWhjHyzK5tqkXwSZeGJ3lhh9VMxXqfIxapqpgtf1dzWS/de+uT0MoBjLORj0Hq4rvLdzkJDceUw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734372847; c=relaxed/simple; bh=6NT2QHRnfPJt27gRj3F2dY37/u1mclj7JuylMQy4/3I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=FIuNqj0X3uW0lUVLfoK7AGNJ/M8kopsHEgDtZXI+hc5rzw7MYGCNq5vsU0b7d3CfLfgr1m0ovBo2gjO2BfasFe//krxRmmsWQJzCXOQ55MHG7GFxJgUN8AO6AICNHqt9G8zA48csSX0Zi1DFz0spJ8wlg/nNGR37n0f1myY7Qis= 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=jK4dHEjn; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=z1eu/cy3; arc=fail smtp.client-ip=205.220.177.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="jK4dHEjn"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="z1eu/cy3" Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BGHQh7t024115; Mon, 16 Dec 2024 18:13:56 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=2KxBn49JUOG5nsjBFXTjqA2e8itFVgNEkch0ty41lEM=; b= jK4dHEjnavJ6TGNNzwVEmDNqUnXgPJXILaigNDKjaNQVPdkhaEicgE+1iOuEDF6l S7yNf6vJCpKkLMMQYzDVt/lTCM2K4hSmYdERzgJTXXSHKH3yScQlQP9P5pWcjxjl CIorJ69jux2dXXm8ymd2NzFa00xCSfL9uQA31u5SyhdpGWe/LG1UuEEaUOCyK01l jPR6i95Le16Ig4WFotSH4jtOo1jAejG+4KdNMF+lePizNkmM2QBqqFTys0aQtkF4 UGMfpmk8DiiV5kEqIVWwPtTx99AoTsKTAeiKbCASLgUDn2xvX5QVdQePhMYy8J28 hLhXCaEq0kUMrsT5IO7JNw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 43h0t2byvc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 16 Dec 2024 18:13:56 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4BGH6pM9032708; Mon, 16 Dec 2024 18:13:55 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2174.outbound.protection.outlook.com [104.47.56.174]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 43h0fdmw3u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 16 Dec 2024 18:13:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mdSpFldkSMrI7cdrnsv/ycXTk6fRbprubwy5GJ+VWZOAyyQ0SptTZwAnZHHjb93h2vGDLAr8guj1ROFwLYETBsYQw+NlT3w/onXdVcctyngNhs73l1Ho0az8CaAu9NdEarlnXu8ooff406qbg6qToMp7SoKRyzTso1jbQvQeOWJ44SU5fY0Wn8QsN/3/lgp9pEVD/cZPRoKyRSYOIb73+w/65q+8ZNumhbodvNOcKWxCjC74EsdTpjzzsxHcjkiJAdJrSvIuGeuXP3p6MvhbzNnoAeLQIOM7QsDgfxcAiBApU/B9Hd+YUJdiaIqMgy9qJG6VXO6R2pztbP2l3rtL8g== 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=2KxBn49JUOG5nsjBFXTjqA2e8itFVgNEkch0ty41lEM=; b=pLFMCzXGEVh2TVNf4znpamKxLxeiVxXB0V1j4+VgXlXi/qdY1xsBJmpo7DLd7Ne7BjGotewB/SYHIdMS+JxKaJAAg8D7CRMZ6iSGeo/Mu5rCLm811kLRINXP7jgP11WsAgtXJpc0UhmVyyYJ516xC6bcv84OubNhUFOHGKAxrg9XnC+MtA+zM5Ot8LIjaV0MjfYVyFkKGD0z9emxeSjA+1RfPs38kGgLZykad5/+rDK3jCxIt/vwFHEJaxO3ew8xoHAuA+LlF3vELBv0LhPjnw6h1PKLZ2b4sVlS7aYy+d8h28362w0SQHvpl/T8xISKIbUBRGf/fH1PCMDfNlLVgw== 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=2KxBn49JUOG5nsjBFXTjqA2e8itFVgNEkch0ty41lEM=; b=z1eu/cy33EDH5fOFO1VPMFvk1VGGCBr3AIrk6fT05lwvpRzWJn7AS//3oevcn8gb7sIpqXkKtUDqq6IP3p8cUAvsJSvB+79rEps/9r4zwx4PDk7st/o3Iyq595a1NHucw9j/3FqKXuGBXvsFsoWcsW6yquRCJzEuTyTUBPfx158= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by MW4PR10MB6653.namprd10.prod.outlook.com (2603:10b6:303:22e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.11; Mon, 16 Dec 2024 18:13:53 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::fea:df00:2d94:cb65]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::fea:df00:2d94:cb65%2]) with mapi id 15.20.8251.015; Mon, 16 Dec 2024 18:13:53 +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 v4 1/9] btrfs: initialize fs_devices->fs_info earlier Date: Tue, 17 Dec 2024 02:13:09 +0800 Message-ID: <767bd0e42792760d77b7e8225111d9c8a6f4039b.1734370092.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: References: X-ClientProxiedBy: MA0PR01CA0048.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a01:81::19) 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_|MW4PR10MB6653:EE_ X-MS-Office365-Filtering-Correlation-Id: 56c8a02a-ba64-4868-6487-08dd1dfd65b3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: AGKkLnm1zFpmRBJeeWq4OfXfR8+MEKX9fpMYcuynIk23BT+tzeRbDfSJ4I2SzqXU5zFHyYJ+EiBtxZOHs1bJgC/VGY6XEZ4qmTCZXcIdf6MWuNpHVNzIL1eWgGGgsnwRap7uM209uJ+foD4jezH4iqctjkudtM5Qh/4JH5zjv9cKhZSCc+hnHQrZdokea+IxaZOD9eNKT3z7kYNQrhaNyTy7bEHut65ky2ph/kf2JegauAF43PFhWIeUvDOq+WGI39fpWZLcWEQMuVDfbfruopxrzPN4bVTuOpF2yIVvMR7Phnd+zmIRODk4IMFHzxJHF/nWLrwHgmssc3ULwafzRU4fWbphoc3MQa/2diRZ0Tobl6OZchaqvfQfNumkWvauwaNmGi6vfH16uebL61Hakb37ny/iQFxCoerUfoWCIZgzhi3CrKGAk5QYqrU0eIXh9URjErOzuUe8XiKQrExRG5GH1FaQbeHHo84qKbTyAoM6vlFbZMedhVrPYpsoggljiMDipPF8gd618Hvoip7Ulp+QuLRLd9lwsL3sjTAzEwtX1tVqZpmGpivT4yuT6OrMmfdHKB8wiGytKNahK4JIGR7af2WQHWudN+1Sd4zxe5zLgSsS4HV2qkk6N9PcGcrSVMHNnvCYBNn6b1cNSzxBu/6XdPX/2LxxOmP/JdBuPSDIn9g6rf2vUcFyAA7/BlR0m2OgXjIhZdyfdfYNDJGeUQyOUdayZSqnbX2Pr+l6HxWowcpt1MCpgIdf3FQLqwNSOv2SE/cHueL+rXAWT+wMiWgloI62wVR0fRodooFk9HFWzXyKirmJEnVg/Zu4csZNRt8a/P7QCv7XoDyvrTD44BTLUSqZYxT8SpOfxfwGIGHTnQgDSKNtuqkr/eVeJq5+VxjjSP/W9+N1j2jcE2Z9aYJZxemVYEedggRAAli4T1U76oktNCw/Mrb2QPQ9iBuwKqX43HtKc3N+EGOuqiPd2suvNsXTF0g17QKdJbbFqAwyKE+hvuaPK1LengKblBsjRdE85EkgjKpnwyHKuIjeaeTqB7AE3q0/i3LV2CZWK6OVJ963M8aJ4rDTjOadJWWA2rvr0B5ZqB2/ttVXTrkKwgpsIZOYGooEJfsbPGEWR5J3NVjRAmEGDZ9ynGr3VPJyZXhLpvVg1mQ3/lV6CF8uDdrQ/ibNld0VR3Sa69K5TltpbSILGhGUzK0GYq5jQ15rG7y47YSN9+zS49syulViZyW/nq+UfkubfrTaMzou8bYsIqSAsx40CnloW0oanA+VEBtuxSoPt8eRQQmQeKLNvi9JicUgKlEOiyid33OXgfyPuRjWep+jdyWsR698evkRxXlR3ulnI1XRCMU4XfCIW5hmOqcuzk3mDzCJYZunh5lbCf4YNPT7u1z/2n36AsOs 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)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-Chunk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tljdxPhcv2hJXZ75WP8R371m/5/FDUwwlrklhQ1yO++CMNqGEha972rNIGLYh3oWFoNoD+H+xJ/0mX70tgCAfXOfabZ3+dDMNUGtUU8oMIH1+V+mqgnCAowVeaOOBz1bdwGByI0fxtr5V/slQVTs26hLVSM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 56c8a02a-ba64-4868-6487-08dd1dfd65b3 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2024 18:13:52.9841 (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: zfzwmQm/nM6HS9ZnNaEjEKrQfa9JmHnhCoSftJEKjBVTvZS7oo2IvQwtCZeQ67Ldq9zL7zSMeV1s//DAlFKbrg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR10MB6653 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-12-16_08,2024-12-16_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 suspectscore=0 adultscore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2411120000 definitions=main-2412160152 X-Proofpoint-ORIG-GUID: entRtgaQ_h9RTRDoR32SVALcCW_u2nBd X-Proofpoint-GUID: entRtgaQ_h9RTRDoR32SVALcCW_u2nBd 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 Reviewed-by: Naohiro Aota --- 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;