sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget#/translations/zh_CN/filesystems/daxmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget#/translations/zh_TW/filesystems/daxmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget#/translations/it_IT/filesystems/daxmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget#/translations/ja_JP/filesystems/daxmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget#/translations/ko_KR/filesystems/daxmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget#/translations/sp_SP/filesystems/daxmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhsection)}(hhh](htitle)}(hDirect Access for filesh]hDirect Access for files}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhh=/var/lib/git/docbuild/linux/Documentation/filesystems/dax.rsthKubh)}(hhh](h)}(h Motivationh]h Motivation}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hThe page cache is usually used to buffer reads and writes to files. It is also used to provide the pages which are mapped into userspace by a call to mmap.h]hThe page cache is usually used to buffer reads and writes to files. It is also used to provide the pages which are mapped into userspace by a call to mmap.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hX For block devices that are memory-like, the page cache pages would be unnecessary copies of the original storage. The `DAX` code removes the extra copy by performing reads and writes directly to the storage device. For file mappings, the storage device is mapped directly into userspace.h](hwFor block devices that are memory-like, the page cache pages would be unnecessary copies of the original storage. The }(hhhhhNhNubhtitle_reference)}(h`DAX`h]hDAX}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhubh code removes the extra copy by performing reads and writes directly to the storage device. For file mappings, the storage device is mapped directly into userspace.}(hhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK hhhhubeh}(h] motivationah ]h"] motivationah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hUsageh]hUsage}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hXIf 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.h](h*If you have a block device which supports }(hjhhhNhNubh)}(h`DAX`h]hDAX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh1, you can make a filesystem on it as usual. The }(hjhhhNhNubh)}(h`DAX`h]hDAX}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubhO code currently only supports files with a block size equal to your kernel’s }(hjhhhNhNubh)}(h `PAGE_SIZE`h]h PAGE_SIZE}(hj?hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubhG, so you may need to specify a block size when creating the filesystem.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hpCurrently 5 filesystems support `DAX`: ext2, ext4, xfs, virtiofs and erofs. Enabling `DAX` on them is different.h](h Currently 5 filesystems support }(hjWhhhNhNubh)}(h`DAX`h]hDAX}(hj_hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjWubh0: ext2, ext4, xfs, virtiofs and erofs. Enabling }(hjWhhhNhNubh)}(h`DAX`h]hDAX}(hjqhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjWubh on them is different.}(hjWhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h]usageah ]h"]usageah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hEnabling DAX on ext2 and erofsh]hEnabling DAX on ext2 and erofs}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hWhen mounting the filesystem, use the ``-o dax`` option on the command line or add 'dax' to the options in ``/etc/fstab``. This works to enable `DAX` on all files within the filesystem. It is equivalent to the ``-o dax=always`` behavior below.h](h&When mounting the filesystem, use the }(hjhhhNhNubhliteral)}(h ``-o dax``h]h-o dax}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh? option on the command line or add ‘dax’ to the options in }(hjhhhNhNubj)}(h``/etc/fstab``h]h /etc/fstab}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh. This works to enable }(hjhhhNhNubh)}(h`DAX`h]hDAX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh> on all files within the filesystem. It is equivalent to the }(hjhhhNhNubj)}(h``-o dax=always``h]h -o dax=always}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh behavior below.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK hjhhubeh}(h]enabling-dax-on-ext2-and-erofsah ]h"]enabling dax on ext2 and erofsah$]h&]uh1hhhhhhhhKubh)}(hhh]h)}(hEnabling DAX on xfs and ext4h]hEnabling DAX on xfs and ext4}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK&ubah}(h]enabling-dax-on-xfs-and-ext4ah ]h"]enabling dax on xfs and ext4ah$]h&]uh1hhhhhhhhK&ubh)}(hhh](h)}(hSummaryh]hSummary}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK)ubh block_quote)}(hX1. There exists an in-kernel file access mode flag `S_DAX` that corresponds to the statx flag `STATX_ATTR_DAX`. See the manpage for statx(2) for details about this access mode. 2. There exists a persistent flag `FS_XFLAG_DAX` that can be applied to regular files and directories. This advisory flag can be set or cleared at any time, but doing so does not immediately affect the `S_DAX` state. 3. If the persistent `FS_XFLAG_DAX` flag is set on a directory, this flag will be inherited by all regular files and subdirectories that are subsequently created in this directory. Files and subdirectories that exist at the time this flag is set or cleared on the parent directory are not modified by this modification of the parent directory. 4. There exist dax mount options which can override `FS_XFLAG_DAX` in the setting of the `S_DAX` flag. Given underlying storage which supports `DAX` the following hold: ``-o dax=inode`` means "follow `FS_XFLAG_DAX`" and is the default. ``-o dax=never`` means "never set `S_DAX`, ignore `FS_XFLAG_DAX`." ``-o dax=always`` means "always set `S_DAX` ignore `FS_XFLAG_DAX`." ``-o dax`` is a legacy option which is an alias for ``dax=always``. .. warning:: The option ``-o dax`` may be removed in the future so ``-o dax=always`` is the preferred method for specifying this behavior. .. note:: Modifications to and the inheritance behavior of `FS_XFLAG_DAX` remain the same even when the filesystem is mounted with a dax option. However, in-core inode state (`S_DAX`) will be overridden until the filesystem is remounted with dax=inode and the inode is evicted from kernel memory. 5. The `S_DAX` policy can be changed via: a) Setting the parent directory `FS_XFLAG_DAX` as needed before files are created b) Setting the appropriate dax="foo" mount option c) Changing the `FS_XFLAG_DAX` flag on existing regular files and directories. This has runtime constraints and limitations that are described in 6) below. 6. When changing the `S_DAX` policy via toggling the persistent `FS_XFLAG_DAX` flag, the change to existing regular files won't take effect until the files are closed by all processes. h]henumerated_list)}(hhh](h list_item)}(hThere exists an in-kernel file access mode flag `S_DAX` that corresponds to the statx flag `STATX_ATTR_DAX`. See the manpage for statx(2) for details about this access mode. h]h)}(hThere exists an in-kernel file access mode flag `S_DAX` that corresponds to the statx flag `STATX_ATTR_DAX`. See the manpage for statx(2) for details about this access mode.h](h0There exists an in-kernel file access mode flag }(hj=hhhNhNubh)}(h`S_DAX`h]hS_DAX}(hjEhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj=ubh$ that corresponds to the statx flag }(hj=hhhNhNubh)}(h`STATX_ATTR_DAX`h]hSTATX_ATTR_DAX}(hjWhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj=ubhC. See the manpage for statx(2) for details about this access mode.}(hj=hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK+hj9ubah}(h]h ]h"]h$]h&]uh1j7hj4ubj8)}(hThere exists a persistent flag `FS_XFLAG_DAX` that can be applied to regular files and directories. This advisory flag can be set or cleared at any time, but doing so does not immediately affect the `S_DAX` state. h]h)}(hThere exists a persistent flag `FS_XFLAG_DAX` that can be applied to regular files and directories. This advisory flag can be set or cleared at any time, but doing so does not immediately affect the `S_DAX` state.h](hThere exists a persistent flag }(hjyhhhNhNubh)}(h`FS_XFLAG_DAX`h]h FS_XFLAG_DAX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjyubh that can be applied to regular files and directories. This advisory flag can be set or cleared at any time, but doing so does not immediately affect the }(hjyhhhNhNubh)}(h`S_DAX`h]hS_DAX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjyubh state.}(hjyhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK/hjuubah}(h]h ]h"]h$]h&]uh1j7hj4ubj8)}(hXUIf the persistent `FS_XFLAG_DAX` flag is set on a directory, this flag will be inherited by all regular files and subdirectories that are subsequently created in this directory. Files and subdirectories that exist at the time this flag is set or cleared on the parent directory are not modified by this modification of the parent directory. h]h)}(hXTIf the persistent `FS_XFLAG_DAX` flag is set on a directory, this flag will be inherited by all regular files and subdirectories that are subsequently created in this directory. Files and subdirectories that exist at the time this flag is set or cleared on the parent directory are not modified by this modification of the parent directory.h](hIf the persistent }(hjhhhNhNubh)}(h`FS_XFLAG_DAX`h]h FS_XFLAG_DAX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubhX4 flag is set on a directory, this flag will be inherited by all regular files and subdirectories that are subsequently created in this directory. Files and subdirectories that exist at the time this flag is set or cleared on the parent directory are not modified by this modification of the parent directory.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK3hjubah}(h]h ]h"]h$]h&]uh1j7hj4ubj8)}(hXThere exist dax mount options which can override `FS_XFLAG_DAX` in the setting of the `S_DAX` flag. Given underlying storage which supports `DAX` the following hold: ``-o dax=inode`` means "follow `FS_XFLAG_DAX`" and is the default. ``-o dax=never`` means "never set `S_DAX`, ignore `FS_XFLAG_DAX`." ``-o dax=always`` means "always set `S_DAX` ignore `FS_XFLAG_DAX`." ``-o dax`` is a legacy option which is an alias for ``dax=always``. .. warning:: The option ``-o dax`` may be removed in the future so ``-o dax=always`` is the preferred method for specifying this behavior. .. note:: Modifications to and the inheritance behavior of `FS_XFLAG_DAX` remain the same even when the filesystem is mounted with a dax option. However, in-core inode state (`S_DAX`) will be overridden until the filesystem is remounted with dax=inode and the inode is evicted from kernel memory. h](h)}(hThere exist dax mount options which can override `FS_XFLAG_DAX` in the setting of the `S_DAX` flag. Given underlying storage which supports `DAX` the following hold:h](h1There exist dax mount options which can override }(hjhhhNhNubh)}(h`FS_XFLAG_DAX`h]h FS_XFLAG_DAX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh in the setting of the }(hjhhhNhNubh)}(h`S_DAX`h]hS_DAX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh0 flag. Given underlying storage which supports }(hjhhhNhNubh)}(h`DAX`h]hDAX}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh the following hold:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK9hjubh)}(hC``-o dax=inode`` means "follow `FS_XFLAG_DAX`" and is the default.h](j)}(h``-o dax=inode``h]h -o dax=inode}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj#ubh means “follow }(hj#hhhNhNubh)}(h`FS_XFLAG_DAX`h]h FS_XFLAG_DAX}(hj9hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj#ubh” and is the default.}(hj#hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK=hjubh)}(hC``-o dax=never`` means "never set `S_DAX`, ignore `FS_XFLAG_DAX`."h](j)}(h``-o dax=never``h]h -o dax=never}(hjUhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjQubh means “never set }(hjQhhhNhNubh)}(h`S_DAX`h]hS_DAX}(hjghhhNhNubah}(h]h ]h"]h$]h&]uh1hhjQubh , ignore }(hjQhhhNhNubh)}(h`FS_XFLAG_DAX`h]h FS_XFLAG_DAX}(hjyhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjQubh.”}(hjQhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK?hjubh)}(hC``-o dax=always`` means "always set `S_DAX` ignore `FS_XFLAG_DAX`."h](j)}(h``-o dax=always``h]h -o dax=always}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh means “always set }(hjhhhNhNubh)}(h`S_DAX`h]hS_DAX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh ignore }(hjhhhNhNubh)}(h`FS_XFLAG_DAX`h]h FS_XFLAG_DAX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh.”}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKAhjubh)}(hH``-o dax`` is a legacy option which is an alias for ``dax=always``.h](j)}(h ``-o dax``h]h-o dax}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh/ is a legacy option which is an alias for }(hjhhhNhNubj)}(h``dax=always``h]h dax=always}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKChjubhwarning)}(h}The option ``-o dax`` may be removed in the future so ``-o dax=always`` is the preferred method for specifying this behavior.h]h)}(h}The option ``-o dax`` may be removed in the future so ``-o dax=always`` is the preferred method for specifying this behavior.h](h The option }(hjhhhNhNubj)}(h ``-o dax``h]h-o dax}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh! may be removed in the future so }(hjhhhNhNubj)}(h``-o dax=always``h]h -o dax=always}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh6 is the preferred method for specifying this behavior.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKGhjubah}(h]h ]h"]h$]h&]uh1jhjubhnote)}(hXModifications to and the inheritance behavior of `FS_XFLAG_DAX` remain the same even when the filesystem is mounted with a dax option. However, in-core inode state (`S_DAX`) will be overridden until the filesystem is remounted with dax=inode and the inode is evicted from kernel memory.h]h)}(hXModifications to and the inheritance behavior of `FS_XFLAG_DAX` remain the same even when the filesystem is mounted with a dax option. However, in-core inode state (`S_DAX`) will be overridden until the filesystem is remounted with dax=inode and the inode is evicted from kernel memory.h](h1Modifications to and the inheritance behavior of }(hjChhhNhNubh)}(h`FS_XFLAG_DAX`h]h FS_XFLAG_DAX}(hjKhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjCubhg remain the same even when the filesystem is mounted with a dax option. However, in-core inode state (}(hjChhhNhNubh)}(h`S_DAX`h]hS_DAX}(hj]hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjCubhr) will be overridden until the filesystem is remounted with dax=inode and the inode is evicted from kernel memory.}(hjChhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKLhj?ubah}(h]h ]h"]h$]h&]uh1j=hjubeh}(h]h ]h"]h$]h&]uh1j7hj4ubj8)}(hXTThe `S_DAX` policy can be changed via: a) Setting the parent directory `FS_XFLAG_DAX` as needed before files are created b) Setting the appropriate dax="foo" mount option c) Changing the `FS_XFLAG_DAX` flag on existing regular files and directories. This has runtime constraints and limitations that are described in 6) below. h](h)}(h&The `S_DAX` policy can be changed via:h](hThe }(hjhhhNhNubh)}(h`S_DAX`h]hS_DAX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh policy can be changed via:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKQhjubj3)}(hhh](j8)}(hOSetting the parent directory `FS_XFLAG_DAX` as needed before files are created h]h)}(hNSetting the parent directory `FS_XFLAG_DAX` as needed before files are createdh](hSetting the parent directory }(hjhhhNhNubh)}(h`FS_XFLAG_DAX`h]h FS_XFLAG_DAX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh# as needed before files are created}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKShjubah}(h]h ]h"]h$]h&]uh1j7hjubj8)}(h/Setting the appropriate dax="foo" mount option h]h)}(h.Setting the appropriate dax="foo" mount optionh]h2Setting the appropriate dax=”foo” mount option}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKVhjubah}(h]h ]h"]h$]h&]uh1j7hjubj8)}(hChanging the `FS_XFLAG_DAX` flag on existing regular files and directories. This has runtime constraints and limitations that are described in 6) below. h]h)}(hChanging the `FS_XFLAG_DAX` flag on existing regular files and directories. This has runtime constraints and limitations that are described in 6) below.h](h Changing the }(hjhhhNhNubh)}(h`FS_XFLAG_DAX`h]h FS_XFLAG_DAX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh~ flag on existing regular files and directories. This has runtime constraints and limitations that are described in 6) below.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKXhjubah}(h]h ]h"]h$]h&]uh1j7hjubeh}(h]h ]h"]h$]h&]enumtype loweralphaprefixhsuffix)uh1j2hjubeh}(h]h ]h"]h$]h&]uh1j7hj4ubj8)}(hWhen changing the `S_DAX` policy via toggling the persistent `FS_XFLAG_DAX` flag, the change to existing regular files won't take effect until the files are closed by all processes. h]h)}(hWhen changing the `S_DAX` policy via toggling the persistent `FS_XFLAG_DAX` flag, the change to existing regular files won't take effect until the files are closed by all processes.h](hWhen changing the }(hj)hhhNhNubh)}(h`S_DAX`h]hS_DAX}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj)ubh$ policy via toggling the persistent }(hj)hhhNhNubh)}(h`FS_XFLAG_DAX`h]h FS_XFLAG_DAX}(hjChhhNhNubah}(h]h ]h"]h$]h&]uh1hhj)ubhl flag, the change to existing regular files won’t take effect until the files are closed by all processes.}(hj)hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK\hj%ubah}(h]h ]h"]h$]h&]uh1j7hj4ubeh}(h]h ]h"]h$]h&]jarabicjhj.uh1j2hj.ubah}(h]h ]h"]h$]h&]uh1j,hhhK+hjhhubeh}(h]summaryah ]h"]summaryah$]h&]uh1hhhhhhhhK)ubh)}(hhh](h)}(hDetailsh]hDetails}(hjzhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjwhhhhhKbubh)}(hThere are 2 per-file dax flags. One is a persistent inode setting (`FS_XFLAG_DAX`) and the other is a volatile flag indicating the active state of the feature (`S_DAX`).h](hDThere are 2 per-file dax flags. One is a persistent inode setting (}(hjhhhNhNubh)}(h`FS_XFLAG_DAX`h]h FS_XFLAG_DAX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubhO) and the other is a volatile flag indicating the active state of the feature (}(hjhhhNhNubh)}(h`S_DAX`h]hS_DAX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh).}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKdhjwhhubh)}(h`FS_XFLAG_DAX` is preserved within the filesystem. This persistent config setting can be set, cleared and/or queried using the `FS_IOC_FS`[`GS`]`ETXATTR` ioctl (see ioctl_xfs_fsgetxattr(2)) or an utility such as 'xfs_io'.h](h)}(h`FS_XFLAG_DAX`h]h FS_XFLAG_DAX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubhr is preserved within the filesystem. This persistent config setting can be set, cleared and/or queried using the }(hjhhhNhNubh)}(h`FS_IOC_FS`[`GS`h]hFS_IOC_FS`[`GS}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubhR]`ETXATTR` ioctl (see ioctl_xfs_fsgetxattr(2)) or an utility such as ‘xfs_io’.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhjwhhubh)}(hNew files and directories automatically inherit `FS_XFLAG_DAX` from their parent directory **when created**. Therefore, setting `FS_XFLAG_DAX` at directory creation time can be used to set a default behavior for an entire sub-tree.h](h0New files and directories automatically inherit }(hjhhhNhNubh)}(h`FS_XFLAG_DAX`h]h FS_XFLAG_DAX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh from their parent directory }(hjhhhNhNubhstrong)}(h**when created**h]h when created}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh. Therefore, setting }(hjhhhNhNubh)}(h`FS_XFLAG_DAX`h]h FS_XFLAG_DAX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubhY at directory creation time can be used to set a default behavior for an entire sub-tree.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKlhjwhhubh)}(h,To clarify inheritance, here are 3 examples:h]h,To clarify inheritance, here are 3 examples:}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKqhjwhhubh)}(h Example A:h]h Example A:}(hj<hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKshjwhhubh literal_block)}(hmmkdir -p a/b/c xfs_io -c 'chattr +x' a mkdir a/b/c/d mkdir a/e ------[outcome]------ dax: a,e no dax: b,c,dh]hmmkdir -p a/b/c xfs_io -c 'chattr +x' a mkdir a/b/c/d mkdir a/e ------[outcome]------ dax: a,e no dax: b,c,d}hjLsbah}(h]h ]h"]h$]h&] xml:spacepreserveforcelanguageshellhighlight_args}uh1jJhhhKuhjwhhubh)}(h Example B:h]h Example B:}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjwhhubjK)}(h]mkdir a xfs_io -c 'chattr +x' a mkdir -p a/b/c/d ------[outcome]------ dax: a,b,c,d no dax:h]h]mkdir a xfs_io -c 'chattr +x' a mkdir -p a/b/c/d ------[outcome]------ dax: a,b,c,d no dax:}hjosbah}(h]h ]h"]h$]h&]jZj[j\j]shellj_}uh1jJhhhKhjwhhubh)}(h Example C:h]h Example C:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjwhhubjK)}(hamkdir -p a/b/c xfs_io -c 'chattr +x' c mkdir a/b/c/d ------[outcome]------ dax: c,d no dax: a,bh]hamkdir -p a/b/c xfs_io -c 'chattr +x' c mkdir a/b/c/d ------[outcome]------ dax: c,d no dax: a,b}hjsbah}(h]h ]h"]h$]h&]jZj[j\j]shellj_}uh1jJhhhKhjwhhubh)}(hThe current enabled state (`S_DAX`) is set when a file inode is instantiated in memory by the kernel. It is set based on the underlying media support, the value of `FS_XFLAG_DAX` and the filesystem's dax mount option.h](hThe current enabled state (}(hjhhhNhNubh)}(h`S_DAX`h]hS_DAX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh) is set when a file inode is instantiated in memory by the kernel. It is set based on the underlying media support, the value of }(hjhhhNhNubh)}(h`FS_XFLAG_DAX`h]h FS_XFLAG_DAX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh) and the filesystem’s dax mount option.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjwhhubh)}(h#statx can be used to query `S_DAX`.h](hstatx can be used to query }(hjhhhNhNubh)}(h`S_DAX`h]hS_DAX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjwhhubj>)}(h~That only regular files will ever have `S_DAX` set and therefore statx will never indicate that `S_DAX` is set on directories.h]h)}(h~That only regular files will ever have `S_DAX` set and therefore statx will never indicate that `S_DAX` is set on directories.h](h'That only regular files will ever have }(hjhhhNhNubh)}(h`S_DAX`h]hS_DAX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh2 set and therefore statx will never indicate that }(hjhhhNhNubh)}(h`S_DAX`h]hS_DAX}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh is set on directories.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j=hjwhhhhhNubh)}(hSetting the `FS_XFLAG_DAX` flag (specifically or through inheritance) occurs even if the underlying media does not support dax and/or the filesystem is overridden with a mount option.h](h Setting the }(hj+hhhNhNubh)}(h`FS_XFLAG_DAX`h]h FS_XFLAG_DAX}(hj3hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj+ubh flag (specifically or through inheritance) occurs even if the underlying media does not support dax and/or the filesystem is overridden with a mount option.}(hj+hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjwhhubeh}(h]detailsah ]h"]detailsah$]h&]uh1hhhhhhhhKbubh)}(hhh](h)}(hEnabling DAX on virtiofsh]hEnabling DAX on virtiofs}(hjVhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjShhhhhKubh)}(hXThe semantic of DAX on virtiofs is basically equal to that on ext4 and xfs, except that when '-o dax=inode' is specified, virtiofs client derives the hint whether DAX shall be enabled or not from virtiofs server through FUSE protocol, rather than the persistent `FS_XFLAG_DAX` flag. That is, whether DAX shall be enabled or not is completely determined by virtiofs server, while virtiofs server itself may deploy various algorithm making this decision, e.g. depending on the persistent `FS_XFLAG_DAX` flag on the host.h](hX The semantic of DAX on virtiofs is basically equal to that on ext4 and xfs, except that when ‘-o dax=inode’ is specified, virtiofs client derives the hint whether DAX shall be enabled or not from virtiofs server through FUSE protocol, rather than the persistent }(hjdhhhNhNubh)}(h`FS_XFLAG_DAX`h]h FS_XFLAG_DAX}(hjlhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjdubh flag. That is, whether DAX shall be enabled or not is completely determined by virtiofs server, while virtiofs server itself may deploy various algorithm making this decision, e.g. depending on the persistent }(hjdhhhNhNubh)}(h`FS_XFLAG_DAX`h]h FS_XFLAG_DAX}(hj~hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjdubh flag on the host.}(hjdhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjShhubh)}(hX.It is still supported to set or clear persistent `FS_XFLAG_DAX` flag inside guest, but it is not guaranteed that DAX will be enabled or disabled for corresponding file then. Users inside guest still need to call statx(2) and check the statx flag `STATX_ATTR_DAX` to see if DAX is enabled for this file.h](h1It is still supported to set or clear persistent }(hjhhhNhNubh)}(h`FS_XFLAG_DAX`h]h FS_XFLAG_DAX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh flag inside guest, but it is not guaranteed that DAX will be enabled or disabled for corresponding file then. Users inside guest still need to call statx(2) and check the statx flag }(hjhhhNhNubh)}(h`STATX_ATTR_DAX`h]hSTATX_ATTR_DAX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh( to see if DAX is enabled for this file.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjShhubeh}(h]enabling-dax-on-virtiofsah ]h"]enabling dax on virtiofsah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h,Implementation Tips for Block Driver Writersh]h,Implementation Tips for Block Driver Writers}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hXPTo support `DAX` in your block driver, implement the 'direct_access' block device operation. It is used to translate the sector number (expressed in units of 512-byte sectors) to a page frame number (pfn) that identifies the physical page for the memory. It also returns a kernel virtual address that can be used to access the memory.h](h To support }(hjhhhNhNubh)}(h`DAX`h]hDAX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubhXD in your block driver, implement the ‘direct_access’ block device operation. It is used to translate the sector number (expressed in units of 512-byte sectors) to a page frame number (pfn) that identifies the physical page for the memory. It also returns a kernel virtual address that can be used to access the memory.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hXThe direct_access method takes a 'size' parameter that indicates the number of bytes being requested. The function should return the number of bytes that can be contiguously accessed at that offset. It may also return a negative errno if an error occurs.h]hXThe direct_access method takes a ‘size’ parameter that indicates the number of bytes being requested. The function should return the number of bytes that can be contiguously accessed at that offset. It may also return a negative errno if an error occurs.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hXrIn order to support this method, the storage must be byte-accessible by the CPU at all times. If your device uses paging techniques to expose a large amount of memory through a smaller window, then you cannot implement direct_access. Equally, if your device can occasionally stall the CPU for an extended period, you should also not attempt to implement direct_access.h]hXrIn order to support this method, the storage must be byte-accessible by the CPU at all times. If your device uses paging techniques to expose a large amount of memory through a smaller window, then you cannot implement direct_access. Equally, if your device can occasionally stall the CPU for an extended period, you should also not attempt to implement direct_access.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(h~These block devices may be used for inspiration: - brd: RAM backed block device driver - pmem: NVDIMM persistent memory driverh]h~These block devices may be used for inspiration: - brd: RAM backed block device driver - pmem: NVDIMM persistent memory driver}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h],implementation-tips-for-block-driver-writersah ]h"],implementation tips for block driver writersah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h*Implementation Tips for Filesystem Writersh]h*Implementation Tips for Filesystem Writers}(hj6hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj3hhhhhKubh)}(hFilesystem support consists of:h]hFilesystem support consists of:}(hjDhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj3hhubh bullet_list)}(hhh](j8)}(hSAdding support to mark inodes as being `DAX` by setting the `S_DAX` flag in i_flagsh]h)}(hSAdding support to mark inodes as being `DAX` by setting the `S_DAX` flag in i_flagsh](h'Adding support to mark inodes as being }(hj[hhhNhNubh)}(h`DAX`h]hDAX}(hjchhhNhNubah}(h]h ]h"]h$]h&]uh1hhj[ubh by setting the }(hj[hhhNhNubh)}(h`S_DAX`h]hS_DAX}(hjuhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj[ubh flag in i_flags}(hj[hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjWubah}(h]h ]h"]h$]h&]uh1j7hjThhhhhNubj8)}(hwImplementing ->read_iter and ->write_iter operations which use :c:func:`dax_iomap_rw()` when inode has `S_DAX` flag seth]h)}(hwImplementing ->read_iter and ->write_iter operations which use :c:func:`dax_iomap_rw()` when inode has `S_DAX` flag seth](h?Implementing ->read_iter and ->write_iter operations which use }(hjhhhNhNubh)}(h:c:func:`dax_iomap_rw()`h]j)}(hjh]hdax_iomap_rw()}(hjhhhNhNubah}(h]h ](xrefcc-funceh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocfilesystems/dax refdomainjreftypefunc refexplicitrefwarn reftarget dax_iomap_rwuh1hhhhKhjubh when inode has }(hjhhhNhNubh)}(h`S_DAX`h]hS_DAX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh flag set}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j7hjThhhhhNubj8)}(hXKImplementing an mmap file operation for `DAX` files which sets the `VM_MIXEDMAP` and `VM_HUGEPAGE` flags on the `VMA`, and setting the vm_ops to include handlers for fault, pmd_fault, page_mkwrite, pfn_mkwrite. These handlers should probably call :c:func:`dax_iomap_fault()` passing the appropriate fault size and iomap operations.h]h)}(hXKImplementing an mmap file operation for `DAX` files which sets the `VM_MIXEDMAP` and `VM_HUGEPAGE` flags on the `VMA`, and setting the vm_ops to include handlers for fault, pmd_fault, page_mkwrite, pfn_mkwrite. These handlers should probably call :c:func:`dax_iomap_fault()` passing the appropriate fault size and iomap operations.h](h(Implementing an mmap file operation for }(hjhhhNhNubh)}(h`DAX`h]hDAX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh files which sets the }(hjhhhNhNubh)}(h `VM_MIXEDMAP`h]h VM_MIXEDMAP}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh and }(hjhhhNhNubh)}(h `VM_HUGEPAGE`h]h VM_HUGEPAGE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh flags on the }(hjhhhNhNubh)}(h`VMA`h]hVMA}(hj& hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh, and setting the vm_ops to include handlers for fault, pmd_fault, page_mkwrite, pfn_mkwrite. These handlers should probably call }(hjhhhNhNubh)}(h:c:func:`dax_iomap_fault()`h]j)}(hj: h]hdax_iomap_fault()}(hj< hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhj8 ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjdax_iomap_faultuh1hhhhKhjubh9 passing the appropriate fault size and iomap operations.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j7hjThhhhhNubj8)}(hCalling :c:func:`iomap_zero_range()` passing appropriate iomap operations instead of :c:func:`block_truncate_page()` for `DAX` filesh]h)}(hCalling :c:func:`iomap_zero_range()` passing appropriate iomap operations instead of :c:func:`block_truncate_page()` for `DAX` filesh](hCalling }(hjk hhhNhNubh)}(h:c:func:`iomap_zero_range()`h]j)}(hju h]hiomap_zero_range()}(hjw hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhjs ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjiomap_zero_rangeuh1hhhhKhjk ubh1 passing appropriate iomap operations instead of }(hjk hhhNhNubh)}(h:c:func:`block_truncate_page()`h]j)}(hj h]hblock_truncate_page()}(hj hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjblock_truncate_pageuh1hhhhKhjk ubh for }(hjk hhhNhNubh)}(h`DAX`h]hDAX}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjk ubh files}(hjk hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjg ubah}(h]h ]h"]h$]h&]uh1j7hjThhhhhNubj8)}(h[Ensuring that there is sufficient locking between reads, writes, truncates and page faults h]h)}(hZEnsuring that there is sufficient locking between reads, writes, truncates and page faultsh]hZEnsuring that there is sufficient locking between reads, writes, truncates and page faults}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1j7hjThhhhhNubeh}(h]h ]h"]h$]h&]bullet*uh1jRhhhKhj3hhubh)}(hThe iomap handlers for allocating blocks must make sure that allocated blocks are zeroed out and converted to written extents before being returned to avoid exposure of uninitialized data through mmap.h]hThe iomap handlers for allocating blocks must make sure that allocated blocks are zeroed out and converted to written extents before being returned to avoid exposure of uninitialized data through mmap.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj3hhubh)}(h.These filesystems may be used for inspiration:h]h.These filesystems may be used for inspiration:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj3hhubhseealso)}(h,ext2: see Documentation/filesystems/ext2.rsth]h)}(hj h]h,ext2: see Documentation/filesystems/ext2.rst}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1j hj3hhhhhNubj )}(h+xfs: see Documentation/admin-guide/xfs.rsth]h)}(hj. h]h+xfs: see Documentation/admin-guide/xfs.rst}(hj0 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj, ubah}(h]h ]h"]h$]h&]uh1j hj3hhhhhNubj )}(h)ext4: see Documentation/filesystems/ext4/h]h)}(hjE h]h)ext4: see Documentation/filesystems/ext4/}(hjG hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjC ubah}(h]h ]h"]h$]h&]uh1j hj3hhhhhNubeh}(h]*implementation-tips-for-filesystem-writersah ]h"]*implementation tips for filesystem writersah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hHandling Media Errorsh]hHandling Media Errors}(hje hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjb hhhhhKubh)}(hXThe libnvdimm subsystem stores a record of known media error locations for each pmem block device (in gendisk->badblocks). If we fault at such location, or one with a latent error not yet discovered, the application can expect to receive a `SIGBUS`. Libnvdimm also allows clearing of these errors by simply writing the affected sectors (through the pmem driver, and if the underlying NVDIMM supports the clear_poison DSM defined by ACPI).h](hThe libnvdimm subsystem stores a record of known media error locations for each pmem block device (in gendisk->badblocks). If we fault at such location, or one with a latent error not yet discovered, the application can expect to receive a }(hjs hhhNhNubh)}(h`SIGBUS`h]hSIGBUS}(hj{ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjs ubh. Libnvdimm also allows clearing of these errors by simply writing the affected sectors (through the pmem driver, and if the underlying NVDIMM supports the clear_poison DSM defined by ACPI).}(hjs hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjb hhubh)}(hSince `DAX` IO normally doesn't go through the ``driver/bio`` path, applications or sysadmins have an option to restore the lost data from a prior ``backup/inbuilt`` redundancy in the following ways:h](hSince }(hj hhhNhNubh)}(h`DAX`h]hDAX}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubh& IO normally doesn’t go through the }(hj hhhNhNubj)}(h``driver/bio``h]h driver/bio}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubhV path, applications or sysadmins have an option to restore the lost data from a prior }(hj hhhNhNubj)}(h``backup/inbuilt``h]hbackup/inbuilt}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh" redundancy in the following ways:}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjb hhubj3)}(hhh](j8)}(hX Delete the affected file, and restore from a backup (sysadmin route): This will free the filesystem blocks that were being used by the file, and the next time they're allocated, they will be zeroed first, which happens through the driver, and will clear bad sectors. h]h)}(hX Delete the affected file, and restore from a backup (sysadmin route): This will free the filesystem blocks that were being used by the file, and the next time they're allocated, they will be zeroed first, which happens through the driver, and will clear bad sectors.h]hX Delete the affected file, and restore from a backup (sysadmin route): This will free the filesystem blocks that were being used by the file, and the next time they’re allocated, they will be zeroed first, which happens through the driver, and will clear bad sectors.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM hj ubah}(h]h ]h"]h$]h&]uh1j7hj hhhhhNubj8)}(hTruncate or hole-punch the part of the file that has a bad-block (at least an entire aligned sector has to be hole-punched, but not necessarily an entire filesystem block). h]h)}(hTruncate or hole-punch the part of the file that has a bad-block (at least an entire aligned sector has to be hole-punched, but not necessarily an entire filesystem block).h]hTruncate or hole-punch the part of the file that has a bad-block (at least an entire aligned sector has to be hole-punched, but not necessarily an entire filesystem block).}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1j7hj hhhhhNubeh}(h]h ]h"]h$]h&]jjgjhjjhuh1j2hjb hhhhhM ubh)}(hXThese are the two basic paths that allow `DAX` filesystems to continue operating in the presence of media errors. More robust error recovery mechanisms can be built on top of this in the future, for example, involving redundancy/mirroring provided at the block layer through DM, or additionally, at the filesystem level. These would have to rely on the above two tenets, that error clearing can happen either by sending an IO through the driver, or zeroing (also through the driver).h](h)These are the two basic paths that allow }(hj hhhNhNubh)}(h`DAX`h]hDAX}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubhX filesystems to continue operating in the presence of media errors. More robust error recovery mechanisms can be built on top of this in the future, for example, involving redundancy/mirroring provided at the block layer through DM, or additionally, at the filesystem level. These would have to rely on the above two tenets, that error clearing can happen either by sending an IO through the driver, or zeroing (also through the driver).}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjb hhubeh}(h]handling-media-errorsah ]h"]handling media errorsah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h Shortcomingsh]h Shortcomings}(hj; hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj8 hhhhhMubh)}(hEven if the kernel or its modules are stored on a filesystem that supports `DAX` on a block device that supports `DAX`, they will still be copied into RAM.h](hKEven if the kernel or its modules are stored on a filesystem that supports }(hjI hhhNhNubh)}(h`DAX`h]hDAX}(hjQ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjI ubh! on a block device that supports }(hjI hhhNhNubh)}(h`DAX`h]hDAX}(hjc hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjI ubh%, they will still be copied into RAM.}(hjI hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj8 hhubh)}(huThe DAX code does not work correctly on architectures which have virtually mapped caches such as ARM, MIPS and SPARC.h]huThe DAX code does not work correctly on architectures which have virtually mapped caches such as ARM, MIPS and SPARC.}(hj{ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM!hj8 hhubh)}(hXCalling :c:func:`get_user_pages()` on a range of user memory that has been mmapped from a `DAX` file will fail when there are no 'struct page' to describe those pages. This problem has been addressed in some device drivers by adding optional struct page support for pages under the control of the driver (see `CONFIG_NVDIMM_PFN` in ``drivers/nvdimm`` for an example of how to do this). In the non struct page cases `O_DIRECT` reads/writes to those memory ranges from a non-`DAX` file will failh](hCalling }(hj hhhNhNubh)}(h:c:func:`get_user_pages()`h]j)}(hj h]hget_user_pages()}(hj hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjget_user_pagesuh1hhhhM$hj ubh8 on a range of user memory that has been mmapped from a }(hj hhhNhNubh)}(h`DAX`h]hDAX}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubh file will fail when there are no ‘struct page’ to describe those pages. This problem has been addressed in some device drivers by adding optional struct page support for pages under the control of the driver (see }(hj hhhNhNubh)}(h`CONFIG_NVDIMM_PFN`h]hCONFIG_NVDIMM_PFN}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubh in }(hj hhhNhNubj)}(h``drivers/nvdimm``h]hdrivers/nvdimm}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubhA for an example of how to do this). In the non struct page cases }(hj hhhNhNubh)}(h `O_DIRECT`h]hO_DIRECT}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubh0 reads/writes to those memory ranges from a non-}(hj hhhNhNubh)}(h`DAX`h]hDAX}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubh file will fail}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM$hj8 hhubj>)}(h`O_DIRECT` reads/writes _of a `DAX` file do work, it is the memory that is being accessed that is key here). Other things that will not work in the non struct page case include RDMA, :c:func:`sendfile()` and :c:func:`splice()`.h]h)}(h`O_DIRECT` reads/writes _of a `DAX` file do work, it is the memory that is being accessed that is key here). Other things that will not work in the non struct page case include RDMA, :c:func:`sendfile()` and :c:func:`splice()`.h](h)}(h `O_DIRECT`h]hO_DIRECT}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubh reads/writes _of a }(hj hhhNhNubh)}(h`DAX`h]hDAX}(hj. hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubh file do work, it is the memory that is being accessed that is key here). Other things that will not work in the non struct page case include RDMA, }(hj hhhNhNubh)}(h:c:func:`sendfile()`h]j)}(hjB h]h sendfile()}(hjD hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhj@ ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjsendfileuh1hhhhM/hj ubh and }(hj hhhNhNubh)}(h:c:func:`splice()`h]j)}(hje h]hsplice()}(hjg hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhjc ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjspliceuh1hhhhM/hj ubh.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM/hj ubah}(h]h ]h"]h$]h&]uh1j=hj8 hhhhhNubeh}(h] shortcomingsah ]h"] shortcomingsah$]h&]uh1hhhhhhhhMubeh}(h]direct-access-for-filesah ]h"]direct access for filesah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerj error_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(j j hhjjjjjjjtjqjPjMjjj0j-j_ j\ j5 j2 j j u nametypes}(j hjjjjtjPjj0j_ j5 j uh}(j hhhjjjjjjjqjjMjwjjSj-jj\ j3j2 jb j j8 u footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.