From patchwork Tue Jul 26 05:00:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9247631 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9BC5760757 for ; Tue, 26 Jul 2016 05:33:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8155226223 for ; Tue, 26 Jul 2016 05:33:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73D21276AE; Tue, 26 Jul 2016 05:33:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12B0726223 for ; Tue, 26 Jul 2016 05:33:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753667AbcGZFds (ORCPT ); Tue, 26 Jul 2016 01:33:48 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35819 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751333AbcGZFdr (ORCPT ); Tue, 26 Jul 2016 01:33:47 -0400 Received: by mail-wm0-f65.google.com with SMTP id i5so19666090wmg.2 for ; Mon, 25 Jul 2016 22:33:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:subject:to:cc:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=IeVc6uYQyjP5s3XGsgAGfsTFWN1+DhjLOo4NpKteGV8=; b=IbtTBg30IExAcycOIMb3c1+xlixXGXLE2N0XmOudh0hGXuL3ISIQGRZkHbCkJyZV/w 7uNcrra2pICBwTKFgV6mM0y1OeYUU2TmeecOjEx2gD1HHByVZOnxeu1aKt78I1C9du7j Dm36SSr2doUF/C0ComxHp/PYVH3XjOoIczqABNCWCBG1JT/vSrc9+E2bWiByrkmeZylP IIJAeodCWWPYNOJradlZkoscLtUhWG7iOlDDckc8POaKy3CxxzgzinNGw7/YsbF4zrWS kgD2jvjCA8EfooNhVhuGslFof31FVJVlQgiczoBySiAD+RdQebQ11QEl46vaHmO/HkZ2 0Ebw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:subject:to:cc:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=IeVc6uYQyjP5s3XGsgAGfsTFWN1+DhjLOo4NpKteGV8=; b=d2/NInI6wxsgCND45hqEgBZXWaH9DHhiwG/XXLkwSJ9vixWxmhoLBYpL4ef1FIqoHP dMlj5Eo1QlsKw/ZGoQhuU4FMSZR2+o+z4U0nKUbCTQCNkNQvskcklcFL12U+1S6VonTX +KFdSS48U94UTj0RfIwLJdYuodVbqCSie04ru8rdHOlCOq3ycjmBj3NUJxdYUgdvRL2q nHA++Ly3EpPXu4/0hdLE2bcs5/qR9QOlr2bt5FzBuCJ4zrVXAIjI9bEK0uwcDu4dDJG0 6fd2vWmc27EQ440YKP9+UlrN3NEmNz6hCsP8HCrQgls0n3IdAqexgO6h1szIG6n2SDUm ZYig== X-Gm-Message-State: AEkoouvMCimmk1FURzJ5jdXvTWexmjqm0A6X/I0BPqfgu5Cr8oMk98X3jKBE0J5cN13tdg== X-Received: by 10.28.3.69 with SMTP id 66mr18477315wmd.26.1469511225228; Mon, 25 Jul 2016 22:33:45 -0700 (PDT) Received: from ?IPv6:2003:62:5f01:4400:f15c:3bb5:5e12:3e94? (p200300625F014400F15C3BB55E123E94.dip0.t-ipconnect.de. [2003:62:5f01:4400:f15c:3bb5:5e12:3e94]) by smtp.googlemail.com with ESMTPSA id hb8sm19143661wjd.13.2016.07.25.22.33.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jul 2016 22:33:44 -0700 (PDT) From: Heiner Kallweit Subject: [PATCH 1/3] fs: super: remove obsolete usage of unnamed_dev_start To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org Message-ID: <29bc27aa-bc71-8459-b8f2-79886868de66@gmail.com> Date: Tue, 26 Jul 2016 07:00:08 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit c63e09ecccb5 "Make allocation of anon devices cheaper" made a performance-driven change in 2009. With commit 2c57a0e233d7 "lib: find_*_bit reimplementation" the performance of the related functionality was much improved in 2015, so I think we can remove this older extension. However I didn't do any benchmarking. As a result of this change we use the idr functionality the same way as other parts of the kernel. Signed-off-by: Heiner Kallweit --- fs/super.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/fs/super.c b/fs/super.c index c2ff475..362e765 100644 --- a/fs/super.c +++ b/fs/super.c @@ -881,10 +881,6 @@ void emergency_remount(void) static DEFINE_IDA(unnamed_dev_ida); static DEFINE_SPINLOCK(unnamed_dev_lock);/* protects the above */ -/* Many userspace utilities consider an FSID of 0 invalid. - * Always return at least 1 from get_anon_bdev. - */ -static int unnamed_dev_start = 1; int get_anon_bdev(dev_t *p) { @@ -895,9 +891,10 @@ int get_anon_bdev(dev_t *p) if (ida_pre_get(&unnamed_dev_ida, GFP_ATOMIC) == 0) return -ENOMEM; spin_lock(&unnamed_dev_lock); - error = ida_get_new_above(&unnamed_dev_ida, unnamed_dev_start, &dev); - if (!error) - unnamed_dev_start = dev + 1; + /* Many userspace utilities consider an FSID of 0 invalid. + * Always return at least 1 from get_anon_bdev. + */ + error = ida_get_new_above(&unnamed_dev_ida, 1, &dev); spin_unlock(&unnamed_dev_lock); if (error == -EAGAIN) /* We raced and lost with another CPU. */ @@ -908,8 +905,6 @@ int get_anon_bdev(dev_t *p) if (dev >= (1 << MINORBITS)) { spin_lock(&unnamed_dev_lock); ida_remove(&unnamed_dev_ida, dev); - if (unnamed_dev_start > dev) - unnamed_dev_start = dev; spin_unlock(&unnamed_dev_lock); return -EMFILE; } @@ -923,8 +918,6 @@ void free_anon_bdev(dev_t dev) int slot = MINOR(dev); spin_lock(&unnamed_dev_lock); ida_remove(&unnamed_dev_ida, slot); - if (slot < unnamed_dev_start) - unnamed_dev_start = slot; spin_unlock(&unnamed_dev_lock); } EXPORT_SYMBOL(free_anon_bdev);