From nobody Mon Apr 27 08:43:35 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15C2AC43334 for ; Wed, 15 Jun 2022 08:18:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243874AbiFOISc (ORCPT ); Wed, 15 Jun 2022 04:18:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236297AbiFOIS2 (ORCPT ); Wed, 15 Jun 2022 04:18:28 -0400 Received: from ssh248.corpemail.net (ssh248.corpemail.net [210.51.61.248]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CBF2275DB; Wed, 15 Jun 2022 01:18:24 -0700 (PDT) Received: from ([60.208.111.195]) by ssh248.corpemail.net ((D)) with ASMTP (SSL) id KGI00017; Wed, 15 Jun 2022 16:18:17 +0800 Received: from localhost.localdomain (10.200.104.97) by jtjnmail201602.home.langchao.com (10.100.2.2) with Microsoft SMTP Server id 15.1.2308.27; Wed, 15 Jun 2022 16:18:19 +0800 From: Bo Liu To: CC: , , Bo Liu Subject: [PATCH] block: Directly use ida_alloc()/free() Date: Wed, 15 Jun 2022 04:18:16 -0400 Message-ID: <20220615081816.4342-1-liubo03@inspur.com> X-Mailer: git-send-email 2.18.2 MIME-Version: 1.0 X-Originating-IP: [10.200.104.97] tUid: 2022615161817e7cde56c8b56f5d215d9d2f0915e296f X-Abuse-Reports-To: service@corp-email.com Abuse-Reports-To: service@corp-email.com X-Complaints-To: service@corp-email.com X-Report-Abuse-To: service@corp-email.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use ida_alloc()/ida_free() instead of ida_simple_get()/ida_simple_remove(). The latter is deprecated and more verbose. Signed-off-by: Bo Liu Reviewed-by: Christophe JAILLET --- block/blk-core.c | 4 ++-- block/blk-sysfs.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index 06ff5bbfe8f6..eb86c756a7fd 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -448,7 +448,7 @@ struct request_queue *blk_alloc_queue(int node_id, bool= alloc_srcu) =20 q->last_merge =3D NULL; =20 - q->id =3D ida_simple_get(&blk_queue_ida, 0, 0, GFP_KERNEL); + q->id =3D ida_alloc(&blk_queue_ida, GFP_KERNEL); if (q->id < 0) goto fail_srcu; =20 @@ -498,7 +498,7 @@ struct request_queue *blk_alloc_queue(int node_id, bool= alloc_srcu) fail_split: bioset_exit(&q->bio_split); fail_id: - ida_simple_remove(&blk_queue_ida, q->id); + ida_free(&blk_queue_ida, q->id); fail_srcu: if (alloc_srcu) cleanup_srcu_struct(q->srcu); diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 14607565d781..2ed9e7d52b47 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -799,7 +799,7 @@ static void blk_release_queue(struct kobject *kobj) if (blk_queue_has_srcu(q)) cleanup_srcu_struct(q->srcu); =20 - ida_simple_remove(&blk_queue_ida, q->id); + ida_free(&blk_queue_ida, q->id); call_rcu(&q->rcu_head, blk_free_queue_rcu); } =20 --=20 2.27.0