Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2218837ybv; Fri, 14 Feb 2020 13:58:24 -0800 (PST) X-Google-Smtp-Source: APXvYqwR48rp7ayRb8R0X0HMg2r6CtFICxU518eZxI+zVS0iyPZ/6CwlhL7mQzwNiP2UNTHpcgvy X-Received: by 2002:aca:190b:: with SMTP id l11mr3419140oii.65.1581717504009; Fri, 14 Feb 2020 13:58:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581717504; cv=none; d=google.com; s=arc-20160816; b=rTTTEqP53tOYtsoZeNJU3L7L+WqOi7p3ZKgCHPd++F69o8dxvRibmKrq6vGHsipnap YNPWa6GsSmBb4vA9nQEBsoKdfOpGI+95Smn2oTDW6rmaf8a0HGKthU3Kc9xnV13Haf+q gScDLtPk/Bun3uZI3+rAA3+3Ua21LfiGXH2U6tyBjdX+4u63xL2u1BWH1dI/h8b5VJyt pu9R22gmbH2D2naMBaE3BKfse3OHwFMDwEFoA5giF3x3wfFcNPbNv2SR9qbWtcm0nLY0 0LcfId5pxhzhiltOsudre293mnyBy/hWRPkcM8gRwgzX2ewdFIQqZNGXlP8xzVPYUbSZ QR2w== 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=k29rBzUNlsqFqZTkvH5vxAyi13I+tYoNe53lrXC3uBw=; b=Gwhgu9xwvRt/r8UmBfV1Vd26YTCrLgFfIijeth7i9u4PUL7ERoxWXGh5SoxHXwSEMK 2xyAIMXf0sB0Er2sifZ+0hRx3hHN8CFrlWpm4HOiL9NPS6sUw/c1z6RU/BlszuA38ltR vFCklRjDFdsJM2tWvpp+0SLwsJlLmojSXASUKR2qWQq9rAhs3H1i9qWutKsyY5dOj2l/ tIVyKl1IKdxwgMxtNs6wTFn9EvAlyJFIIuTLlLSNFvhecR+i8qr7P9ehndIbxHE3Pq3H ZBHiBEVFNuDyv+WX/fPN79oTZZZTcCruhw54+hs+jDAwdes33wjPcMCffVCbtCMpJzR3 NiXQ== 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; 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 j25si3276850oij.242.2020.02.14.13.58.10; Fri, 14 Feb 2020 13:58:23 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730576AbgBNV6C (ORCPT + 99 others); Fri, 14 Feb 2020 16:58:02 -0500 Received: from mga02.intel.com ([134.134.136.20]:36581 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728911AbgBNV6B (ORCPT ); Fri, 14 Feb 2020 16:58:01 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Feb 2020 13:58:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,442,1574150400"; d="scan'208";a="433159510" Received: from iweiny-desk2.sc.intel.com ([10.3.52.157]) by fmsmga005.fm.intel.com with ESMTP; 14 Feb 2020 13:58:00 -0800 Date: Fri, 14 Feb 2020 13:58:00 -0800 From: Ira Weiny To: Jeff Moyer Cc: Dan Williams , "Darrick J. Wong" , Linux Kernel Mailing List , Alexander Viro , Dave Chinner , Christoph Hellwig , "Theodore Y. Ts'o" , Jan Kara , linux-ext4 , linux-xfs , linux-fsdevel Subject: Re: [PATCH v3 00/12] Enable per-file/directory DAX operations V3 Message-ID: <20200214215759.GA20548@iweiny-DESK2.sc.intel.com> References: <20200211201718.GF12866@iweiny-DESK2.sc.intel.com> <20200213190156.GA22854@iweiny-DESK2.sc.intel.com> <20200213190513.GB22854@iweiny-DESK2.sc.intel.com> <20200213195839.GG6870@magnolia> <20200213232923.GC22854@iweiny-DESK2.sc.intel.com> <20200214200607.GA18593@iweiny-DESK2.sc.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.1 (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 14, 2020 at 04:23:19PM -0500, Jeff Moyer wrote: > Ira Weiny writes: > > > [disclaimer: the following assumes the underlying 'device' (superblock) > > supports DAX] > > > > ... which results in S_DAX == false when the file is opened without the mount > > option. The key would be that all directories/files created under a root with > > XFS_DIFLAG2_DAX == true would inherit their flag and be XFS_DIFLAG2_DAX == true > > all the way down the tree. Any file not wanting DAX would need to set > > XFS_DIFLAG2_DAX == false. And setting false could be used on a directory to > > allow a user or group to not use dax on files in that sub-tree. > > > > Then without '-o dax' (XFS_MOUNT_DAX == false) all files when opened set S_DAX > > equal to XFS_DIFLAG2_DAX value. (Directories, as of V4, never get S_DAX set.) > > > > If '-o dax' (XFS_MOUNT_DAX == true) then S_DAX is set on all files. > > One more clarifying question. Let's say I set XFS_DIFLAG2_DAX on an > inode. I then open the file, and perform mmap/load/store/etc. I close > the file, and I unset XFS_DIFLAG2_DAX. Will the next open treat the > file as S_DAX or not? My guess is the inode won't be evicted, and so > S_DAX will remain set. The inode will not be evicted, or even it happens to be xfs_io will reload it to unset the XFS_DIFLAG2_DAX flag. And the S_DAX flag changes _with_ the XFS_DIFLAG2_DAX change when it can (when the underlying storage supports S_DAX). Trying to change XFS_DIFLAG2_DAX while the file is mmap'ed returns -EBUSY. Ira > > The reason I ask is I've had requests from application developers to do > just this. They want to be able to switch back and forth between dax > modes. > > Thanks, > Jeff > > > [1] I'm beginning to think that if I type dax one more time I'm going to go > > crazy... :-P > > dax dax dax! >