Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp269447ybl; Tue, 10 Dec 2019 22:39:52 -0800 (PST) X-Google-Smtp-Source: APXvYqwo2yqoAahVvuzdHEp55HcuF1MdWQLLSGHXEOCB3b4d4qigIDp1ik17AxsljvkcpOz0B4nu X-Received: by 2002:aca:4183:: with SMTP id o125mr1466018oia.125.1576046392158; Tue, 10 Dec 2019 22:39:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576046392; cv=none; d=google.com; s=arc-20160816; b=vk9NJevj/AJ/hJhnOsFxsZEOtJko33uxLvwOc+hw8VDk5ntQfygPz3gtK1W865W7O7 Djeh5oU3CZHOONx53NZl+O0OnpqI/UDzLth2qG3ZFABRRVXu9fUfvC+P0fTsv2mElQhw gbp0Ovq7AZEJldrUj/ms97u/tlnovSEHynBYtOL5yFXfwidtUWtpREwNY25smjP1cBDu m25eVClWdxX/J8xB26ttwUJWonPLndvjAPI/prrN/cKeoDpM3nnBzG5OMa4eFN1u8uDH 7UbjOlMuKz5F+jYvAnnVXylOAdNhPvTHnqerUuQRgDV+k5N5yf5KOzeCG3vaubREcnio pRkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=lubuPp2BzYBadtV1qPHcympDdFWTzPsfZeBP7V9a6OE=; b=CDdwvKQ4miFS4wZ3S9f638tGSJqU636ATGAxD7lH/29dbvURMStjvvkoZzgl5vGfmo SrLe55dy/3eIwW32Elo5KfhX24yhf3oEjLrVy4MPVzpW1oSxJvSnZ25JHxYM6Km6Tyo2 iapvnPgkD6R1IojEnhdSofafwtCyY6ETdyxFLCiL7UIxqRh19JdgsMpvxnSbCN/trugB f649Hao1eaVeVhKH7nyYEAGji6PthTnLl+/Kt7Jx+cJ/PjDi62hwhl4uubSjvpRUH23/ hlfyX7lithWRW37en9AsU14zUSVsBY+zLdy8qS1c3CFnQg0XwtjqmKQkfq5/y+MEtTEf 9g2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m26si442273otn.307.2019.12.10.22.39.38; Tue, 10 Dec 2019 22:39:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727851AbfLKGjH (ORCPT + 99 others); Wed, 11 Dec 2019 01:39:07 -0500 Received: from mail.loongson.cn ([114.242.206.163]:42610 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725800AbfLKGjH (ORCPT ); Wed, 11 Dec 2019 01:39:07 -0500 Received: from [10.130.0.36] (unknown [123.138.236.242]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9DxfxfvjvBdz38JAA--.103S3; Wed, 11 Dec 2019 14:38:41 +0800 (CST) Subject: Re: [PATCH v5] fs: introduce is_dot_or_dotdot helper for cleanup To: Al Viro References: <1576030801-8609-1-git-send-email-yangtiezhu@loongson.cn> <20191211024858.GB732@sol.localdomain> <20191211044723.GC4203@ZenIV.linux.org.uk> Cc: Eric Biggers , Matthew Wilcox , "Theodore Y. Ts'o" , Jaegeuk Kim , Chao Yu , Tyler Hicks , linux-fsdevel@vger.kernel.org, ecryptfs@vger.kernel.org, linux-fscrypt@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, "Darrick J. Wong" From: Tiezhu Yang Message-ID: <4a90aaa9-18c8-f0a7-19e4-1c5bd5915a28@loongson.cn> Date: Wed, 11 Dec 2019 14:38:34 +0800 User-Agent: Mozilla/5.0 (X11; Linux mips64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20191211044723.GC4203@ZenIV.linux.org.uk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CM-TRANSID: AQAAf9DxfxfvjvBdz38JAA--.103S3 X-Coremail-Antispam: 1UD129KBjvdXoW7Xry3KF4UGF4furW3Xry5urg_yoWkGrX_ur 18Cw1DAF4UZr13ZwsxJFW7JFZxWFW5Wr1jvFyvv3y7AF98A398urWkKrsIva1UZr4fZFZI kryjyrWIqrW29jkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUb-AYjsxI4VW3JwAYFVCjjxCrM7AC8VAFwI0_Gr0_Xr1l1xkIjI8I 6I8E6xAIw20EY4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM2 8CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW5JVW7JwA2z4x0Y4vE2Ix0 cI8IcVCY1x0267AKxVW8JVWxJwA2z4x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I 8E87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI 64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8Jw Am72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IY64vIr41lFIxGxcIEc7CjxVA2Y2ka0xkIwI1l c7I2V7IY0VAS07AlzVAYIcxG8wCY02Avz4vE14v_GF1l42xK82IYc2Ij64vIr41l4I8I3I 0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWU GVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI 0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0 rVWrZr1j6s0DMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr 0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x07j7jjgUUUUU= X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/11/2019 12:47 PM, Al Viro wrote: > On Wed, Dec 11, 2019 at 11:59:40AM +0800, Tiezhu Yang wrote: > >> static inline bool is_dot_or_dotdot(const unsigned char *name, size_t len) >> { >> if (len == 1 && name[0] == '.') >> return true; >> >> if (len == 2 && name[0] == '.' && name[1] == '.') >> return true; >> >> return false; >> } >> >> Hi Matthew, >> >> How do you think? I think the performance influence is very small >> due to is_dot_or_dotdot() is a such short static inline function. > It's a very short inline function called on a very hot codepath. > Often. > > I mean it - it's done literally for every pathname component of > every pathname passed to a syscall. OK. I understand. Let us do not use the helper function in fs/namei.c, just use the following implementation for other callers: static inline bool is_dot_or_dotdot(const unsigned char *name, size_t len) { if (len >= 1 && unlikely(name[0] == '.')) { if (len < 2 || (len == 2 && name[1] == '.')) return true; } return false; } Special thanks for Matthew, Darrick, Al and Eric. If you have any more suggestion, please let me know. Thanks, Tiezhu Yang