Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2355234ybz; Thu, 23 Apr 2020 16:39:11 -0700 (PDT) X-Google-Smtp-Source: APiQypLwuZd4nTTL5ilNn58wbylPCKt687gLx5KI1ujk5NaJg6lw3GB6YFksVAhwcNCKV6KYvav7 X-Received: by 2002:a17:906:af94:: with SMTP id mj20mr4615519ejb.347.1587685151848; Thu, 23 Apr 2020 16:39:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587685151; cv=none; d=google.com; s=arc-20160816; b=mpP58ISYKGUSEB7QCaimlDA3rNCx+8SFsp6LmLJD3Nakv8wNm6oVWHTNnW3JXfnLt/ xt+BdNXVwMSoMoVTcRAlA0ApM6SG5uqDaqoAYssB8O3jm6fCulfBjSvc+RMZbOV39k45 vm3Wmz64SBIS4h0Nd13XxJIAaQkl4zi1ovwgP7lo0zxSMLYwdFCge0JzM6DLvPr01ton RQ27RdLZgCQWhl0X6LH4CwsxsQJPNgCSPF+jv/3PB4fYOwqywHsWTrSsq1H9Fe9wcHNV TTtbTBK/qszMbsTnOivuzgawGW+toMpFypLRe4r+UJ2PTeVp+0hqt+/3Qt1ZZH0QZepu /2FQ== 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:ironport-sdr:ironport-sdr; bh=iP77rtgUUe6Lo3ExqjOf8CVx6M8RXYAslfRYsHrqjTs=; b=iRCCpb+1edlBNIkSN1BbPgHGgBMNQviVYWVtpKtxG8jRiw++D/hbbIX55lBlHDLWgX PcLljmwN489ORIVwyXIXRC2yvpND/4GuLtN6d1I/NslqKB9/Y+Rw0Yllfvpr8YHH48eM ZL0cON+W+BBjJgt84fNj5Mt3M7YV4ASTpnaABpqysqZcvb1WCyRKvZTFfxGHtqG+AWQ1 8Y6dWN2Ll52maQVH6adyU9plduyN6odjOgn/8IMpik5KRLuaibBsmbCYNRXugvyn1ce6 s99MeX6KNd019URp4dgH2lc5c937R0MdueJ8b/dfe8GN1i+2dl7b5mnxcTQUL5Pyk+V5 CZyQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-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 dp4si2269261ejc.399.2020.04.23.16.38.48; Thu, 23 Apr 2020 16:39:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-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 S1728134AbgDWXip (ORCPT + 99 others); Thu, 23 Apr 2020 19:38:45 -0400 Received: from mga12.intel.com ([192.55.52.136]:19223 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727065AbgDWXip (ORCPT ); Thu, 23 Apr 2020 19:38:45 -0400 IronPort-SDR: UsBmFeQ5wYXus9/dg+eHAl5bz/ag+ZHvU5y0MHBdbt3kpLZY8fCdVbgqiy7x02WaCNj8x/9Jfz xj6He1zlYZlQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Apr 2020 16:38:44 -0700 IronPort-SDR: Ay5kz9diZ69oZHhCrNMcInn+tS8GYQ2LZFIBKiIdKXXft+yMe0sOT0D4/UiGHeVBopF7Fi7Uba W1bPhGDfk8cQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,309,1583222400"; d="scan'208";a="335158850" Received: from iweiny-desk2.sc.intel.com ([10.3.52.147]) by orsmga001.jf.intel.com with ESMTP; 23 Apr 2020 16:38:25 -0700 Date: Thu, 23 Apr 2020 16:38:25 -0700 From: Ira Weiny To: Dave Chinner Cc: linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, "Darrick J. Wong" , Al Viro , Jan Kara , Dan Williams , Christoph Hellwig , "Theodore Y. Ts'o" , Jeff Moyer , linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org Subject: Re: [PATCH V10 10/11] fs: Introduce DCACHE_DONTCACHE Message-ID: <20200423233824.GC4088835@iweiny-DESK2.sc.intel.com> References: <20200422212102.3757660-1-ira.weiny@intel.com> <20200422212102.3757660-11-ira.weiny@intel.com> <20200423225734.GY27860@dread.disaster.area> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200423225734.GY27860@dread.disaster.area> User-Agent: Mutt/1.11.1 (2018-12-01) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri, Apr 24, 2020 at 08:57:34AM +1000, Dave Chinner wrote: > On Wed, Apr 22, 2020 at 02:21:01PM -0700, ira.weiny@intel.com wrote: > > From: Ira Weiny > > > > DCACHE_DONTCACHE indicates a dentry should not be cached on final > > dput(). > > > > Also add a helper function to mark DCACHE_DONTCACHE on all dentries > > pointing to a specific inode when that inode is being set I_DONTCACHE. > > > > This facilitates dropping dentry references to inodes sooner which > > require eviction to swap S_DAX mode. > > > > Cc: Al Viro > > Signed-off-by: Ira Weiny > > Code looks fine.... > > > --- a/fs/inode.c > > +++ b/fs/inode.c > > @@ -1526,6 +1526,21 @@ int generic_delete_inode(struct inode *inode) > > } > > EXPORT_SYMBOL(generic_delete_inode); > > > > +void mark_inode_dontcache(struct inode *inode) > > +{ > > + struct dentry *de; > > + > > + spin_lock(&inode->i_lock); > > + hlist_for_each_entry(de, &inode->i_dentry, d_u.d_alias) { > > + spin_lock(&de->d_lock); > > + de->d_flags |= DCACHE_DONTCACHE; > > + spin_unlock(&de->d_lock); > > + } > > + inode->i_state |= I_DONTCACHE; > > + spin_unlock(&inode->i_lock); > > +} > > +EXPORT_SYMBOL(mark_inode_dontcache); > > Though I suspect that this should be in fs/dcache.c and not > fs/inode.c. i.e. nothing in fs/inode.c does dentry list walks, but > there are several cases in the dcache code where inode dentry walks > are done under the inode lock (e.g. d_find_alias(inode)). > > So perhaps this should be d_mark_dontcache(inode), which also marks > the inode as I_DONTCACHE so that everything is evicted on last > reference... That does follow an existing pattern. Al? Any preference? Ira > > Cheers, > > Dave. > -- > Dave Chinner > david@fromorbit.com