Message ID | eb75e74fb2dc424e47c68f8d31be8def23db1a33.1735748715.git.anand.jain@oracle.com (mailing list archive) |
---|---|
State | New |
Headers | show
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 AB8191E231E for <linux-btrfs@vger.kernel.org>; Wed, 1 Jan 2025 18:09:55 +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=1735754997; cv=fail; b=AlYur089Gzm9So9Jux/a8l4E6t3PYK70yPC56/JYgZcngvQYJZf0WjNVSqYFuvdVFhkwb4ezCMD+GHMszhZUwZOpr8SCVPBtysnNZort//DFpbW4qeba+g2pNiQ3ME0gYmSWdmEavoW43fDVCMoGPKsMB/rZOSTDBLX8LF3jk3I= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735754997; c=relaxed/simple; bh=b7uPh5whV7MewalyZ7zR0knjGEdFLsevpwEqHQtFTPo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=ZMkyszVgDh2xVLgA+Hnms/KPo48eeYp/ZTl9jx5W+7QuUzq9KxRHCn/jRcln//0Z04vWgKa6xaeKNFW8MkAzIdFcTCeDTJu+JahlZRK5cbs93mNccMj6QzIetXBB7l0jmJiF7HJ80LDjMc1dWXgAxzF2knvlWVmOkpZrBIjX2PE= 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=DFUoVr4O; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=O7wy1UBt; 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="DFUoVr4O"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="O7wy1UBt" 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 501Fl7tQ027199; Wed, 1 Jan 2025 18:09:45 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=z65in74P5MF2tELa/EF17Ce6XG3Wx7bzC8YUMcexup0=; b= DFUoVr4OSxDjhUeWV9gIxV040gc6TlWutyP29Kf/0KaIIhKNc9JhmSTzmAsa0kfk WfGb8F1CJiSq6FFEEMtJv17OHYKhxPozd/Mj8s1kHGkiUP7l0Run3YovDFCX+Zkk /SwuT0uYhu4BJ5kh/oxX3Ur1+cEnvDI/vaphrKTjMgJ7A4oyVG4w2BVRDIgD4W2r RV1HTrBB2FyKmFBvfP7uXUqrJjZIEFIJRN1Sr1a2+E8e4lab4guoh2YCt3D/SYa7 1Bvo4JuqnEIKTUOIhUkqLm3la9JXixn4PNOdDWIteu9/YZu+uUTY5AnyOoJmjgFj W1enk/fMZEdp0a6MCFrevA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 43t9chcgfs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 01 Jan 2025 18:09:45 +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 501E07h9009126; Wed, 1 Jan 2025 18:09:44 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2046.outbound.protection.outlook.com [104.47.55.46]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 43t7s861d8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 01 Jan 2025 18:09:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Cw60TlJGsJjiG0LLUuokGD1H3jpqIz44U3G+QexemKvNUW51eK/SisufB6D+GTKgAAO0qx3u8Bvc/GbV7k0YqbibePWbO6FAEpyxk1v1PzwNtuBxST9WrxqYGHi7C1KQhxeK3XRQrs7vLQ9oxfHfizqZf2u+Qynn1OvWb+YciHvMm4l5qhR6ulK9zPZd2a2Cn+dhEc6j7CnuJrm+GgDKl4SI0kSas4TW4HGPAtkYVCknYLajnijTrR0wCC8cIJbgagJgiHqB5UO4aSQwRXnmb0VP+nQvr+BUSn+yWBzKWRZSTuo+Xg/AXK/MnUTHRVO+toaJbfDEzVA3UJTmr3ysZQ== 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=z65in74P5MF2tELa/EF17Ce6XG3Wx7bzC8YUMcexup0=; b=eej7jmWcCV+qpHH8xPn5K2C5MDwyJxIoLuzyLmyneQzz5ldsoYEJw31Jgxv6TQRMM3DTLTrwj8iED8xdqoeW8MQGPxIhO2Cd15MQgZuQQ6N2gBPL04iUJxjBgjjFcXgqMNxZwEuA/5sa5PWPeCs2wB/2UnhXK6rX5zgO7yP8gW1eBSZL2Gb3pLKa2HXGV5XK3/ycKLeuttrDKoYMuK2q4fqryw+drwwLGmeDtQ5if5xTB2Ob84E1D49DHiGkliMaliU0ALxYtgEZBGHs+ZHSjOw/7zc3Rq9hfZoKHCqFUrkosoSHTxWBHxT4pJSXEjtKQ6A6iyIhPu/OzNWOX01IsA== 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=z65in74P5MF2tELa/EF17Ce6XG3Wx7bzC8YUMcexup0=; b=O7wy1UBt0HgnBQ75fZmcTePqww7AIogc3MJqyQwEOJIL7Uu44GxxCz0SXIYtf5dTWwaSt/i6tSVnH5YeZAqTa+7KL+5t0ZhhI2V/yheHUknUs/mdS4GhhCv9OObnHGXQerL8y96aiVeL/kvUAc6N2Xa3ezwf5yzcmY12Kc2eUtw= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SJ0PR10MB5549.namprd10.prod.outlook.com (2603:10b6:a03:3d8::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.12; Wed, 1 Jan 2025 18:09:38 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::fea:df00:2d94:cb65]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::fea:df00:2d94:cb65%2]) with mapi id 15.20.8293.000; Wed, 1 Jan 2025 18:09:38 +0000 From: Anand Jain <anand.jain@oracle.com> To: linux-btrfs@vger.kernel.org Cc: dsterba@suse.com, Naohiro.Aota@wdc.com, wqu@suse.com, hrx@bupt.moe, waxhead@dirtcellar.net Subject: [PATCH v5 02/10] btrfs: simplify output formatting in btrfs_read_policy_show Date: Thu, 2 Jan 2025 02:06:31 +0800 Message-ID: <eb75e74fb2dc424e47c68f8d31be8def23db1a33.1735748715.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <cover.1735748715.git.anand.jain@oracle.com> References: <cover.1735748715.git.anand.jain@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: MA0P287CA0008.INDP287.PROD.OUTLOOK.COM (2603:1096:a01:d9::19) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: <linux-btrfs.vger.kernel.org> List-Subscribe: <mailto:linux-btrfs+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-btrfs+unsubscribe@vger.kernel.org> MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|SJ0PR10MB5549:EE_ X-MS-Office365-Filtering-Correlation-Id: b151a24a-bd35-448c-ee96-08dd2a8f74cc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: 4XjATll171s2cne7XQaHkoNuUNK/+s1dz+qxDoxvDgwcg7GoIy5i10Hj1+aAdMI7jCHwCqL/LsJgWhDAiiPTyRodC1PyzvToGkdTQol5ARFUe25PEFfKEov63UpT6pyu9DKdO6xhTnlQ72xe03vd7qb+vY3Zz2AnTpgc2ZNSRjkT5AzjB67FzUsGVlG8kI6Eg4qK61IwV+6AXFAD4/PuTmSKsPd78g0XkpBkz6WUbAZ2/G1uqxRTMP5o/wEA1j59zCLWJGIGUUch7Bu47iK/DnM4z2BISh42z8rFt7/qi6yGuTk7JL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+RsWrp0qbdvYJjnpR1gbBRN X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB5706.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Z9L34PoGMX1V6pyURGxym7/asktsiiTQil0sJv4c2KibUChMbBGXSS1DopEkCvgMLUU4j+tQzqYpaMpl/ExchoXoh585hxhpjYrj7xwjatfZuuHbMMz96rcc9o0jJiR04G8c6+UOhrDClPoX9ScPvYqafiwTiU150uCAyb8+uADcAKlFhss9FfpjuTQjMZBx9KgPCd9nZDZNUoRTUdQXxgxFd5LAQCfeRNQi4XMAxgw3r/KbENQsqqD/YprlwXwNNlPrn9H3GAlTfsgTxnIaSlEt5WNon9VW8ekKYoNCgY0oSwHnH5gefHmtOeLKUHFcXuG9qmRkbwWgNkWViqaEd/E25NHcFQ8HPYUbesVOsEbE4u2bwNMpCtC1Oq9KPzxk+iiY0tJ/fxVBrWeG8RsvddtwCs6onAkLAU2Vi46bQ8ADap40VU1tAczkapEzePPhSi+KqPmqvHjn6N89keJ/gtpSqtGgONylA5rHsKdG5qTWH/TFx58DLgmMkdbFGVYkl9jGyrs/Q7WGtIiGY3nj8nNPTXMCSSUdu6nuJlxEMOTpu3XfOV+3DrSfp6RMbU31Nrf7338QRug4Boz97FLBDN74mzkNwWDcwDDP+s3LZlOqEd1vzJR9As7JHY4JEb5i5E69b/qrb1/6PizHmFjKSewmqCZJJBQhXZpVRX1hps3025DjJ+paOf0YilIQb63et8FAmmOXGkLT8tv3Rwc326rbqL+3JNpN3H6JJrYoCnvEZSFjSjbtuZzUMsKS6uLPrbtP7AU7Wq4r8H13qc86Y9uX9Bn7BFVyVHOgAfk1oz50oknaOQL6peEM+EsVevr15Vi9FDRVhqXlXvN2hLnrhkoVwkn2Qw5pnKfAoXXM6gvwJdQpjpv54w/SP3uY58662SSZ/uOZxnChWg/XoW2t629nBEleQxwFaOYCqJGruyAao2kQViR3JLt9HGo+KAMxVG6wAzIN3Sv6w2MtUujgGhwOdBtskC+zhicJPkYbzoL/QIIi9VZiFBLmVbroYsUZr5s8VgoubAgnGNcHkPMw27O/6c/uc81QzWLReNR1fO743so72L2mwSTQTDtFDu5HXxS0WeB6Zs8CvdVa+WQ0fo6kVaxGdkSzz8NvDGKzafUPr3Us9x05e3TTqvBMajmuda1lFJmv2MthwlScNRD2HgyIr8NM888gndlU6G7/hH+usdVlJiClWDGSFyBqYz135rQa6bXXLbyn2ugkk0t4vioRyOhbeMXN5pP5Gz7QCzOSy1mrRMScvphDhiYprTtlifwm8vMXi4xkKVfgDJOLqjlfp0tBPB9QC5vE4yfQB5hOrbVoHqI2qnIVZi5LVpif+57LXOK0dY3Xadwd//4N2+KaLe7/7T0MOhIB71KgXYKObyRm2BG/ENOt111lIL/Pje2HaPaoEjCxJdkprEt28l6yJCOkWUoNXSXsft2VvxhV1tr/CC6zv3PfjMVgMBgRh1sGAPwLbF1v10t0nMIJkEoLYT8fdncZpx8x+N2pXrfpmQDokLJeMQUerw76gfWbLnseOw9A3uWGIWmC2JZuN3dGuruIkdg2HoORzvBCQSL/lMDkpnRo6bq9kOq5Z+ZT X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: OA9Nkb6cH7e+JA23lJ8dGbx5BM0DvjSVTGV44aECtgXvsTLjLB1m64CCK0FgruvwFONrwalRG0BzAKkXkN1ohm35AMj/NcRXaaRpiQv2QjBjnHDYcQdFCmbIvaY5uZMgzINVBjuw8OHZg42GXY52tafvhzluDku99hC5aUtUkZKpicrX2mIzmtQ4J0sROiZj1XlP3a7QxsBkWW8dEnbad/LIFSvR5mAy16t7yGX1pCMFli+kcIG11WrX7gm1fYHzaPrMlPSMrh/XTRtgcYjZu2rkq8MVrxRkN0zRSQfm0+bogllTeLGOhDQuzabYxxRG0RqXx0ratYoeYo54dqzz8L1NqcVbN3nBaDuXFc6oShaZp9LSdpFh2u5zt05Oe59+lhvF5feUkCC9H7+fveL6HiZtaalPyCI3cemw4ZZJ71rNS19vpzq0S+1ZhmgdX6RLOCduauKXXhhpUskJBK0IJvRhzFVjWlnPjdqjy3+eNEr3zsqztbjtJKHo0V2k0riXg9lNZriia96d7gKkIuNLTMr3BuSol4Q53KfeZVYsGx/S3Q+z+Q1mpvNwXRRydARhGv3/fyYPIibgdIvskeCPv2/D6qZBTtK1XPef/9USpsc= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b151a24a-bd35-448c-ee96-08dd2a8f74cc X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jan 2025 18:09:38.7703 (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: phRftiFjGM6I6aveq7bNyR7gIHAA30IGz1v1SB/XZbp70c5amkfqV2g3ovMQ5Kv7TJOro9Rd/IIHK2/nl4cpDQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5549 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-01_08,2024-12-24_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 spamscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2411120000 definitions=main-2501010159 X-Proofpoint-GUID: 5mAZQspqRf9okQB0EeshbFEAHuf2nz4q X-Proofpoint-ORIG-GUID: 5mAZQspqRf9okQB0EeshbFEAHuf2nz4q |
Series |
raid1 balancing methods
|
expand
|
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");
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 <anand.jain@oracle.com> --- fs/btrfs/sysfs.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)