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; From patchwork Fri Nov 15 14:54:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13876345 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 752881CEACD for ; Fri, 15 Nov 2024 14:55:01 +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=1731682503; cv=fail; b=M3NPfvDL4+y73PQwMiA9vu2qk78Ek68V6IR1xkoF9gsEgUUYNQLebcRfQKctcB2Ptz5J2/DnkDgY4Ks/dOcaVfJduJawk4krDntB5vVNk/dNnfTecZc/QjQKkoPaFdqKtPfStlo+Y6Ae2uaHT5R7HpTv0RNqLJStjm0RiL/7qto= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731682503; c=relaxed/simple; bh=s9VohoOtQQ6feG/Kuy2Lrlg9a5F12+nFzMpdpKvd8eY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=bqfDeNY5Y/mZKp7eomhVqis64l4whvhIxa7fJOPItzXw13QYZI0LtUMS02QNL+xAtEqxFkXf7qsi2/A+9w0S3vJJAZmKA2CTYufzB/rmu0/JjN4tNhYmd2oYcnGR4YsqAzoGYfCIYYgdgaazIOf4IHK0hKQl+jOMoQT3K9+C4fI= 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=g5wGTvEd; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=F9dx6jbU; 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="g5wGTvEd"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="F9dx6jbU" Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AFDCTEq005665; Fri, 15 Nov 2024 14:54:52 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=Z/aNA4znFofwpOT/8JxRRYXNNDek0WXFYL//ac/abG0=; b= g5wGTvEd45TIdBpxjHuevAAQiVKfqZoJvnpLeuhKFMLtybfPOKUc3v26i62cnKY7 qTtR3Dw+mLdfw4YxLZnKvUtdO3yw6VzKZar/kGQf9K2x+DQ8TqjN5RFK0Pw3EIr1 UJ7MBD7bo1i8AKOw/4pSEqqg2cqzAFr+GLfjM1iQ/e0kHfkoZflxCOJi1+rUOj8y hH8ZlY62KUe3AMJmqZGWL6VxTiOjh+6RVS1LAbstjJ8k7k/3Kzi9KqccawatHL5F 9YXV5DwZEgMyCHgBzorR9Fp63/FH5irOocWievJTW+uMyMdHNTZa4Yx+XRR9tFcG eivuUzyiqPQAfosBaJJTZw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42t0mbkmnd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Nov 2024 14:54:51 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4AFEbrxK001160; Fri, 15 Nov 2024 14:54:50 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2172.outbound.protection.outlook.com [104.47.58.172]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 42sx6cnm17-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Nov 2024 14:54:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=joXJndvgZGkLWsEUjgrDtZX0wheTBiwu3YTg2oOh9NU+t6W3cIg1L3hfsvop+1SCN+aKNuXbNOmz5h7AIdEU66y74+vhSEJHsWni5Ra6X+4O32lRLQxNg3ZwTfcoX1gE7D5H1+gP7euDT6pWoohrNFD331Tug1NenA9uI03pN3u4T8M7Y4fdC5p1hbPRlTEidaOkE6Vre6ZQZ0hOwUYT/qCatxpZFWidLYwzwSUGFViu83vMmSMKnFo4KVicbuOeq5nQ0mAcSDfyFmJFpDnHbkEcxi58CVfXxd5UOVYxSSTIsyTzfhir1amexjK2o2NtRBQROTLPsPUFrf4ytlmKxQ== 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=Z/aNA4znFofwpOT/8JxRRYXNNDek0WXFYL//ac/abG0=; b=MjaDGxkb03f+ljYUaaDR1/8lYIiPbR2WRzJ1qKkXeYc3DH3r0PzuWaRhTyXm3NnfVl7UWz98vIpY8phj9tpCzHv+bH5gb1zVKs5tiXHZNqBV8HpnCstP7/PU+WR/+VmVrYtDlQBmeqWZtqIqIAbvxDL6ZynZvtarlgp+kQz6UVtbn+PXBlBTEF7hs054joUa/HbQNtWaC9oz15XJVLx4QiDhA3K9xRIsC0OSIJOTqB9PZwhX8AFk1/N46/sB8Jw8JMR8Orsv6JZvFN//oUpdtamP+kArnCQFw4h0JTNy4MNtuuRqcMOh9XGLPmxtHkJR8Gj7XEhUE/SeZDdA89K/Fg== 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=Z/aNA4znFofwpOT/8JxRRYXNNDek0WXFYL//ac/abG0=; b=F9dx6jbUVTfyNt8Wf1xj3KngRvDHqFHXtoCtSObDJilx9xGrZk1pwR2Vk6C5ZcBmToAnnfo4x9+MzH42FKzJTei/w/RN5N4vfH+zCWYZqSTxPAXZgCsc2xIORKCuD34T7bzTNbh2No7iAAXeUUjRdrfBWVajFebD9qUY+Q25o74= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by PH0PR10MB4582.namprd10.prod.outlook.com (2603:10b6:510:39::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.19; Fri, 15 Nov 2024 14:54:46 +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:46 +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 02/10] btrfs: simplify output formatting in btrfs_read_policy_show Date: Fri, 15 Nov 2024 22:54:02 +0800 Message-ID: <52368693c79f21276e1f633f446a82f10ab548d1.1731076425.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.46.1 In-Reply-To: References: X-ClientProxiedBy: SG2PR02CA0001.apcprd02.prod.outlook.com (2603:1096:3:17::13) 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_|PH0PR10MB4582:EE_ X-MS-Office365-Filtering-Correlation-Id: 6f07246d-3ac5-467d-a5bb-08dd058571a4 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: LcIdSoShZIHavypPYU+vIK4z8ZO20ZyPyk0rCLj2/jGx21kDCgtyotjIdz5x2Y41W7tm58Iq6qOem58yaQQeCLwVNaDmFF6WuU+/DUERGz8vThrNeU8YSfzz+E4vg3/Hfy7wLLjblGnbylXpL6cHLtH8dTKTfKxCPc+C+P7Vfs8JlC9+zDOlafAsEwK/qY3cgQRlTTmDKgH6gmLIX1wqgGEsXYtw/G59z9Vo64DC+HreIHZtNPk8zPa3ylKjtdRLakI6qDyYavLWtZnZJLwOU1mrHnEF8h+tmwhSCtMKk6RyFYicNxea274WfU6WE0pjf8y084bcdGuoXs6K8XlejshfSMQU172q+6J0XDykRVBmn+nWZ+ewNxsEGHFgIDEsyDvXYGu8ao3vTpiE4DlIptm83qoASR2t3coZNG5iB7LI3tuYheKoUkX+8q1937zkvAQ6VxpCB0ZDj95QtjEFlj5B90usEDqGHbit/6AdlzYTbkETSA2rPVuswr78wq3tShELV9AOoiD/FHF8RjrWWkYneiFCP90PaRWwLj7bsM9mETnth9axL1nEDcbYXe7wQLmZ9rSKaMIwu6KXtkLG6Wb63+usu2VZwzqEvPj1sip/3Gs3WRGHt2YS0HBWwLd9fbpiQIatN0agozifOjR2e9OfX4pZOUQkrvnrIsfXdeY/TtrbZJ66m49+0hhfwTtBYzNjs79Gto2xi46tRrExir199JGIaYCxUPO2KqY96kHKIVgpjEqbq/sZq/4sGV84+HmBu+/WqC9J4lhTDZj/F5jpVc921CarZfx1fQjIMR6D2htur1B0u9tVAlJProJUHmX8qWwV5N8QVQ/dLezrlzwhaZCNlz9w3Ak010wL4FsrHLct2BUnl96xP89NIBvzc361HbNg29jZdNqFWI84ZP5JQuUqNn/AsBAH6UWnNzo1/BmjsPmDdb90qdVkbU6eT2ceVOY4MeTIpzsWlsA21vwSkg8dPuKulR+iIOdg6CVc11BPHSff2+lXrzZJGTCtR96Zu0paYZetuB4pdVg6HaS6DSfgaidyE3hVIt1ASkBJ3Emq/IX+dV9+qBgbLBlYCzY6H1jrV0S/8+K4J24UlkwMaQP8JuAJTelf0znWybV0RhYIn7ZZvJtalEwkePZkxlQHKlPuHzqfT2pFaeMRYdSfmbaauylBQROvEK617WpEtrLZqagptzAruyXmzB7Zn/fa9bk6U5og0n/wFge8DWdAJHvc3bxK1rvwCaJYnibw4sh6LkVhcqiAOdjbnU/TbMMnI+/y2Uwmpd7VE/oz2Qxl+f07j+lKB2MCej2sB6lStRfkBm87FjcvtL72Clf+ 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: WxkflNF00/irjHOhgRfL8P55t5OSE9QP1na2RKEx9IrU1AwGeLpnWaeTJDg2VYzCXvkYws2Chu0rnbeuRdC+UYgMBedhRuPK2ZE0pxjLNRdFYL8pCjIBYFr1NY7V8hus8OqaDvtKHwk+gdBpNGG/GPUXSt43NKBgjA3XEmtvB5kFnmi5HIjXZnU7lE53DyjF+raLOeohs8KgzHlBRgrT/AO+No9oefE6iPMQPb1Q1+eW+6aZMSrHz6CgV/sQJuiMGOVOx/+LS+hbSKs5GnjO87XR/CCoqRf8gvONNgBPrtTKJRz94UFpSC2idUTrb7yQFln4Wy3IG2T8CEZ0Aq6NiBsU1CXQo4m5RV204SxfO/K0ZWVHBCxPbejXSwJqKwLZRv6eglKaL4zctqQLgY57/QWfKjrpskwENg3u9B573bdJby48tvJ10yhNo8aJUZbReubiOmrT8WilvJm48GU8rtu+pL7mubRKxuC3fYyFOUUzZOcg4a5w4xogyISqKp2nM3tIT5qltAh0WGi7kMbI9fjNwcLwdvgqfV13z1yLMJ5/6TKUyoRmY/vceMMGHvnRRr98wl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ageData-0: ockfgJiHcAWJtaySX6DPKTRHmlQSNV0mYR6KphQB6cPdepNA/nZgR/VV2Hl2l6YHw08FaqMZxSpVtebt9+q8mplEWv7KwBeWNPG5+rX2s6B4boBLss95vb/1RosmpoCs2IvM1qTROyKPIWXa/kYwYbjCwRD0ad/y6ok5e2TsrEmw/V44fhvoCKh/zBdOMsRlZMChbLCIgAbr7v8mDqxrSPL6OV0M8Aio61sshJigk8ZJQ0sSThAJR7aZC5ekN2h4Kwg/2dYPJ1y8lELls/edHxXi2zrPnKjR4lIouPIiQT1L1JpCw7a1tTXuuzJ1Tj9KaFwC9l40O5dBGNZDXGEUiVw1yzkialdpb9kpIyH9q/VASEMfWhyVSCnDjqC8HC+K289rJuD/x9upVzLsfm/meP/Q69CkZI+KHLnT9Tfpfas1Cns36uHzFVJ6jE8RvoV0t3T23kV67SfZGdbYWbStR1bDieU5gvYk8jAwy9kRHD7dtPVrJtndVhpIUV66wN+lpYpYxg5FxmUwu+OGqTLXvTPrYG4cY1RomLFeR116deA+/nbdRi0oDGlCreZQC7z1bQ4TlBmOZqxocPVvDMAmLWdTnzJ1uGL7AFg9pwFInc4= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6f07246d-3ac5-467d-a5bb-08dd058571a4 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:46.1513 (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: ZkcuAxpqdROVnLP7pZd6t7YNjCUSFzm6OsNELaTkmuMUdVYJ5zsjBpt19XayWXh42O6EBO2n6Iui1ZiTR22htA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB4582 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 malwarescore=0 adultscore=0 phishscore=0 bulkscore=0 suspectscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411150127 X-Proofpoint-GUID: c1pZNVoM-bTvIaz3IOhktuqMpewUQiYB X-Proofpoint-ORIG-GUID: c1pZNVoM-bTvIaz3IOhktuqMpewUQiYB Refactor the logic in btrfs_read_policy_show() to streamline the formatting of read policies output. Streamline the space and bracket handling around the active policy without altering the functional output. This is in preparation to add more methods. Signed-off-by: Anand Jain --- fs/btrfs/sysfs.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index b843308e2bc6..fd3c49c6c3c5 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c @@ -1316,14 +1316,16 @@ static ssize_t btrfs_read_policy_show(struct kobject *kobj, int i; for (i = 0; i < BTRFS_NR_READ_POLICY; i++) { - if (policy == i) - ret += sysfs_emit_at(buf, ret, "%s[%s]", - (ret == 0 ? "" : " "), - btrfs_read_policy_name[i]); - else - ret += sysfs_emit_at(buf, ret, "%s%s", - (ret == 0 ? "" : " "), - btrfs_read_policy_name[i]); + if (ret != 0) + ret += sysfs_emit_at(buf, ret, " "); + + if (i == policy) + ret += sysfs_emit_at(buf, ret, "["); + + ret += sysfs_emit_at(buf, ret, "%s", btrfs_read_policy_name[i]); + + if (i == policy) + ret += sysfs_emit_at(buf, ret, "]"); } ret += sysfs_emit_at(buf, ret, "\n"); From patchwork Fri Nov 15 14:54:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13876346 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 D9D961D434F for ; Fri, 15 Nov 2024 14:55:03 +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=1731682508; cv=fail; b=AvovLdGmzi5tPEjaFySiCtafwlrb7kklfSF0T0jMOBJ8ANcj7Vl1sKVfuTTYJ9qVeilpiqhOpK778cLrcrfdvw3eP19TUgCEmAjKIw0uvWHq5OmYTXrzqXCFmqsS3m0ExP9vPmHmtsO70A2/IXWvwiwrgIm2sFtCEiO/tQ7ZVhg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731682508; c=relaxed/simple; bh=BFHDymGuUvk83r1iZqYOf+MeW97zo1o/Nzb0D0VFGeo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=W0pNl9V9I+TcIDQsVd1JNn1kEgq087M945N5KO7oooeCpJ9PnbFlbf1ZkVnO+H4YsBhrv5JXsgcjZuKDJ1Ak1Ou7DUGZROFbq3W+MllML5K1Xij+KGnCiTQzwnfjEvJaVvWoKm2l/fY/+MeNHH9tK5ibmmgNztJ3Y67/abPqFVs= 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=AuL8NdMI; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=QirRSYqw; 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="AuL8NdMI"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="QirRSYqw" Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AFDCQOM029312; Fri, 15 Nov 2024 14:54:54 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=SPMWIWztqEvnLtlYQfvugE0wdPJMjhoKrctVm4Vwn1Q=; b= AuL8NdMIShhmbuMYr6MphZHKyzFEP3AnBE41bSXZtCQcae/1abxj2Op81aZiFTxa 5O+Uv0AsnsviX9ldF1bz7biAw815Nv+qGt1iefzJRe4nj4RGLiTROnSC5CP3GBm/ OFsor+AleyCSNYHK9uQ7sGB+miqZ7ByFOI+eNtyL3JR6U3SbPAyZMshaVkuKpdYp HJlQmpv6w+xPelOwocgWlSi0C+yt3fhLuUAj+BmUaenT+imXvsQEfVkgFm1Wa38X QrNyXZW3LyvB3szoxc9tocs2eqydOUV4NnHposcMGsrSxcqMM2QB/4HmpyVZbClY EPNyAuIOejbRGCLYPZ6iqA== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42t0nwukad-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Nov 2024 14:54:53 +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 4AFE19F6036149; Fri, 15 Nov 2024 14:54:52 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2175.outbound.protection.outlook.com [104.47.56.175]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42sx6c9ebw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Nov 2024 14:54:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KNzx0hbtb0rloJaoqtoBuijHGizabprzI1YUZCd1n81SHYcYSVtLdlIdlIJEJyBg6hhcxcyFtLfxWZ/ZLR277XqBvrl8DKMfd5oXX5k3aGCnC/lMQBcf2pusxDhbCi9l1FiLltS+jkT249k9P61c9YB5PzWuXf7LCmcnhSVLSmj6VTYzUjMBYQafQWOx1x0IKYz8LiI0EsIxqz26Ni7yqVZiS36tDi/4AH7xAlBGoisvaUF4Kc9dDSA0AX7nJjL23JL3ormsLwhVwa8NQrsqrHShvhZ6sX0nTCA9ltXlPLMGOIWgxDTe5tMFnDIZwUcLy0/GnKjFi8/deBkmnvtLBQ== 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=SPMWIWztqEvnLtlYQfvugE0wdPJMjhoKrctVm4Vwn1Q=; b=Aods9krkcuG3ZRk7DnzpSfKLsS1BDEX/4/XcGavR5pA03rteVKzFw8ss2GSyukzbQWnNzqZdIk4rKltzfqT6MXCz97jeUCQqs8GAsS2JiBymAv0tS1Y3pd/GEPP7EOpp1LyYJ2iCqXdaekaSXMYkOnLnni7imgnJFrizotTub1TjkmwbS7Gi1hMJVjFnWc5VoHrqwP/+G5ORGoBYQoTKR2Rq1q+RH5wT3Jm1gYbyrzv7k+8g7eR8HI34VIEkBpQEeAPKe1ssLpsXnEptJo4NGmaf0bmIfxhkrQk8CfAELU1ynt9tJWtwDCMYKW0wqCIwbpSJEBZ8LYQGXK6mWrNUTw== 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=SPMWIWztqEvnLtlYQfvugE0wdPJMjhoKrctVm4Vwn1Q=; b=QirRSYqw8M6vl1lrsFCHs4wVjHmuQX6+mrOiyO6w6v6U8JTBH7T4ZzUJ5TUEn2Q1S6iO7n7cRvYrtKgI/76vyWDHYbQavQj/hnouq/UtqzJ52EjwLknhOCeWAWUFglrxY/1zJZw4Vm3cNg3KAG/xwBmkktMVksYAXFDq5AZzy7M= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by PH0PR10MB4582.namprd10.prod.outlook.com (2603:10b6:510:39::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.19; Fri, 15 Nov 2024 14:54:50 +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:50 +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 03/10] btrfs: add btrfs_read_policy_to_enum helper and refactor read policy store Date: Fri, 15 Nov 2024 22:54:03 +0800 Message-ID: <4664157d202c375536d3c7d3d8545b38611e35bd.1731076425.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.46.1 In-Reply-To: References: X-ClientProxiedBy: SG2PR02CA0021.apcprd02.prod.outlook.com (2603:1096:3:17::33) 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_|PH0PR10MB4582:EE_ X-MS-Office365-Filtering-Correlation-Id: 95f9b28c-752a-4ef0-e2af-08dd05857486 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: ay2SijsGdbHT19hF0B7UQvXW9FShcaiqcbs77YKNqNSUiSos7vR+EvVVwej9dUl0mz0M47beON554cuVG7LsiZqQEeHtie8HdAvz23AaLsybuQaBfh8DK3JIPIyjWwh2fXF39Le4qknCevsRJ9Wj7hPYZUYkiK8Os4iU69xTysE+/2B3YG0C0DuxlHtaJ1tPChMqBHnWiE5mok19/moMTesf4pn6BzaCglqX7DM2MCpaSjL0V5I0aCWfajXJbi+QP0BpA2ASSjLqE3AyuSLQLzdlCLHwBLRrchw7eXJsfpPGSHBddQpfztkHDhZ3FLZ3BaMvEK0WBekYoAdk4Rp3R8jLLks5XE2AAcbLstYem4NIlJWPUDhx7pKv1nEamMxdQ7ZYz5u4zRMG8jSQtlDt8dCd9ni09CpkSXD5tdz/BPCMLgsC3MYKPo4yoLqExxyoHCrmyy2IKpRQw0UQfkwmrTNBPV4WdViwddd3OYWj8NrfXxXIn/1djldGTNLXn9lNA5zWW4XSEBmPD64OL0amjMFt4dDopN9ndqXqjh01eDnvKLP0W4rW+sKcq+xCnMOR3jbxsfHr4mcHm6FjLhOI3zc/OV3S/c86p909Y3le/R4V10WJMPVj19g7sL1FS+2IL0qpLsEsexr/2BKERc8bsq+AYhq5YhI8b9+LY22wONLSDYiYyJOmVG6sv64l99eYObfHE1wTC1zWjS6eGEAQMhsfCy24v0psoeK2Ny4ZDAtLA1mgVC0+Q0i5QdMU/q6Za997TnylqC/3mqD7Zv6qBfHZUqZWA9Ye690pzXEKNNwnhzd0avkbsDi5lew1JBmRnU4eE6NTcl0qCD7xQ6HNI8HFrf4Hu63gD3wf1ddy/KtCgwn6BVzHhpHcRdl6kUT6PaRrI4SJgY/e089tSoOtorpY10xwXFgDzfMfH3f6V9kyWG2z93i/8XN8bB+uwTINGJcImHP8OLn/eiZQsD/XTgI/C641Cmj8Kye2og8NJx5ChLBKkSNPQ2uu23iNsGetIW9QS7mg2GB9X22wyu0bii7wLad2JDubjh0E6rZGcphzdOkjJX9/yKqnaWF3bNU9dblzHRbs7qEWL8Zq4pM75Xnj5oCjM9zKGeUB4MxssFfAhusjvIZS0od9uABnl37VoowVaj4qj8Ml52wiMIE9dQXR2oXUQ4HG8bf/xjdGH8v8T4ivg68u33ue1VJC6rP/LRzqemah/gE5cAoqb6ShjaQOipvJ/va+1jBxeKJDHaWf+9vcQhq7pYvnGpIAXd86xQwA/Z3KrSLvILNGcTxhwwvEjzCmNi/k8xkZd8l4TWrPRjIKzFgm1xooeJEolPgK 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: nKvIen0eyAgCuhcMEx9fjmj4n0KfvpQd52Ihs68TQNwYaXR4qVGo4pxMq7DBziousS33VdDsqSlXYBWvsq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nJLLwPeA0jzogWHuZ8+svxtvoTTXZkPMYJXzkeduVIhacWK+U8aUibip1PYxlORoRvlcq/MjVqlpnetRIketsVkGjdzq5jDHYaEOmyrod77gvZgDHWuKvZ1Ij5LhHOk17oipEBVt5dwjuK6DYC5IKqdeFtPpSlnKI7Wv/crh3aK6P0o8qEosCkB62Ow+rNBIfY6QGM8Albbwce6BA3ALzRldgjW81DAIZg7+xfNBEe8sU+2f6fzBGj1qkKUFKcHv+9XZoHlTJ6N/F8lGWpH6cmkJmC5kvaPBlL46GyMkVMr9mEz+0wEO53ZH/2DkVc4za72MkBnnk5G1sdQ93g5YNsRI6HF//PVXDzdce3ZLDbgNWyrriqd1kOgxwI700jUxp9tGugGP0h3pP4jacBi3bWkx8XBcQE2Xjw9ZPqxdA9dNTlBIiWvG4GszmbDFdWg3bQP X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: TUOoehkaSrZv+Rl0/scQGuMwbzXk1zU5WQWApsiWC3BF+evOExLofYuPV/L90t2rjcl45Gaq75mfW02a7mJ8EM9coRnN2TI4FGTlpD08taoopj749DiGaxMhE7nydlZhGI3rbx7604QpA0rifA3pobpKf87QRZEvok8+88wjUQjsI2SUExeg8cO9kDvJtKW0AZlSOILbSRPWoKyyWOGcN7f7i7oPQfYSCqPASsnhl2162h4zA7S6oTLUjMVrT5nsKEinW4pllpPTPIq1PdJT3nVmYW2zujy2xuRC+gCnPkExK+J4kboK8W4itx7yzAZgIK+pW17DkaUlSL0p7XqzXbcTu1h3gPetHoPMGbNibZ4iktVQJLWgfSmwPUHgF6E65xekWVh4ncMImPkr7Vynx66BuvnnKIbG4YU+088ddRh1nPJKV9JdeyX93V7FyX68cJyHICuzALfy73Ap2nWfwEHe3fm940MXXjpiolk6fqHoAc/xDzDSglXY2Qj3qmjcXP9gHxPHRtIN89NP/cCybae5lhf1XZddX43iMpAoEr6gc1DL6MyZRr4MkL+UfqETnCMVhszUJ3rKprs3QDl49LMe7MfDvj+jv46/k+BpN5Y= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 95f9b28c-752a-4ef0-e2af-08dd05857486 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:50.3121 (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: TcD/7riMmQXGbFoUv659Jk2ZoH1kNfwa+L4zQeFEWTKJ7QcFnndLoJu/h6t/bC+F0HZDpplvLkxFv2SkIJ3hpw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB4582 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 adultscore=0 malwarescore=0 mlxscore=0 bulkscore=0 suspectscore=0 phishscore=0 mlxlogscore=999 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411150127 X-Proofpoint-GUID: M8I7oZyGCd_UGHzNvwm5dtGT5kB2LLx6 X-Proofpoint-ORIG-GUID: M8I7oZyGCd_UGHzNvwm5dtGT5kB2LLx6 Introduce the `btrfs_read_policy_to_enum` helper function to simplify the conversion of a string read policy to its corresponding enum value. This reduces duplication and improves code clarity in `btrfs_read_policy_store`. The `btrfs_read_policy_store` function has been refactored to use the new helper. The parameter is copied locally to allow modification, enabling the separation of the method and its value. This prepares for the addition of more functionality in subsequent patches. Signed-off-by: Anand Jain --- fs/btrfs/sysfs.c | 50 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index fd3c49c6c3c5..7506818ec45f 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c @@ -1307,6 +1307,34 @@ BTRFS_ATTR(, temp_fsid, btrfs_temp_fsid_show); static const char * const btrfs_read_policy_name[] = { "pid" }; +static enum btrfs_read_policy btrfs_read_policy_to_enum(const char *str) +{ + bool found = false; + enum btrfs_read_policy index; + char *param; + + if (!str || !strlen(str)) + return 0; + + param = kstrdup(str, GFP_KERNEL); + if (!param) + return -ENOMEM; + + for (index = 0; index < BTRFS_NR_READ_POLICY; index++) { + if (sysfs_streq(param, btrfs_read_policy_name[index])) { + found = true; + break; + } + } + + kfree(param); + + if (found) + return index; + + return -EINVAL; +} + static ssize_t btrfs_read_policy_show(struct kobject *kobj, struct kobj_attribute *a, char *buf) { @@ -1338,21 +1366,19 @@ static ssize_t btrfs_read_policy_store(struct kobject *kobj, const char *buf, size_t len) { struct btrfs_fs_devices *fs_devices = to_fs_devs(kobj); - int i; + enum btrfs_read_policy index; - for (i = 0; i < BTRFS_NR_READ_POLICY; i++) { - if (sysfs_streq(buf, btrfs_read_policy_name[i])) { - if (i != READ_ONCE(fs_devices->read_policy)) { - WRITE_ONCE(fs_devices->read_policy, i); - btrfs_info(fs_devices->fs_info, - "read policy set to '%s'", - btrfs_read_policy_name[i]); - } - return len; - } + index = btrfs_read_policy_to_enum(buf); + if (index == -EINVAL) + return -EINVAL; + + if (index != READ_ONCE(fs_devices->read_policy)) { + WRITE_ONCE(fs_devices->read_policy, index); + btrfs_info(fs_devices->fs_info, "read policy set to '%s'", + btrfs_read_policy_name[index]); } - return -EINVAL; + return len; } BTRFS_ATTR_RW(, read_policy, btrfs_read_policy_show, btrfs_read_policy_store); From patchwork Fri Nov 15 14:54:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13876347 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 0740B1CEACD for ; Fri, 15 Nov 2024 14:55:07 +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=1731682509; cv=fail; b=nGnlgSfQEAPOOCE9Hxj3qG+Hn1WHoixqtEeSMVMhELJd32JcKiCEcgd30XNIMolSEU0gKXICUDSFaRkJdBi0tuLDNOvZs5DXPmoe0xwawf940S0/SZhiWjt5KalbZLDu6l9nWzJDPC0YMH2iMMU4rMmW25ykdIN6qsMfro6PEX0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731682509; c=relaxed/simple; bh=NQCAt/iom+THmMZuhxtgCHAryCm986N9TaxQrxIAlug=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=SS5vpeDG5PkbE45rFbyyRlhp0qj/R6JCy9XpH7elDyFEbLWiRnj7syCBMYc2fItnzWQJXxNOwIf98NglvX7i2gBHM2gXsR5Ggy4zhdQ+m//T3vhiTkvTulj6x1gDgs2TmVXkOexZBM+yVXgwTPvuO0fy5LKRqrNVtv21jaCPzlE= 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=ItdMVy61; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=vcPEr1wT; 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="ItdMVy61"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="vcPEr1wT" Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AFDCRBU030500; Fri, 15 Nov 2024 14:54:58 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=wRiQmEAymNPmtxWn2oCcGkdf+EbA5flL5go852YL9hU=; b= ItdMVy61J3dHm/FW+igv8ta8kvXR+QoW2zgSGmcNtE8PmY/7dWlMnTDp6BgW+AqM lAI1H6kOGoGkl3gvfhUN8MT3e17Mr22rUzsexcpAPKQAGdIDgYEhpQoYCy8HYNV5 BBbWGKirdWAoHIBOi728tPAqdC8lqaE2nsy7MWIzzL0PfFEYcKXtzv4Ax3A30mDz S6JHsiImtNiF9ih4oaHt7g/or0kZK7sxWTI2Hn4d2/uB7ZA/cgwYicyFu7iiccnY G+1jMeFqLULFdDq/UhF0+8/p/ZsdOekSL9uRKYMZ/tw5A372y74dieSTgsG3rhW5 RjzSYt+z4nSVqQh9Hc7yDg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42t0heue4f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Nov 2024 14:54:58 +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 4AFDk43S036004; Fri, 15 Nov 2024 14:54:57 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2048.outbound.protection.outlook.com [104.47.55.48]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42sx6c9ef7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Nov 2024 14:54:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Mev301EfJIQbjd7FSTH0poAra/e7/RDCwpt249pjhLmKpCDOgQCOZ3Ar7TLgmT0ZseXLaYKR13W0O7W5KgvMd9k9jyxppeY2C1ObbteaBMglKLsHkhFtgLhomTyXGoXIfANWy1qpO+bHLekisQ2KTSXgI5/duAnMVPZ+/Ydrh4EGufvETwErDHgldGt4G1nWKWfyCiZI848ZnDwd2PyhXdB0uR5DC0smIH5QL5Mw0WAEw+eNXtbPYgYpfs0q3DR8VM33OPn7s/um/Uoh77elqGJ60kKdyJarRyae1zwHYX9mZ9IS2nc+L2p16hkSl8IXQbtsx+x2o5cAhiGcvTJvYg== 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=wRiQmEAymNPmtxWn2oCcGkdf+EbA5flL5go852YL9hU=; b=wgU7XYVpY/PDJ/dEcKdJ2rEMSs1w2j5ZU4wdjzB6wonsbn+b/j+ZbAa5HcpSV9uh+zL7sAQqMhDmNK7zkfug6CdSLO3Ee5Em12Wgw2beK/yn0dhRYUisjIPk69DEYL2dDDrETLLTIs03bfSl7ey/xcfz79TJP+ErOCsFqwj9/twsOEIu3e67BMrZpnys9iZHBRSpfNx1GwMI54pcsHPOawiSrU/bSjxYM5PhmJnssdgtf7D03q+Mjcx8j6izFLfuicH7K9Xsb/p55/SXMISYCY4uiKAvVtl+8IuR4XtOOkoLwd6PrpntZKaAvx6BcQAzCXNED6/PiUanP6FR2Chb2Q== 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=wRiQmEAymNPmtxWn2oCcGkdf+EbA5flL5go852YL9hU=; b=vcPEr1wTkvpTEbQaiUdUh5QsHtV9DUy0xzzb75vr4sLH/kmQItv4IiX+TOjfP4n+QO/iOoUGuo/wfGPivSI5hUKn74vn0vfI/SrIFq98qIi9HuG4gEghElJS7YFIqUmGd19gJ74DwYHrViVnHG++OFunIIHyW9Gqsdcmp9PRVLo= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by MN6PR10MB8167.namprd10.prod.outlook.com (2603:10b6:208:4f1::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.18; Fri, 15 Nov 2024 14:54:54 +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:54 +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 04/10] btrfs: handle value associated with raid1 balancing parameter Date: Fri, 15 Nov 2024 22:54:04 +0800 Message-ID: X-Mailer: git-send-email 2.46.1 In-Reply-To: References: X-ClientProxiedBy: SG2PR06CA0195.apcprd06.prod.outlook.com (2603:1096:4:1::27) 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_|MN6PR10MB8167:EE_ X-MS-Office365-Filtering-Correlation-Id: c93e48f6-54e2-4dc0-0fd5-08dd058576c0 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: LZX+y8nF6oucbLrnorcztMqus/NxIm6HpN+yevbT1yaMa4QVVd+PwEF9FjogKLPh9c2on3UVXJf0SmUraRBAn5/JdaGiQDFrIv/j05ztxc4q1ycxPvivvhkE6ezoS3x8Yca9NeXRZIm3p2ncYoidxJptHXMuMYNSaqtD/5eVKHEfTBN9n6RPz7FToF+DYEQTebrz2PoYyQeO0PUcrqXRDEMYC+RHpAkv1fjgf/LzeKKZ1sYiH11v04cxNZDX46mudelqTyVlKYRrtGbj2OUAd5qos6rP1Fj7w+iPPn8TypdiorXGcju2moSWjBafSCOTbZJN6/FyHqeEPihY0kGF8S+W3B1QQM0Js9MvEgPAHC9L0BEtRd05BJztsplPhcMmkC5dVdKqqLZ0WE2AM6YQwtKYaLDV+lB0E4NsLy3uXjEFO3zOve2uW1op8S8GgG3xxb7A9iey5DM21cL7NIlXtMBHGpz4o+/W42EaJDFrLNiAliE/pDoDgY4TX4eztW0Bja69zcaszre0D8+ANqxfvlxWscjV7J/hVhFFAB1wl/yjg+7x5aSBVUQgCxUWwCajbzGcZBFPVqE3tVvzs89MgVyVvmqjXohIjqSyDxm5qGgzxTK1WjNTDrUttteqK0K/LQHVrFhSIp7eEY8V6lI1iySFx011uQ25ZiiQAphW1UVifWFiKhfKpbeN7NKaHVd0po3w7Vc1oxK9cZhYG/dxsYWWIHMQZaFH/AsMKDUbfDeVhFUk+3ioMGnLlKOwrJ9LgOH5NtFVbgbIb51EUmGc0oQqwK2thMD1LOFR3u500G8eYAtfqLGWvrW0Fj9Osp2mMVMreAFXGDapQvsUJZIUwG7fv7KltjEYm8bcwMws8uOJBByZojIJgoLvAm9bg9/gaM8D67Th51bErJDsHUolaHstZqu16tmfHTTpKM+CVA2wYSWDJFxH49o/8gl2Mr5oGkOfd2peYyAkqd8YX7LGI3tS6oB0pxJmoEpysqZ9CHAGvtT5AyMFGmdz4qL6I1MPw1GM0l6AU07yshu2Gywgs68EUpU/HWiigMj7S35tqCj8UZd6IW0zeDX7g3QSeyXhGYLaOmuS8UCWnJkdPYNBfIdx6gaHxlIsz6o6dctI4rKGWj52Id2krns4zogKnmgLymaPpKYg6PKJ0DYpJnn1iLgInfdlv6TkfjtE8OBfPrYTdEtOsLdkr7V31w4FFeZ5iYfLUXC7xyvl33Ls+BEFXtIzE/SQ0mXtil59aQ2NZtkxC4U5XSkgk2SKGjQdZIInSfKKtsFhqrV5FweM+afsFfWWxodT5l2C60m0JAkJv5zn9QbShkY5GeYK6CbckBHA 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-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WIosGDjypfijrgAA7JeabK2HxLdAum+KYTYLV5hlr46Bw+Dm1MBU6EI0LG9c6sDQlXH4KEj2ys7H1CXLTMNLFtvGPnYsMNpq61L4BvuRn1IGLtFwabE1ZD3ytsoqJMc/GkwVrcMxB+7WTI9vz8ZGQ1hqa6NRO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xD/CWqml15m+e1rEm/gpgm552YtEoMYNcCAk3jdPu+gQpD4GQE6NM4JopFjzpYoU+KeDz5VPlfcXqugg4Ng0381XZhtkxx96yMKfcH9Tw5RrSsur6Fl2445dzOMCw+0m5gW3OxK2YnUwjlqjfmuGaXUCooECgCMHVSixP02WTqyYNqw+B0pRDAJyqlypyFayZbSYjETKoIhUL8xqjywgRTGMXbS2y9zFcvBHU1QXcfv1Y19vZJ/iwJKjzg91g3/E1j663SrwllpxW74m9GXEOgRanuYV/8Q1csXw9PIGW14O4gnwTtKvMfQAnkMbExExZfKCVkb+n2BJHMgKvie+X8AoEybnFNU0tf5gpg21+7Wwv3KTZmT6rG X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: jVd6zZb1tyBsciEkTJicf/d14d2BjyTNuFS7f8SThXgZWuJ+sIGS2Ii/4UVRl7YfHpbijfwM54zy/zeO/Y/Bdu4qBwUEreWlH0VCPDf6M4nimVD+r6CGS/Iw7XtAnNKFRJlrq3/lU8sT7ELVGDEuTXfoTNJH46ThvKayuByBDEBd0JscSVjAt3LOsraAR/PtzzHZTxCc5UG8YTwm0HLySb3sWLaJY4RlnpZZxjtt0xq50q4l8DinhJVAq2i+ZT1iQch4cOgAQvCsQFhcSsSvBdwjtsAlhOD978cBNvqAMhVguHzXwggOMZes9r3cy0WvfM6tSigy66omgzmOSlFpZasc9p6Uzyg2nYSlzEarWu0S3YSblwowYolTN/5zAmTEvaJO1n9YSCx9Lrim7pGHud909ffkUaYheG/J04+qWPHudr9UBddjgwqU6RImOd40clihW81UPzQRklecTyV4lvs5SxHXYich+HR87hfJ3Oia1hpKqSJGvZfAJRxsZtclbfAnGw2yAkuk3XpTw9Kw5EHmdmx6RZNvAvGhkbeUgVPiV6N+sJfEFWuB4y2iTswoQP0/witvgQEiEK7JWg57UFvImeknXl7F6OEargJtEQI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c93e48f6-54e2-4dc0-0fd5-08dd058576c0 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:54.0323 (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: VYUV999gsGl3fMHEVKU+py733dvEtl+M9iXcbl/Km7imj6OGS3FVa7Xl+geIbqPnL9PJKTH5DeaqZoV/nlXCxA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN6PR10MB8167 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 adultscore=0 malwarescore=0 mlxscore=0 bulkscore=0 suspectscore=0 phishscore=0 mlxlogscore=999 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411150127 X-Proofpoint-ORIG-GUID: 8IOkR6CaCQevc_oRvkzA5NTzYqfe1nWe X-Proofpoint-GUID: 8IOkR6CaCQevc_oRvkzA5NTzYqfe1nWe This change enables specifying additional configuration values alongside the raid1 balancing / read policy in a single input string. Updated btrfs_read_policy_to_enum() to parse and handle a value associated with the policy in the format `policy:value`, the value part if present is converted 64-bit integer. Update btrfs_read_policy_store() to accommodate the new parameter. Signed-off-by: Anand Jain --- fs/btrfs/sysfs.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index 7506818ec45f..7907507b8ced 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c @@ -1307,8 +1307,11 @@ BTRFS_ATTR(, temp_fsid, btrfs_temp_fsid_show); static const char * const btrfs_read_policy_name[] = { "pid" }; -static enum btrfs_read_policy btrfs_read_policy_to_enum(const char *str) +static enum btrfs_read_policy btrfs_read_policy_to_enum(const char *str, s64 *value) { +#ifdef CONFIG_BTRFS_EXPERIMENTAL + char *value_str; +#endif bool found = false; enum btrfs_read_policy index; char *param; @@ -1320,6 +1323,18 @@ static enum btrfs_read_policy btrfs_read_policy_to_enum(const char *str) if (!param) return -ENOMEM; +#ifdef CONFIG_BTRFS_EXPERIMENTAL + /* Separate value from input in policy:value format. */ + if ((value_str = strchr(param, ':'))) { + *value_str = '\0'; + value_str++; + if (value && kstrtou64(value_str, 10, value) != 0) { + kfree(param); + return -EINVAL; + } + } +#endif + for (index = 0; index < BTRFS_NR_READ_POLICY; index++) { if (sysfs_streq(param, btrfs_read_policy_name[index])) { found = true; @@ -1367,8 +1382,9 @@ static ssize_t btrfs_read_policy_store(struct kobject *kobj, { struct btrfs_fs_devices *fs_devices = to_fs_devs(kobj); enum btrfs_read_policy index; + s64 value = -1; - index = btrfs_read_policy_to_enum(buf); + index = btrfs_read_policy_to_enum(buf, &value); if (index == -EINVAL) return -EINVAL; From patchwork Fri Nov 15 14:54:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13876348 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 66B061CEACD for ; Fri, 15 Nov 2024 14:55:11 +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=1731682513; cv=fail; b=huS7z+onI9jKg5JIUqMLsP2bD9eEn8c37ORrbLuqnbi4G07s81Sj+XPqC4uFhzDmEtPBD5WXUsMH7iifOxhWdSKdCrMMN51ble/CWJ4Hty27pWYmnONowdwwymmlKj8IAs1GH1t1tIbmcKPAoqtP8IDsg6k7Bd8kXu4QxQ+sUK0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731682513; c=relaxed/simple; bh=IjKLwcQN3dyIfDDk7yfm5K4bFbGF2CDEl/DkQzY+PoM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=TOwLDk/4lCgGrthE2CAr//vrkS2jDpBm9S6klxdoHJ5BsLWHt9bO3YI4MY/zm3vxWNkatr7Gct9zaWtTCP+sHs28XF2SIgqPr3ZL92o+1wZxp00lazNbWqJoRN7LXKT/qyuUXBqaUE6wAkDRuPTyU7xAS3JDXCiO9aZJ1bHnW7k= 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=gVdKuK9o; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=gIYDJZR9; 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="gVdKuK9o"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="gIYDJZR9" 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 4AFDCSMf017354; Fri, 15 Nov 2024 14:55:01 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=vlpCZaZkDklvhd754Zsgzwi1VY2EvgW/9r+fWmDdfn0=; b= gVdKuK9opDSVDIgy6I6HrMXQjJjYaHD1R9eKxdDwuDPIxww0VPwskYMG/MQTa1Ho OWJnuq+ZNrqqvK1Wh6CAt80koxCm0FRgyiri0+YQKzwDOXwvSB+Csg1Ov2+L4hoM AgDsyDuQUX52vhYxavdJcCZl9eIdEl6rvrnYU7wVglmWo3lQxitcRGoiBSFqX5o7 6zBEWIIjzYXDtDQ4tNgW756jrjNx9iZFWEmKcEvMX2wx1zrB7GXvh8Y0lC/dPKxT StlUdhfUnaTuprd+223NPPRHe4bpthdbqKSRljttjrIqou5CDb7TfCtjPjsplo5C TtSxY7RZs+mKv9cSx26kYw== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42t0k2bhbd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Nov 2024 14:55:01 +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 4AFDrCfj036079; Fri, 15 Nov 2024 14:55:00 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2175.outbound.protection.outlook.com [104.47.56.175]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42sx6c9eh8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Nov 2024 14:55:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=w9z0u/QXHAQfNwL3uYqvtghp/JZY4ZX7YOB84c2QfZA9Fbh5Zi5oX2cPmywBoDweIZccqBJ5N1QnDc4bMTYAdonTOXOYMMIKuCzOqgCum77/6zwwxqWo2ZpML+Acc0s3M7RGgAZ2y2Kq09dsdu2ylKpuymDq2KtYnixgdltI/t/SOFndTa4HvN29vYC5GzgIIbb4X312WQnrHO4+JK5+hNdMajJZr955MYke4aDnm08nvAEikmXBb7wkJY2mRSQD+Vav1O6da/OCjKZ50aWi61D/zxhOqKwzyo/TODWFIEiEr9PtUGQt1ISRvPPNBwyzH4FyXZtSvIqBSmLabedteQ== 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=vlpCZaZkDklvhd754Zsgzwi1VY2EvgW/9r+fWmDdfn0=; b=LWg2p45m1zcaIDVrYATmAh5C/NNhuTnmT6iVu/awGgiDGI0iVErEGfjg19kMHP5QH1Tbw3wdf/Jpj1X4ns3yLLK+QXTQF+f7pGe+Y+s/8n6pWbuLnycw0m54R4W7PG7F75P4IeyeVEZvvSnz5C85/QoTPQO+jmKFfdDDPJwrEcXJOWusCspohwA37DmZQ6ZdDRlqwzydFcBRo3KfsREE2jCFOdNdKtCanLLZBnzYyo7oG4DImhOexh+kOJb1m6Xgwug21iCrclRwrB3mVZeI72/qZVgVN48aGWZNetuEbNO/IOoicTan5rJNjg6+uxO05sIPOiAtH9masbsOEaAlJA== 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=vlpCZaZkDklvhd754Zsgzwi1VY2EvgW/9r+fWmDdfn0=; b=gIYDJZR9m9chcPB0FtmkizQoiLIU7q7tFfaG4GEQzxiInYzxDLo1NU3E9M+1zvl2K0oRZclkO8OAPVRywbLx2JyQtHXCb5SMOORkaBcM/SGIqrEL/Q0dpXwC1T333rg8Pzu47A5ncKBLNiwArV7mXxEL69PWPP+k0U3Zzk4Cdg8= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by PH0PR10MB4582.namprd10.prod.outlook.com (2603:10b6:510:39::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.19; Fri, 15 Nov 2024 14:54:57 +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:57 +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 05/10] btrfs: introduce RAID1 round-robin read balancing Date: Fri, 15 Nov 2024 22:54:05 +0800 Message-ID: <995d4a9dd9f553825805efdac24dec4a9de20ef3.1731076425.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.46.1 In-Reply-To: References: X-ClientProxiedBy: SG2PR02CA0054.apcprd02.prod.outlook.com (2603:1096:4:54::18) 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_|PH0PR10MB4582:EE_ X-MS-Office365-Filtering-Correlation-Id: 52b93a27-7a27-45d2-47d9-08dd058578fa 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: WBIq7CfhGA+9VeVW6eZG6dWnLKR/NhgGAVFwPMEENK0R1fgMC3p1khyge8KGyvY36jcIFli34c/8LqRX+XQjpMH12KvEu/aZYWk4q6Vg2aWDaRcqF+W9v4eb4B+/dHVV/pL69JTzC9OHTXO5LLyATIuWAyyT8JStFVC68ITSTY4hTy2mhFa1RU69dJ8muQEGncwYQkkPwd7IAQVqnxojVQqh8TeoPTmopJz3xAlhl3yUiZuuUvHEQrBqNM/bjCxDqz0MSz8Kn/tcq53idG0AAMT8Gy8GTcANtQvxSgz2WVwNj1kg8/UqIULbSfjRA/XMstrD9dNuUqE3eN8po7l2S8l/Uj9haS4MuFIoMX5kwUQBYqpdnWPbgdm6XAeFIw2lZuKlKPcWXxj6cICXMHTKL7/8dFD9/AEGWhet3BuPPjeS3rEkQ8UrB5Cr6CmIF+tiREymPGdda2CbTaBwsL89kXSVKd1o+vlhWPZHLTXa59bnuCJehS18CQ+s2p3KzAYriLgR0LRyb3A7WHfE5dcYowxihJwx1qf1AWIdFAT6lw0zfxZ71mXD0TYXiigkbMSoT8NLp6LS1xaEThK1rotl3IUub5bdPm7QpdOf1GrhTqKAld/3evQedsG/2FrwyGhKYiqd3BShDNQ9TkCQqsKNhzm3EKkALNdo/7oCZR8t4oBvm6dQ35Yr3VEQh6fg5sfTcrsTKR0vcsJ8uQSEitNGV5az+VvaAdXtGpsTjGcAkLtYWE+LCSAZORrhxSfgibjMMU0ECJb5xhuXwnnu4w+0+93+DRhcS0qQQ05/TvMaciM5/u/IeY2zjO/trMk1UIXMsl4H1GygHJQhNYOEaiLhScTiINJkKm05oZoGWkrvUwyZTbAaTH15r2HOwNgdkqF3ZgCOmgiJ9JMCz1KUH0JxMKRHuTNjIr5nuwS/hQXOmi6zPWa2l+MfuRHlux2ELLT6r5nv2LRCZgT3z9ucmyHEQUomyf58Io5viJrUpbXeulfj3QyIYWRFe/aItUc3nt68dS9cOikrauZ72XpBgBHSRujq8zRJcNT0iMWwR1woxOpSv4T2QHYUQkP1qObLwX+Vhkhjf7WnTK8xrMqMJVOriPqlyR6ZT5hS845hAl2P3FIbCFwYZox2Hi0w9QqPh70xYgwxdJV+UzUNh0Vqk7KNuihaQF3FQifJffP1hubtGOP9baMWqyWaxi4pnJA7aJ1Wh05m+2NMwToklrk9H2dojnKmpkpu8qijhY3WexIdYKiNovTx6edGqoTwWkqWS/1ZYb+gOcuo/uad2KIRqS3G+tygxjnzA1uGXQXtT6sME3S/Ry4v7h+ROTInDsC3JhpB 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: gqL5yePJNe+PizfPIt0Vf3E5rDc2egc/KEIYh7aUy7rpMxMqOOCoQ2aEVxVcShxGIJJkCZZNyJnx8yd5FI6rZ6rS/1x20Q3REfjnRn0aP1hntZHPVXmv286qNUR4gkrLjI4J8NGcBHAOvxwnVP1MgckdeZcSwJ/kcPxvcjHBWcjSBJJmA5Qr6HzlEqOqonBFcc6sMSNFRJGLtXWwvtAyEd+5VYUtNLX5W9kViIcSci4AkOdSZZGZAjnEWbYnAatPlqEL+ov0Av2TIl+wIK6wqaDroDlVEj6bfVQ33IGo6c8yBCVzwdhy38PQvodoiGdVEQsNAraqqL7lQ+QTZOxiNj61Iu7JX8FFYr/x8GivzrgVwsPyza0RvW5DgDpQTXBa+w8of45U2jdCTvnrXQHwbYFiZBRtjaU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S/RJ4Hgyl/Eq1V4m5z5393hhDUduEXL4mFESU17+PoFbud0of5y5oEVfFaBB2Hs1QENLSbV4hi4f/J/9LHySrGewOSDC4m0G1F17vsl78Phg0b+Sj0wDgo X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: u038f7OjS7Oyalt8WFFex81cFAMw4H3y+zWtd8eYbobyKRnpQtn7EinXn7mcutAwNxNZNSpnwXdztJvaLpYvJAFsrm2Rhfo9v9KQGY3IWARN1APQcFH6RHmcXgWV6JHIQTo7ihL+KcPpNZjOGI73EXpA4QLKyqlOkLNyHdvIGzKE8Ro6j3zV49XiIES7v5v9viGDDI4g2vARWPB8gA19Nt8YcO8hAiIDtD+7wlijqOQlndlsHNuyisJxi8dhr4jpwzFtNpsX3rW3hfCsLHHfEPojWUyX5LiIa9v7r3zXBmM8wXRh7FN5NB49TejJz1B1VyJSyH3BdC1lcdVMrehqkPChf/J/YSGssjQs4ckVMYO8WWsGcjgKWIFSKfA+T+OsJrs6J+qF3OWj6Ev9oxCBuMtdtEcI6JxTUvpzAQu2xyxavMD85xI54y6Tk++Hs9Zmpi3/tqZso8azZToTOmK671H/CX8VoXNsyqSNoNcU76QgJXdvvxDH8ppHYMhCFFRkvGdRrS81tVbmPG/nUWxKloOs1lT1O5ZYiMH8GPCrqAi1k1eWtNEgYkNiVXP8hsE8B9+cYHfZE6h+maXWvStE8jgsgyDwarTiazSdbrpR6rA= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 52b93a27-7a27-45d2-47d9-08dd058578fa 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:57.6244 (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: FKxjRvAwYNRtHsih5PxCbthxDEt+hks42+SMV/hXNIPb11sXOp7++whcU5wdixowtPur+kPNxE2znCD3aOVbQg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB4582 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 adultscore=0 malwarescore=0 mlxscore=0 bulkscore=0 suspectscore=0 phishscore=0 mlxlogscore=999 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411150127 X-Proofpoint-ORIG-GUID: S5FYJXpc6DHnR2pwkL9nC29p5W7N1i93 X-Proofpoint-GUID: S5FYJXpc6DHnR2pwkL9nC29p5W7N1i93 This feature balances I/O across the striped devices when reading from RAID1 blocks. echo round-robin:[min_contiguous_read] > /sys/fs/btrfs//read_policy The min_contiguous_read parameter defines the minimum read size before switching to the next mirrored device. This setting is optional, with a default value of 256 KiB. Signed-off-by: Anand Jain --- fs/btrfs/sysfs.c | 38 +++++++++++++++++++++++++++++ fs/btrfs/volumes.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++ fs/btrfs/volumes.h | 9 +++++++ 3 files changed, 107 insertions(+) diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index 7907507b8ced..092a78298d1a 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c @@ -1305,7 +1305,11 @@ static ssize_t btrfs_temp_fsid_show(struct kobject *kobj, } BTRFS_ATTR(, temp_fsid, btrfs_temp_fsid_show); +#ifdef CONFIG_BTRFS_EXPERIMENTAL +static const char * const btrfs_read_policy_name[] = { "pid", "round-robin" }; +#else static const char * const btrfs_read_policy_name[] = { "pid" }; +#endif static enum btrfs_read_policy btrfs_read_policy_to_enum(const char *str, s64 *value) { @@ -1367,6 +1371,12 @@ static ssize_t btrfs_read_policy_show(struct kobject *kobj, ret += sysfs_emit_at(buf, ret, "%s", btrfs_read_policy_name[i]); +#ifdef CONFIG_BTRFS_EXPERIMENTAL + if (i == BTRFS_READ_POLICY_RR) + ret += sysfs_emit_at(buf, ret, ":%d", + fs_devices->min_contiguous_read); +#endif + if (i == policy) ret += sysfs_emit_at(buf, ret, "]"); } @@ -1388,6 +1398,34 @@ static ssize_t btrfs_read_policy_store(struct kobject *kobj, if (index == -EINVAL) return -EINVAL; +#ifdef CONFIG_BTRFS_EXPERIMENTAL + if (index == BTRFS_READ_POLICY_RR) { + if (value != -1) { + if ((value % fs_devices->fs_info->sectorsize) != 0) { + btrfs_err(fs_devices->fs_info, +"read_policy: min_contiguous_read %lld should be multiples of the sectorsize %u", + value, fs_devices->fs_info->sectorsize); + return -EINVAL; + } + } else { + /* value is not provided, set it to the default 256k */ + value = 256 * 1024; + } + + if (index != READ_ONCE(fs_devices->read_policy) || + value != READ_ONCE(fs_devices->min_contiguous_read)) { + WRITE_ONCE(fs_devices->read_policy, index); + WRITE_ONCE(fs_devices->min_contiguous_read, value); + atomic_set(&fs_devices->total_reads, 0); + + btrfs_info(fs_devices->fs_info, "read policy set to '%s:%lld'", + btrfs_read_policy_name[index], value); + + } + + return len; + } +#endif if (index != READ_ONCE(fs_devices->read_policy)) { WRITE_ONCE(fs_devices->read_policy, index); btrfs_info(fs_devices->fs_info, "read policy set to '%s'", diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index fe5ceea2ba0b..97576a715191 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -1328,6 +1328,10 @@ static int open_fs_devices(struct btrfs_fs_devices *fs_devices, fs_devices->total_rw_bytes = 0; fs_devices->chunk_alloc_policy = BTRFS_CHUNK_ALLOC_REGULAR; fs_devices->read_policy = BTRFS_READ_POLICY_PID; +#ifdef CONFIG_BTRFS_EXPERIMENTAL + /* Set min_contiguous_read to a default 256kib */ + fs_devices->min_contiguous_read = 256 * 1024; +#endif return 0; } @@ -5959,6 +5963,57 @@ unsigned long btrfs_full_stripe_len(struct btrfs_fs_info *fs_info, return len; } +#ifdef CONFIG_BTRFS_EXPERIMENTAL +struct stripe_mirror { + u64 devid; + int num; +}; + +static int btrfs_cmp_devid(const void *a, const void *b) +{ + struct stripe_mirror *s1 = (struct stripe_mirror *)a; + struct stripe_mirror *s2 = (struct stripe_mirror *)b; + + if (s1->devid < s2->devid) + return -1; + if (s1->devid > s2->devid) + return 1; + return 0; +} + +static int btrfs_read_rr(struct btrfs_chunk_map *map, int first, int num_stripe) +{ + struct stripe_mirror stripes[4] = {0}; //4: max possible mirrors + struct btrfs_fs_devices *fs_devices; + struct btrfs_device *device; + int j; + int read_cycle; + int index; + int ret_stripe; + int total_reads; + int reads_per_dev = 0; + + device = map->stripes[first].dev; + + fs_devices = device->fs_devices; + reads_per_dev = fs_devices->min_contiguous_read/fs_devices->fs_info->sectorsize; + index = 0; + for (j = first; j < first + num_stripe; j++) { + stripes[index].devid = map->stripes[j].dev->devid; + stripes[index].num = j; + index++; + } + sort(stripes, num_stripe, sizeof(struct stripe_mirror), + btrfs_cmp_devid, NULL); + + total_reads = atomic_inc_return(&fs_devices->total_reads); + read_cycle = total_reads/reads_per_dev; + ret_stripe = stripes[read_cycle % num_stripe].num; + + return ret_stripe; +} +#endif + static int find_live_mirror(struct btrfs_fs_info *fs_info, struct btrfs_chunk_map *map, int first, int dev_replace_is_ongoing) @@ -5988,6 +6043,11 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info, case BTRFS_READ_POLICY_PID: preferred_mirror = first + (current->pid % num_stripes); break; +#ifdef CONFIG_BTRFS_EXPERIMENTAL + case BTRFS_READ_POLICY_RR: + preferred_mirror = btrfs_read_rr(map, first, num_stripes); + break; +#endif } if (dev_replace_is_ongoing && diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index 3a416b1bc24c..05778361c270 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h @@ -303,6 +303,10 @@ enum btrfs_chunk_allocation_policy { enum btrfs_read_policy { /* Use process PID to choose the stripe */ BTRFS_READ_POLICY_PID, +#ifdef CONFIG_BTRFS_EXPERIMENTAL + /* Balancing raid1 reads across all striped devices (round-robin) */ + BTRFS_READ_POLICY_RR, +#endif BTRFS_NR_READ_POLICY, }; @@ -431,6 +435,11 @@ struct btrfs_fs_devices { enum btrfs_read_policy read_policy; #ifdef CONFIG_BTRFS_EXPERIMENTAL + /* IO stat, read counter. */ + atomic_t total_reads; + /* Min contiguous reads before switching to next device. */ + int min_contiguous_read; + /* Checksum mode - offload it or do it synchronously. */ enum btrfs_offload_csum_mode offload_csum_mode; #endif From patchwork Fri Nov 15 14:54:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13876349 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 B3A521CEACD for ; Fri, 15 Nov 2024 14:55:15 +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=1731682517; cv=fail; b=canMeRCgvnwsHj3FrCWjC/Xp+U8ACrLpkpxXpfvPItXZPO4vMks6rWBGV+Vf5Jo4pQcxKqyyEzwlqm09U/Nyh3MWDlkf/2UWXOyjQN/bqhyohZ1H/fNQj6pwR6y+owSLgf4oN6X9ycvquYc9XRZ9lDPMtJh2bpf4V0tkdzYwlGY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731682517; c=relaxed/simple; bh=8JKaPZTH1mUv/JrEh5EXL5Gt/+J9IUV9kaQke8M+igs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=gXHLb88UgP2TTCJrz7uClpG6zlnotBc7X+PAdm5mcbh7bbrUShKIA7e0NFwLCqCjmzEGanmnMK6kkJA0kAw+Jg5dgw6/V58vynxK3gWeTlCSuIgfuNz+GEyzWvTxM1bCI6OzNPEtSIsNqFH1tdRZkb/oHaXCKlWUIqhGUppFVGM= 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=XVMtCqca; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=HogQKoHW; 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="XVMtCqca"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="HogQKoHW" Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AFDDCrp030573; Fri, 15 Nov 2024 14:55:06 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=5/E/XWII8PMcrHTFDpNlIhRV/A4itS3xAggWc/T4S7A=; b= XVMtCqcaP/0JBSj8cIGXlL1w7CKpTvgL84bHR/0BXaN6plPua53x20h6GLESv4N8 qst/v4MAWIpFvcfBDElY/f5M+G5bQd3Z+jkGmlkeYhRya4KtsUMcb1JONbsj1VFf D+yhI7ZaShfvLqyZ3IPsKnTHKV0L1O1k7nJ8nHIH7biSNWGGiqn/VspdPngGeZCI A2c8mOswamsZqUH09iLJiYd53SE7MUekp4wsda0f+2PJjskLgl01JNibxCQ2t65u WjGleD3Gf/yvmFN84kFHUomjojq8VkLR0ObuYQQ7ivI+5aC9yDfXL8qU0xMwd0Kc RpUlyjJE7lLWmiyTOefuiw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42t0nwukb1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Nov 2024 14:55:05 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4AFCuEgi022800; Fri, 15 Nov 2024 14:55:04 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2041.outbound.protection.outlook.com [104.47.55.41]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42vuw2s4s1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Nov 2024 14:55:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=T2wK1YYbYehCWSlt1PWOB1Tv5dWB18BYjj5v+DOECDOo9ey2wLqNzF7nuluCIoCN8oOjxt0i/PlXMYvGQYnVOll9Csmnjxl97Dk4uJ3kJTeQe6X+yX+k97hkMBc/tKuy4UVNk5FGQQDD7Sf3czTmZKP28V/Zux14bEQl1XPcaDqAw8tjAZYf5NFwK6bh3WoHIHNGroiIb0mIqeaHZv3NsyBm3JBgPrCWFMlNGaRWs72eVkAsHO87mTV8MkDvM3ZwtmEBJ5r9JGfZpMTttYsDCCW98BaSPg6HpNJBb4uB3TZhTL2bvnsT8RQB3xtVgLl6tlDdBz0U8gJqRDMoiDY70g== 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=5/E/XWII8PMcrHTFDpNlIhRV/A4itS3xAggWc/T4S7A=; b=TtlrmP7MVVmHKPP2lQCHjFhzIn5k3lu3FB2JnNxN+scnyLny3K3ReKYIMJcrPR3FhtXryEcKZFbkDMqRJf3JnfDkv8qDEZaIbiQbqAm5PVw5qGmuQt2RdC71wNbhLRgtXCVez41hOyetvy8GUvZG3nruSoiP5xYjHGkwCgXB8OMkflGzp2Oez2Wfl6mggCX16W1fhrAmNj1I9jUyP6jOH0HanU78Zn0DG/SOr+p7vS/tPuJyst6vnF5QsLEYtcXu0339eYYJx+HLvN0U4ALiiCuV/NES3iG/8AO2p0zoXDEwxt6gOQXd5cKdvHVGN7sRD1bH2BUlYynoKAds2xy9/Q== 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=5/E/XWII8PMcrHTFDpNlIhRV/A4itS3xAggWc/T4S7A=; b=HogQKoHWp9T2Q6aIgra+aTs18SYoQKSay2svd2q3JaaD90fQHyG7tEgC7moU+awsBYxJIrhJW49uqryxq20KRkGDoY4bP59eHwFlcHwTcbWuFpJwWt24JKupB3qnuPP+os/J/hWSHS0FuIPR0TbSnKFejAgAMK2x80SmOtG/hYE= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by MN6PR10MB8167.namprd10.prod.outlook.com (2603:10b6:208:4f1::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.18; Fri, 15 Nov 2024 14:55: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%4]) with mapi id 15.20.8158.017; Fri, 15 Nov 2024 14:55:01 +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 06/10] btrfs: add RAID1 preferred read device Date: Fri, 15 Nov 2024 22:54:06 +0800 Message-ID: <8a076d890d2b76fa869fe282f2f53eafa692d503.1731076425.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.46.1 In-Reply-To: References: X-ClientProxiedBy: SG2PR06CA0196.apcprd06.prod.outlook.com (2603:1096:4:1::28) 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_|MN6PR10MB8167:EE_ X-MS-Office365-Filtering-Correlation-Id: 1bd62253-0c7b-4d4d-7ab8-08dd05857b48 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: vawiFmyJdey2+MvJEtamDIw3MAw281X1dC8d/jy86niSLzCmySDrI4Dg1UZ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WUBWnmxsiosWFJbrgEhz3iaCQy7RZN2xay0y9gCMrJ/SUcXL0gpxD4IPS3Ua3iCJNDOYseQA+ORGgafokhzz/2aU4I9HLv/NrZLdWLSVVhE8wzdFrEjPhJvorvDuljP/FzRpl1/LEoHeSrFup/bXH8YL8qOvs0hC/aiMltVxZQ7gaCudMLh4g= 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-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3oqqwDtQ2E3U9MyPRluTcypEoo2zdlQ0N/+LKCK/apOjrB55ys9YaK9/LjyxSEJ2pZnRoZYOYOIBGck2ZIBNCJqdI8Ma9PV6UTgHC7YWt2vnI8OHLo3x6015puNral894qFeYaRuBlZ+I+ijUqKFRTGxPpLIvDihgjKIPm++pa/9minji7WPSS9X3NnMSlJPzrh0KpiKqMzRzPdUjGoct1LvIhz47lCrucT4/NJZ5N9M3t2VT1GVotmdRPhh5ixaLOuYei56Vtw3HHQbRmP3j68CD8I1CzbGSJ2p23fogX3glF1lSAWnco4FrDT+kAL/30bBokwHfXT+9fg3ugYczRbaO7jncRpfBGn1qwRRSKuOOCKYoRMhEJioMFXm0yp3RERavs5YDLi13Y5b8kNiCBf45CxMdRRPzmHPZpMcV3sMqpLQn9TFHmGJkuYnsxG0oSVSl0+Gfm/KxcX/PEip7O1Dae14R1uKWtbOBDpBX32YKX8SqTAc0yHNPSPk9wbgSy8J7BLtnZyT/TukaiN4SuaGD3ihLBz6YV1RSoSdVK9j5JH5dcF7atwSDrli07h2IpR6cgndDPfYMfQYVhwX16Ixx+FikAMlWyJvL6F0z2GHrMEbI4EyHdxDEpOZHktJCF7gzDgrepvudUu3w2ypmH95UqJSnCE6NhyM7dpWXtpP65R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BMOL3VWAnCgPSuvx5jn+NkQD/8aGlmukNTgiuyJ7p+nsWZTPwZ6ogcT0oIXog2yunaLd9lkFZK1PqzFmb69qOV1sMzS8ptk0qwa81Uun4uAiiIfht42kmYBmROJTubEDRlcy80UB/xfMJvMBQj/JM2fkb8gb23GGSHuoA0bKTiT1a6aD6lum7gOTcgMjPkPm0yJ0q3T9AKGxPqHt9DinaFU+o+joRLzP4+JJmzMvjZYegpOCOJtqiv3VJfwEsZbh3eJQcM5vcUI6JFI/A6oxiLDpVdL+B9he9e+QO032GJS3Q5GX571jLkEtquP/QT612oPGz4Ob7DoEFO5x/8w5K1DRY2gr2CgAc2BJasX4YC2GysBkutEFjCTkkvxvJa38DVH+GqQj7Ktu97Kp9xCZTAjzRs3UTbbtQd5GvWMJVOGDsk+SZxI97fOq0f++zn2YQFwyBVKzsdra1vtGYusvhl3hI4gkoLNfL5OPpvkFNsAiqi1TeLxGy2cpS662lhfmqL3sUqb7PQ+tVdO14IKQkhdvrk= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1bd62253-0c7b-4d4d-7ab8-08dd05857b48 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:55:01.6289 (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: KZgYgJb4VviM7J9ujFo5gZETJf5SVuO0fac30wwsSLUk3RxzKLCqYwmR3qj+TGUxqTU7e18OYpfPweWp3y+AFA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN6PR10MB8167 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 bulkscore=0 mlxscore=0 spamscore=0 adultscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411150127 X-Proofpoint-GUID: cSk4ND68x8ABu8fmIX5l2zPH1f8zJtC2 X-Proofpoint-ORIG-GUID: cSk4ND68x8ABu8fmIX5l2zPH1f8zJtC2 When there's stale data on a mirrored device, this feature lets you choose which device to read from. Mainly used for testing. echo "devid:" > /sys/fs/btrfs//read_policy Signed-off-by: Anand Jain --- fs/btrfs/sysfs.c | 34 ++++++++++++++++++++++++++++++++-- fs/btrfs/volumes.c | 21 +++++++++++++++++++++ fs/btrfs/volumes.h | 5 +++++ 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index 092a78298d1a..96d0480d1b9e 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c @@ -1306,7 +1306,7 @@ static ssize_t btrfs_temp_fsid_show(struct kobject *kobj, BTRFS_ATTR(, temp_fsid, btrfs_temp_fsid_show); #ifdef CONFIG_BTRFS_EXPERIMENTAL -static const char * const btrfs_read_policy_name[] = { "pid", "round-robin" }; +static const char * const btrfs_read_policy_name[] = { "pid", "round-robin", "devid" }; #else static const char * const btrfs_read_policy_name[] = { "pid" }; #endif @@ -1375,8 +1375,11 @@ static ssize_t btrfs_read_policy_show(struct kobject *kobj, if (i == BTRFS_READ_POLICY_RR) ret += sysfs_emit_at(buf, ret, ":%d", fs_devices->min_contiguous_read); -#endif + if (i == BTRFS_READ_POLICY_DEVID) + ret += sysfs_emit_at(buf, ret, ":%llu", + fs_devices->read_devid); +#endif if (i == policy) ret += sysfs_emit_at(buf, ret, "]"); } @@ -1425,6 +1428,33 @@ static ssize_t btrfs_read_policy_store(struct kobject *kobj, return len; } + + if (index == BTRFS_READ_POLICY_DEVID) { + + if (value != -1) { + BTRFS_DEV_LOOKUP_ARGS(args); + + /* Validate input devid */ + args.devid = value; + if (btrfs_find_device(fs_devices, &args) == NULL) + return -EINVAL; + } else { + /* Set default devid to the devid of the latest device */ + value = fs_devices->latest_dev->devid; + } + + if (index != READ_ONCE(fs_devices->read_policy) || + (value != READ_ONCE(fs_devices->read_devid))) { + WRITE_ONCE(fs_devices->read_policy, index); + WRITE_ONCE(fs_devices->read_devid, value); + + btrfs_info(fs_devices->fs_info, "read policy set to '%s:%llu'", + btrfs_read_policy_name[index], value); + + } + + return len; + } #endif if (index != READ_ONCE(fs_devices->read_policy)) { WRITE_ONCE(fs_devices->read_policy, index); diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 97576a715191..90d84fb664aa 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -1331,6 +1331,7 @@ static int open_fs_devices(struct btrfs_fs_devices *fs_devices, #ifdef CONFIG_BTRFS_EXPERIMENTAL /* Set min_contiguous_read to a default 256kib */ fs_devices->min_contiguous_read = 256 * 1024; + fs_devices->read_devid = latest_dev->devid; #endif return 0; @@ -5964,6 +5965,23 @@ unsigned long btrfs_full_stripe_len(struct btrfs_fs_info *fs_info, } #ifdef CONFIG_BTRFS_EXPERIMENTAL +static int btrfs_read_preferred(struct btrfs_chunk_map *map, int first, + int num_stripe) +{ + int last = first + num_stripe; + int stripe_index; + + for (stripe_index = first; stripe_index < last; stripe_index++) { + struct btrfs_device *device = map->stripes[stripe_index].dev; + + if (device->devid == READ_ONCE(device->fs_devices->read_devid)) + return stripe_index; + } + + /* If no read-preferred device, use first stripe */ + return first; +} + struct stripe_mirror { u64 devid; int num; @@ -6047,6 +6065,9 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info, case BTRFS_READ_POLICY_RR: preferred_mirror = btrfs_read_rr(map, first, num_stripes); break; + case BTRFS_READ_POLICY_DEVID: + preferred_mirror = btrfs_read_preferred(map, first, num_stripes); + break; #endif } diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index 05778361c270..3b7ba202b169 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h @@ -306,6 +306,8 @@ enum btrfs_read_policy { #ifdef CONFIG_BTRFS_EXPERIMENTAL /* Balancing raid1 reads across all striped devices (round-robin) */ BTRFS_READ_POLICY_RR, + /* Read from the specific device */ + BTRFS_READ_POLICY_DEVID, #endif BTRFS_NR_READ_POLICY, }; @@ -440,6 +442,9 @@ struct btrfs_fs_devices { /* Min contiguous reads before switching to next device. */ int min_contiguous_read; + /* Device to be used for reading in case of RAID1. */ + u64 read_devid; + /* Checksum mode - offload it or do it synchronously. */ enum btrfs_offload_csum_mode offload_csum_mode; #endif From patchwork Fri Nov 15 14:54:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13876350 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 6A6D61D4352 for ; Fri, 15 Nov 2024 14:55:17 +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=1731682520; cv=fail; b=DuFRTz4vtCMoQiNbYxZzKSiH7ISwwI+sfuXcNirPEUP7X4Fy1tAXQ/lcypb7cq3cxOio+VFgrVRcnHDuMWyOXMxCdp1rOa1+7Ox/UCIbIp0qK++3td6+d3S8Bg8/3Cn6cyQpmPvfghsB1/xSG+gIBcBKgzBTSLxrN8dGCp7Brj8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731682520; c=relaxed/simple; bh=uqgKBbMbaiP+EC54pDdaY0tTseyJ4r60NA9N+yh9RjA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=bAaJI3sx23reEvd4TOSb9CY8cBZXxKSiT2WISZilRT5mLu59yZ/Q3s9M8EtgmCqrAhSALJQGeHy/yKFdC0ZTyYQ31EmHeVZGEvmkf6bJIYx9jrqwV0R2Vw8Mzg+E17WTiDi0S+HjUQwlDnS9SkFmJlyrK5fU9mZOlyLyn6eg4/Q= 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=nBx/C8vB; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=EMm24QNm; 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="nBx/C8vB"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="EMm24QNm" Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AFDDfUF032164; Fri, 15 Nov 2024 14:55:08 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=HCejvsq6TaO1hWg/sI8WCCAvubtrapNoTeCBQFJ1Nv4=; b= nBx/C8vB3L7yTTnRY/yT/NUXZ/A2gGULA5ug4EsJnt8q0fMjIEaL9Y64EFH2NYmv OMs7+tNk/rWBaBJTuIjObr6+uYSh6BVRWZRH69gFarpd/4mNO81qL8AOMr6uayH1 S3hkN5jJaxaY1b3pqCIjt7qsFIh2g84GR0RDocHxUMenVQvNVmEzpF+CSRRa9tPQ h6O/e9rDCixNRdTJGZWf938EiEWZBW+g2sbSgK71R/KxOEN7C7KFck8mBpa5H3Fd 8lWIMBSX2uXc+o75EoVj+Pj1xaEWFBHq/0mwPlXs2qEbe/+YTN+P1iQ0NmebVJh6 ujxHVm2OhyBF5Ha6ypAAKg== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42t0heue52-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Nov 2024 14:55:08 +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 4AFDDnN5005705; Fri, 15 Nov 2024 14:55:07 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2177.outbound.protection.outlook.com [104.47.59.177]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 42sx6crfkd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Nov 2024 14:55:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=H9BCpN9lppHw3MDjSzwH/llnHU2t8iz6ZN7lZWAhgb50qILnkU0OcHrbY49z09oZD5EodWqyQr5cM0W/oTw1FP0FbWl27j4Ml6M2Vx/QeYv34wfmpcSP2gWrb4lnnJi8LrWEXie0YzhAXR7bAmtALHYOurz0Tr/6kWO4oQcOzuMgJ5pXZfH7XhsTaCkwgRIz4uSmHFD9qC0keZTOJJTcXr3/q9EEJR4I6mZB5J5iYh0W5rCIaiAo7IKiemSdrZqyQR+7e0I3Os7aeYbzZ/LFvuzDrES/G7OdDJPKAMByba7eV1qDQ2l1rd+Dvhtn8Cl2Qqz5ObfUuRtVUfSr4/t+3w== 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=HCejvsq6TaO1hWg/sI8WCCAvubtrapNoTeCBQFJ1Nv4=; b=cB5hA1WCN7L0YWsxdadS6fegtd7UWNqxJc4QZZjOzJO0kIfNjUXR0wS3thxxinALtElhGN7RLgl9fFIr27wO27EgcuMgelJ08XZ+rit6ll/3ayX1OZuBKT/6cdwl74XCdvk6upDRZWjifc0RM51eRiMQCpKKprcIo1gFAK/9yYVoQQAgUYNvslrqTJZrM6lreqYInt2fg2aAj5n71gz1o1WNxyABBOjAlWgo8/iUeuyL2WjbAyZ6OkiLmoEu3GoICScHPj8ExvxA8tNpDb2c+ikSY1qtSohMQm9AVHr+o6teKxhi9VOsHYf6JMIQRi6Yju1U7zPM6HQyXK9/vM9lyA== 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=HCejvsq6TaO1hWg/sI8WCCAvubtrapNoTeCBQFJ1Nv4=; b=EMm24QNmKCkOlcIQraTvfGvsYVhm3DoSFDqvC5ovwjtO/xSk0FQ2S6XuoBngEI+9ClbjNDXV9oKpmnsN3WBAEKx0+9w9M+BaZ6h54BeHR7io98wUdapxyqaszGo4/KIc9J0C9ZEOtY6dGYkKP6o8T+NMYHWRE5YMXJxBtgAftiQ= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SJ0PR10MB5645.namprd10.prod.outlook.com (2603:10b6:a03:3e2::22) 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:55:05 +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:55:05 +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 07/10] btrfs: pr CONFIG_BTRFS_EXPERIMENTAL status Date: Fri, 15 Nov 2024 22:54:07 +0800 Message-ID: X-Mailer: git-send-email 2.46.1 In-Reply-To: References: X-ClientProxiedBy: SG2P153CA0002.APCP153.PROD.OUTLOOK.COM (2603:1096::12) 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_|SJ0PR10MB5645:EE_ X-MS-Office365-Filtering-Correlation-Id: ab24e9f9-1379-4b8d-e6a4-08dd05857d63 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: CXU4xCJ5rb8YpuwMFDfM0brXTjl6ZovCC5N5MQrk9DCQz1EQqgtvOyJqpAQUFbKJeX3GQ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awzWYRTMj49CcVpG3eBq2MPoAh+MioCGWK04YBKs1hUJ9HmYUWWF2AiTadHl9v33hZFhkFVcEdaAh1c9E/yHoP75Qhta8sgCQtnJftS7nb225MCspSEMIQ9F6QF403JkoYHL+Kad2DSkfk6/fGOR017rYuZbyHpQzbNufHwM4/Cac8HfdvF/eFphoRqL4BHDmE 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: yg41ZwAvvkozsL+gwoJ3h55QYFQbsL7yMraLp8LsSQ4cSGFScpK3OnpEUifUPIqSlSZ2wJMoY/v2c11RzzlAwfzPNDZVvYUKEZYLXsXzRUWgRYClEAA6jzO8/onDJrtw7JX7hgkwqMuLmpt2CzK9iEF/VLMZhBON1aXVDg9VNGs0ovZZl25iU6jivwdM3hv7FwJCdxzo5WJk51pTh4v57NStRQ+HcvsOun1at22Gru9phXFLKNNlpfAt5+uN9q01huMzxLl2oQwMYPNDjGwBZAGAGP676sffcI/ZSEiRSMrUAtg86pQXZhGX+iAk/u5SplAfLwROR42VvLGm2yYtQ9Plrt9BgHUKd5IJUu5DvSCEeVnnD7ktxdIHD7DWrf1IkK7qC81c+5f+I5KVkjdqNUMc/SkI3AbNkTCATp4Tkepxb2R9HfNv/8LOTb9nDoiHAaDmMFah7jmxtn2+1gbUanIM9AuWjrH1Z2/tSgoX/+Na1HHQnrDo1y028ABjD4KefCbl8lE31/atIKAZdfvQRyut8zLvCllbBXnyyMyLi57ZqXgQanvmKtTu5kmJO0lhf6Z1tnynjW9LO/WhkJXGFQGwa6rX91jjfi5RxZD+RsxFVPWmCC+F3vbAp7Tl1hfhB6eVi4ntMe7eT0Juy5l9R/5oKEDw+usp5Z8x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N3IDLHqRqKbh/QU9nOiiCt4/bQ7VDvVG1lq9b78j7sXDHXunNQO1oHUVFfATnp5fvJvrQxHn1ylhN997tqOEpiRHh+WFeqAPmNUGvJ8gEaeewu/yy1ScGp9q6bzLr/YMFDWk+Z7YDVoPp7/wEIzOY1OIYDnnLOHLysOuKkqfdo+M8ZNP+4GFkCImQk5k/GVyT3LsC6stg7GfKhxMW6lgrSQl5WXsPMIhsmeaLZCfs6cSUgNUI1WxDa3bwYWm3snlxeYoMEtllWi/3A+kyK+i7cCACvHCyvkj6tyepkxfckAqxVb36EY+E1LTN1LGMlekoBU4KD62HNhe5jhXXdG+y5MiawqXDXQQpLgnRpWLltPXq7svCw6UVoPnjf3ZXEOuE0WbXPV+ujb7z90qN6IkEdSVeDfJF0AoAqnHAIgy58bLHTg8ObHpz51oUpG8vOR6H3lkPUJr+3bO7Xb1ltudUs+wKbyPW66pEevjHedrh0o/j1yXholmlWYir+CABbq9A68Yidcn6t8FCtgsMBl+JsovBI0E5SQA= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ab24e9f9-1379-4b8d-e6a4-08dd05857d63 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:55:05.0138 (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: hnl0hjXS5YNq3BYPI5qUdtZx2y4Y8tQ1bINJcnq6KSxH/kqTq4/gAQOgXUs+5b3EaVAAIVUkxbpnrpsuDfRqFw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5645 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 suspectscore=0 malwarescore=0 spamscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411150127 X-Proofpoint-ORIG-GUID: vz9EIs6bxeYE6VHjJ6zV2E0N4WwptO2H X-Proofpoint-GUID: vz9EIs6bxeYE6VHjJ6zV2E0N4WwptO2H Commit c9c49e8f157e ("btrfs: split out CONFIG_BTRFS_EXPERIMENTAL from CONFIG_BTRFS_DEBUG") introduces a way to enable or disable experimental features, print its status during module load, like so: Btrfs loaded, debug=on, assert=on, zoned=yes, fsverity=yes Signed-off-by: Anand Jain --- fs/btrfs/super.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 6cc9291c4552..d52f7f6e2de7 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -2487,6 +2487,11 @@ static int __init btrfs_print_mod_info(void) ", fsverity=yes" #else ", fsverity=no" +#endif +#ifdef CONFIG_BTRFS_EXPERIMENTAL + ", experimental=yes" +#else + ", experimental=no" #endif ; pr_info("Btrfs loaded%s\n", options); From patchwork Fri Nov 15 14:54:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13876351 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 D653C1D432D for ; Fri, 15 Nov 2024 14:55:22 +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=1731682524; cv=fail; b=jjLtWTjlpab7D8JkkWV4o54kShHb+d7wcwMHKgC6SEVZODixP/WefCWYDLBSfl6wDVjKFuvhMlJoClym+HbFHVJQNE5SMkndu7UUidDdVLF8GVgtYEwhEGUblaO323zpdjf1P7I13pyR27mZoUe1zONwVDpK3b9cZfWfrCvanvw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731682524; c=relaxed/simple; bh=wy2e3PSiO8u87DwjiL1m/EVMP27q8vdlCLaFNJuKSCA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=g8RBz+wiqd3XCIPH92qPtVkUCXoSlSkxAYGA5F3YUXaC4OsnC0cYYlS4Tjf59AcGOkk8zo0rkQGYy1wtvnv95o1gIEc0GCxGdsVgCqeu3Q2lYgugBQEpYeRl/Mdcnw+kjRSPipSaJH3SOg3HELGO2pz3bXtCsfp/Jbj3D1w2IrM= 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=VSRDW/Ga; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=xP1IMgi5; 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="VSRDW/Ga"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="xP1IMgi5" 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 4AFDD9r4019222; Fri, 15 Nov 2024 14:55:13 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=oEvYARKFBI7o/E7KyRTlz25joxSxHOSs/6gp0OtR5r8=; b= VSRDW/GaLcQXjcgyKMj8vMozJYhAGr+imXedjPPxBi4apMxwzh5GyixNDmnIytQ+ L2Egwj1wfp9RhbD5ai2yrYp/u8vlc7KyQ9qexuCP2bxMFbwibhuwbBLKaY/omjBi NGFEYKjCEc6XdMgxa7OobeQdK+Qaw4RxMXzvxLyGiqLydyE42RjJfuzZbLlWM471 AlE9+8rXxOipue7a6d2EUSFyxIt0SfyULduh/aaxk5uytQFkMxpm14eDUipnvfE/ gqDiAnYmttIPUzpobkrjCWouk+U4w+SMb4VzA80ay0efWl1d9MNrm+RYBtCiLJ0V ZZHnOUvPvlzvmmXPG/hlVA== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42t0k2bhc0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Nov 2024 14:55:13 +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 4AFDDGj9025853; Fri, 15 Nov 2024 14:55:12 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2049.outbound.protection.outlook.com [104.47.66.49]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42sx6ca3x1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Nov 2024 14:55:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FfjIdioqa0XIUwVWnpofMkaFtTWleuXj8TCcym3ObqtwhZdo3Om1K0cWIjLan6MwKgPKwdslqKyIm9zOYf901Q13nZHyUK886GCAFSGZzD2M1oRv/SXN48RxYTFvESTUcZnY4Dw8Av1kpL3OQ96xl+63KKzAu/O1GX2SwA8iB198v4Z5/V7JmSN3G4bHT4Z98qDZpSxG8aHB7XpkG0QV440XdxUgvZ2vlAReZMwyIAl9nmeFkjZ0FCFRpFp04Au9kxp5ql8WL1OdzZcdDo3pwwQ2TC3RzW8TBgY2DvnRNN52PmV5Vl2qteF6SVX3brb1/8As4qzBMeXZx00AkMgKuA== 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=oEvYARKFBI7o/E7KyRTlz25joxSxHOSs/6gp0OtR5r8=; b=lPhneObeTzaicl3QK+WJurI/ivZybtqVm+p+s5ZEBL3fK4ezxBcDcLgu01fd3IxqrcGUX8CcdoG26aEj8ni9ev5g2F2Eh8grbcMFGNGhgiJsiQUWOtDWj3WDEJWzedi1BdrSKWlxmppKG0S2ePo1TUq5IYPlyIBrkPZ9dDzSadZjv9nUT4lX9BnhomkoKkBmPi9LtaY1rIxAV/SI2MT+uL3sO/9HDBP0GLeVoAW5tRcYxvnrdCmmwLs3/uKEd458gJrw+5Y6RFiM5j/i9Ju+I7U421Y292cbIMZ0xX0GnrRJtbagLSTkCfkBA5zmJyPvWlWYsiYuUTyUZW9eINUS3w== 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=oEvYARKFBI7o/E7KyRTlz25joxSxHOSs/6gp0OtR5r8=; b=xP1IMgi5ELh1VDxw8jcKVdbI3DnwrB0jelUa/1mCpWlI6DUYC/FTXzGU7IV3aSxb44lN+z+TSCI079jp/ahAiOmrgXBJiwwESgOg0mCLVNThzTtC/iZlG/tz8Od4kR/Uzv32uO/z7G+JlxAj3GaMIRORzODnMxa91Zj8hJgCnes= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SJ0PR10MB5645.namprd10.prod.outlook.com (2603:10b6:a03:3e2::22) 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:55:09 +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:55:09 +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 08/10] btrfs: fix CONFIG_BTRFS_EXPERIMENTAL migration Date: Fri, 15 Nov 2024 22:54:08 +0800 Message-ID: <4abbb1e359944c0b2b65b43fc0f8fa0f95b14753.1731076425.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.46.1 In-Reply-To: References: X-ClientProxiedBy: SG2PR01CA0182.apcprd01.prod.exchangelabs.com (2603:1096:4:189::20) 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_|SJ0PR10MB5645:EE_ X-MS-Office365-Filtering-Correlation-Id: 314d66e7-ac6e-4def-f543-08dd05857fb2 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: gkAnmOwvrDiYda0/bFxPV5TmgGDpyq10hIg6b/5BQ2QyQyWm+woJ4k0Twg3JhqqvS0x2sm101ImctNMJNM322pCYzA0yREEjkFOAOTlHiBowQK1WBZ1mEMFWyV+XsJLDALVHWe8+QzXvTT5xCClOGa1Xnq/S0Bk7sY4rYwootA5Qkn+EXyTF5aT/SdaxS+2xbKySTGDj/Z1nUiEiNN84NS1wEpudOgyzwRMc+cMMdqwg/wxmwO18g6T2HbS19/o2WQaQHwlWDeM6ijpSHObbT+TDQH3uFddXR+/rw+kOlM0vuD+4jrNNGOSZvqzSaE2qJFza30GPt09hwLlGY2yQ778VYKDHg+3xhE1SVjdJPQ2mvPH5pzMWlUVPgUv9uJs2YUuWdZytfOIIKXS4j/Bm+pL/nM9yywvZgJB66AJ69iC2d4cbCKbR7eetXEKlLiJN78/1qCVtR/wqaq2imxcqSYfmB+DTFkun8tqDOufw21glMbu2AXdk12DA3nug0oHfqn4/ZkElNfkrBdbH5TkUNp5egS7P3bG5voHibjWSuIJWWHi761Ruxc9lChMo5YElYz08o25oktKu366QJSgYPSFFuT+FKkgyaVzbEAEF04u9aSP5Fxlb7WAXb3U9GsNgyYQ31K9GenAJgUb0HJe3D3gfSXBFVmElkVRf4caaksmbwf5oOyZlaigS3bxXTV4QlrNJ3hGXMAvxmeKjJtQ7IPtdg1aFLeRhET7dHk+O8pAMmxJTMU0/+Q2uMmA58irCgDJpcFM2Qo02YA5eASEPiVWayfqj1+PCbiwiyRv9IM+j3RG9XQ0lYSwuC4Spb0oOrV+mG7bRpMOGNmLQbm3sANBkzHDN45uwiaLsmqyBMVJ7gHv2o2j1aKfrzaB+K4BgYGMp7exXMTMKI9TC6T4s4cMjGsbdd7nLrMxS34BTTGegCYW7uwO+MBwxI+lsgzyn14RrNmF8MTP3+UrsSpWoqh1Lk4kL2o90r7gA1mwY8yXVj3DyUe2HWqvLqzh2Vh/TLkPd1Yw4ZNnlmF7iO32KjKMzS5xkF3NT8xtQ+2tn/CaSyFEvb24gDOdcJldQTIvwtkZNSCqeBb5NY5kykdYAK6BcwCndUEz7f3PioNQGmS49pDq+ommHIb7/fFMpqihqDoFkqRa3DM19ARV0HyJmocJHOB8yyQda91Plhh6hJI19tmCGRqFjxNAZ68IEfC/XFama4vXwFb4HIBfDX0boZvIHsIIH+gt4nJsn+Mt4H5tXWiQsEpOoahOwh4/5ov2Gdlx8RbVvTHWN9zs7as2/a9mmzvwKnn6BZbvl4Mj+HH8lomUTMrK+8iouZR66IjwI 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: 3R32IqAg544ZqRhOR/k4rapM2wqkjSMxHksgcM+cAVFfVLTsDOjSSknMfCseyXpi9RIpn1Ey6irvRTONd1CG2M8sW4sObaeKg9j85SYeJl2b8Gi6Z2rECXdIId89A2ygSMb7IFhIQhjAamXf1dQuZOwUqT9manJtB9nDPys8pzAwxqAjBXAbmuHDWOVvCiu23dBogob3RCCb8x9Krqj5ChO52DHZbeNaNHVKO3fQ4L5fCEG+CPkkg9evUrFjLMXMeFH+dGmec+/tS7nb4cgS1tC/ZbFpR9hG4e60y/pGYkcc/OYxAOtfVAa/oZosQarSZGo5fLX3sgPQ618aLhQip2xjli8G0bijQEXoTrGifpk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DVpLNLkRK0b3PNfyY8xgY/L8zfdtu3Rt+wtgxwzcdJukddJoec5ZyKmHuxr9tjCHLKCRncaRWLMNER2OmB/f2ZO9pQXkFy4r1SJ90y6o3FOSAyB5obIpIYgTNmC0SbxJIQv8a0QlLjq0Bv0eRtX27xwgCfNanzgDQ X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: yRJpn5cKW8vu+JDxxJQh3SnB/bKoikjctNL4fscg0tCdnI6j0MaUkA0JKUFIkwhD3TlqugMLMmiKlB4rmXaGrBlD+d0OEBif/Fw5v9MkYxloMveFG7UU6n2KkS46AByVMwGrSIt+Qmx23YhkSOAFWeN2+FwH91no9vIxo9nR3E4XvuRI/TK3Z9wKhcohBAepGvDmrHxbLuHQ9ZQafrtiyRDGEeBd4DXjq6vv8O81B+nXl0q36t4dX40wTxrXSAjHRcAkA2Y/cvGesLuzmefaz1NTRxSgFs0DHAUlxE31FPnu10SYZsY9tLH5P7FezIbQay+UcBJxZx6s/2PK0HeFISMINzaOYthwswB9IyykOHPE9g4UR9Kks324NKn6MPN2P0RrTlpBD9o/6KXUZjxX/u9r4gVGmgrpo0JXV+aL9R8arx2BLhhdnimA1z7mjzMj8A7HGxR1Mu40sYVEMshblNk/7WZ+jypSQZB/QAmTPLsuPIbcTh2tCMAmZLzexSKzhgbLZX6RHpixgZNITDodgCnj6tLwrD8RsaNjkzu82lb5CtvBtEhoJKOcLxhyRexNZQ6l3Az6rsTLNTJ2nfpDA0OMiJnZhpW7rUkLHCFsfCw= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 314d66e7-ac6e-4def-f543-08dd05857fb2 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:55:09.0536 (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: O/k50b4A5P1QirFpBSNj2lDeaHGtZB4GQFz1VF0BDeEDlPyZGvcU4UvgzIB8OHQ0faCn+zbz/+L+EXjij/v5/A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5645 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-ORIG-GUID: a5O3PeoZOuPERrQRZ3kZeFtYe8PCoL4a X-Proofpoint-GUID: a5O3PeoZOuPERrQRZ3kZeFtYe8PCoL4a Commit c9c49e8f157e ("btrfs: split out CONFIG_BTRFS_EXPERIMENTAL from CONFIG_BTRFS_DEBUG") migrated some features from CONFIG_BTRFS_DEBUG to CONFIG_BTRFS_EXPERIMENTAL. We could also move the corresponding sysfs entries for these features, as there is no point in retaining the sysfs interfaces once the feature is moved. Signed-off-by: Anand Jain --- fs/btrfs/sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index 96d0480d1b9e..50b8b8847dd4 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c @@ -295,7 +295,7 @@ BTRFS_FEAT_ATTR_INCOMPAT(simple_quota, SIMPLE_QUOTA); #ifdef CONFIG_BLK_DEV_ZONED BTRFS_FEAT_ATTR_INCOMPAT(zoned, ZONED); #endif -#ifdef CONFIG_BTRFS_DEBUG +#ifdef CONFIG_BTRFS_EXPERIMENTAL /* Remove once support for extent tree v2 is feature complete */ BTRFS_FEAT_ATTR_INCOMPAT(extent_tree_v2, EXTENT_TREE_V2); /* Remove once support for raid stripe tree is feature complete. */ @@ -329,7 +329,7 @@ static struct attribute *btrfs_supported_feature_attrs[] = { #ifdef CONFIG_BLK_DEV_ZONED BTRFS_FEAT_ATTR_PTR(zoned), #endif -#ifdef CONFIG_BTRFS_DEBUG +#ifdef CONFIG_BTRFS_EXPERIMENTAL BTRFS_FEAT_ATTR_PTR(extent_tree_v2), BTRFS_FEAT_ATTR_PTR(raid_stripe_tree), #endif From patchwork Fri Nov 15 14:54: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: 13876352 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 D9BAC1D4333 for ; Fri, 15 Nov 2024 14:55:28 +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=1731682530; cv=fail; b=fSh+QAz2wmUt7uosEdSJXESPdj6xQQyRP9/BwF2BQMQTIWu6zuKDZh7gmr/IQ1PssS7bDpG+ptID2lPOhjnGa85c1NG924782D9SIpETUfGdmY7O86VsMXecWvxjbuOniOo+/kugUxDttXc9sK5G6E4F97f5vug76xMc76VIPBo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731682530; c=relaxed/simple; bh=IF6x5mYvckeHTvTazKiGkIzeJE3YO+IuSCld3rA3Pcg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=UqyVhPpPQdm4fPPleccWru1cBcSyhGreSuRYhlw6ffobZQ79jrenm9LH9OeJ5vElQh9lOKRnVZtVfeVWqJcxbIwrvtUNOBpLcTxxRwmX6Gm5fDuuqRyNR0CQ5IXmNP5k6oM3qhso88HLWFMctIHiOMbRgoypF/hmdk4K+CKLy0E= 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=o0hbkYIF; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=VLJbh1v3; 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="o0hbkYIF"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="VLJbh1v3" Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AFDCVjt005695; Fri, 15 Nov 2024 14:55:19 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=LgZOqe4iRQLYxW8j4tgOXK1I04zS7upotjpJMBdRX78=; b= o0hbkYIF50iCu7GurAYdq0gyYmCX28GmKvvCVNo8i8TShFELCouJB0KQfzB1bE2d XYK1jkjEQJBh8NzI+rerc8cymD5W6K5UxlG7p2iIclrkY7gKzLkTxtcxcH1M7cdE eFCW0AyM3rQchxqHOc7Cex5muMs8gnPHMP0PbYDV18wvnSf3cwW+X4h7KXfAYmQm OWHKE0aS0mv2Urcenki3YkBVrOzhqiubWppBEtGm0PuVe0b7HbOJXHKMZdy0yZ11 DzYUj84v30wn8kYVzoffKj+bTWNqoHp809kwpCo442I/4OMeHtM83Knp1ovDipbS 4TjTpLTq3jadOrhJ4MxQZw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42t0mbkmp3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Nov 2024 14:55:19 +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 4AFDDGjE025853; Fri, 15 Nov 2024 14:55:18 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2043.outbound.protection.outlook.com [104.47.66.43]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42sx6ca41n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Nov 2024 14:55:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pFY3IOTUzLZ5rsACUs81WJqCOZkhmuv/q2HszrLV7c/H6I95lNXcH8NiHutZ/0ozuREj9EZe2BSNw6fzCI2aV7HY8Ky9PdEihAJ7a6BPEFvBeP0ABECsY44DKy9yy+zwuDHmTghba/oqiEllcymkINKvQs/Pbhy2HOGn5QL1BmYiTu4AHYzEcgY2Oz/SQRUgVp3RHNL9sU1G6A9bg1pxJj632eCeSdbRNpqRhfyXbCaKAkgKLOwQ39Aeg3MzauemppHOPTMU+uFvOaVjsoinAAVi/YDR+BhBizy/LdRjYxLI3h1wvKq6jtmyf5nBnqtC7gHJxfvfgBgaSyJj+eEqXw== 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=LgZOqe4iRQLYxW8j4tgOXK1I04zS7upotjpJMBdRX78=; b=vFqbLVbjpnXkO0Oe8TuLxOyNgeX+B9qSEz8aPUfoRwZwahdXW7g623DeZnbp+c+se6ACEmh2hAoB0v1Zjl9za1cQWRstGhiSNuPolKkBGvv0iDj8gXAJFM+mp0ZnIISBXsxdgyEb1ljlhmfxJQenRVGLez/i5Mb+FJgB8KkTuTW8SV/YG/hg4S8jMZwGwAGa16fCwXafTO+YTdTyrhkIz2wvBze28Wtk5F1OrFpaSEkKPTLZFCNslXBKmIAVkw2oAkPAt8k3HlLeFkF6qzbjmNPU89HSbuVc3Asu5EIkLDaZnkYdF3QFbJdN2hTP06MFIo+n8ldRVf0s6YHHgOD1ag== 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=LgZOqe4iRQLYxW8j4tgOXK1I04zS7upotjpJMBdRX78=; b=VLJbh1v3YuINWZlk2mKV5C2mWVVc+FjMSOW7HEW0nC8L4T8N1qzMvwmeXjcoXDuJgiPt1K5BrLsXFnR1hOoINX3m/jJwsbbYjm1CmW/AM4tGicDHIE/eH8JNYr5S3i2kaG1SALznBSeGbTXMrcYA4YnIT/hc/xmqeNpJdjneII8= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SJ0PR10MB5645.namprd10.prod.outlook.com (2603:10b6:a03:3e2::22) 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:55:12 +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:55:12 +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 09/10] btrfs: enable RAID1 balancing configuration via modprobe parameter Date: Fri, 15 Nov 2024 22:54:09 +0800 Message-ID: <6f5d7b5e910d5cc7b9b87adc91417402d3f3189e.1731076425.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.46.1 In-Reply-To: References: X-ClientProxiedBy: SG2PR02CA0111.apcprd02.prod.outlook.com (2603:1096:4:92::27) 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_|SJ0PR10MB5645:EE_ X-MS-Office365-Filtering-Correlation-Id: 5a5987f6-1850-4c2c-51b3-08dd058581d6 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: kL3avgBSRDakcyldaUVlwCTHbl3BulJHJ3CgXRKw6fb9eCpje/Mz+EU1kD6ghl8o4cgditEMBmREkNuwuZcP5tTAaMvjRW3SyJhVh+tDmaXWadjnspbcAIAY+sQPEbG92wQPfHQhLtt6Hff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c0E6C0VF/HjciaH96+9C2EtfIsnq7RJ+yW1u1Zf7j7NXlE6BDyRlMXlVNFAbJihc2w4BUUMNK4sKlfwMrSCrX/lbAD1ojrFheBiNAsoUIkdOnf2n0bakY7GD 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: NHUuvuoJ1QGWmn51hdosXRrwC658HjfAhX37UHdMqzRKPouae0qnp70anRviNkXWP/iLOmAuVjDncHZD6p/pwl3LImafBHBlvtCF6kfe1zahMZDzjWjmsS2V5SC4FqDY8N33oxlleI+Df3CVyXJNhKdvdquNRpib1mzFSefjF1INnzIqBU/5ze5nm9fGAqhxpkqEEZm0U05bKqlQm4CxTAETWqCNlPReJutWV8kApwBHbobJ0kwCtyfdmZsrwKp0OpNbA62yR+mujYnrbHFbNGMSJCwwYlKG4VN91NwpuVCOwOHeez0g6wro54ecdcCKpatVEnfT3fkPlpUTPA2Gjgkm0c4IkMump0YqFh6bODuenk7khoSaEeCecUub6HSyq85wGIwTIcQS2km0QjNFbIVy5bJDBhTUblzF1vTWkWHQ0i4uqxc7pgFXTT4nywbWxQCEncI9l6wNK4lPPxFuP9MTNx/W9TiyKuxu6BW61J70jvASYn7VjXcI0TUG12XjbzFdJ2+RnaPNM7irHfAORSmnEfBXRRnYLFPY7VwixyuNawAEf+/QjveLKfLC7vvaThCLGUkd/FXQwRc1voEOqfox0iJJt4bCz2lbmLr/qvgWdJPnvtBjcJrbiBYkYU8hie4wL1HjMJlisAXYXAGAIwOGLKzm0rWTjZWMMo0NhiZmcuccmt1DUxJxYFAgRpwftnmD2amD3ianH70C0HqHoK+Ram16tToqqFi0v0QYUFG2vMfYFGEWX+D3BjyXqkIC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TzLNZ73E6YzvSIIHOWyg9UqcX8yKpOPcLttYaeG4FnrYQE58vKKjyu1uhb/1sQtVhn9jg9xLNfPgq4+5tfjfyAgSYaibHxhLHKNH7sgSEHWOwYoiBtPUTz/ImSlyDoQOTjLgF+WffwyAMxdxm2Ju2v4/vlErfodH99At6Fvof8EL7jRycgVix4DK6lZ+DoLRmWjLBLsPOtx+zrmYgqAOEmMz6SzrUn3Z/3g6vffrDpNsz5frAyxuO+5IQ+ccSVFsKZ2lPWpLYJaKQRXQAgCPAneOiS97ijaUFNT+FsHJhrS+fdjREpBGy4MU2y6Uq7hhlS/kNFay1n7GSGUmR1zkt5jQR/hJyzYZgTEDqMz80DHf6hOxjmKF0aAM1TxX9S8ZHJvrbqDhAAK+1fkX75bJaKzmnR08P7DRlcKrXXC6q6Gun2R9ZioWowbJ4wKO9cdw5BS50oXXFeHQ= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5a5987f6-1850-4c2c-51b3-08dd058581d6 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:55:12.4533 (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: AecLfWFo6yqzENLX1nPRDLB7L0SsqclhZopKtAWtjUxogeecCX8n7S+HuseJQH7XuCwtHrfIufozv5u+HPZg3Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5645 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: t4ySHxbd2vRdx-FkxUA2roYAj3l2NZ0x X-Proofpoint-ORIG-GUID: t4ySHxbd2vRdx-FkxUA2roYAj3l2NZ0x This update allows configuring the `raid1-balancing` methods using a modprobe parameter when experimental mode CONFIG_BTRFS_EXPERIMENTAL is enabled. Examples: - Set the RAID1 balancing method to round-robin with a custom `min_contiguous_read` of 192k: $ modprobe btrfs raid1-balancing=round-robin:196608 - Set the round-robin balancing method with the default `min_contiguous_read` of 256k: $ modprobe btrfs raid1-balancing=round-robin - Set the `devid` balancing method, defaulting to the latest device: $ modprobe btrfs raid1-balancing=devid Signed-off-by: Anand Jain --- fs/btrfs/super.c | 5 +++++ fs/btrfs/sysfs.c | 29 +++++++++++++++++++++++++++++ fs/btrfs/sysfs.h | 5 +++++ fs/btrfs/volumes.c | 5 ++++- 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index d52f7f6e2de7..ecadc8e0dcfb 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -2552,6 +2552,11 @@ static const struct init_sequence mod_init_seq[] = { }, { .init_func = extent_map_init, .exit_func = extent_map_exit, +#ifdef CONFIG_BTRFS_EXPERIMENTAL + }, { + .init_func = btrfs_raid1_balancing_init, + .exit_func = NULL, +#endif }, { .init_func = ordered_data_init, .exit_func = ordered_data_exit, diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index 50b8b8847dd4..50bc4b6cb821 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c @@ -1307,11 +1307,28 @@ BTRFS_ATTR(, temp_fsid, btrfs_temp_fsid_show); #ifdef CONFIG_BTRFS_EXPERIMENTAL static const char * const btrfs_read_policy_name[] = { "pid", "round-robin", "devid" }; + +/* Global module configuration parameters */ +static char *raid1_balancing; +char *btrfs_get_raid1_balancing(void) +{ + return raid1_balancing; +} + +/* Set perm 0, disable sys/module/btrfs/parameter/raid1_balancing interface */ +module_param(raid1_balancing, charp, 0); +MODULE_PARM_DESC(raid1_balancing, +"Global read policy; pid (default), round-robin:[min_contiguous_read], devid:[[devid]|[latest-gen]|[oldest-gen]]"); + #else static const char * const btrfs_read_policy_name[] = { "pid" }; #endif +#ifdef CONFIG_BTRFS_EXPERIMENTAL +enum btrfs_read_policy btrfs_read_policy_to_enum(const char *str, s64 *value) +#else static enum btrfs_read_policy btrfs_read_policy_to_enum(const char *str, s64 *value) +#endif { #ifdef CONFIG_BTRFS_EXPERIMENTAL char *value_str; @@ -1354,6 +1371,18 @@ static enum btrfs_read_policy btrfs_read_policy_to_enum(const char *str, s64 *va return -EINVAL; } +#ifdef CONFIG_BTRFS_EXPERIMENTAL +int __init btrfs_raid1_balancing_init(void) +{ + if (btrfs_read_policy_to_enum(raid1_balancing, NULL) == -EINVAL) { + btrfs_err(NULL, "Invalid raid1_balancing %s", raid1_balancing); + return -EINVAL; + } + + return 0; +} +#endif + static ssize_t btrfs_read_policy_show(struct kobject *kobj, struct kobj_attribute *a, char *buf) { diff --git a/fs/btrfs/sysfs.h b/fs/btrfs/sysfs.h index e6a284c59809..f0fb0c0c2f7d 100644 --- a/fs/btrfs/sysfs.h +++ b/fs/btrfs/sysfs.h @@ -47,5 +47,10 @@ void btrfs_sysfs_del_qgroups(struct btrfs_fs_info *fs_info); int btrfs_sysfs_add_qgroups(struct btrfs_fs_info *fs_info); void btrfs_sysfs_del_one_qgroup(struct btrfs_fs_info *fs_info, struct btrfs_qgroup *qgroup); +#ifdef CONFIG_BTRFS_EXPERIMENTAL +enum btrfs_read_policy btrfs_read_policy_to_enum(const char *str, s64 *value); +int __init btrfs_raid1_balancing_init(void); +char *btrfs_get_raid1_balancing(void); +#endif #endif diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 90d84fb664aa..2b31fdffea08 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -1327,11 +1327,14 @@ static int open_fs_devices(struct btrfs_fs_devices *fs_devices, fs_devices->latest_dev = latest_dev; fs_devices->total_rw_bytes = 0; fs_devices->chunk_alloc_policy = BTRFS_CHUNK_ALLOC_REGULAR; - fs_devices->read_policy = BTRFS_READ_POLICY_PID; #ifdef CONFIG_BTRFS_EXPERIMENTAL /* Set min_contiguous_read to a default 256kib */ fs_devices->min_contiguous_read = 256 * 1024; fs_devices->read_devid = latest_dev->devid; + fs_devices->read_policy = + btrfs_read_policy_to_enum(btrfs_get_raid1_balancing(), NULL); +#else + fs_devices->read_policy = BTRFS_READ_POLICY_PID; #endif return 0; From patchwork Fri Nov 15 14:54:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13876353 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 05CE11D433C for ; Fri, 15 Nov 2024 14:55:29 +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=1731682531; cv=fail; b=Vp4fkQiy7eDC/Oy3Cik3x1IMvcFQ2m7TFI4TDVf3cKvuSYyZz098z1Aa+Xi3I5JvZVPTbWbleg0BYTuohKxN0JtYo0h2NCpMreS5mT988/YhI6KPaB7ggxqJyjHenXDM8w86mZ5drXU8NQKWrWSFf2qFHJ6xK+gTF7aq+z5iYw4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731682531; c=relaxed/simple; bh=3T+GGniCFwTJdj3ZTIW4IiwBEUnbonUZ6hVpgQxdgoA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=A1Cvx6ZV9xgHPMvfmdoekGpr7RGlhzC+iyq3C2ncJlXHyt4iqg8cBqKQpztRmAkP5MgmHzDl+Fk8iFgJcjmHdWhpFoB4LNdFJNOEjLsNdk8DgZyP2TJSQCE7/YZzUbOJBaYn3szDesinjovyVAhCYLlkk2QjPxyzARm84NlQyI8= 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=k89UKHFy; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=aVJxNZd/; 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="k89UKHFy"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="aVJxNZd/" Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AFDDF7x025341; Fri, 15 Nov 2024 14:55:20 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=mNArQ+Otgbin1oJPvxSLjbodNaWhwtQxHn8IJZK/gjE=; b= k89UKHFyOkdiNNGLKpPT2PeFo2ynNQID9Y2k2I0RZJwgF8G42aBLHbOrbJrtEJtV Sz9af6cR6ud3DMbUAH+nWtQ8em+k+7R8QRPHNkC1oN57vmrChZb0dcipOtHclH9v KL9e0ZKFZKNDXtaRQAlos7h5BriMLIUUUjPpUdPGSM+EDMzbVKB574OhyoV8xGX4 lnsxtYLWVRQtiHGuFHuGQ9XVsqXbNyzf8m0A60/fx//FIjZG82qyrx2darmU++7T lCDCVoVLJtmH/d0PB7uVCC/1vb7zA61L14Ura4jMUvGoPWy7gYFjTM/V1FKlszsC drfbvydZn4BCoQwcAxFtPg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42t0k5kdkq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Nov 2024 14:55:19 +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 4AFDDGjF025853; Fri, 15 Nov 2024 14:55:19 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2043.outbound.protection.outlook.com [104.47.66.43]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42sx6ca41n-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Nov 2024 14:55:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vrtfkr2T66oWu4sSBILU+waZw4lWyIhOqXv9cMdtZKVi4GLtNG6ahcqDkH2H9I21fzoUnxHgbslAZXX/LktNu3dbCeGUrJ598vth5OMPXaKY2nNffgQtnWLwUSDo1diDwiKnNVQ9pVqweqhlQUs7iQCdMLyfJOV+HhOUcDJeWrgrlm4+7JyXCkzJZKXORkMYeWXpRFETQCI1vRAOl/5vpRLYWh0PCpNBss9rykNJqUmYr4xvTmImFCg1VPyLjbRPp/4BJpylzCmf/puZGJRlkSNiEJFJaMumipC0YfP7cSDbdKwmJ6ma80YJK6QrZtfJT2tMRHkvXF7HLf+D4T9JOg== 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=mNArQ+Otgbin1oJPvxSLjbodNaWhwtQxHn8IJZK/gjE=; b=t1QlhnMLFthtMY6Hf9e3rMKnXFJ6MxfcAQ/nWrg3mNBFacHGogOJuym1PffyWyi8H5vInxYse9t11XiP9nq4E0dhUxaiJJsPDC+rlPkIouHY8eqxqpVBXmIag7qf2R0cmflS7fQ3FHa1H5QBI21jaeDLYHVt082tpTpCIAa6w1vQql862DxIJlWiAXG/lvSRxG1BHlTtjGWA+PWF5bMVawogwQlRL0R4O6PKnNO5f4fTn2qSzs8LhFlUUBbSiDKDcBIozEL23uTeZeMvkHwLnzDOTRH4AqH922Rwrd2gLbbsklS5IBstHwBGr0GwdN1arIbDusntWUSq+8t/t7QHwA== 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=mNArQ+Otgbin1oJPvxSLjbodNaWhwtQxHn8IJZK/gjE=; b=aVJxNZd/RJV9TZ3rILZkPawKd79ovvn59hCpFZ+lUrS2EIA0bKshNt2vuKSpd4vI5OgS6cDhJ7a3bMD6ZLrYi+PfU/wn3yReUC1nr86+U/cv6+HRtucpfgVUUbIQVM/zVd+BWS4jOxPGe9B+2+G+YI8/9/lkpA/UQ+JW4sy5TDo= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SJ0PR10MB5645.namprd10.prod.outlook.com (2603:10b6:a03:3e2::22) 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:55:16 +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:55:16 +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 10/10] btrfs: modload to print RAID1 balancing status Date: Fri, 15 Nov 2024 22:54:10 +0800 Message-ID: <363f635137e513f902e11fdaca02cc0689d62173.1731076425.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.46.1 In-Reply-To: References: X-ClientProxiedBy: SG2PR06CA0226.apcprd06.prod.outlook.com (2603:1096:4:68::34) 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_|SJ0PR10MB5645:EE_ X-MS-Office365-Filtering-Correlation-Id: aa0f24f4-3e04-47be-f981-08dd058583fe 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: Gt4GyURMHYUf4HzhEDN+oCdksQQCMSLVEUeLjoiL/JjI5meNtsONxM+eupf2sYPgewJQ6eaE2ruHALu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KdkYbhT0rltCaJg1HLtzRU313qNFCK5tBsBWE+Nvi9lMD9PdI6I+zsM5s6KV8ZlnqWSHYFxqig1Rx/05c4CNWUjnFEebpBVwcPWGOe4N0aXDqCRIN9tgvtvhZUFJuIS92vir1LMqpnMVmxzLDEp9re6NH+yvZ6t1ZoSJhsU9x3etrHljtg8KjlbqRp4IwP74j1N0 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: K34MyjiY3/0g00MZZj+u3vNT6ZayqVtuyKkosilmtU1fPs7ppklEaTEr9+1jt0A6cw7xjF22X8RNBuPfjdvLDEgO20U/MLxqML8orIEU8a7GvADZyWis5ElC67JpNEQsPgHqEkjuq0WefBzIWi8aaW1hbDNwHyaARNw0FkX7yRP+IKzv4PhYXVgWWj5+K0vyrK/7CSiroxV5vtZj6Fh3Rdqljj6TjtV5QqpJjr9vLF3WUtu94UcYUohBXMBWkRirLdYNH8KOwDH3+hSsLMuUQKD4kDPVNdGFA3Y++7aDh4I7kXcpS8aUQO+eY/L8CxFpUFlfdw6k0j9xiHkJDgCkMJc+n1Gn4PZLnLXrFuc/qdRNeKMlVk2tWi/rxHrWawHNVXFIAqOwoHj0mqNLPZIqG3+RDU9CMNLA/d9RYGQ+k7yVeuUOdylBl/fTYXo9HTxLERrDs6e2hTIxWe/4yQqDCIcbAZ3i1WcNQG+5c/KalNcRCiFMTpz4qDMXNZxiLbDaXbqEn9e+yaUsGOMpT0vkpUWYWYKVWvME7R1/ICajT3f/xasVNzOBSOLwBFyZil2AGntAa2zULk7GcZu0RGw7Y9RomWG0obok7/n77vYugb4bLKjNxzkBG4JuNzFj9/tKo1oh7GPTYupnN8rINcVlr162KW4FR5lKblfFrmWhi7sQhDmGnC1kkyaf3P/g5OEZSf4eNalsmDUVk503GdbtNdwqYLh5pmZ4nmAgPrwhuc6PMuGfpSn7smu4LflWNax0CjY9VeHj0oyAApLnEoB48rc/ZitoF3QOL0rtfUtd98kY5npNKR91g/BKJeCRAqrrSkgz4XJrfB9XnzWPf1D80YDsF3sbEHYQOOM2jMXZdC04CcHlD+RwbyqOyeoy1MLVtD9P2duXLxBipnegWe2vaJgq9BdcQQ3RJK2KZsgDkXTznToCsIXAIyLrCrUOhdPLM2kVXoyQu9w91ZW/qM8lUAVXhZfFzoc5kT4WRCFMHaFQHJO8t/TynIiv5QkuO75ebRA3P9bMbxYFjFxefbUq3eHF5L1xzqYGgP42N6tqVPs5xKQLd0G71Vu0791ojiV/QSRQB/P80ng1vofhq6nupI50xhQddNs6yUjrUZcb8obDOTgPXjb4OBLi0nmG2ewqwnhkz2bc+0kCYZ8p60a1l7VO0CB5wODJdTzowzIZhGFgQRI/1X2vu/i/kCQF8fPFtMBYykCfUGL1U0HmfbRn2XNWFMr477265bxB5y+f9uICEwqOxpWxODrGIMsCBqK6yQVxRNWV3OKuVRVSadHzURVChc1dYz3GvwYuN0+RS187tMedjITwKpLqBeLeCeHTBXD5UyrURyXwm46X8qm3rBHXSifD3ry8xjJenHqDhy9k+wYNB+fZzN4rPCZtxC6U2x9MBiFFHffigL/zosWaUwHc5kDwUWfAvQL8RSopc+7x18yTKhFGieiluV69qFXJHAiUcNL9pOiXAymVqxTRMA9XbP32hm6tUyeEi4iB+dhYi0BfTgUFIFR5aiqgpyiR3/5zoTWqDlvEcDJ+SfEcnDqQUdYFo+TxdCDMm1UoBck7Xt8DhB2VzgcScg7QxAuC X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: nxjKOkr5KeytHLnihDWCnhMWM2yRJ5IJ4VsK6UneJdepJuE2kdT7U2rZ8H2zlLnMoIWxZchifv3ZnKEDjPUSAROkzb4vG02ji2XPt5VWm4midzv9cX8G22znNgjtKgClXG7Y6fofGHYJr+3mHAV+dZospvVzTAJdDHfpFofXO+NhenTTZPFKRzGhm4o6tnzRtIz1Fy30S+SMO3tZewz0NoB0Sa9g2dGy1B2h4x8eNy/6NSw2MS47vh2KcK+aH8A287UmhSDH5r7N91B0PKArvHa+GI1eZBJOAlNrL1lt+DiosZ8StTDZJDJPWhYx/v4b0houvEd6JZIicZQFYsEwS2lBcaopw23BOlq5V05f2J94nGqheJ00sEPl9WyuM44E8BegW8TuZfxpQbo9+4v4zQ2Qepsp/7u4+k8mk7RDFZofoXDaXJqLky0O5dZaNvxI4EV/ol6COBoCxA14EXxMNVhm5qOQPDJC729jsPqPjcZlkQ+wsGRv2yd2bAxqKyiyTtjcZGwPp1JFwVpXlBhxzbrFxuR0ls2nRXX1tXKF2GCOwG2U5c6fVRfF3uuba5w9x1aFK4ELdt45y9U21b1TWiWx433HU8339L+frrwLqNs= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa0f24f4-3e04-47be-f981-08dd058583fe 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:55:16.0831 (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: Cq/X9ZtZSr0Yhuw7ywayNncv0NmI80BjVX5dPU5lz0+jEw2tu/MFao+0+Zo/ez5RrsuPlsFf3i/qhKGsmYAAyw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5645 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-ORIG-GUID: PD8GjOMc2KbUW5i837KJRLmMsR2DfD_0 X-Proofpoint-GUID: PD8GjOMc2KbUW5i837KJRLmMsR2DfD_0 Modified the Btrfs loading message to include the RAID1 balancing status if the experimental feature is enabled. Signed-off-by: Anand Jain --- fs/btrfs/super.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index ecadc8e0dcfb..8eb5da5da693 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -2494,7 +2494,17 @@ static int __init btrfs_print_mod_info(void) ", experimental=no" #endif ; - pr_info("Btrfs loaded%s\n", options); + +#ifdef CONFIG_BTRFS_EXPERIMENTAL + if (btrfs_get_raid1_balancing() == NULL) + pr_info("Btrfs loaded%s\n", options); + else + pr_info("Btrfs loaded%s, raid1_balancing=%s\n", + options, btrfs_get_raid1_balancing()); +#else + pr_info("Btrfs loaded%s\n", options); +#endif + return 0; }