Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp703174ybf; Wed, 26 Feb 2020 21:33:29 -0800 (PST) X-Google-Smtp-Source: APXvYqz8vilOg/wmEB1ZljPV4knmhketJZGOGCGHlZJ6FpsquWw4Ywu/sUpttPoJ1ryjJhlsoKfX X-Received: by 2002:aca:5303:: with SMTP id h3mr1946812oib.109.1582781608935; Wed, 26 Feb 2020 21:33:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582781608; cv=none; d=google.com; s=arc-20160816; b=GY/v4ReZvrFk8MCpsEmOxLvg5fP8vLpIzZkhZxTx7lOcoBsunRAFFdpR9xTQwgCiNN lj/jBJJ81GBWHiuTBXYWjEfgYYFNIP2jNmgjzX95YcL2q14/AsPyYA0HjGIbWboFLfzz kU+Zdr7NB30MGHtGHbsVeZmgxDrhmsVCCAYQCVfZt4Ar3fNpsYwn359/FMZqyWoQFSM5 eOCcZta3D5Iks4Tmhg71BxQItuCksCVPmmV8mQ0C/1VBoOs1N/CuISySqw1lkG6YFeFO nIzWVo9lkCmGwpgMRlkJ2rHvf0StSFbwy+vodN/0ubzm4wGIx45ZFthP7gnIcNURV4sF m1Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=uI+FHmzW97sRMoezHeT6D8yN2YMz3fpchiOu7j+qcdk=; b=u4UNJg2ljm89xhpiBRie7F0GLJ5b/KXlkgw71D38vwV0e2Z9lYjdAwFjqe1tAu8YnM 24BhQwxosqh56/lWbZAFkt/k5QQxK0+TA9KON29gmxdL+QYBzqSxf6G19mCqbCFQP8Jp fdgD36j7tePh2/CDeq46jSxf4TDyuatODayYTU/DrKFY1vyt4k03WDVr6zmEQ1KCOpPf s87Ufe5zBeFdZ6rRqBYVhedSX/yH2IEW6Yv7/fV1hl2Fm8c7eyH4jif9/2g1YsH5unlz zAQET3eEKkdykE4nYsVa8XW+FdkZmtHYD/OkHwexpt2xvO/zLr8rkdrQmjXt/CQA0v0+ YeZw== 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 l65si826938oih.23.2020.02.26.21.33.17; Wed, 26 Feb 2020 21:33:28 -0800 (PST) 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 S1728500AbgB0Fc6 (ORCPT + 99 others); Thu, 27 Feb 2020 00:32:58 -0500 Received: from mga01.intel.com ([192.55.52.88]:17728 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728453AbgB0Fcr (ORCPT ); Thu, 27 Feb 2020 00:32:47 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Feb 2020 21:32:46 -0800 X-IronPort-AV: E=Sophos;i="5.70,490,1574150400"; d="scan'208";a="261320404" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.157]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Feb 2020 21:32:46 -0800 From: ira.weiny@intel.com To: linux-kernel@vger.kernel.org Cc: Ira Weiny , Alexander Viro , "Darrick J. Wong" , Dan Williams , Dave Chinner , Christoph Hellwig , "Theodore Y. Ts'o" , Jan Kara , linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH V5 12/12] Documentation/dax: Update Usage section Date: Wed, 26 Feb 2020 21:24:42 -0800 Message-Id: <20200227052442.22524-13-ira.weiny@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200227052442.22524-1-ira.weiny@intel.com> References: <20200227052442.22524-1-ira.weiny@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Ira Weiny Update the Usage section to reflect the new individual dax selection functionality. Signed-off-by: Ira Weiny --- Documentation/filesystems/dax.txt | 84 ++++++++++++++++++++++++++++++- 1 file changed, 82 insertions(+), 2 deletions(-) diff --git a/Documentation/filesystems/dax.txt b/Documentation/filesystems/dax.txt index 679729442fd2..32e37c550f76 100644 --- a/Documentation/filesystems/dax.txt +++ b/Documentation/filesystems/dax.txt @@ -20,8 +20,88 @@ Usage If you have a block device which supports DAX, you can make a filesystem on it as usual. The DAX code currently only supports files with a block size equal to your kernel's PAGE_SIZE, so you may need to specify a block -size when creating the filesystem. When mounting it, use the "-o dax" -option on the command line or add 'dax' to the options in /etc/fstab. +size when creating the filesystem. + +Enabling DAX on an individual file basis (XFS) +---------------------------------------------- + +There are 2 per file dax flags. One is a physical configuration setting and +the other a currently enabled state. + +The physical configuration setting is maintained on individual file and +directory inodes. It is preserved within the file system. This 'physical' +config setting can be set using an ioctl and/or an application such as "xfs_io +-c 'chattr [-+]x'". Files and directories automatically inherit their physical +dax setting from their parent directory when created. Therefore, setting the +physical dax setting at directory creation time can be used to set a default +behavior for that sub-tree. Doing so on the root directory acts to set a +default for the entire file system. + +To clarify inheritance here are 3 examples: + +Example A: + +mkdir -p a/b/c +xfs_io 'chattr +x' a +mkdir a/b/c/d +mkdir a/e + + dax: a,e + no dax: b,c,d + +Example B: + +mkdir a +xfs_io 'chattr +x' a +mkdir -p a/b/c/d + + dax: a,b,c,d + no dax: + +Example C: + +mkdir -p a/b/c +xfs_io 'chattr +x' c +mkdir a/b/c/d + + dax: c,d + no dax: a,b + + +The current inode enabled state is set when a file inode is loaded and it is +determined that the underlying media supports dax. + +statx can be used to query the file's current enabled state. NOTE that a +directory will never be operating in a dax state. Therefore, the dax config +state must be queried to see what config state a file or sub-directory will +inherit from a directory. + +NOTE: Setting a file or directory's config state with xfs_io is possible even +if the underlying media does not support dax. + + +Enabling dax on a file system wide basis ('-o dax' mount option) +---------------------------------------------------------------- + +The physical dax configuration of all files can be overridden using a mount +option. In summary: + + (physical flag || mount option) && capable device == dax in effect + ( || <'-o dax'> ) && capable device == + +To enable the mount override, use "-o dax" on the command line or add +'dax' to the options in /etc/fstab + +Using the mount option does not change the physical configured state of +individual files. Therefore, remounting _without_ the mount option will allow +the file system to set file's enabled state directly based on their config +setting. + +NOTE: Setting a file or directory's physical config state is possible while the +file system is mounted with the dax override. However, the file's enabled +state will continue to be overridden and "dax enabled" until the mount option +is removed and a remount performed. At that point the file's physical config +state dictates the enabled state. Implementation Tips for Block Driver Writers -- 2.21.0