From patchwork Wed Jan 8 21:01:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13931552 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 6964A1AA1EE for ; Wed, 8 Jan 2025 21:02:06 +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=1736370128; cv=fail; b=FZFbUmX+FLO/7Mp5wDoVsAb5skLQSUyEvob2OkYIU1RmfujZ8JYT+GdWlv8n72Sje7Ygu8rPWJf9kKGaWtRebKx91gX6n4weEzYNWOvTVKF5wbOiZWz4vX0LuCtcjWDqnRA9+AIchPURtkBJ/ZiH+LFJHuoOPtOlbvv7ZhkecSA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736370128; c=relaxed/simple; bh=V0vzns1PWj+awoiTh2xa7+1knOUk3ZYolKoaACz2B60=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=UcZD6qGYUuMOjXFm84UUJVAkMSrz4jQPF/Ty1v/cNV7gxQ9ls9wce0Ki1EhUjKB03b4JzIf1r9CYNFmBE+usNH8i2eWZtfCLeqcjzvTdXWsds2kHLONJBg7mfoQ/klQCb/lnNetESoNhKXw/xCJKVdRdd/Gy0CW9I80mHfqAvBA= 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=dkpT37G2; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=y9vuujfV; 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="dkpT37G2"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="y9vuujfV" 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 508IMrs4015048; Wed, 8 Jan 2025 21:02:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=ZsVUV2hahfYQ4vRhh2bNjDFUCN+74sGIYirXSVB4QOY=; b= dkpT37G2Qaq7bLyOdBgNpv/WlaYEB68rVhthYFvMwA/A+mQJDCtqSekQjRNKECc/ cpDBbJaTncrEojF6kQ8EipmSByPbydNG24wUyxT/1n5vfuf0o1tp8cYc2eWwOMKo RvgYVYZkRjLLKzkO8R8MasG83vFly45TzSOMmtoGRzbK3hHli2B7nk4/R/+Yd2+d 3SDpvsTf6VdH3e+GYKzRiO3xKWGLs9Za7QzmhA4YEt+bGiFa93p/8mcFV6j60Fuu ttsZrXrz4JwyU7YfgT+RUj+VaN8e8u+j1c5/bD6yzQSdCub/Oicn4r1GOhuKj1ZJ NlyvPSudPw1frPLXy2x9/Q== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 43xus2fsnq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 08 Jan 2025 21:02:03 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 508KIFcG010284; Wed, 8 Jan 2025 21:02:03 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2172.outbound.protection.outlook.com [104.47.59.172]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 43xuea37fv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 08 Jan 2025 21:02:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=U3d9wuGM1uPC6EexX+Zb5oSLltMTZBhNV9hwlyVpt313ObaN1iC3Lpw/TwNs3TS8nA2RhTwH8w3bx9D/WMb5xLUSE4iJ4SkIalDQISkLYV39dAho/BbDpax4/swbWee6k50+mbkAiIbovL7rlHI3hRWQ8ufERdAmNEgS8rUA6BVGscDi5T9tvRTiZ77A1MVK5rgn8bWEhcCbec+vxnXXia7SfQoDuwTHQrkjlTJApKSHEum2QqpXn6VFliSLs95rJtkHvgnkIWwIJ4RqymDaSSWcvhK+4bY/RwqmZJuLjJsHaHgqPsBG2FYhvMqbDT7//8u7ijG82DqpVMRfY7CmJw== 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=ZsVUV2hahfYQ4vRhh2bNjDFUCN+74sGIYirXSVB4QOY=; b=CBtO3XLWpkCqZXfq9B8Ur0UD7AVdvoDJSFJJIo52c2ldgk9s1G7AMg8YEzCWUvekD4CLEsn8NeEdeO0G3UO9h4SghzRKQf+ZwjBkudpq+8keXiAMDHxzg+9jmwmf1UI6McA026wzq96S6ObN602Jqyw7eGLJZ3uLiYaWOrC9NY9TbOGtRP+BR+pL/ydGUTWWBBL5BxRgx94C22XnN3f81580emO0BiNcxIgMmWy3fTBhhna+VZte2MSmuUivrfpje3QAvZmO/yYkwN69EoCNlegK48xC8gitfzOpEs+fsdCA3wmRV9Tj1c6sr+ZynYVt/za2mGi3qp3j2qmddBECfg== 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=ZsVUV2hahfYQ4vRhh2bNjDFUCN+74sGIYirXSVB4QOY=; b=y9vuujfVtJbw5P0JxLyuifLWxgT/qKEcdJz0+VsjyAtkd5BGJNJmY/Nf8eXzXTCx3nQEceZL3kjaxF82MwDUAd/HQHAtpU4W4NDB0pPTKd0KKrcFe6a3BWLwbNpt2bGrcKzhsy0xpqbTzgUBVZIrtFruZhYK2JgbBn0llFXwQ30= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by BY5PR10MB4131.namprd10.prod.outlook.com (2603:10b6:a03:206::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8335.11; Wed, 8 Jan 2025 21:02:01 +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.8335.010; Wed, 8 Jan 2025 21:02:01 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org, dsterba@suse.com Subject: [PATCH 1/2] fixup: btrfs: add tracking of read blocks for read policy Date: Thu, 9 Jan 2025 05:01:35 +0800 Message-ID: <1a227a5a8c9ef60ee1fa55aba8f9a55317b80d23.1736369474.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: References: X-ClientProxiedBy: MAXP287CA0011.INDP287.PROD.OUTLOOK.COM (2603:1096:a00:49::24) 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_|BY5PR10MB4131:EE_ X-MS-Office365-Filtering-Correlation-Id: cb702828-ed22-406d-8a66-08dd3027b25d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|1800799024; X-Microsoft-Antispam-Message-Info: /Biz36hvVrg6GeS/z9Ez18OSLxYV5Q6hG90IO+ht5ucFKi4qC7qmskVCRd8spcLGDIpsvFuQW/euirN+cz+2WkC5MdB24juL2eoytZk1yoY7zTRXsS4pK1SMOgrJxGxKBMSkuJkttON0uBzJuo01vW/u9Yg7cDhunqEY/42Xp3A+hqgqiQS3RzZN1g0edC9iUNmoIVtXOTkoBs8xleUG/t4tEaiYq6rvw4SFhDoFxCRh3kaxHlm0rNiRsWsS+Kwug7M3h04DxEULyWPOIpw9GBz1DWhQCYd5uT9AiYwcog4QDg5JwKm8Kf5ZuzHzkSmt/fgQqDLILLH0aywUXLFt9PSbJPLaMPE6CnxnXiU8hC+7SV0T08E4r9ks9cBohh1M7JZ/sUR385kdyp6lciZYN5rw2YFK4CePuGmg5QDZ4kM3xc5JHKxb/I7hanfkxwRd1ZvLeTRs8rFSbFRX5BiR67Wob58+pAgEB3PphrXqHOb13ad9pjxxpa9HEXDs9ECaTjQPY9dY0WPUcLUoqHvXmb5IRJQZa8e0F8tKXZP4168mnjiiF6a6bFXbgg9iAZU5sA2a74vPS27UQWfbcg9Beu02YuugLZi8WtRZNVeSFZH0s4wvZqPYoQU8YQcQdZ94KLuqcwl5wjxz7ymqTz/SEXCf/6CCA9wM72O1UvwKtYTtPcIWXnBPFv14BWQ4uGs3C4r7jGbsgnsFbpGxiCKcC5gmc3yGwYyJsLGifZ4PRyJ0xsoScmyVyeLvtiGju9f6bbbDfhMbeJ2kcTkttv41JmWv4goeGKWWLDKgUYjns5JLxsLwObx3+D1jR8cf8NoAoX7/hts3NMDJlwvT2Ianvf50AZv7XdE9v199ceywCW+xRHhN3N65+oLGW3lh4+sqjmeBLK19UHL/6CDc+NndIm8ymk3tzAj5Rh4mvwRE/Bz9bK8DFYsLFAPfF9C2h6GTga/Qm3V9p2sjvEE4Xlgw6+g8J0XCrDmD3bfmkQE1P6S7PKxuHHMdOYALRj897zJ+rWJX7RQ/IGF/eroooOOqacLXOYUx+L9tkFmmIp/0i0/GzFf4QhYZVsY+/6FjTVgORSS4tEnVWU7n34Z/gxNZyxX0sS3ut3y3wXmQMGct6tKUShA0mLz8er8WfJU64Oa//8jNU+yK6nLQVmm3HiCCM6XjpcMO9B0gsN3z2FKUP/Ltq9aVXvJrZrkxybQJ0dBN7J3y9Y8lNjte4Q3zF4y5yDBRyOoAOYt0OCxd7/Gza231dkWYb+iSXp0vK9lhIlsZa6bx6QNWiQN0yDs1DMK4/PXLm0qxS+zliqcPA38dI3ogaEoYXRn5fMJUPrUcjNiBbYjxd9zWcf/eSKmJe/q8bA== 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)(376014)(366016)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TW5vTiI6zMLxUERCUlhT7jqr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yxyEkWXcf4GBlyWQn+SXDunkqt5Pl4CMC/P02SCbEyOC9S5nxWqdrrHVumTRnLGEBRxEaU+r2e5xOYuaGH5DMx7KgYExeUzphvczmh0aqo+WJraTXMY0hHd8= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cb702828-ed22-406d-8a66-08dd3027b25d X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2025 21:02:01.4172 (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: 6Z3rwB0LR1YdPw6TDzwdMAenq8fxJrYAv/kJn0tg04QICY97+uA7pzTTRc+jZoBcgb0NOOmg1+m8nbHMwuNsRQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4131 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=2025-01-08_05,2025-01-08_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2411120000 definitions=main-2501080171 X-Proofpoint-ORIG-GUID: H-kATZN3YWKo0gCbrLdX-BezW5wvy1z4 X-Proofpoint-GUID: H-kATZN3YWKo0gCbrLdX-BezW5wvy1z4 Move stats_read_blocks from btrfs_fs_devices to btrfs_fs_info and its init and destroy. This is based on the `for-next` branch in the repo github.com/btrfs/linux.git. Fixes: 49136a74162e btrfs: add tracking of read blocks for read policy Signed-off-by: Anand Jain --- fs/btrfs/bio.c | 2 +- fs/btrfs/disk-io.c | 5 +++++ fs/btrfs/fs.h | 3 +++ fs/btrfs/volumes.c | 6 ------ fs/btrfs/volumes.h | 3 --- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c index afff205ef671..bc2555c44a12 100644 --- a/fs/btrfs/bio.c +++ b/fs/btrfs/bio.c @@ -458,7 +458,7 @@ static void btrfs_submit_dev_bio(struct btrfs_device *dev, struct bio *bio) * filesystem is fully initialized. */ if (dev->fs_devices->collect_fs_stats && bio_op(bio) == REQ_OP_READ && dev->fs_info) - percpu_counter_add(&dev->fs_devices->stats_read_blocks, + percpu_counter_add(&dev->fs_info->stats_read_blocks, bio->bi_iter.bi_size >> dev->fs_info->sectorsize_bits); if (bio->bi_opf & REQ_BTRFS_CGROUP_PUNT) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 4928bf2cd07f..ef3121b55c50 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1258,6 +1258,7 @@ void btrfs_free_fs_info(struct btrfs_fs_info *fs_info) { struct percpu_counter *em_counter = &fs_info->evictable_extent_maps; + percpu_counter_destroy(&fs_info->stats_read_blocks); percpu_counter_destroy(&fs_info->dirty_metadata_bytes); percpu_counter_destroy(&fs_info->delalloc_bytes); percpu_counter_destroy(&fs_info->ordered_bytes); @@ -2923,6 +2924,10 @@ static int init_mount_fs_info(struct btrfs_fs_info *fs_info, struct super_block if (ret) return ret; + ret = percpu_counter_init(&fs_info->stats_read_blocks, 0, GFP_KERNEL); + if (ret) + return ret; + fs_info->dirty_metadata_batch = PAGE_SIZE * (1 + ilog2(nr_cpu_ids)); diff --git a/fs/btrfs/fs.h b/fs/btrfs/fs.h index be8c32d1a7bb..b572d6b9730b 100644 --- a/fs/btrfs/fs.h +++ b/fs/btrfs/fs.h @@ -627,6 +627,9 @@ struct btrfs_fs_info { struct kobject *qgroups_kobj; struct kobject *discard_kobj; + /* Track the number of blocks (sectors) read by the filesystem. */ + struct percpu_counter stats_read_blocks; + /* Used to keep from writing metadata until there is a nice batch */ struct percpu_counter dirty_metadata_bytes; struct percpu_counter delalloc_bytes; diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index c02d551b73a7..e0c64246f8f6 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -1255,7 +1255,6 @@ static void close_fs_devices(struct btrfs_fs_devices *fs_devices) list_for_each_entry_safe(device, tmp, &fs_devices->devices, dev_list) btrfs_close_one_device(device); - percpu_counter_destroy(&fs_devices->stats_read_blocks); WARN_ON(fs_devices->open_devices); WARN_ON(fs_devices->rw_devices); fs_devices->opened = 0; @@ -1303,11 +1302,6 @@ static int open_fs_devices(struct btrfs_fs_devices *fs_devices, s64 __maybe_unused value = 0; int ret = 0; - /* Initialize the in-memory record of filesystem read count. */ - ret = percpu_counter_init(&fs_devices->stats_read_blocks, 0, GFP_KERNEL); - if (ret) - return ret; - list_for_each_entry_safe(device, tmp_device, &fs_devices->devices, dev_list) { int ret2; diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index f197e152f318..120f65e21eeb 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h @@ -438,9 +438,6 @@ struct btrfs_fs_devices { enum btrfs_chunk_allocation_policy chunk_alloc_policy; - /* Track the number of blocks (sectors) read by the filesystem. */ - struct percpu_counter stats_read_blocks; - /* Policy used to read the mirrored stripes. */ enum btrfs_read_policy read_policy; From patchwork Wed Jan 8 21:01:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13931553 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 2BCE21AA1EE for ; Wed, 8 Jan 2025 21:02:11 +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=1736370132; cv=fail; b=PGoHdL6TyoGduC9SL67TlFStQosJThP5M8nFZHgpmOLN1Fe+dcAx8YUnQzan6qgWRqQtK8VeSCdRbPKxIYKbNqhcrnotUw7AJ/r7CzpajMu0n8ovJIWgYzFPPqKHOkZb7NdZcgwbqSY3mpg2K6QRzv5+uLo3+soEIoJW7tqCcVs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736370132; c=relaxed/simple; bh=ete0NtSChlwiqyjBqk8ohxJZrcvF7tk39ksdSaq1RGY=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=F2yYCAbsqd7FYmnQvh5waW4L9N0d3cFR9KAmcp0fxPc1/jbpzASV/LM2XvMU34cVJZxbDGGihVrpwo/5jhLzrCcXPiI1OaUYDVKIKew+vjVjh4KDBhxBC4Leym5fsmKevk+lzmd6raca11GN5nGnbFCSA836iJbdStBrH4mCc9Y= 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=ihZnCAJG; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=rQAF4w/w; 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="ihZnCAJG"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="rQAF4w/w" Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 508IMrZO029521; Wed, 8 Jan 2025 21:02:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=N8d3CzRXGNpBlymLfP09c4jGUhNtS8eb4vbJZrg9/Ho=; b= ihZnCAJG7J0lZz1bNwaSfWu39g3lAXQHiBk472uQgyYCC4WRdktxKlcFxMg0/ws/ txLjt6E0mdpy9Kr85rtY7BY78Rw0MEJz1Ti1LCqPaaBDdFR8l5LWJqurr8oi4Urp Fh29RvEyA4RpjRhtyPn3viCUKF7nqg4lfjfAvV4H1NZMqT6fGxi4bJ/0E0YDm5U9 urzvG2aSwhYiArr1tOZ/KEJ1zfnZhXvbUhwmNLGFL/HdstLkjvRedhSuVvEw24AC PzbitKi0eqwML2aIJce6bRUSyflD76fRrkKaim70A338WpFTj77ojAryPTrZYxiu jjDzQO+gFPsGEnmLmFY/Gw== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 43xuk080pp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 08 Jan 2025 21:02:08 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 508JtVgZ002803; Wed, 8 Jan 2025 21:02:08 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2172.outbound.protection.outlook.com [104.47.55.172]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 43xuea96c5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 08 Jan 2025 21:02:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pRicNN1IHRPsod4cndW5olKeknw6VguundfXb+gfnNIEAYFQUC+Qz9Tq5SIC2SNI3fM0nILkbJ2TEZ7KFleeNakwNuCKwivpJuZ0G+gV62z3ys+E+ajR98Og+Z5tuA99oZufP9Hu9dFBn1cxV6+d76ohjnR1usTqqDCL80Ddz9Ab0lcREAiRSg+n2MJVtd58E+WFjPQHPSTY9gbDzrQgiUrEndXccposMh1z77IPb16uSvKGZF0YAg3+BOM71U6DiYnhBnfW4ftHD0tdy2uHkA5K6eKOin2czZZav3DHNcKYZeM7pGp4PC3pXdodfWCDuBSn1KlKflFxLuuPGVijWg== 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=N8d3CzRXGNpBlymLfP09c4jGUhNtS8eb4vbJZrg9/Ho=; b=hGt8AgaS2D6wJXl4e1Mo0ho46sJxXQ/ERQFkzF1qMJFSaCzwA0iCjBoy1gRMpQPJNfIc47H/1WHzrgH4/mGBxp5jji0EYYh2wGRCct6BbRc26cx50xBuvUtBl+pHt4crAWnEKnOv90jwp5Iij/3r44793X3+7fVqfumaTatEYriHuVB209vhge9lkFAtJbk1VN0zMWbvcT9iUtbbgPqSY3haadAhck53ZTd5gkluzjgCOQ8O+9J5jXteu+mqmqSpuYIF5sphQ7j4iTE3axVj2fCINVcQLOqczS7357Vh4Q+i0d8HzpCfUlZXXLqeHLOx7VShatK5cFudshWzm8HILg== 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=N8d3CzRXGNpBlymLfP09c4jGUhNtS8eb4vbJZrg9/Ho=; b=rQAF4w/wpojAkcRzEtRHiGFMwmnsipdL4u3IMCHYonsYHVFbypszVA7Hp+pTP2SogScwznGBGmsGM6t66BwJWTwfO92pmNYYTsHqeLk+x3pGgZksEIrjvd01W7OMvrxEjQUUZRuq6rqM3zXnix/Hk/SMLdegB2IawOLf9PSdko8= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by BY5PR10MB4131.namprd10.prod.outlook.com (2603:10b6:a03:206::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8335.11; Wed, 8 Jan 2025 21:02:06 +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.8335.010; Wed, 8 Jan 2025 21:02:05 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org, dsterba@suse.com Subject: [PATCH 2/2] fixup: btrfs: introduce RAID1 round-robin read balancing Date: Thu, 9 Jan 2025 05:01:36 +0800 Message-ID: X-Mailer: git-send-email 2.47.0 In-Reply-To: References: X-ClientProxiedBy: MA0PR01CA0026.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a01:b8::14) 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_|BY5PR10MB4131:EE_ X-MS-Office365-Filtering-Correlation-Id: 291a71bd-4271-419a-45b6-08dd3027b507 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|1800799024; X-Microsoft-Antispam-Message-Info: MwmCxdmQnOEF3kGZxHEGGXWpcwbgOKRxIMTogaofFiSAQMojsDqY9JOnryKBBV3QL15x00hbZnqhSqrU/9aMH7TMZ3zsKuryE4PDS7qEz+fP/7BQvrGaHxFZHDC+F8oRr2rnrf4ID4Cufowueoe2XRfslb0h+6GNlis0MxRRxgt7TUFufijaT7N6fBzHYlKMbxCOqrWXTm5CStA8WisQLuWZHKFNT7NfabSMZW4CfrLoWUm1SDfKyxSpc5SmK+RCx3ZPfteQ60zYhcXDtb2SRLLMbkFoM5D20xeRKCwcjIcjtpfyCmfLM/6rSLMN/0nu7HpWBUWePlvAX1P1kI+X+QJBj2UCPkzMEn961LgQEqiP+FAgbGsH+Z2L6/Tb6u9sPjAQvtU9wBz7SRIeaMPHwoVafITUeLLaDJ5FTZIiJdWnHR7M7BETm90VXiswn/fSM/ogWwlVrH/Q+IOKu6F1WhhJycaUMdyhJcJqE5cllrxK3DrIi6y4mviy8eYOSP3WcI+6rfNTn9Q/UeRl7aVAt2f8YM2YFvrVZk3iEYRPKK907XnLBO/CvGtXf0oKHsnCT0kKTKlo7HXCerLGMEFoKtxELv4Qw0ahGxrL05+et+ppnCi3XogVm+i5p5LyCfdu1ihz+BRf3vqGUqTedadP+9mRRL39s9+bkYDRxX182BIEKK6/jcEOqgIidA/yOhEiKQXAujBHA51Lpkwv93wxSJ/z176MTR2E+5B5P0tScYAD63Zc3B0gGGk9YnRWo7+PmKvE/kkmZeSJi+JMmlwlXlCoEOxZHppXU5eK30cfbQojZyLAk22HTASFcxTOX5freXQUh+i1ej2QCTO4bYPy1gUe26sBj1tKCapbJFzZIlWdKVC3OYoJY8pMtMklbo5l/nndm852xqxlfpcgG2SDrYgsAop3vy3pWm4jepMp2sq+8h6AG4Ia2oi3GrJqUGIDTiHW+T4FROITDLhS1ZGtEItWieJ4me58K/DEDis5Q099Jt1cafC2US9iYbYXDd5hPuonONaNXcR9ibP7AOsgvRrnEEHYraW9Ota/jUCdf6oTUxtQZ3XERssfahenNIZ8goMRKreux6FuoiSzvzC/11X/uQx11lCP72RMNvqUFdUdFdkEbkyloCBt7KR/OCkz3xzbH5aKIq8QK42oHt1MvN3/a0ZEPvP+NHyOvKPTKzsCv8ZJj2biG3x7c/P85DFraT2S6qF8nAAE9w1eu4Cmc5Q18G0mOyJQyhysFEYM1bsNLZlkQhqS8YelF+voaJSIL+on47DkeqiFIRZNcWJg9WdEDQvNPDNiD3lnVY/ycVAPHjQGzJWh60tmntO3n+noGitbI17bHOW6dabfnsKJ7g== 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)(376014)(366016)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ox/gPNSBf35k/7HwlCJ4tx1D/sSE7+2XiwjERSmFhkbWrZygGjSqyIkur3XTpDXRcQnVf+56irsrr0U9o9kWp9YXSUjmJq3mJQU7jaS8lbvDTt/FSxGvxyEwiL3BUn6/rWtfhlihQsUyDWWuVYnQUQ8YxPF6briqzAomdk0Vco2IzLFNnxkk+XimjOyG3j7ks+mbK+N6c8gT8FlK8t/ftAKQxXYbyTpXwM6QyO4vjWfyTuhiaQZSxWZvO/9KXQVfwhjaGl1ltZbg6NFkWm8oPh1hfv+M/7i9eay6VmrnqFwLHI/X/+aDbUPP4gh4D5OMASqAe3L/1cqEVsvCl34xdeTkDrh1muLrZ4Fu/zsotdNdG+JVJo11zmQM/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kb6MwqrnBkIetobRw/zQYV0VFdZmzCNX3C5NgASva+mxCus8ZJReytLP7jfzs3W+vvJg8RqGW2ViNqknWAuxHCs5WPmobd1/GCScVhU+OrchMP/SWUKICSZiYXgKYB0NPNPvP1wVHUyqfv583Gq X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: dpE80ow3r/Ig0b+0VCUVQw54L8Urt4+kUqSs7oBaId13r0i8kY6p+KlPOzs7mdS4rhk6S+bYvymFlEOFUsRubW+0tr+CvZiODR5GaPOvKOPPO/eUL1pF43B8Uxz4ZvUDZ0MKU6F0u5HvtykzWuMWYZDMZG8UCeDG03fFJDnrdakLmjftEMmctSMD7WDJmu6sQlmplp19rQsYMtzCbB6wVLu2UAYFfXtKBdZ1Mci3SC8NOxXc/XGvUeCrskXbJAGq29knwWtEQXDGxrV+9q+7ex+miV0dMf9r/8MaoSir1sKAWN8wzZqq5+LCWgZCADtaVeIXfKxQGYdgv8Jhop8fi1SSYxQ/w3kEtr00mH9trtpHnPJvEius5tVLWDBR8MDxRle8ujtjUfd44TT1GEOlJ29JuKFHN9yvH2V59mvsfjQfdegreVO8JXQfufQwiQgj1Qva9SS5ofLOUSOjyniAqUczFOk9IMWHBZQnTh4RYVKhCvIDOr9o3Vn3GXc2GJjwuYsNII1hROi+pW1ja5X5YqTaJ5mWMoH1lTltfDjjPaX2omoyJRjpamWImMl4bBbRwdVHI+JHJLy4mgz0/O0QdvchsjHYsWf1FWppQianCJE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 291a71bd-4271-419a-45b6-08dd3027b507 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2025 21:02:05.8839 (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: 5ETU1CefzxJiPHBdcvk//XCDPFw7JhXREVxi94caiKdyLaK67DxgV4hMXrpKil1onFXHl0bocyvaApZT/d/hGQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4131 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=2025-01-08_05,2025-01-08_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 suspectscore=0 adultscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2411120000 definitions=main-2501080171 X-Proofpoint-ORIG-GUID: 9FAjIKZN_vOavIJ--CmkpD-mODhrAPJi X-Proofpoint-GUID: 9FAjIKZN_vOavIJ--CmkpD-mODhrAPJi The member stats_read_blocks has been moved to fs_info, so update its usage accordingly in btrfs_read_rr(). This is based on the `for-next` branch in the repo github.com/btrfs/linux.git. Fixes: ee37a901a9d2 btrfs: introduce RAID1 round-robin read balancing Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index e0c64246f8f6..a594f66daedf 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -6018,21 +6018,22 @@ static int btrfs_read_rr(const struct btrfs_chunk_map *map, int first, int num_s { struct stripe_mirror stripes[BTRFS_RAID1_MAX_MIRRORS] = { 0 }; struct btrfs_device *device = map->stripes[first].dev; - struct btrfs_fs_devices *fs_devices = device->fs_devices; + struct btrfs_fs_info *fs_info = device->fs_devices->fs_info; unsigned int read_cycle; unsigned int total_reads; unsigned int min_reads_per_dev; - total_reads = percpu_counter_sum(&fs_devices->stats_read_blocks); - min_reads_per_dev = READ_ONCE(fs_devices->rr_min_contig_read) >> - fs_devices->fs_info->sectorsize_bits; + total_reads = percpu_counter_sum(&fs_info->stats_read_blocks); + min_reads_per_dev = READ_ONCE(fs_info->fs_devices->rr_min_contig_read) >> + fs_info->sectorsize_bits; for (int index = 0, i = first; i < first + num_stripes; i++) { stripes[index].devid = map->stripes[i].dev->devid; stripes[index].num = i; index++; } - sort(stripes, num_stripes, sizeof(struct stripe_mirror), btrfs_cmp_devid, NULL); + sort(stripes, num_stripes, sizeof(struct stripe_mirror), + btrfs_cmp_devid, NULL); read_cycle = total_reads / min_reads_per_dev; return stripes[read_cycle % num_stripes].num;