From patchwork Thu Jul 11 08:23:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13730189 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 BAE161509B1 for ; Thu, 11 Jul 2024 08:24:10 +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=1720686252; cv=fail; b=W7teI0OeDM2fJYQ5JAVCQwpB4ErB4beh/r7HkJ1VLY6W0a82jWn+cJ3k/2Gbm9iELSibyiYY/DrTAHBoOWwQ3WK/907n83oK+Zbb0HjHRJ/zl2nHLhtWn9OKs/cYy8QgUQ8OhIHErE7agEDPsWeizCRTaGZEGNrIwoIH6p0P9bA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720686252; c=relaxed/simple; bh=sN1BcmTptJOeA8gjTlY2SmDyU7YzOXUptqmSpJrd+NQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=TatoxiLA3TVVvlZCBircQWbExIijyrZ+qm9tKIwH4IreD+aGpuzQ5bxd71lFKSECdZjXx6JAL/oy3FEaDwEP8TVYqHNoDAQhUPazEZ1APN6mZeVFxByKsuUkO7pXjklyCNNKtUEZaZUfi9+TztYBHk7lTD51ZZ/O1awnHKHhJI0= 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=WoSQcBEM; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=N/g8mlDi; 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="WoSQcBEM"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="N/g8mlDi" 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 46B7uCAT026543; Thu, 11 Jul 2024 08:24:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=QjvTVPZhQ9oHlDil7LBTxKK6Ut34mfK/rj6EhyOA2rM=; b= WoSQcBEMUtkjZPMaSz9UpfPbnTbYIZEa6WyhUbUkrtDwlb9BznIaRt3IOFSCwKS/ O9h8JjnVxv+bbkjW0dJMvtaT3x48HkvQHLwI0ABoREd7L6zBiF9EWYiUnB0Abea5 UEM8k0XHfrldJRu/zU9hmOt9Pa6Jzg1ifKJYzF1bH1nQHV3T/GHtbGI7EWIghVWV AVs3BkdvDUuhdmfkIp4X6Z1JvuLfvPomfSXzyOvI++nSZ469SfnaNT36KyuShZXu Kml/it1hMXuYLE9k7ybVUrLSTCvRtljFQ0JU0DOrZ5+McDHoEQumiQD5qK/zIqgN 3I0JhmVXUePwDKTgieD0Ug== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 407emt0cf8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Jul 2024 08:24:07 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 46B71oAL028764; Thu, 11 Jul 2024 08:24:06 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2044.outbound.protection.outlook.com [104.47.70.44]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 409vv4p3wn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Jul 2024 08:24:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HpYDYlRnOus2/Tg/Bmx42a4QKTrddS8Cw3Wk1OJF1wohtune+p3cDiUtjFqrAE59MDKxM5NQHq/e8lleclKEM+cAL7zzuCbeWqUWkAuElni9srknUB2kR4NSdvcmZhEvxjChHyfLCb3naMYEBXeErNqot06nk+Ueo3eP18F9g4lNhFiEty0WG0fp7JCfDbHTFAvuwXC/sYl2QeVfN/o8QoPJdpZujAUvJJ4C3uf9OYi5PdRuOOfLaIOG7Enaoomm30yDdczuCMs+J9BEROOYr07PIM4gLexgNo2znH4DcEJfOzfxYGJ6XK3n9pnQWoOQY+3fQ9csn8K9XVqSLEh6ow== 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=QjvTVPZhQ9oHlDil7LBTxKK6Ut34mfK/rj6EhyOA2rM=; b=Sb8EY5SUlgRl1zTcW9blKHNKYyXh+StrkYsndhL6Gk0pjEzuNPzKY5IiQsO9TX4q8V6Y+yyt+0dN847IXjO5grWQr66oipndJnDQCxirP/lQNZuEtU5XXX7NVo1zc2KgzKuV9Ydg0EBa8b7ODEPSzyLows3t80ZQjF++rIc7zBLe/sQb5pMUNAJEpgA1eyXXr6RsVHMMp1HPSta5V6CYAUBiUaoI1JhX/WQXt4+4GtdfaYF9jlJ/09NwLskwx6XExTb5p6SgI1lt+oLte7NiWgkLdHvOMvIx+guxmSH3VZBvcl2Aqd1o5ak3xm94QO+HxKTA77sbuGKiuDL7xi037Q== 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=QjvTVPZhQ9oHlDil7LBTxKK6Ut34mfK/rj6EhyOA2rM=; b=N/g8mlDiisxt3XBc9ZFRNs27Vb5kDd6MfaGx0WL5mlxpoEGC8hXoFZnO+MbWOx6qKgQhSrhRImXcZlHAd5tWjcrhtooQmvuqd1cDgLglOcce9T8i4xGgO0QGUjT/BcEK38oqdZsmgtkEEEKoMLtCutGyYWJkXjwWmVADe6bn5XM= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by PH8PR10MB6672.namprd10.prod.outlook.com (2603:10b6:510:216::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Thu, 11 Jul 2024 08:24:05 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%6]) with mapi id 15.20.7762.016; Thu, 11 Jul 2024 08:24:05 +0000 From: John Garry To: axboe@kernel.dk, hch@lst.de Cc: linux-block@vger.kernel.org, John Garry Subject: [PATCH v2 06/12] block: Catch possible entries missing from alloc_policy_name[] Date: Thu, 11 Jul 2024 08:23:33 +0000 Message-Id: <20240711082339.1155658-7-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240711082339.1155658-1-john.g.garry@oracle.com> References: <20240711082339.1155658-1-john.g.garry@oracle.com> X-ClientProxiedBy: BYAPR11CA0083.namprd11.prod.outlook.com (2603:10b6:a03:f4::24) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|PH8PR10MB6672:EE_ X-MS-Office365-Filtering-Correlation-Id: c1fe7e4c-d441-422f-b1b5-08dca182d3cf 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: FtmSSNymzGlbOdL5D+Lg/lFsgrnOXeN/aTsvqyEMK+VxXl0ZepjzEU7c5KIx+JhtTgRnn/YvJmN+4fOTezAQvBYNH3Mywh2GpkMj8jWxVomb8QVQ88edf5IwY7NcybnUsYlwG/+g6kLr+Se5DGldhi745IF7zLpzdZlZ07k+QJJ7rQjOdVRJ/UoyUtq9PcrmtzuIhNBCn/VyxflNxJ6ZK5zfr+g1pFJj8LOMaQOsGM2QrvtjYuQfflad2PCusYcat3p02NkppzoeBhNZiYHVJFWel7+7XRBH0gAgnv69zjvLi4jz6OL7JM5AX0LWV1qQ3H5lytScd12VuZQaOOv2ISEU3Vcxph8HT9fnKMXmHAN0c35R6LY32Af1p2MnBtNjplqUt8FWaCyPF+z8XtPPTfWHc0Jrcon9lAGzIWra610TzfysUgXDc2isbjC8fwPgjX0MrMpuvErWIHyilChUfALGxtZAQ+ezvqnhGzDLGa5loQO1iwbVWc3I6paDWDhcrSW/rJUj3/pMRbLvmlGtJSTzvspckuBMgPV2BEymCDuIDMCmJ37HsMQFygdiZu+fGLBZykrRDMoO8EjH+ewj6biRzKA2zvNnoGjzRihEh8+MqtzxX8SsuFoNAF+H2eWFM3r2fY7TAvogVQOPo1hEIF4oVDBeQeN1S9QylNnALFDC/Tj2OujTDcq00NRnLR+4nUhsJNug8yzsa84BO3W8iq/aszR1SgFtztrTSzH8/CouFGu8ukRnuETeQvKlUro/YaXRzrZO17IJKsI4o3AhhKU/Z40in2IWKSGBU2209WYmu7d/0eDYo2yv+ZPiMw2SDu5SxDoNXh3UDsHCIhMUI1wOyCgMwpZseERE1zkhFcy8Xn7ZHy7WkQKEOE3VFpYShoBLLm4EjVx7DV4OGXgjgfXcmlaREgMFXO1Iv1JjXy6Sgiek/r7q/dgX9iH38ihGubwpziqDtgcwljXkrzLbTyafVszJOamwk864shafaXCODib6st97dGmmtIHbhfxf+gw5RcbYmhWlyxBcBYHvRdBPxgLpVcmy2VJWRsIjCd1cLXFSNjx7hXAfVXqpMOW3Wct2zUdgv24+NklbZXIWmSutyCt9vitoNyzJRpLczkg6jjEaR4I4SL3UOhAs5fTTHR73HJJAFDnK+/hyHLpQwr7h8cSIcwno+YIQySumbLiDmzbBKaxEr9DO8ZTCHxFIfXoqZksqB60r1I2dXUDiPv2rlVjVkSxD4KXeaQ/0ll52SDAcsZZfbeWSU3ysP3SGxpsluymy4n7M4vRcmzJHuDBxeeh+kI1O7NL1mhQE5s4UaE8V/Ad0XUvRkXbLounzw2fEl70elx6VP+zUsW+BQg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.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-M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3vt+0Kq+lnTAgd22ZFIHokD7u3dNJFEpFReSmLlPqv8pSuOqIzs8lInvT3b/iQS1Snd6fSdCuXrm7Trb8N38KcstVuwoDi0JQZOV9lrjR80x1I5cFVWN8BmCxzR+D9lNQzAn0OlM11IC2H1oJKARXdPjK70wMDgg= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c1fe7e4c-d441-422f-b1b5-08dca182d3cf X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2024 08:24:05.2195 (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: 6lWd2GTwSv/DhEyM9iBQDbHhf38qW9dUsILnnpT4sT1CwaWs6C044wj+2rKNJ8S/SLVV/L/zx1Mzh0kwhVMDjA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR10MB6672 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-11_04,2024-07-10_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2406180000 definitions=main-2407110058 X-Proofpoint-GUID: Lo4wAkXtJHShO5Zj4oTWUop7NN1IgDEg X-Proofpoint-ORIG-GUID: Lo4wAkXtJHShO5Zj4oTWUop7NN1IgDEg Make BLK_TAG_ALLOC_x an enum and add a "max" entry. Also add a BUILD_BUG_ON() call to ensure that we are not missing entries in hctx_flag_name[]. Signed-off-by: John Garry Reviewed-by: Bart Van Assche --- block/blk-mq-debugfs.c | 1 + include/linux/blk-mq.h | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index b9bf4b25b267..91396f205f0d 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -198,6 +198,7 @@ static int hctx_flags_show(void *data, struct seq_file *m) BUILD_BUG_ON(ARRAY_SIZE(hctx_flag_name) != BLK_MQ_F_ALLOC_POLICY_START_BIT); + BUILD_BUG_ON(ARRAY_SIZE(alloc_policy_name) != BLK_TAG_ALLOC_MAX); seq_puts(m, "alloc_policy="); if (alloc_policy < ARRAY_SIZE(alloc_policy_name) && diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 6a41d5097dd8..454008397e64 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -278,8 +278,14 @@ enum blk_eh_timer_return { BLK_EH_RESET_TIMER, }; -#define BLK_TAG_ALLOC_FIFO 0 /* allocate starting from 0 */ -#define BLK_TAG_ALLOC_RR 1 /* allocate starting from last allocated tag */ +/* Keep alloc_policy_name[] in sync with the definitions below */ +enum { + /* allocate starting from 0 */ + BLK_TAG_ALLOC_FIFO = 0, + /* allocate starting from last allocated tag */ + BLK_TAG_ALLOC_RR, + BLK_TAG_ALLOC_MAX +}; /** * struct blk_mq_hw_ctx - State for a hardware queue facing the hardware