Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1034798ybb; Wed, 8 Apr 2020 15:07:51 -0700 (PDT) X-Google-Smtp-Source: APiQypKzSkiMqZRDGKA6NcO1wTQI9AJ7Ah5dy6W/FTsmWpiAFL9ekRxiHQu7TGwY8LRaNwr8tqqV X-Received: by 2002:a4a:6b09:: with SMTP id g9mr2409114ooc.2.1586383671501; Wed, 08 Apr 2020 15:07:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586383671; cv=none; d=google.com; s=arc-20160816; b=JzZnQJfjvws2EnQRfJ6eMDfwKttOQ7MBvQ0gUGWI6oTG1NenAiFOXYaCR/3zcaoYDN MC62es8HdKk6iqtpO4VGkpR3qL91x4/kICZFZhmR+QVdq0LYRykedjK8wR0xZv59/deH qNXKvISfYQJNE3QM7J2lBaib8AmDaoABLT7AHlcEUpuXmSSY84D+bgthCjUU2ZtVSpNZ sv9Xt2IiKpRqmgoSW/6lcpc9rSxAJs/H9UiDFrKcVqnPD6HMrc/+0M5vLF7QluW/bojM y/Eq+YOx+6cwXPEsiT0C84PyZQhkhePO/HRuqXW5zW4ahnGGvXVGtSJyF4qR9TR36Uo7 2d1Q== 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=QeuMSnpMC5uY3fOGnf5Vad7Y6DrAWDr38pXajw1ACug=; b=JGh91K+9kr+o23/tWhIlaBr/wHqGhSep4YPQ5ebA2g4JeRgmAN7QXPfqTrx0VkVfNb bo/zC3aQtHxXBy8vlZ88SxeXlpTietnEwBzALxAfh1GBWhiA0jZa8Esv+C6iPaFfLRAj DCJ1G3RSyvTwclyIguQz0s6eX/Qy8aACz/G22s9ieJwTnAYPXUzJchRrl2z/L1q5RC9F 3T2tfHrVpkx3S0pCA+TCXmBOy56YrVZRtJ08UPl7n6BNmUTAqdqt+zFFYMy5/WSSz5+M oGMkdvzvB+7pzhBIIvV3xlU2b6aDXS5xVKDPcRz0HB20Z8Ry9rWkHpyY2H/VZVTGLqJO d0AA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id l63si2432109oif.161.2020.04.08.15.07.38; Wed, 08 Apr 2020 15:07:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-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-ext4-owner@vger.kernel.org designates 209.132.180.67 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 S1726483AbgDHWHh (ORCPT + 99 others); Wed, 8 Apr 2020 18:07:37 -0400 Received: from mga09.intel.com ([134.134.136.24]:59699 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726469AbgDHWHh (ORCPT ); Wed, 8 Apr 2020 18:07:37 -0400 IronPort-SDR: 3KdoTt4VgvH52W/mwTz8YkQUaDPjTVsBR6HJQza2JXYI5g1puUX3Ss5Elj/wVFr4G22Kcadg+j TwjRv7TfTPLA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2020 15:07:35 -0700 IronPort-SDR: xpWLvKMUDOBpguasXWBlaLt37tIpZR/h2WIIcnBXMOV8v0k0hyFTK0fAuE+I+mpptJTco46//+ Dz/b07FIQeiw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,360,1580803200"; d="scan'208";a="269882952" Received: from iweiny-desk2.sc.intel.com ([10.3.52.147]) by orsmga002.jf.intel.com with ESMTP; 08 Apr 2020 15:07:35 -0700 Date: Wed, 8 Apr 2020 15:07:35 -0700 From: Ira Weiny To: Dave Chinner Cc: linux-kernel@vger.kernel.org, "Darrick J. Wong" , Dan Williams , Christoph Hellwig , "Theodore Y. Ts'o" , Jan Kara , Jeff Moyer , linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH V6 6/8] fs/xfs: Combine xfs_diflags_to_linux() and xfs_diflags_to_iflags() Message-ID: <20200408220734.GA664132@iweiny-DESK2.sc.intel.com> References: <20200407182958.568475-1-ira.weiny@intel.com> <20200407182958.568475-7-ira.weiny@intel.com> <20200408020827.GI24067@dread.disaster.area> <20200408170923.GC569068@iweiny-DESK2.sc.intel.com> <20200408210236.GK24067@dread.disaster.area> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200408210236.GK24067@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 Thu, Apr 09, 2020 at 07:02:36AM +1000, Dave Chinner wrote: > On Wed, Apr 08, 2020 at 10:09:23AM -0700, Ira Weiny wrote: [snip] > > > > This sounds good but I think we need a slight modification to make the function equivalent in functionality. > > > > void > > xfs_diflags_to_iflags( > > struct xfs_inode *ip, > > bool init) > > { > > struct inode *inode = VFS_I(ip); > > unsigned int xflags = xfs_ip2xflags(ip); > > unsigned int flags = 0; > > > > inode->i_flags &= ~(S_IMMUTABLE | S_APPEND | S_SYNC | S_NOATIME | > > S_DAX); > > We don't want to clear the dax flag here, ever, if it is already > set. That is an externally visible change and opens us up (again) to > races where IS_DAX() changes half way through a fault path. IOWs, avoiding > clearing the DAX flag was something I did explicitly in the above > code fragment. yes... you are correct. But I don't like depending on the caller to clear the S_DAX flag if xfs_inode_enable_dax() is false. IMO this function should clear the flag in that case for consistency... This is part of the reason I used the if/else logic from xfs_diflags_to_linux() originally. It is very explicit. > > And it makes the logic clearer by pre-calculating the new flags, > then clearing and setting the inode flags together, rather than > having the spearated at the top and bottom of the function. But this will not clear the S_DAX flag even if init is true. To me that is a potential for confusion down the road. > > THis leads to an obvious conclusion: if we never clear the in memory > S_DAX flag, we can actually clear the on-disk flag safely, so that > next time the inode cycles into memory it won't be using DAX. IOWs, > admins can stop the applications, clear the DAX flag and drop > caches. This should result in the inode being recycled and when the > app is restarted it will run without DAX. No ned for deleting files, > copying large data sets, etc just to turn off an inode flag. We already discussed evicting the inode and it was determined to be too confusing.[*] Furthermore, if we did want an interface like that why not allow the on-disk flag to be set as well as cleared? IMO, this function should set all of the flags consistently including S_DAX. Ira [*] https://lore.kernel.org/lkml/20200403072731.GA24176@lst.de/ > > Cheers, > > Dave. > -- > Dave Chinner > david@fromorbit.com