From patchwork Tue Nov 22 19:57:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Dobriyan X-Patchwork-Id: 9441813 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 2CF64605EE for ; Tue, 22 Nov 2016 17:59:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FABB26907 for ; Tue, 22 Nov 2016 17:59:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1459026C2F; Tue, 22 Nov 2016 17:59:27 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 A93B326907 for ; Tue, 22 Nov 2016 17:59:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755745AbcKVR7Z (ORCPT ); Tue, 22 Nov 2016 12:59:25 -0500 Received: from mail-qt0-f196.google.com ([209.85.216.196]:32909 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756416AbcKVR7Y (ORCPT ); Tue, 22 Nov 2016 12:59:24 -0500 Received: by mail-qt0-f196.google.com with SMTP id n6so3578870qtd.0 for ; Tue, 22 Nov 2016 09:57:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=6lk+sRc3bykNzOiNMiJnxmLNOfMJFfW0xlFqbT/sVZE=; b=EHRl4sc6l1GIID9huGHCEu9xJfw49vrGNSU0TudgFWDPHiiix/kf1Ncpsg2EMw76zH pirQM+OKiANy1zPwZHg6Zf1JfCD6iRyuvbwoR9FAPayxaOglJrl2yGmlYlWmj5Z+j8sG 27O56cflzXL839EmompR+DveqIgnFwtgjymiIQDJwuXqXFHvyMNMC8uIT2FyDzNYleyb P/PbmffeRcCZwYgc0JCCzMhzYCY31YKR9Y2Zu0SGCJbPhS/9sK6+SL2T7+fQT9zjEUHI 9QrzD3qGJ1sWzRloIX0NrH2JsPynd7lgDOy0vlnffOfhRIBNkSIi5JF+BL4Khs6L3OQP 4JQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=6lk+sRc3bykNzOiNMiJnxmLNOfMJFfW0xlFqbT/sVZE=; b=DO7kx1A4iYMm1XtQkbqwnn4Tqunr6ySiFkJxjH29OYnVLMHp2lUNd3emfwZMSsSgzI N8scCjjw5PVRE4ao+YTMqaTlM+ZvmL38RQpf1ZdKjhNsbWgf7c4u5uWJKcJSN7g9P6x+ 9+llDHjEj0XrHFVlkVoiZpfg0XfOyPciZltTPSpnMYUNdQW7NWBr31e8UqRsjOh3iLoq A/OxJeDDHXgB8oT/zkQiYzmI53kyHA8xSnngPTl1hxJldWS4yM/uf35G+zGSrOcl6mSB I08JcOY2ehhQ3fneEFwwPqJIGDq964IpVPcLzY6xWCfn0bIwRMaDfjjI0oIW683VsR2p wapg== X-Gm-Message-State: AKaTC01jgmOc2FcFuOutFZbMYCGdupMMaPaDW7OLTfXbHWlNKQWclp4HXGDWb+bPiXru3Q== X-Received: by 10.25.134.139 with SMTP id i133mr4517782lfd.79.1479837466867; Tue, 22 Nov 2016 09:57:46 -0800 (PST) Received: from avx2 (nat6-minsk-pool-46-53-209-92.telecom.by. [46.53.209.92]) by smtp.gmail.com with ESMTPSA id b76sm6422777lfg.41.2016.11.22.09.57.45 (version=TLS1_2 cipher=AES128-GCM-SHA256 bits=128/128); Tue, 22 Nov 2016 09:57:46 -0800 (PST) Date: Tue, 22 Nov 2016 22:57:42 +0300 From: Alexey Dobriyan To: viro@zeniv.linux.org.uk Cc: linux-fsdevel@vger.kernel.org Subject: [PATCH 1/2] vfs: simpler d_hash() Message-ID: <20161122195742.GC29812@avx2> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) 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 Precalculate "32 - d_cache_shift". Signed-off-by: Alexey Dobriyan --- fs/dcache.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/fs/dcache.c +++ b/fs/dcache.c @@ -106,7 +106,7 @@ static struct hlist_bl_head *dentry_hashtable __read_mostly; static inline struct hlist_bl_head *d_hash(unsigned int hash) { - return dentry_hashtable + (hash >> (32 - d_hash_shift)); + return dentry_hashtable + (hash >> d_hash_shift); } #define IN_LOOKUP_SHIFT 10 @@ -3560,6 +3560,8 @@ static void __init dcache_init_early(void) for (loop = 0; loop < (1U << d_hash_shift); loop++) INIT_HLIST_BL_HEAD(dentry_hashtable + loop); + + d_hash_shift = 32 - d_hash_shift; } static void __init dcache_init(void) @@ -3591,6 +3593,8 @@ static void __init dcache_init(void) for (loop = 0; loop < (1U << d_hash_shift); loop++) INIT_HLIST_BL_HEAD(dentry_hashtable + loop); + + d_hash_shift = 32 - d_hash_shift; } /* SLAB cache for __getname() consumers */