From mboxrd@z Thu Jan 1 00:00:00 1970 From: Waiman Long Subject: Re: [PATCH v3 1/1] dcache: Translating dentry into pathname without taking rename_lock Date: Fri, 06 Sep 2013 22:24:01 -0400 Message-ID: <522A8E41.3060607@hp.com> References: <1378483738-10129-1-git-send-email-Waiman.Long@hp.com> <1378483738-10129-2-git-send-email-Waiman.Long@hp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Alexander Viro , linux-fsdevel , Linux Kernel Mailing List , "Chandramouleeswaran, Aswin" , "Norton, Scott J" , George Spelvin , John Stoffel To: Linus Torvalds Return-path: Received: from g4t0014.houston.hp.com ([15.201.24.17]:34676 "EHLO g4t0014.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750837Ab3IGCYQ (ORCPT ); Fri, 6 Sep 2013 22:24:16 -0400 In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On 09/06/2013 04:52 PM, Linus Torvalds wrote: > On Fri, Sep 6, 2013 at 9:08 AM, Waiman Long wrote: >> This patch will replace the writer's write_seqlock/write_sequnlock >> sequence of the rename_lock of the callers of the prepend_path() and >> __dentry_path() functions with the reader's read_seqbegin/read_seqretry >> sequence within these 2 functions. > Ok, this actually looks really good. > > I do have one comment, from just reading the patch: > > I would really like the stuff inside the > > restart: > bptr = *buffer; > blen = *buflen; > if (retry_cnt) { > seq = read_seqbegin(&rename_lock); > rcu_read_lock(); > } else > write_seqlock(&rename_lock); > > ... guts of path generation ... > > if (retry_cnt) { > retry_cnt--; > rcu_read_unlock(); > if (read_seqretry(&rename_lock, seq)) > goto restart; > } else > write_sequnlock(&rename_lock); > > could possible be done as a separate function? > > Alternatively (or perhaps additionally), maybe the locking could be > done as an inline function too (taking the retry count as an argument) > to make things a bit more easy to understand. I would prefer putting the begin and end blocks into 2 helper inlined helper functions to make code easier to look at. I will work on this over the weekend. -Longman