Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp191860ybl; Tue, 10 Dec 2019 20:49:26 -0800 (PST) X-Google-Smtp-Source: APXvYqxy9Q7mbE/qUIss4iHFlch8Dv6sstjFTAyvC8X/9QX8SyHrLSOLSfIhMiJfoFSV2w4I37RU X-Received: by 2002:a9d:6395:: with SMTP id w21mr975943otk.3.1576039766613; Tue, 10 Dec 2019 20:49:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576039766; cv=none; d=google.com; s=arc-20160816; b=Qg13qkrlgGvXn38sTB3esZGSdLCqI04wqE8InSEGXBp/e8Ha0mFTGhIcC61Uaet3Ty l9a423Qmrp/WlFiYTh2nIPTmE2H3Xa/c7sj/00pWbPZ1prCMWPX5pJ+rPWUTypeJthhU /S4xlHRbQAAEWCzCX60pkYmoSY3dHoSPvFqHa2Hb+Ooxtq1yNW77vDUKcbWgoHbT0EfA iHNSM9q2GLzY7hYC8OhsFtFvBRdavz4r01AsjzbDIJmHGDojJMmTh8eVZRjwWsP2k80u Lmvjs6cJWOOE/hkRtbID8NqFgXiAmU7LLRMZABeaJDFSwBVo2xl/cMm9FvL3n44TJa6F ryYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=EnsBwnoej1b4xMOB/MXv4rQx38sqvAEn9Pu5P9tg2uw=; b=EV/hsrSviTrI1mGciKg7j7uiJtgVQlQTgLeeSYHs4o/h0sFVdZEt0OmQqZFieEe8uy oKnSbq4A7WT90IbCfnYJh5+dgkFI6mHZ5QhpNnUEhHRIYNO39uLimHzGSFgcM3iHC3MF ZbKSjRkHMmZsF5rRoQeu52/dT9C5mLO+StHNcaEUv6hGDeO9tTfJ6riVCkDUJlL3iwLC hfhdzPLDgdsD7vtTYXEyiLku5mqNl0tIOV27UNfwuzz7rzesLsX9pM/5YOLLJPSK+Kdz FsXHEEDTmtO0YnQvER0SoFVCFDAexsPstUTU8oquzI8DOh0Id4XV/yMGglhzWuuY1lJS nyVg== 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 c1si443583oto.91.2019.12.10.20.49.13; Tue, 10 Dec 2019 20:49:26 -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 S1726975AbfLKErp (ORCPT + 99 others); Tue, 10 Dec 2019 23:47:45 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:52522 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726613AbfLKErp (ORCPT ); Tue, 10 Dec 2019 23:47:45 -0500 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1ietuF-0004dd-CH; Wed, 11 Dec 2019 04:47:23 +0000 Date: Wed, 11 Dec 2019 04:47:23 +0000 From: Al Viro To: Tiezhu Yang 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 Subject: Re: [PATCH v5] fs: introduce is_dot_or_dotdot helper for cleanup Message-ID: <20191211044723.GC4203@ZenIV.linux.org.uk> References: <1576030801-8609-1-git-send-email-yangtiezhu@loongson.cn> <20191211024858.GB732@sol.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.