Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5485997pxj; Wed, 23 Jun 2021 02:13:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwaK8sKlYWcNzUSPZaqUGjdth+Rc43tb2LG/CC5HraTqebqVlaR16hyhLz3LbBg89Trk7sm X-Received: by 2002:aa7:d812:: with SMTP id v18mr11089997edq.159.1624439620916; Wed, 23 Jun 2021 02:13:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624439620; cv=none; d=google.com; s=arc-20160816; b=04uR0r8KWU/K9zV6ok99YniTYOKDyALLLz2sKVJc/p0nKzBqiMTZFdGqtlGNlJd9lB 6iUheA12rucj26rnurFvLrlscMOvqITUrs3b9Bw2AXjIHlqgdanJMY/umLPysaE12cAb yNqt6EfBqw65Whq3Szku6IUVzY7730QFMbMPwDoH8JPwonJXJxc0uoiXMBfnWn1kPjKu 83ii9jnU5yq2EwJJAV+D3dwLG9kbuLgVtlguxNXLHWfwI2dUIP36uc7C/BrhUXzDmq8q bhwJdyhy0LETvXUKIg3dpORVsMaFiuFFPD6IZztlMyDDMZq6dybNLJQ7tVG0VFJHZVaV qu7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=mMEiSq3sJ87ltndUrL1YVh/H0A70OZCs3YW+hsrRPcc=; b=p2VUdAh1Eb97pO0wQKpL3jLetDZMpM2qsd3WPXGBqzqskGY0UxtVN7fRjlTMx5OyfE S/Tkp7zCv0fRigHJUGAE6gqdFbvJobAfBbo5XPXWy4HyDOJwJ/jFAl4HvpDsW+8wuZNW 4emsY5VyZQ89iVHe/+wYj5VubUz5cAb84rqFNmnWOjycIW55k2LucRB+oj0v5PADFlxt tVZTEoDNFbS0mYN0WOXfI3Ld5IGsEjwQEGZyuD4szeUPbMWWnK2D+c6p0DYc245K/lcb BkRD3IQDuS8jTVgP5/C4/S8+dSxPKxp9/7fA9+vuzzSNIZgYq0PyPxJxW1spfkJ222/T XUtA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m4si5714282edc.107.2021.06.23.02.13.17; Wed, 23 Jun 2021 02:13:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230053AbhFWJNU (ORCPT + 99 others); Wed, 23 Jun 2021 05:13:20 -0400 Received: from mga06.intel.com ([134.134.136.31]:64028 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229833AbhFWJNT (ORCPT ); Wed, 23 Jun 2021 05:13:19 -0400 IronPort-SDR: lX/3ZRXaokTnCMmFEgHbOGWeh7n4/DaGtmYnBA7kMbr/wf43b1VSmcJDUdoGsBCpSr5yp1/U1y lnUQoSetO31Q== X-IronPort-AV: E=McAfee;i="6200,9189,10023"; a="268365302" X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208";a="268365302" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2021 02:10:45 -0700 IronPort-SDR: hxXNz0tyEQrcK4vGZgRlb1Z2ZzfLzU/qRksGlt9+s+57wqqsRXAv7zL9nawXi9U9LD8bHWElKc gQ50VUPkFy5g== X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208";a="474074292" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2021 02:10:41 -0700 Received: from andy by smile with local (Exim 4.94.2) (envelope-from ) id 1lvyu5-004hYo-62; Wed, 23 Jun 2021 12:10:37 +0300 Date: Wed, 23 Jun 2021 12:10:37 +0300 From: Andy Shevchenko To: Jia He Cc: Petr Mladek , Steven Rostedt , Sergey Senozhatsky , Rasmus Villemoes , Jonathan Corbet , Alexander Viro , Linus Torvalds , "Peter Zijlstra (Intel)" , Eric Biggers , "Ahmed S. Darwish" , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Matthew Wilcox , Christoph Hellwig , nd@arm.com Subject: Re: [PATCH v2 1/4] fs: introduce helper d_path_unsafe() Message-ID: References: <20210623055011.22916-1-justin.he@arm.com> <20210623055011.22916-2-justin.he@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210623055011.22916-2-justin.he@arm.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 23, 2021 at 01:50:08PM +0800, Jia He wrote: > This helper is similar to d_path() except that it doesn't take any > seqlock/spinlock. It is typical for debugging purposes. Besides, > an additional return value *prenpend_len* is used to get the full > path length of the dentry, ingoring the tail '\0'. > the full path length = end - buf - prepend_length - 1. > > Previously it will skip the prepend_name() loop at once in > __prepen_path() when the buffer length is not enough or even negative. > prepend_name_with_len() will get the full length of dentry name > together with the parent recursively regardless of the buffer length. ... > /** > * prepend_name - prepend a pathname in front of current buffer pointer > - * @buffer: buffer pointer > - * @buflen: allocated length of the buffer > - * @name: name string and length qstr structure > + * @p: prepend buffer which contains buffer pointer and allocated length > + * @name: name string and length qstr structure > * > * With RCU path tracing, it may race with d_move(). Use READ_ONCE() to > * make sure that either the old or the new name pointer and length are This should be separate patch. You are sending new version too fast... Instead of speeding up it will slow down the review process. ... > + const char *dname = smp_load_acquire(&name->name); /* ^^^ */ I have commented on the comment here. What does it mean for mere reader? > + int dlen = READ_ONCE(name->len); > + char *s; > + int last_len = p->len; Reversed xmas tree order, please. The rule of thumb is when you have gotten a comment against a piece of code, try to fix all similar places at once. ... > @@ -108,8 +181,7 @@ static int __prepend_path(const struct dentry *dentry, const struct mount *mnt, > * prepend_path - Prepend path string to a buffer > * @path: the dentry/vfsmount to report > * @root: root vfsmnt/dentry > - * @buffer: pointer to the end of the buffer > - * @buflen: pointer to buffer length > + * @p: prepend buffer which contains buffer pointer and allocated length > * > * The function will first try to write out the pathname without taking any > * lock other than the RCU read lock to make sure that dentries won't go away. Kernel doc fix should be in a separate patch. -- With Best Regards, Andy Shevchenko