Received: by 2002:a05:7412:8d11:b0:fa:4934:9f with SMTP id bj17csp7558rdb; Sun, 14 Jan 2024 04:30:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IE1toJE52mOBHh2AJvJRWuxESnlv6+f5/6XfGVJi+yxijHMzH289vLz/lXPvrq/GcnrcbQO X-Received: by 2002:a17:906:2f03:b0:a28:7d3b:5706 with SMTP id v3-20020a1709062f0300b00a287d3b5706mr1694564eji.111.1705235439100; Sun, 14 Jan 2024 04:30:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705235439; cv=none; d=google.com; s=arc-20160816; b=spxWpNk1apfSZn488WtUQGM2GExUtKZzrPIoAPdK9J5C/YaUv3J2LxYy9kI6GQQjRU kw6fG27FEiC6giu0935Wa51WiA5KUZ02FR4CPJGydhlz41WCPnmn/ctNskAVg3yxSNmZ VODV+3v23SqhNyNW3jgvsJP/FQW2qBPQ8On3pNWa5c+goYzWgk3l+mEW28P6LsBSqnoz ObQ03VK1YWGj8joj4R3GwDEDSN8CXOSZ/eGvXTs9oPJm5nfD3SWUq9Ubzr6v0BNR/stz 28n0yqtqiP9WfRUcBSfiDEpOu/PrzdkncIkTQDIPAXWeed296RRsidLFFy8GZif4JBS1 l0TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=wwWONP9bo1w0znM3ZxH9vYALPKyLiU5MQ76GyS8w0gU=; fh=n33ILku+CEfNyBB2IKI90H5y4+D8QU4ZiRvY7+H8Jpo=; b=ys117+3kK2n77aYkJkDUiyjTT24udYAOjLZbDEMEjuJhXC/5BkX5AY0ZlOSOFKzI5A YXzlQQmuM/v0YghQqJ53Tz8OM97Wv3drI51BFMYidZWRR/pTRpWOcIPrEjXJfsC3bdhn 18uh/1vwSiPPYjeJnvDApTlfIx1lBSIVJNVsuyGYxJ4x7R8EGrYlM4CU9tjEnertRE00 JahUa8tTAa8alrrya/4RhbCXJk+JKy0PhlsOBVHc7nVSGYXimEiKzBbXbsAIRgBszFFn LPehm4o4W4SNHpORvxC8E1cDqPHQGjSTIg3tZMiU7nts0okzRrbDHGQqFSX6ppj/uou5 ZORQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=bRAx5uAs; spf=pass (google.com: domain of linux-kernel+bounces-25455-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25455-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id z22-20020a170906241600b00a2753f69882si2963418eja.807.2024.01.14.04.30.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jan 2024 04:30:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25455-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=bRAx5uAs; spf=pass (google.com: domain of linux-kernel+bounces-25455-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25455-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id CDFE81F218FF for ; Sun, 14 Jan 2024 12:30:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9D9B323BD; Sun, 14 Jan 2024 12:30:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="bRAx5uAs" Received: from smtp.smtpout.orange.fr (smtp-29.smtpout.orange.fr [80.12.242.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44BD51866 for ; Sun, 14 Jan 2024 12:30:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Received: from fedora.home ([92.140.202.140]) by smtp.orange.fr with ESMTPA id Ozd6rsmrDIwxKOzd6rIDcl; Sun, 14 Jan 2024 13:30:22 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1705235422; bh=wwWONP9bo1w0znM3ZxH9vYALPKyLiU5MQ76GyS8w0gU=; h=From:To:Cc:Subject:Date; b=bRAx5uAsbztrq6HNaUIFHM4PsD8TISoybUJuyHs7ZUlEm10ylRs6N/Rk1Hir0olqF JyNVQidn64ec884JPQI7+HSHmjzuQUxpjynqYEiKW0+AeaU0iLk5cQ5KAmxU5IkgWW MAXcRSHNeyC5p9wsQxiFE7tK69br9NvUJnqvw9Tg+3bNpWOP/j2NjdQJHyMlc9HsGT 7f+umyckOa+kmUFVsyXPZNDrMlo4X7CqhBnACUtHw2l3CUM6d6Qw1hXaCaekQ5if7w mp59wq+RDHiiBLAGZ1r1YHmXIaKe4rgX6LirqXP6M8vaJOQ8+SThAubwIcPrXQiabg vhmTSgRu90t9A== X-ME-Helo: fedora.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 14 Jan 2024 13:30:22 +0100 X-ME-IP: 92.140.202.140 From: Christophe JAILLET To: Coly Li , Kent Overstreet Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-bcache@vger.kernel.org Subject: [PATCH] bcache: Remove usage of the deprecated ida_simple_xx() API Date: Sun, 14 Jan 2024 13:30:16 +0100 Message-ID: <2f038df3860c2f44d5c7f5d06d03ca663cdbc651.1705235398.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ida_alloc() and ida_free() should be preferred to the deprecated ida_simple_get() and ida_simple_remove(). Note that the upper limit of ida_simple_get() is exclusive, but the one of ida_alloc_max() is inclusive. So a -1 has been added when needed. Signed-off-by: Christophe JAILLET --- drivers/md/bcache/super.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index dc3f50f69714..a2eecd1db126 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -881,8 +881,8 @@ static void bcache_device_free(struct bcache_device *d) bcache_device_detach(d); if (disk) { - ida_simple_remove(&bcache_device_idx, - first_minor_to_idx(disk->first_minor)); + ida_free(&bcache_device_idx, + first_minor_to_idx(disk->first_minor)); put_disk(disk); } @@ -926,8 +926,8 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size, if (!d->full_dirty_stripes) goto out_free_stripe_sectors_dirty; - idx = ida_simple_get(&bcache_device_idx, 0, - BCACHE_DEVICE_IDX_MAX, GFP_KERNEL); + idx = ida_alloc_max(&bcache_device_idx, BCACHE_DEVICE_IDX_MAX - 1, + GFP_KERNEL); if (idx < 0) goto out_free_full_dirty_stripes; @@ -980,7 +980,7 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size, out_bioset_exit: bioset_exit(&d->bio_split); out_ida_remove: - ida_simple_remove(&bcache_device_idx, idx); + ida_free(&bcache_device_idx, idx); out_free_full_dirty_stripes: kvfree(d->full_dirty_stripes); out_free_stripe_sectors_dirty: -- 2.43.0