sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget0/translations/zh_CN/filesystems/iomap/operationsmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/zh_TW/filesystems/iomap/operationsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/it_IT/filesystems/iomap/operationsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/ja_JP/filesystems/iomap/operationsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/ko_KR/filesystems/iomap/operationsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/sp_SP/filesystems/iomap/operationsmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhhJ/var/lib/git/docbuild/linux/Documentation/filesystems/iomap/operations.rsthKubhtarget)}(h.. _iomap_operations:h]h}(h]iomap-operationsah ]h"]iomap_operationsah$]h&]uh1hhKhhhhhhubh)}(hDumb style notes to maintain the author's sanity: Please try to start sentences on separate lines so that sentence changes don't bleed colors in diff. Heading decorations are documented in sphinx.rst.h]hDumb style notes to maintain the author's sanity: Please try to start sentences on separate lines so that sentence changes don't bleed colors in diff. Heading decorations are documented in sphinx.rst.}hhsbah}(h]h ]h"]h$]h&]hhuh1hhhhhhhhK ubhsection)}(hhh](htitle)}(hSupported File Operationsh]hSupported File Operations}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhK ubhtopic)}(hTable of Contents h](h)}(hTable of Contentsh]hTable of Contents}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhKubh bullet_list)}(hhh](h list_item)}(hhh](h paragraph)}(hhh]h reference)}(hhh]h Buffered I/O}(hj hhhNhNubah}(h]id1ah ]h"]h$]h&]refid buffered-i-ouh1jhjubah}(h]h ]h"]h$]h&]uh1jhjubh)}(hhh](h)}(hhh]j)}(hhh]j )}(hhh]hliteral)}(h#``struct address_space_operations``h]hstruct address_space_operations}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hNhNhj)ubah}(h]id2ah ]h"]h$]h&]refidstruct-address-space-operationsuh1jhj&ubah}(h]h ]h"]h$]h&]uh1jhj#ubah}(h]h ]h"]h$]h&]uh1hhj ubh)}(hhh]j)}(hhh]j )}(hhh]j-)}(h``struct iomap_folio_ops``h]hstruct iomap_folio_ops}(hjZhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hNhNhjWubah}(h]id3ah ]h"]h$]h&]refidstruct-iomap-folio-opsuh1jhjTubah}(h]h ]h"]h$]h&]uh1jhjQubah}(h]h ]h"]h$]h&]uh1hhj ubh)}(hhh]j)}(hhh]j )}(hhh]hInternal per-Folio State}(hjhhhNhNubah}(h]id4ah ]h"]h$]h&]refidinternal-per-folio-stateuh1jhjubah}(h]h ]h"]h$]h&]uh1jhj}ubah}(h]h ]h"]h$]h&]uh1hhj ubh)}(hhh]j)}(hhh]j )}(hhh]hBuffered Readahead and Reads}(hjhhhNhNubah}(h]id5ah ]h"]h$]h&]refidbuffered-readahead-and-readsuh1jhjubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhj ubh)}(hhh](j)}(hhh]j )}(hhh]hBuffered Writes}(hjhhhNhNubah}(h]id6ah ]h"]h$]h&]refidbuffered-writesuh1jhjubah}(h]h ]h"]h$]h&]uh1jhjubh)}(hhh](h)}(hhh]j)}(hhh]j )}(hhh]hmmap Write Faults}(hjhhhNhNubah}(h]id7ah ]h"]h$]h&]refidmmap-write-faultsuh1jhjubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hhh]j)}(hhh]j )}(hhh]hBuffered Write Failures}(hjhhhNhNubah}(h]id8ah ]h"]h$]h&]refidbuffered-write-failuresuh1jhjubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hhh]j)}(hhh]j )}(hhh]hZeroing for File Operations}(hj*hhhNhNubah}(h]id9ah ]h"]h$]h&]refidzeroing-for-file-operationsuh1jhj'ubah}(h]h ]h"]h$]h&]uh1jhj$ubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hhh]j)}(hhh]j )}(hhh]hUnsharing Reflinked File Data}(hjLhhhNhNubah}(h]id10ah ]h"]h$]h&]refidunsharing-reflinked-file-datauh1jhjIubah}(h]h ]h"]h$]h&]uh1jhjFubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhj ubh)}(hhh]j)}(hhh]j )}(hhh]h Truncation}(hjzhhhNhNubah}(h]id11ah ]h"]h$]h&]refid truncationuh1jhjwubah}(h]h ]h"]h$]h&]uh1jhjtubah}(h]h ]h"]h$]h&]uh1hhj ubh)}(hhh](j)}(hhh]j )}(hhh]hPagecache Writeback}(hjhhhNhNubah}(h]id12ah ]h"]h$]h&]refidpagecache-writebackuh1jhjubah}(h]h ]h"]h$]h&]uh1jhjubh)}(hhh](h)}(hhh]j)}(hhh]j )}(hhh]j-)}(h``struct iomap_writeback_ops``h]hstruct iomap_writeback_ops}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hNhNhjubah}(h]id13ah ]h"]h$]h&]refidstruct-iomap-writeback-opsuh1jhjubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hhh]j)}(hhh]j )}(hhh]hPagecache Writeback Completion}(hjhhhNhNubah}(h]id14ah ]h"]h$]h&]refidpagecache-writeback-completionuh1jhjubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhj ubeh}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhhubh)}(hhh](j)}(hhh]j )}(hhh]h Direct I/O}(hj!hhhNhNubah}(h]id15ah ]h"]h$]h&]refid direct-i-ouh1jhjubah}(h]h ]h"]h$]h&]uh1jhjubh)}(hhh](h)}(hhh]j)}(hhh]j )}(hhh]h Return Values}(hj@hhhNhNubah}(h]id16ah ]h"]h$]h&]refid return-valuesuh1jhj=ubah}(h]h ]h"]h$]h&]uh1jhj:ubah}(h]h ]h"]h$]h&]uh1hhj7ubh)}(hhh]j)}(hhh]j )}(hhh]h Direct Reads}(hjbhhhNhNubah}(h]id17ah ]h"]h$]h&]refid direct-readsuh1jhj_ubah}(h]h ]h"]h$]h&]uh1jhj\ubah}(h]h ]h"]h$]h&]uh1hhj7ubh)}(hhh]j)}(hhh]j )}(hhh]h Direct Writes}(hjhhhNhNubah}(h]id18ah ]h"]h$]h&]refid direct-writesuh1jhjubah}(h]h ]h"]h$]h&]uh1jhj~ubah}(h]h ]h"]h$]h&]uh1hhj7ubh)}(hhh]j)}(hhh]j )}(hhh]j-)}(h``struct iomap_dio_ops:``h]hstruct iomap_dio_ops:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hNhNhjubah}(h]id19ah ]h"]h$]h&]refidstruct-iomap-dio-opsuh1jhjubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhj7ubeh}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhhubh)}(hhh](j)}(hhh]j )}(hhh]hDAX I/O}(hjhhhNhNubah}(h]id20ah ]h"]h$]h&]refiddax-i-ouh1jhjubah}(h]h ]h"]h$]h&]uh1jhjubh)}(hhh](h)}(hhh]j)}(hhh]j )}(hhh]h fsdax Reads}(hjhhhNhNubah}(h]id21ah ]h"]h$]h&]refid fsdax-readsuh1jhjubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hhh](j)}(hhh]j )}(hhh]h fsdax Writes}(hjhhhNhNubah}(h]id22ah ]h"]h$]h&]refid fsdax-writesuh1jhjubah}(h]h ]h"]h$]h&]uh1jhjubh)}(hhh]h)}(hhh]j)}(hhh]j )}(hhh]hfsdax mmap Faults}(hj>hhhNhNubah}(h]id23ah ]h"]h$]h&]refidfsdax-mmap-faultsuh1jhj;ubah}(h]h ]h"]h$]h&]uh1jhj8ubah}(h]h ]h"]h$]h&]uh1hhj5ubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhjubh)}(hhh]j)}(hhh]j )}(hhh]h*fsdax Truncation, fallocate, and Unsharing}(hjlhhhNhNubah}(h]id24ah ]h"]h$]h&]refid(fsdax-truncation-fallocate-and-unsharinguh1jhjiubah}(h]h ]h"]h$]h&]uh1jhjfubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hhh]j)}(hhh]j )}(hhh]hfsdax Deduplication}(hjhhhNhNubah}(h]id25ah ]h"]h$]h&]refidfsdax-deduplicationuh1jhjubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhhubh)}(hhh](j)}(hhh]j )}(hhh]h Seeking Files}(hjhhhNhNubah}(h]id26ah ]h"]h$]h&]refid seeking-filesuh1jhjubah}(h]h ]h"]h$]h&]uh1jhjubh)}(hhh](h)}(hhh]j)}(hhh]j )}(hhh]h SEEK_DATA}(hjhhhNhNubah}(h]id27ah ]h"]h$]h&]refid seek-datauh1jhjubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hhh]j)}(hhh]j )}(hhh]h SEEK_HOLE}(hjhhhNhNubah}(h]id28ah ]h"]h$]h&]refid seek-holeuh1jhjubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhhubh)}(hhh]j)}(hhh]j )}(hhh]hSwap File Activation}(hj+hhhNhNubah}(h]id29ah ]h"]h$]h&]refidswap-file-activationuh1jhj(ubah}(h]h ]h"]h$]h&]uh1jhj%ubah}(h]h ]h"]h$]h&]uh1hhhubh)}(hhh](j)}(hhh]j )}(hhh]hFile Space Mapping Reporting}(hjMhhhNhNubah}(h]id30ah ]h"]h$]h&]refidfile-space-mapping-reportinguh1jhjJubah}(h]h ]h"]h$]h&]uh1jhjGubh)}(hhh](h)}(hhh]j)}(hhh]j )}(hhh]h FS_IOC_FIEMAP}(hjlhhhNhNubah}(h]id31ah ]h"]h$]h&]refid fs-ioc-fiemapuh1jhjiubah}(h]h ]h"]h$]h&]uh1jhjfubah}(h]h ]h"]h$]h&]uh1hhjcubh)}(hhh]j)}(hhh]j )}(hhh]hFIBMAP (deprecated)}(hjhhhNhNubah}(h]id32ah ]h"]h$]h&]refidfibmap-deprecateduh1jhjubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhjcubeh}(h]h ]h"]h$]h&]uh1hhjGubeh}(h]h ]h"]h$]h&]uh1hhhubeh}(h]h ]h"]h$]h&]uh1hhhhhhNhNubeh}(h]table-of-contentsah ](contentslocaleh"]table of contentsah$]h&]uh1hhhhKhhhhubj)}(hOBelow are a discussion of the high level file operations that iomap implements.h]hOBelow are a discussion of the high level file operations that iomap implements.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhhhhubh)}(hhh](h)}(h Buffered I/Oh]h Buffered I/O}(hjhhhNhNubah}(h]h ]h"]h$]h&]refidjuh1hhjhhhhhKubj)}(hBuffered I/O is the default file I/O path in Linux. File contents are cached in memory ("pagecache") to satisfy reads and writes. Dirty cache will be written back to disk at some point that can be forced via ``fsync`` and variants.h](hBuffered I/O is the default file I/O path in Linux. File contents are cached in memory (“pagecache”) to satisfy reads and writes. Dirty cache will be written back to disk at some point that can be forced via }(hjhhhNhNubj-)}(h ``fsync``h]hfsync}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh and variants.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhKhjhhubj)}(hX\iomap implements nearly all the folio and pagecache management that filesystems have to implement themselves under the legacy I/O model. This means that the filesystem need not know the details of allocating, mapping, managing uptodate and dirty state, or writeback of pagecache folios. Under the legacy I/O model, this was managed very inefficiently with linked lists of buffer heads instead of the per-folio bitmaps that iomap uses. Unless the filesystem explicitly opts in to buffer heads, they will not be used, which makes buffered I/O much more efficient, and the pagecache maintainer much happier.h]hX\iomap implements nearly all the folio and pagecache management that filesystems have to implement themselves under the legacy I/O model. This means that the filesystem need not know the details of allocating, mapping, managing uptodate and dirty state, or writeback of pagecache folios. Under the legacy I/O model, this was managed very inefficiently with linked lists of buffer heads instead of the per-folio bitmaps that iomap uses. Unless the filesystem explicitly opts in to buffer heads, they will not be used, which makes buffered I/O much more efficient, and the pagecache maintainer much happier.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhjhhubh)}(hhh](h)}(hj0h]j-)}(hj0h]hstruct address_space_operations}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubah}(h]h ]h"]h$]h&]jj>uh1hhjhhhhhK*ubj)}(heThe following iomap functions can be referenced directly from the address space operations structure:h]heThe following iomap functions can be referenced directly from the address space operations structure:}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhK,hjhhubh block_quote)}(hq* ``iomap_dirty_folio`` * ``iomap_release_folio`` * ``iomap_invalidate_folio`` * ``iomap_is_partially_uptodate`` h]h)}(hhh](h)}(h``iomap_dirty_folio``h]j)}(hjFh]j-)}(hjFh]hiomap_dirty_folio}(hjKhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjHubah}(h]h ]h"]h$]h&]uh1jhhhK/hjDubah}(h]h ]h"]h$]h&]uh1hhjAubh)}(h``iomap_release_folio``h]j)}(hjfh]j-)}(hjfh]hiomap_release_folio}(hjkhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjhubah}(h]h ]h"]h$]h&]uh1jhhhK0hjdubah}(h]h ]h"]h$]h&]uh1hhjAubh)}(h``iomap_invalidate_folio``h]j)}(hjh]j-)}(hjh]hiomap_invalidate_folio}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubah}(h]h ]h"]h$]h&]uh1jhhhK1hjubah}(h]h ]h"]h$]h&]uh1hhjAubh)}(h ``iomap_is_partially_uptodate`` h]j)}(h``iomap_is_partially_uptodate``h]j-)}(hjh]hiomap_is_partially_uptodate}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubah}(h]h ]h"]h$]h&]uh1jhhhK2hjubah}(h]h ]h"]h$]h&]uh1hhjAubeh}(h]h ]h"]h$]h&]bullet*uh1hhhhK/hj=ubah}(h]h ]h"]h$]h&]uh1j;hhhK/hjhhubj)}(h=The following address space operations can be wrapped easily:h]h=The following address space operations can be wrapped easily:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhK4hjhhubj<)}(hQ* ``read_folio`` * ``readahead`` * ``writepages`` * ``bmap`` * ``swap_activate`` h]h)}(hhh](h)}(h``read_folio``h]j)}(hjh]j-)}(hjh]h read_folio}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubah}(h]h ]h"]h$]h&]uh1jhhhK6hjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(h ``readahead``h]j)}(hj h]j-)}(hj h]h readahead}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubah}(h]h ]h"]h$]h&]uh1jhhhK7hjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(h``writepages``h]j)}(hj*h]j-)}(hj*h]h writepages}(hj/hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj,ubah}(h]h ]h"]h$]h&]uh1jhhhK8hj(ubah}(h]h ]h"]h$]h&]uh1hhjubh)}(h``bmap``h]j)}(hjJh]j-)}(hjJh]hbmap}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjLubah}(h]h ]h"]h$]h&]uh1jhhhK9hjHubah}(h]h ]h"]h$]h&]uh1hhjubh)}(h``swap_activate`` h]j)}(h``swap_activate``h]j-)}(hjnh]h swap_activate}(hjphhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjlubah}(h]h ]h"]h$]h&]uh1jhhhK:hjhubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]jjuh1hhhhK6hjubah}(h]h ]h"]h$]h&]uh1j;hhhK6hjhhubeh}(h]jDah ]h"]struct address_space_operationsah$]h&]uh1hhjhhhhhK*ubh)}(hhh](h)}(hj\h]j-)}(hj\h]hstruct iomap_folio_ops}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubah}(h]h ]h"]h$]h&]jjjuh1hhjhhhhhK=ubj)}(hThe ``->iomap_begin`` function for pagecache operations may set the ``struct iomap::folio_ops`` field to an ops structure to override default behaviors of iomap:h](hThe }(hjhhhNhNubj-)}(h``->iomap_begin``h]h ->iomap_begin}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh/ function for pagecache operations may set the }(hjhhhNhNubj-)}(h``struct iomap::folio_ops``h]hstruct iomap::folio_ops}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubhB field to an ops structure to override default behaviors of iomap:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhK?hjhhubh literal_block)}(hXJstruct iomap_folio_ops { struct folio *(*get_folio)(struct iomap_iter *iter, loff_t pos, unsigned len); void (*put_folio)(struct inode *inode, loff_t pos, unsigned copied, struct folio *folio); bool (*iomap_valid)(struct inode *inode, const struct iomap *iomap); };h]hXJstruct iomap_folio_ops { struct folio *(*get_folio)(struct iomap_iter *iter, loff_t pos, unsigned len); void (*put_folio)(struct inode *inode, loff_t pos, unsigned copied, struct folio *folio); bool (*iomap_valid)(struct inode *inode, const struct iomap *iomap); };}hjsbah}(h]h ]h"]h$]h&]hhforcelanguagechighlight_args}uh1jhhhKChjhhubj)}(hiomap calls these functions:h]hiomap calls these functions:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKMhjhhubj<)}(hX - ``get_folio``: Called to allocate and return an active reference to a locked folio prior to starting a write. If this function is not provided, iomap will call ``iomap_get_folio``. This could be used to `set up per-folio filesystem state `_ for a write. - ``put_folio``: Called to unlock and put a folio after a pagecache operation completes. If this function is not provided, iomap will ``folio_unlock`` and ``folio_put`` on its own. This could be used to `commit per-folio filesystem state `_ that was set up by ``->get_folio``. - ``iomap_valid``: The filesystem may not hold locks between ``->iomap_begin`` and ``->iomap_end`` because pagecache operations can take folio locks, fault on userspace pages, initiate writeback for memory reclamation, or engage in other time-consuming actions. If a file's space mapping data are mutable, it is possible that the mapping for a particular pagecache folio can `change in the time it takes `_ to allocate, install, and lock that folio. For the pagecache, races can happen if writeback doesn't take ``i_rwsem`` or ``invalidate_lock`` and updates mapping information. Races can also happen if the filesystem allows concurrent writes. For such files, the mapping *must* be revalidated after the folio lock has been taken so that iomap can manage the folio correctly. fsdax does not need this revalidation because there's no writeback and no support for unwritten extents. Filesystems subject to this kind of race must provide a ``->iomap_valid`` function to decide if the mapping is still valid. If the mapping is not valid, the mapping will be sampled again. To support making the validity decision, the filesystem's ``->iomap_begin`` function may set ``struct iomap::validity_cookie`` at the same time that it populates the other iomap fields. A simple validation cookie implementation is a sequence counter. If the filesystem bumps the sequence counter every time it modifies the inode's extent map, it can be placed in the ``struct iomap::validity_cookie`` during ``->iomap_begin``. If the value in the cookie is found to be different to the value the filesystem holds when the mapping is passed back to ``->iomap_valid``, then the iomap should considered stale and the validation failed. h]h)}(hhh](h)}(hXG``get_folio``: Called to allocate and return an active reference to a locked folio prior to starting a write. If this function is not provided, iomap will call ``iomap_get_folio``. This could be used to `set up per-folio filesystem state `_ for a write. h]j)}(hXF``get_folio``: Called to allocate and return an active reference to a locked folio prior to starting a write. If this function is not provided, iomap will call ``iomap_get_folio``. This could be used to `set up per-folio filesystem state `_ for a write.h](j-)}(h ``get_folio``h]h get_folio}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh: Called to allocate and return an active reference to a locked folio prior to starting a write. If this function is not provided, iomap will call }(hjhhhNhNubj-)}(h``iomap_get_folio``h]hiomap_get_folio}(hj+hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh. This could be used to }(hjhhhNhNubj )}(hn`set up per-folio filesystem state `_h]h!set up per-folio filesystem state}(hj=hhhNhNubah}(h]h ]h"]h$]h&]name!set up per-folio filesystem staterefuriGhttps://lore.kernel.org/all/20190429220934.10415-5-agruenba@redhat.com/uh1jhjubh)}(hJ h]h}(h]!set-up-per-folio-filesystem-stateah ]h"]!set up per-folio filesystem stateah$]h&]refurijNuh1h referencedKhjubh for a write.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhKOhjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hXS``put_folio``: Called to unlock and put a folio after a pagecache operation completes. If this function is not provided, iomap will ``folio_unlock`` and ``folio_put`` on its own. This could be used to `commit per-folio filesystem state `_ that was set up by ``->get_folio``. h]j)}(hXR``put_folio``: Called to unlock and put a folio after a pagecache operation completes. If this function is not provided, iomap will ``folio_unlock`` and ``folio_put`` on its own. This could be used to `commit per-folio filesystem state `_ that was set up by ``->get_folio``.h](j-)}(h ``put_folio``h]h put_folio}(hjuhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjqubhw: Called to unlock and put a folio after a pagecache operation completes. If this function is not provided, iomap will }(hjqhhhNhNubj-)}(h``folio_unlock``h]h folio_unlock}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjqubh and }(hjqhhhNhNubj-)}(h ``folio_put``h]h folio_put}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjqubh# on its own. This could be used to }(hjqhhhNhNubj )}(he`commit per-folio filesystem state `_h]h!commit per-folio filesystem state}(hjhhhNhNubah}(h]h ]h"]h$]h&]name!commit per-folio filesystem statejM>https://lore.kernel.org/all/20180619164137.13720-6-hch@lst.de/uh1jhjqubh)}(hA h]h}(h]!commit-per-folio-filesystem-stateah ]h"]!commit per-folio filesystem stateah$]h&]refurijuh1hj\Khjqubh that was set up by }(hjqhhhNhNubj-)}(h``->get_folio``h]h ->get_folio}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjqubh.}(hjqhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhKWhjmubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hX``iomap_valid``: The filesystem may not hold locks between ``->iomap_begin`` and ``->iomap_end`` because pagecache operations can take folio locks, fault on userspace pages, initiate writeback for memory reclamation, or engage in other time-consuming actions. If a file's space mapping data are mutable, it is possible that the mapping for a particular pagecache folio can `change in the time it takes `_ to allocate, install, and lock that folio. For the pagecache, races can happen if writeback doesn't take ``i_rwsem`` or ``invalidate_lock`` and updates mapping information. Races can also happen if the filesystem allows concurrent writes. For such files, the mapping *must* be revalidated after the folio lock has been taken so that iomap can manage the folio correctly. fsdax does not need this revalidation because there's no writeback and no support for unwritten extents. Filesystems subject to this kind of race must provide a ``->iomap_valid`` function to decide if the mapping is still valid. If the mapping is not valid, the mapping will be sampled again. To support making the validity decision, the filesystem's ``->iomap_begin`` function may set ``struct iomap::validity_cookie`` at the same time that it populates the other iomap fields. A simple validation cookie implementation is a sequence counter. If the filesystem bumps the sequence counter every time it modifies the inode's extent map, it can be placed in the ``struct iomap::validity_cookie`` during ``->iomap_begin``. If the value in the cookie is found to be different to the value the filesystem holds when the mapping is passed back to ``->iomap_valid``, then the iomap should considered stale and the validation failed. h](j)}(hX ``iomap_valid``: The filesystem may not hold locks between ``->iomap_begin`` and ``->iomap_end`` because pagecache operations can take folio locks, fault on userspace pages, initiate writeback for memory reclamation, or engage in other time-consuming actions. If a file's space mapping data are mutable, it is possible that the mapping for a particular pagecache folio can `change in the time it takes `_ to allocate, install, and lock that folio.h](j-)}(h``iomap_valid``h]h iomap_valid}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh,: The filesystem may not hold locks between }(hjhhhNhNubj-)}(h``->iomap_begin``h]h ->iomap_begin}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh and }(hjhhhNhNubj-)}(h``->iomap_end``h]h ->iomap_end}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubhX because pagecache operations can take folio locks, fault on userspace pages, initiate writeback for memory reclamation, or engage in other time-consuming actions. If a file’s space mapping data are mutable, it is possible that the mapping for a particular pagecache folio can }(hjhhhNhNubj )}(hi`change in the time it takes `_h]hchange in the time it takes}(hj) hhhNhNubah}(h]h ]h"]h$]h&]namechange in the time it takesjMHhttps://lore.kernel.org/all/20221123055812.747923-8-david@fromorbit.com/uh1jhjubh)}(hK h]h}(h]change-in-the-time-it-takesah ]h"]change in the time it takesah$]h&]refurij9 uh1hj\Khjubh+ to allocate, install, and lock that folio.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhK_hjubj)}(hXGFor the pagecache, races can happen if writeback doesn't take ``i_rwsem`` or ``invalidate_lock`` and updates mapping information. Races can also happen if the filesystem allows concurrent writes. For such files, the mapping *must* be revalidated after the folio lock has been taken so that iomap can manage the folio correctly.h](h@For the pagecache, races can happen if writeback doesn’t take }(hjQ hhhNhNubj-)}(h ``i_rwsem``h]hi_rwsem}(hjY hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjQ ubh or }(hjQ hhhNhNubj-)}(h``invalidate_lock``h]hinvalidate_lock}(hjk hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjQ ubh and updates mapping information. Races can also happen if the filesystem allows concurrent writes. For such files, the mapping }(hjQ hhhNhNubhemphasis)}(h*must*h]hmust}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j} hjQ ubha be revalidated after the folio lock has been taken so that iomap can manage the folio correctly.}(hjQ hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhKihjubj)}(hhfsdax does not need this revalidation because there's no writeback and no support for unwritten extents.h]hjfsdax does not need this revalidation because there’s no writeback and no support for unwritten extents.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKohjubj)}(hFilesystems subject to this kind of race must provide a ``->iomap_valid`` function to decide if the mapping is still valid. If the mapping is not valid, the mapping will be sampled again.h](h8Filesystems subject to this kind of race must provide a }(hj hhhNhNubj-)}(h``->iomap_valid``h]h ->iomap_valid}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubhr function to decide if the mapping is still valid. If the mapping is not valid, the mapping will be sampled again.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhKrhjubj)}(hXxTo support making the validity decision, the filesystem's ``->iomap_begin`` function may set ``struct iomap::validity_cookie`` at the same time that it populates the other iomap fields. A simple validation cookie implementation is a sequence counter. If the filesystem bumps the sequence counter every time it modifies the inode's extent map, it can be placed in the ``struct iomap::validity_cookie`` during ``->iomap_begin``. If the value in the cookie is found to be different to the value the filesystem holds when the mapping is passed back to ``->iomap_valid``, then the iomap should considered stale and the validation failed.h](hiomap_begin``h]h ->iomap_begin}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubh function may set }(hj hhhNhNubj-)}(h!``struct iomap::validity_cookie``h]hstruct iomap::validity_cookie}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubh at the same time that it populates the other iomap fields. A simple validation cookie implementation is a sequence counter. If the filesystem bumps the sequence counter every time it modifies the inode’s extent map, it can be placed in the }(hj hhhNhNubj-)}(h!``struct iomap::validity_cookie``h]hstruct iomap::validity_cookie}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubh during }(hj hhhNhNubj-)}(h``->iomap_begin``h]h ->iomap_begin}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubh{. If the value in the cookie is found to be different to the value the filesystem holds when the mapping is passed back to }(hj hhhNhNubj-)}(h``->iomap_valid``h]h ->iomap_valid}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubhC, then the iomap should considered stale and the validation failed.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhKvhjubeh}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]j-uh1hhhhKOhj ubah}(h]h ]h"]h$]h&]uh1j;hhhKOhjhhubj)}(hIThese ``struct kiocb`` flags are significant for buffered I/O with iomap:h](hThese }(hj@ hhhNhNubj-)}(h``struct kiocb``h]h struct kiocb}(hjH hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj@ ubh3 flags are significant for buffered I/O with iomap:}(hj@ hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhKhjhhubj<)}(hc* ``IOCB_NOWAIT``: Turns on ``IOMAP_NOWAIT``. * ``IOCB_DONTCACHE``: Turns on ``IOMAP_DONTCACHE``. h]h)}(hhh](h)}(h,``IOCB_NOWAIT``: Turns on ``IOMAP_NOWAIT``. h]j)}(h+``IOCB_NOWAIT``: Turns on ``IOMAP_NOWAIT``.h](j-)}(h``IOCB_NOWAIT``h]h IOCB_NOWAIT}(hjo hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjk ubh : Turns on }(hjk hhhNhNubj-)}(h``IOMAP_NOWAIT``h]h IOMAP_NOWAIT}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjk ubh.}(hjk hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhKhjg ubah}(h]h ]h"]h$]h&]uh1hhjd ubh)}(h2``IOCB_DONTCACHE``: Turns on ``IOMAP_DONTCACHE``. h]j)}(h1``IOCB_DONTCACHE``: Turns on ``IOMAP_DONTCACHE``.h](j-)}(h``IOCB_DONTCACHE``h]hIOCB_DONTCACHE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubh : Turns on }(hj hhhNhNubj-)}(h``IOMAP_DONTCACHE``h]hIOMAP_DONTCACHE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubh.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhKhj ubah}(h]h ]h"]h$]h&]uh1hhjd ubeh}(h]h ]h"]h$]h&]jjuh1hhhhKhj` ubah}(h]h ]h"]h$]h&]uh1j;hhhKhjhhubeh}(h]jpah ]h"]struct iomap_folio_opsah$]h&]uh1hhjhhhhhK=ubh)}(hhh](h)}(hInternal per-Folio Stateh]hInternal per-Folio State}(hj hhhNhNubah}(h]h ]h"]h$]h&]jjuh1hhj hhhhhKubj)}(hX?If the fsblock size matches the size of a pagecache folio, it is assumed that all disk I/O operations will operate on the entire folio. The uptodate (memory contents are at least as new as what's on disk) and dirty (memory contents are newer than what's on disk) status of the folio are all that's needed for this case.h]hXEIf the fsblock size matches the size of a pagecache folio, it is assumed that all disk I/O operations will operate on the entire folio. The uptodate (memory contents are at least as new as what’s on disk) and dirty (memory contents are newer than what’s on disk) status of the folio are all that’s needed for this case.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhj hhubj)}(hX(If the fsblock size is less than the size of a pagecache folio, iomap tracks the per-fsblock uptodate and dirty state itself. This enables iomap to handle both "bs < ps" `filesystems `_ and large folios in the pagecache.h](hIf the fsblock size is less than the size of a pagecache folio, iomap tracks the per-fsblock uptodate and dirty state itself. This enables iomap to handle both “bs < ps” }(hj hhhNhNubj )}(h[`filesystems `_h]h filesystems}(hj hhhNhNubah}(h]h ]h"]h$]h&]name filesystemsjMJhttps://lore.kernel.org/all/20230725122932.144426-1-ritesh.list@gmail.com/uh1jhj ubh)}(hM h]h}(h] filesystemsah ]h"] filesystemsah$]h&]refurij! uh1hj\Khj ubh# and large folios in the pagecache.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhKhj hhubj)}(h3iomap internally tracks two state bits per fsblock:h]h3iomap internally tracks two state bits per fsblock:}(hj9 hhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhj hhubj<)}(hX* ``uptodate``: iomap will try to keep folios fully up to date. If there are read(ahead) errors, those fsblocks will not be marked uptodate. The folio itself will be marked uptodate when all fsblocks within the folio are uptodate. * ``dirty``: iomap will set the per-block dirty state when programs write to the file. The folio itself will be marked dirty when any fsblock within the folio is dirty. h]h)}(hhh](h)}(h``uptodate``: iomap will try to keep folios fully up to date. If there are read(ahead) errors, those fsblocks will not be marked uptodate. The folio itself will be marked uptodate when all fsblocks within the folio are uptodate. h]j)}(h``uptodate``: iomap will try to keep folios fully up to date. If there are read(ahead) errors, those fsblocks will not be marked uptodate. The folio itself will be marked uptodate when all fsblocks within the folio are uptodate.h](j-)}(h ``uptodate``h]huptodate}(hjV hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjR ubh: iomap will try to keep folios fully up to date. If there are read(ahead) errors, those fsblocks will not be marked uptodate. The folio itself will be marked uptodate when all fsblocks within the folio are uptodate.}(hjR hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhKhjN ubah}(h]h ]h"]h$]h&]uh1hhjK ubh)}(h``dirty``: iomap will set the per-block dirty state when programs write to the file. The folio itself will be marked dirty when any fsblock within the folio is dirty. h]j)}(h``dirty``: iomap will set the per-block dirty state when programs write to the file. The folio itself will be marked dirty when any fsblock within the folio is dirty.h](j-)}(h ``dirty``h]hdirty}(hj| hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjx ubh: iomap will set the per-block dirty state when programs write to the file. The folio itself will be marked dirty when any fsblock within the folio is dirty.}(hjx hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhKhjt ubah}(h]h ]h"]h$]h&]uh1hhjK ubeh}(h]h ]h"]h$]h&]jjuh1hhhhKhjG ubah}(h]h ]h"]h$]h&]uh1j;hhhKhj hhubj)}(hiomap also tracks the amount of read and write disk IOs that are in flight. This structure is much lighter weight than ``struct buffer_head`` because there is only one per folio, and the per-fsblock overhead is two bits vs. 104 bytes.h](hwiomap also tracks the amount of read and write disk IOs that are in flight. This structure is much lighter weight than }(hj hhhNhNubj-)}(h``struct buffer_head``h]hstruct buffer_head}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubh] because there is only one per folio, and the per-fsblock overhead is two bits vs. 104 bytes.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhKhj hhubj)}(hFilesystems wishing to turn on large folios in the pagecache should call ``mapping_set_large_folios`` when initializing the incore inode.h](hIFilesystems wishing to turn on large folios in the pagecache should call }(hj hhhNhNubj-)}(h``mapping_set_large_folios``h]hmapping_set_large_folios}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubh$ when initializing the incore inode.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhKhj hhubeh}(h]jah ]h"]internal per-folio stateah$]h&]uh1hhjhhhhhKubh)}(hhh](h)}(hBuffered Readahead and Readsh]hBuffered Readahead and Reads}(hj hhhNhNubah}(h]h ]h"]h$]h&]jjuh1hhj hhhhhKubj)}(hX(The ``iomap_readahead`` function initiates readahead to the pagecache. The ``iomap_read_folio`` function reads one folio's worth of data into the pagecache. The ``flags`` argument to ``->iomap_begin`` will be set to zero. The pagecache takes whatever locks it needs before calling the filesystem.h](hThe }(hj hhhNhNubj-)}(h``iomap_readahead``h]hiomap_readahead}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubh4 function initiates readahead to the pagecache. The }(hj hhhNhNubj-)}(h``iomap_read_folio``h]hiomap_read_folio}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubhD function reads one folio’s worth of data into the pagecache. The }(hj hhhNhNubj-)}(h ``flags``h]hflags}(hj* hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubh argument to }(hj hhhNhNubj-)}(h``->iomap_begin``h]h ->iomap_begin}(hj< hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubh` will be set to zero. The pagecache takes whatever locks it needs before calling the filesystem.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhKhj hhubeh}(h]jah ]h"]buffered readahead and readsah$]h&]uh1hhjhhhhhKubh)}(hhh](h)}(hBuffered Writesh]hBuffered Writes}(hj^ hhhNhNubah}(h]h ]h"]h$]h&]jjuh1hhj[ hhhhhKubj)}(hX'The ``iomap_file_buffered_write`` function writes an ``iocb`` to the pagecache. ``IOMAP_WRITE`` or ``IOMAP_WRITE`` | ``IOMAP_NOWAIT`` will be passed as the ``flags`` argument to ``->iomap_begin``. Callers commonly take ``i_rwsem`` in either shared or exclusive mode before calling this function.h](hThe }(hjl hhhNhNubj-)}(h``iomap_file_buffered_write``h]hiomap_file_buffered_write}(hjt hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjl ubh function writes an }(hjl hhhNhNubj-)}(h``iocb``h]hiocb}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjl ubh to the pagecache. }(hjl hhhNhNubj-)}(h``IOMAP_WRITE``h]h IOMAP_WRITE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjl ubh or }(hjl hhhNhNubj-)}(h``IOMAP_WRITE``h]h IOMAP_WRITE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjl ubh | }(hjl hhhNhNubj-)}(h``IOMAP_NOWAIT``h]h IOMAP_NOWAIT}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjl ubh will be passed as the }(hjl hhhNhNubj-)}(h ``flags``h]hflags}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjl ubh argument to }(hjl hhhNhNubj-)}(h``->iomap_begin``h]h ->iomap_begin}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjl ubh. Callers commonly take }(hjl hhhNhNubj-)}(h ``i_rwsem``h]hi_rwsem}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjl ubhA in either shared or exclusive mode before calling this function.}(hjl hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhKhj[ hhubh)}(hhh](h)}(hmmap Write Faultsh]hmmap Write Faults}(hj hhhNhNubah}(h]h ]h"]h$]h&]jjuh1hhj hhhhhKubj)}(hX The ``iomap_page_mkwrite`` function handles a write fault to a folio in the pagecache. ``IOMAP_WRITE | IOMAP_FAULT`` will be passed as the ``flags`` argument to ``->iomap_begin``. Callers commonly take the mmap ``invalidate_lock`` in shared or exclusive mode before calling this function.h](hThe }(hj hhhNhNubj-)}(h``iomap_page_mkwrite``h]hiomap_page_mkwrite}(hj# hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubh= function handles a write fault to a folio in the pagecache. }(hj hhhNhNubj-)}(h``IOMAP_WRITE | IOMAP_FAULT``h]hIOMAP_WRITE | IOMAP_FAULT}(hj5 hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubh will be passed as the }(hj hhhNhNubj-)}(h ``flags``h]hflags}(hjG hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubh argument to }(hj hhhNhNubj-)}(h``->iomap_begin``h]h ->iomap_begin}(hjY hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubh!. Callers commonly take the mmap }(hj hhhNhNubj-)}(h``invalidate_lock``h]hinvalidate_lock}(hjk hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubh: in shared or exclusive mode before calling this function.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhKhj hhubeh}(h]jah ]h"]mmap write faultsah$]h&]uh1hhj[ hhhhhKubh)}(hhh](h)}(hBuffered Write Failuresh]hBuffered Write Failures}(hj hhhNhNubah}(h]h ]h"]h$]h&]jjuh1hhj hhhhhKubj)}(hX;After a short write to the pagecache, the areas not written will not become marked dirty. The filesystem must arrange to `cancel `_ such `reservations `_ because writeback will not consume the reservation. The ``iomap_write_delalloc_release`` can be called from a ``->iomap_end`` function to find all the clean areas of the folios caching a fresh (``IOMAP_F_NEW``) delalloc mapping. It takes the ``invalidate_lock``.h](hyAfter a short write to the pagecache, the areas not written will not become marked dirty. The filesystem must arrange to }(hj hhhNhNubj )}(hT`cancel `_h]hcancel}(hj hhhNhNubah}(h]h ]h"]h$]h&]namecanceljMHhttps://lore.kernel.org/all/20221123055812.747923-6-david@fromorbit.com/uh1jhj ubh)}(hK h]h}(h]cancelah ]h"]cancelah$]h&]refurij uh1hj\Khj ubh such }(hj hhhNhNubj )}(ha`reservations `_h]h reservations}(hj hhhNhNubah}(h]h ]h"]h$]h&]name reservationsjMOhttps://lore.kernel.org/linux-xfs/20220817093627.GZ3600936@dread.disaster.area/uh1jhj ubh)}(hR h]h}(h] reservationsah ]h"] reservationsah$]h&]refurij uh1hj\Khj ubh9 because writeback will not consume the reservation. The }(hj hhhNhNubj-)}(h ``iomap_write_delalloc_release``h]hiomap_write_delalloc_release}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubh can be called from a }(hj hhhNhNubj-)}(h``->iomap_end``h]h ->iomap_end}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubhE function to find all the clean areas of the folios caching a fresh (}(hj hhhNhNubj-)}(h``IOMAP_F_NEW``h]h IOMAP_F_NEW}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubh!) delalloc mapping. It takes the }(hj hhhNhNubj-)}(h``invalidate_lock``h]hinvalidate_lock}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubh.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhKhj hhubj)}(hX:The filesystem must supply a function ``punch`` to be called for each file range in this state. This function must *only* remove delayed allocation reservations, in case another thread racing with the current thread writes successfully to the same region and triggers writeback to flush the dirty data out to disk.h](h&The filesystem must supply a function }(hj5hhhNhNubj-)}(h ``punch``h]hpunch}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj5ubhD to be called for each file range in this state. This function must }(hj5hhhNhNubj~ )}(h*only*h]honly}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1j} hj5ubh remove delayed allocation reservations, in case another thread racing with the current thread writes successfully to the same region and triggers writeback to flush the dirty data out to disk.}(hj5hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhKhj hhubeh}(h]jah ]h"]buffered write failuresah$]h&]uh1hhj[ hhhhhKubh)}(hhh](h)}(hZeroing for File Operationsh]hZeroing for File Operations}(hjqhhhNhNubah}(h]h ]h"]h$]h&]jj3uh1hhjnhhhhhKubj)}(hXSFilesystems can call ``iomap_zero_range`` to perform zeroing of the pagecache for non-truncation file operations that are not aligned to the fsblock size. ``IOMAP_ZERO`` will be passed as the ``flags`` argument to ``->iomap_begin``. Callers typically hold ``i_rwsem`` and ``invalidate_lock`` in exclusive mode before calling this function.h](hFilesystems can call }(hjhhhNhNubj-)}(h``iomap_zero_range``h]hiomap_zero_range}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubhr to perform zeroing of the pagecache for non-truncation file operations that are not aligned to the fsblock size. }(hjhhhNhNubj-)}(h``IOMAP_ZERO``h]h IOMAP_ZERO}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh will be passed as the }(hjhhhNhNubj-)}(h ``flags``h]hflags}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh argument to }(hjhhhNhNubj-)}(h``->iomap_begin``h]h ->iomap_begin}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh. Callers typically hold }(hjhhhNhNubj-)}(h ``i_rwsem``h]hi_rwsem}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh and }(hjhhhNhNubj-)}(h``invalidate_lock``h]hinvalidate_lock}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh0 in exclusive mode before calling this function.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhKhjnhhubeh}(h]j9ah ]h"]zeroing for file operationsah$]h&]uh1hhj[ hhhhhKubh)}(hhh](h)}(hUnsharing Reflinked File Datah]hUnsharing Reflinked File Data}(hjhhhNhNubah}(h]h ]h"]h$]h&]jjUuh1hhjhhhhhKubj)}(hXgFilesystems can call ``iomap_file_unshare`` to force a file sharing storage with another file to preemptively copy the shared data to newly allocate storage. ``IOMAP_WRITE | IOMAP_UNSHARE`` will be passed as the ``flags`` argument to ``->iomap_begin``. Callers typically hold ``i_rwsem`` and ``invalidate_lock`` in exclusive mode before calling this function.h](hFilesystems can call }(hjhhhNhNubj-)}(h``iomap_file_unshare``h]hiomap_file_unshare}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubhs to force a file sharing storage with another file to preemptively copy the shared data to newly allocate storage. }(hjhhhNhNubj-)}(h``IOMAP_WRITE | IOMAP_UNSHARE``h]hIOMAP_WRITE | IOMAP_UNSHARE}(hj+hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh will be passed as the }(hjhhhNhNubj-)}(h ``flags``h]hflags}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh argument to }(hjhhhNhNubj-)}(h``->iomap_begin``h]h ->iomap_begin}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh. Callers typically hold }(hjhhhNhNubj-)}(h ``i_rwsem``h]hi_rwsem}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh and }(hjhhhNhNubj-)}(h``invalidate_lock``h]hinvalidate_lock}(hjshhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh0 in exclusive mode before calling this function.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhKhjhhubeh}(h]j[ah ]h"]unsharing reflinked file dataah$]h&]uh1hhj[ hhhhhKubeh}(h]jah ]h"]buffered writesah$]h&]uh1hhjhhhhhKubh)}(hhh](h)}(h Truncationh]h Truncation}(hjhhhNhNubah}(h]h ]h"]h$]h&]jjuh1hhjhhhhhKubj)}(hXFilesystems can call ``iomap_truncate_page`` to zero the bytes in the pagecache from EOF to the end of the fsblock during a file truncation operation. ``truncate_setsize`` or ``truncate_pagecache`` will take care of everything after the EOF block. ``IOMAP_ZERO`` will be passed as the ``flags`` argument to ``->iomap_begin``. Callers typically hold ``i_rwsem`` and ``invalidate_lock`` in exclusive mode before calling this function.h](hFilesystems can call }(hjhhhNhNubj-)}(h``iomap_truncate_page``h]hiomap_truncate_page}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubhk to zero the bytes in the pagecache from EOF to the end of the fsblock during a file truncation operation. }(hjhhhNhNubj-)}(h``truncate_setsize``h]htruncate_setsize}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh or }(hjhhhNhNubj-)}(h``truncate_pagecache``h]htruncate_pagecache}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh3 will take care of everything after the EOF block. }(hjhhhNhNubj-)}(h``IOMAP_ZERO``h]h IOMAP_ZERO}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh will be passed as the }(hjhhhNhNubj-)}(h ``flags``h]hflags}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh argument to }(hjhhhNhNubj-)}(h``->iomap_begin``h]h ->iomap_begin}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh. Callers typically hold }(hjhhhNhNubj-)}(h ``i_rwsem``h]hi_rwsem}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh and }(hjhhhNhNubj-)}(h``invalidate_lock``h]hinvalidate_lock}(hj0hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh0 in exclusive mode before calling this function.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhKhjhhubeh}(h]jah ]h"] truncationah$]h&]uh1hhjhhhhhKubh)}(hhh](h)}(hPagecache Writebackh]hPagecache Writeback}(hjRhhhNhNubah}(h]h ]h"]h$]h&]jjuh1hhjOhhhhhMubj)}(hXFilesystems can call ``iomap_writepages`` to respond to a request to write dirty pagecache folios to disk. The ``mapping`` and ``wbc`` parameters should be passed unchanged. The ``wpc`` pointer should be allocated by the filesystem and must be initialized to zero.h](hFilesystems can call }(hj`hhhNhNubj-)}(h``iomap_writepages``h]hiomap_writepages}(hjhhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj`ubhF to respond to a request to write dirty pagecache folios to disk. The }(hj`hhhNhNubj-)}(h ``mapping``h]hmapping}(hjzhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj`ubh and }(hj`hhhNhNubj-)}(h``wbc``h]hwbc}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj`ubh, parameters should be passed unchanged. The }(hj`hhhNhNubj-)}(h``wpc``h]hwpc}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj`ubhO pointer should be allocated by the filesystem and must be initialized to zero.}(hj`hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhjOhhubj)}(hThe pagecache will lock each folio before trying to schedule it for writeback. It does not lock ``i_rwsem`` or ``invalidate_lock``.h](h`The pagecache will lock each folio before trying to schedule it for writeback. It does not lock }(hjhhhNhNubj-)}(h ``i_rwsem``h]hi_rwsem}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh or }(hjhhhNhNubj-)}(h``invalidate_lock``h]hinvalidate_lock}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhM hjOhhubj)}(hXThe dirty bit will be cleared for all folios run through the ``->map_blocks`` machinery described below even if the writeback fails. This is to prevent dirty folio clots when storage devices fail; an ``-EIO`` is recorded for userspace to collect via ``fsync``.h](h=The dirty bit will be cleared for all folios run through the }(hjhhhNhNubj-)}(h``->map_blocks``h]h ->map_blocks}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh{ machinery described below even if the writeback fails. This is to prevent dirty folio clots when storage devices fail; an }(hjhhhNhNubj-)}(h``-EIO``h]h-EIO}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh* is recorded for userspace to collect via }(hjhhhNhNubj-)}(h ``fsync``h]hfsync}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhjOhhubj)}(h:The ``ops`` structure must be specified and is as follows:h](hThe }(hj,hhhNhNubj-)}(h``ops``h]hops}(hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj,ubh/ structure must be specified and is as follows:}(hj,hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhjOhhubh)}(hhh](h)}(hjh]j-)}(hjh]hstruct iomap_writeback_ops}(hjRhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjOubah}(h]h ]h"]h$]h&]jjuh1hhjLhhhhhMubj)}(hX!struct iomap_writeback_ops { int (*map_blocks)(struct iomap_writepage_ctx *wpc, struct inode *inode, loff_t offset, unsigned len); int (*submit_ioend)(struct iomap_writepage_ctx *wpc, int status); void (*discard_folio)(struct folio *folio, loff_t pos); };h]hX!struct iomap_writeback_ops { int (*map_blocks)(struct iomap_writepage_ctx *wpc, struct inode *inode, loff_t offset, unsigned len); int (*submit_ioend)(struct iomap_writepage_ctx *wpc, int status); void (*discard_folio)(struct folio *folio, loff_t pos); };}hjesbah}(h]h ]h"]h$]h&]hhjjjj}uh1jhhhMhjLhhubj)}(hThe fields are as follows:h]hThe fields are as follows:}(hjthhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhM$hjLhhubj<)}(hX- ``map_blocks``: Sets ``wpc->iomap`` to the space mapping of the file range (in bytes) given by ``offset`` and ``len``. iomap calls this function for each dirty fs block in each dirty folio, though it will `reuse mappings `_ for runs of contiguous dirty fsblocks within a folio. Do not return ``IOMAP_INLINE`` mappings here; the ``->iomap_end`` function must deal with persisting written data. Do not return ``IOMAP_DELALLOC`` mappings here; iomap currently requires mapping to allocated space. Filesystems can skip a potentially expensive mapping lookup if the mappings have not changed. This revalidation must be open-coded by the filesystem; it is unclear if ``iomap::validity_cookie`` can be reused for this purpose. This function must be supplied by the filesystem. - ``submit_ioend``: Allows the file systems to hook into writeback bio submission. This might include pre-write space accounting updates, or installing a custom ``->bi_end_io`` function for internal purposes, such as deferring the ioend completion to a workqueue to run metadata update transactions from process context before submitting the bio. This function is optional. - ``discard_folio``: iomap calls this function after ``->map_blocks`` fails to schedule I/O for any part of a dirty folio. The function should throw away any reservations that may have been made for the write. The folio will be marked clean and an ``-EIO`` recorded in the pagecache. Filesystems can use this callback to `remove `_ delalloc reservations to avoid having delalloc reservations for clean pagecache. This function is optional. h]h)}(hhh](h)}(hXD``map_blocks``: Sets ``wpc->iomap`` to the space mapping of the file range (in bytes) given by ``offset`` and ``len``. iomap calls this function for each dirty fs block in each dirty folio, though it will `reuse mappings `_ for runs of contiguous dirty fsblocks within a folio. Do not return ``IOMAP_INLINE`` mappings here; the ``->iomap_end`` function must deal with persisting written data. Do not return ``IOMAP_DELALLOC`` mappings here; iomap currently requires mapping to allocated space. Filesystems can skip a potentially expensive mapping lookup if the mappings have not changed. This revalidation must be open-coded by the filesystem; it is unclear if ``iomap::validity_cookie`` can be reused for this purpose. This function must be supplied by the filesystem. h]j)}(hXC``map_blocks``: Sets ``wpc->iomap`` to the space mapping of the file range (in bytes) given by ``offset`` and ``len``. iomap calls this function for each dirty fs block in each dirty folio, though it will `reuse mappings `_ for runs of contiguous dirty fsblocks within a folio. Do not return ``IOMAP_INLINE`` mappings here; the ``->iomap_end`` function must deal with persisting written data. Do not return ``IOMAP_DELALLOC`` mappings here; iomap currently requires mapping to allocated space. Filesystems can skip a potentially expensive mapping lookup if the mappings have not changed. This revalidation must be open-coded by the filesystem; it is unclear if ``iomap::validity_cookie`` can be reused for this purpose. This function must be supplied by the filesystem.lh](j-)}(h``map_blocks``h]h map_blocks}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh: Sets }(hjhhhNhNubj-)}(h``wpc->iomap``h]h wpc->iomap}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh< to the space mapping of the file range (in bytes) given by }(hjhhhNhNubj-)}(h ``offset``h]hoffset}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh and }(hjhhhNhNubj-)}(h``len``h]hlen}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubhX. iomap calls this function for each dirty fs block in each dirty folio, though it will }(hjhhhNhNubj )}(hT`reuse mappings `_h]hreuse mappings}(hjhhhNhNubah}(h]h ]h"]h$]h&]namereuse mappingsjM@https://lore.kernel.org/all/20231207072710.176093-15-hch@lst.de/uh1jhjubh)}(hC h]h}(h]reuse-mappingsah ]h"]reuse mappingsah$]h&]refurijuh1hj\KhjubhE for runs of contiguous dirty fsblocks within a folio. Do not return }(hjhhhNhNubj-)}(h``IOMAP_INLINE``h]h IOMAP_INLINE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh mappings here; the }(hjhhhNhNubj-)}(h``->iomap_end``h]h ->iomap_end}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh@ function must deal with persisting written data. Do not return }(hjhhhNhNubj-)}(h``IOMAP_DELALLOC``h]hIOMAP_DELALLOC}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh mappings here; iomap currently requires mapping to allocated space. Filesystems can skip a potentially expensive mapping lookup if the mappings have not changed. This revalidation must be open-coded by the filesystem; it is unclear if }(hjhhhNhNubj-)}(h``iomap::validity_cookie``h]hiomap::validity_cookie}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubhR can be reused for this purpose. This function must be supplied by the filesystem.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhM&hjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hXt``submit_ioend``: Allows the file systems to hook into writeback bio submission. This might include pre-write space accounting updates, or installing a custom ``->bi_end_io`` function for internal purposes, such as deferring the ioend completion to a workqueue to run metadata update transactions from process context before submitting the bio. This function is optional. h]j)}(hXs``submit_ioend``: Allows the file systems to hook into writeback bio submission. This might include pre-write space accounting updates, or installing a custom ``->bi_end_io`` function for internal purposes, such as deferring the ioend completion to a workqueue to run metadata update transactions from process context before submitting the bio. This function is optional.h](j-)}(h``submit_ioend``h]h submit_ioend}(hjWhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjSubh: Allows the file systems to hook into writeback bio submission. This might include pre-write space accounting updates, or installing a custom }(hjShhhNhNubj-)}(h``->bi_end_io``h]h ->bi_end_io}(hjihhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjSubh function for internal purposes, such as deferring the ioend completion to a workqueue to run metadata update transactions from process context before submitting the bio. This function is optional.}(hjShhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhM7hjOubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hX``discard_folio``: iomap calls this function after ``->map_blocks`` fails to schedule I/O for any part of a dirty folio. The function should throw away any reservations that may have been made for the write. The folio will be marked clean and an ``-EIO`` recorded in the pagecache. Filesystems can use this callback to `remove `_ delalloc reservations to avoid having delalloc reservations for clean pagecache. This function is optional. h]j)}(hX``discard_folio``: iomap calls this function after ``->map_blocks`` fails to schedule I/O for any part of a dirty folio. The function should throw away any reservations that may have been made for the write. The folio will be marked clean and an ``-EIO`` recorded in the pagecache. Filesystems can use this callback to `remove `_ delalloc reservations to avoid having delalloc reservations for clean pagecache. This function is optional.h](j-)}(h``discard_folio``h]h discard_folio}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh": iomap calls this function after }(hjhhhNhNubj-)}(h``->map_blocks``h]h ->map_blocks}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh fails to schedule I/O for any part of a dirty folio. The function should throw away any reservations that may have been made for the write. The folio will be marked clean and an }(hjhhhNhNubj-)}(h``-EIO``h]h-EIO}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubhA recorded in the pagecache. Filesystems can use this callback to }(hjhhhNhNubj )}(hT`remove `_h]hremove}(hjhhhNhNubah}(h]h ]h"]h$]h&]nameremovejMHhttps://lore.kernel.org/all/20201029163313.1766967-1-bfoster@redhat.com/uh1jhjubh)}(hK h]h}(h]removeah ]h"]removeah$]h&]refurijuh1hj\Khjubhl delalloc reservations to avoid having delalloc reservations for clean pagecache. This function is optional.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhM?hjubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]jj9 uh1hhhhM&hjubah}(h]h ]h"]h$]h&]uh1j;hhhM&hjLhhubeh}(h]jah ]h"]struct iomap_writeback_opsah$]h&]uh1hhjOhhhhhMubh)}(hhh](h)}(hPagecache Writeback Completionh]hPagecache Writeback Completion}(hj hhhNhNubah}(h]h ]h"]h$]h&]jjuh1hhjhhhhhMLubj)}(hXTo handle the bookkeeping that must happen after disk I/O for writeback completes, iomap creates chains of ``struct iomap_ioend`` objects that wrap the ``bio`` that is used to write pagecache data to disk. By default, iomap finishes writeback ioends by clearing the writeback bit on the folios attached to the ``ioend``. If the write failed, it will also set the error bits on the folios and the address space. This can happen in interrupt or process context, depending on the storage device.h](hkTo handle the bookkeeping that must happen after disk I/O for writeback completes, iomap creates chains of }(hjhhhNhNubj-)}(h``struct iomap_ioend``h]hstruct iomap_ioend}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh objects that wrap the }(hjhhhNhNubj-)}(h``bio``h]hbio}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh that is used to write pagecache data to disk. By default, iomap finishes writeback ioends by clearing the writeback bit on the folios attached to the }(hjhhhNhNubj-)}(h ``ioend``h]hioend}(hjChhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh. If the write failed, it will also set the error bits on the folios and the address space. This can happen in interrupt or process context, depending on the storage device.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMNhjhhubj)}(hX9Filesystems that need to update internal bookkeeping (e.g. unwritten extent conversions) should provide a ``->submit_ioend`` function to set ``struct iomap_end::bio::bi_end_io`` to its own function. This function should call ``iomap_finish_ioends`` after finishing its own work (e.g. unwritten extent conversion).h](hjFilesystems that need to update internal bookkeeping (e.g. unwritten extent conversions) should provide a }(hj[hhhNhNubj-)}(h``->submit_ioend``h]h->submit_ioend}(hjchhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj[ubh function to set }(hj[hhhNhNubj-)}(h$``struct iomap_end::bio::bi_end_io``h]h struct iomap_end::bio::bi_end_io}(hjuhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj[ubh0 to its own function. This function should call }(hj[hhhNhNubj-)}(h``iomap_finish_ioends``h]hiomap_finish_ioends}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj[ubhA after finishing its own work (e.g. unwritten extent conversion).}(hj[hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMXhjhhubj)}(hXqSome filesystems may wish to `amortize the cost of running metadata transactions `_ for post-writeback updates by batching them. They may also require transactions to run from process context, which implies punting batches to a workqueue. iomap ioends contain a ``list_head`` to enable batching.h](hSome filesystems may wish to }(hjhhhNhNubj )}(h`amortize the cost of running metadata transactions `_h]h2amortize the cost of running metadata transactions}(hjhhhNhNubah}(h]h ]h"]h$]h&]name2amortize the cost of running metadata transactionsjMHhttps://lore.kernel.org/all/20220120034733.221737-1-david@fromorbit.com/uh1jhjubh)}(hK h]h}(h]2amortize-the-cost-of-running-metadata-transactionsah ]h"]2amortize the cost of running metadata transactionsah$]h&]refurijuh1hj\Khjubh for post-writeback updates by batching them. They may also require transactions to run from process context, which implies punting batches to a workqueue. iomap ioends contain a }(hjhhhNhNubj-)}(h ``list_head``h]h list_head}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh to enable batching.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhM^hjhhubj)}(hMGiven a batch of ioends, iomap has a few helpers to assist with amortization:h]hMGiven a batch of ioends, iomap has a few helpers to assist with amortization:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhMfhjhhubj<)}(hX9* ``iomap_sort_ioends``: Sort all the ioends in the list by file offset. * ``iomap_ioend_try_merge``: Given an ioend that is not in any list and a separate list of sorted ioends, merge as many of the ioends from the head of the list into the given ioend. ioends can only be merged if the file range and storage addresses are contiguous; the unwritten and shared status are the same; and the write I/O outcome is the same. The merged ioends become their own list. * ``iomap_finish_ioends``: Finish an ioend that possibly has other ioends linked to it. h]h)}(hhh](h)}(hG``iomap_sort_ioends``: Sort all the ioends in the list by file offset. h]j)}(hF``iomap_sort_ioends``: Sort all the ioends in the list by file offset.h](j-)}(h``iomap_sort_ioends``h]hiomap_sort_ioends}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh1: Sort all the ioends in the list by file offset.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMihjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hX``iomap_ioend_try_merge``: Given an ioend that is not in any list and a separate list of sorted ioends, merge as many of the ioends from the head of the list into the given ioend. ioends can only be merged if the file range and storage addresses are contiguous; the unwritten and shared status are the same; and the write I/O outcome is the same. The merged ioends become their own list. h]j)}(hX``iomap_ioend_try_merge``: Given an ioend that is not in any list and a separate list of sorted ioends, merge as many of the ioends from the head of the list into the given ioend. ioends can only be merged if the file range and storage addresses are contiguous; the unwritten and shared status are the same; and the write I/O outcome is the same. The merged ioends become their own list.h](j-)}(h``iomap_ioend_try_merge``h]hiomap_ioend_try_merge}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubhXj: Given an ioend that is not in any list and a separate list of sorted ioends, merge as many of the ioends from the head of the list into the given ioend. ioends can only be merged if the file range and storage addresses are contiguous; the unwritten and shared status are the same; and the write I/O outcome is the same. The merged ioends become their own list.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMlhjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hV``iomap_finish_ioends``: Finish an ioend that possibly has other ioends linked to it. h]j)}(hU``iomap_finish_ioends``: Finish an ioend that possibly has other ioends linked to it.h](j-)}(h``iomap_finish_ioends``h]hiomap_finish_ioends}(hjJhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjFubh>: Finish an ioend that possibly has other ioends linked to it.}(hjFhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMthjBubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]jjuh1hhhhMihjubah}(h]h ]h"]h$]h&]uh1j;hhhMihjhhubeh}(h]jah ]h"]pagecache writeback completionah$]h&]uh1hhjOhhhhhMLubeh}(h]jah ]h"]pagecache writebackah$]h&]uh1hhjhhhhhMubeh}(h]jah ]h"] buffered i/oah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h Direct I/Oh]h Direct I/O}(hjhhhNhNubah}(h]h ]h"]h$]h&]jj*uh1hhjhhhhhMxubj)}(hIn Linux, direct I/O is defined as file I/O that is issued directly to storage, bypassing the pagecache. The ``iomap_dio_rw`` function implements O_DIRECT (direct I/O) reads and writes for files.h](hmIn Linux, direct I/O is defined as file I/O that is issued directly to storage, bypassing the pagecache. The }(hjhhhNhNubj-)}(h``iomap_dio_rw``h]h iomap_dio_rw}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubhF function implements O_DIRECT (direct I/O) reads and writes for files.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMzhjhhubj)}(hXssize_t iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, const struct iomap_ops *ops, const struct iomap_dio_ops *dops, unsigned int dio_flags, void *private, size_t done_before);h]hXssize_t iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, const struct iomap_ops *ops, const struct iomap_dio_ops *dops, unsigned int dio_flags, void *private, size_t done_before);}hjsbah}(h]h ]h"]h$]h&]hhjjjj}uh1jhhhMhjhhubj)}(hXThe filesystem can provide the ``dops`` parameter if it needs to perform extra work before or after the I/O is issued to storage. The ``done_before`` parameter tells the how much of the request has already been transferred. It is used to continue a request asynchronously when `part of the request `_ has already been completed synchronously.h](hThe filesystem can provide the }(hjhhhNhNubj-)}(h``dops``h]hdops}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh_ parameter if it needs to perform extra work before or after the I/O is issued to storage. The }(hjhhhNhNubj-)}(h``done_before``h]h done_before}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh parameter tells the how much of the request has already been transferred. It is used to continue a request asynchronously when }(hjhhhNhNubj )}(h`part of the request `_h]hpart of the request}(hjhhhNhNubah}(h]h ]h"]h$]h&]namepart of the requestjMvhttps://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c03098d4b9ad76bca2966a8769dcfe59f7f85103uh1jhjubh)}(hy h]h}(h]part-of-the-requestah ]h"]part of the requestah$]h&]refurijuh1hj\Khjubh* has already been completed synchronously.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhjhhubj)}(hThe ``done_before`` parameter should be set if writes for the ``iocb`` have been initiated prior to the call. The direction of the I/O is determined from the ``iocb`` passed in.h](hThe }(hjhhhNhNubj-)}(h``done_before``h]h done_before}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh+ parameter should be set if writes for the }(hjhhhNhNubj-)}(h``iocb``h]hiocb}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubhX have been initiated prior to the call. The direction of the I/O is determined from the }(hjhhhNhNubj-)}(h``iocb``h]hiocb}(hjIhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh passed in.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhjhhubj)}(hQThe ``dio_flags`` argument can be set to any combination of the following values:h](hThe }(hjahhhNhNubj-)}(h ``dio_flags``h]h dio_flags}(hjihhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjaubh@ argument can be set to any combination of the following values:}(hjahhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhjhhubj<)}(hXo* ``IOMAP_DIO_FORCE_WAIT``: Wait for the I/O to complete even if the kiocb is not synchronous. * ``IOMAP_DIO_OVERWRITE_ONLY``: Perform a pure overwrite for this range or fail with ``-EAGAIN``. This can be used by filesystems with complex unaligned I/O write paths to provide an optimised fast path for unaligned writes. If a pure overwrite can be performed, then serialisation against other I/Os to the same filesystem block(s) is unnecessary as there is no risk of stale data exposure or data loss. If a pure overwrite cannot be performed, then the filesystem can perform the serialisation steps needed to provide exclusive access to the unaligned I/O range so that it can perform allocation and sub-block zeroing safely. Filesystems can use this flag to try to reduce locking contention, but a lot of `detailed checking `_ is required to do it `correctly `_. * ``IOMAP_DIO_PARTIAL``: If a page fault occurs, return whatever progress has already been made. The caller may deal with the page fault and retry the operation. If the caller decides to retry the operation, it should pass the accumulated return values of all previous calls as the ``done_before`` parameter to the next call. h]h)}(hhh](h)}(h]``IOMAP_DIO_FORCE_WAIT``: Wait for the I/O to complete even if the kiocb is not synchronous. h]j)}(h\``IOMAP_DIO_FORCE_WAIT``: Wait for the I/O to complete even if the kiocb is not synchronous.h](j-)}(h``IOMAP_DIO_FORCE_WAIT``h]hIOMAP_DIO_FORCE_WAIT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubhD: Wait for the I/O to complete even if the kiocb is not synchronous.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hX``IOMAP_DIO_OVERWRITE_ONLY``: Perform a pure overwrite for this range or fail with ``-EAGAIN``. This can be used by filesystems with complex unaligned I/O write paths to provide an optimised fast path for unaligned writes. If a pure overwrite can be performed, then serialisation against other I/Os to the same filesystem block(s) is unnecessary as there is no risk of stale data exposure or data loss. If a pure overwrite cannot be performed, then the filesystem can perform the serialisation steps needed to provide exclusive access to the unaligned I/O range so that it can perform allocation and sub-block zeroing safely. Filesystems can use this flag to try to reduce locking contention, but a lot of `detailed checking `_ is required to do it `correctly `_. h]j)}(hX``IOMAP_DIO_OVERWRITE_ONLY``: Perform a pure overwrite for this range or fail with ``-EAGAIN``. This can be used by filesystems with complex unaligned I/O write paths to provide an optimised fast path for unaligned writes. If a pure overwrite can be performed, then serialisation against other I/Os to the same filesystem block(s) is unnecessary as there is no risk of stale data exposure or data loss. If a pure overwrite cannot be performed, then the filesystem can perform the serialisation steps needed to provide exclusive access to the unaligned I/O range so that it can perform allocation and sub-block zeroing safely. Filesystems can use this flag to try to reduce locking contention, but a lot of `detailed checking `_ is required to do it `correctly `_.h](j-)}(h``IOMAP_DIO_OVERWRITE_ONLY``h]hIOMAP_DIO_OVERWRITE_ONLY}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh7: Perform a pure overwrite for this range or fail with }(hjhhhNhNubj-)}(h ``-EAGAIN``h]h-EAGAIN}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubhXd. This can be used by filesystems with complex unaligned I/O write paths to provide an optimised fast path for unaligned writes. If a pure overwrite can be performed, then serialisation against other I/Os to the same filesystem block(s) is unnecessary as there is no risk of stale data exposure or data loss. If a pure overwrite cannot be performed, then the filesystem can perform the serialisation steps needed to provide exclusive access to the unaligned I/O range so that it can perform allocation and sub-block zeroing safely. Filesystems can use this flag to try to reduce locking contention, but a lot of }(hjhhhNhNubj )}(he`detailed checking `_h]hdetailed checking}(hjhhhNhNubah}(h]h ]h"]h$]h&]namedetailed checkingjMNhttps://lore.kernel.org/linux-ext4/20230314130759.642710-1-bfoster@redhat.com/uh1jhjubh)}(hQ h]h}(h]detailed-checkingah ]h"]detailed checkingah$]h&]refurijuh1hj\Khjubh is required to do it }(hjhhhNhNubj )}(h]`correctly `_h]h correctly}(hjhhhNhNubah}(h]h ]h"]h$]h&]name correctlyjMNhttps://lore.kernel.org/linux-ext4/20230810165559.946222-1-bfoster@redhat.com/uh1jhjubh)}(hQ h]h}(h] correctlyah ]h"] correctlyah$]h&]refurij uh1hj\Khjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hXD``IOMAP_DIO_PARTIAL``: If a page fault occurs, return whatever progress has already been made. The caller may deal with the page fault and retry the operation. If the caller decides to retry the operation, it should pass the accumulated return values of all previous calls as the ``done_before`` parameter to the next call. h]j)}(hXC``IOMAP_DIO_PARTIAL``: If a page fault occurs, return whatever progress has already been made. The caller may deal with the page fault and retry the operation. If the caller decides to retry the operation, it should pass the accumulated return values of all previous calls as the ``done_before`` parameter to the next call.h](j-)}(h``IOMAP_DIO_PARTIAL``h]hIOMAP_DIO_PARTIAL}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj.ubhX: If a page fault occurs, return whatever progress has already been made. The caller may deal with the page fault and retry the operation. If the caller decides to retry the operation, it should pass the accumulated return values of all previous calls as the }(hj.hhhNhNubj-)}(h``done_before``h]h done_before}(hjDhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj.ubh parameter to the next call.}(hj.hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhj*ubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]jjuh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1j;hhhMhjhhubj)}(hGThese ``struct kiocb`` flags are significant for direct I/O with iomap:h](hThese }(hjnhhhNhNubj-)}(h``struct kiocb``h]h struct kiocb}(hjvhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjnubh1 flags are significant for direct I/O with iomap:}(hjnhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhjhhubj<)}(hX * ``IOCB_NOWAIT``: Turns on ``IOMAP_NOWAIT``. * ``IOCB_SYNC``: Ensure that the device has persisted data to disk before completing the call. In the case of pure overwrites, the I/O may be issued with FUA enabled. * ``IOCB_HIPRI``: Poll for I/O completion instead of waiting for an interrupt. Only meaningful for asynchronous I/O, and only if the entire I/O can be issued as a single ``struct bio``. * ``IOCB_DIO_CALLER_COMP``: Try to run I/O completion from the caller's process context. See ``linux/fs.h`` for more details. h]h)}(hhh](h)}(h,``IOCB_NOWAIT``: Turns on ``IOMAP_NOWAIT``. h]j)}(h+``IOCB_NOWAIT``: Turns on ``IOMAP_NOWAIT``.h](j-)}(h``IOCB_NOWAIT``h]h IOCB_NOWAIT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh : Turns on }(hjhhhNhNubj-)}(h``IOMAP_NOWAIT``h]h IOMAP_NOWAIT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(h``IOCB_SYNC``: Ensure that the device has persisted data to disk before completing the call. In the case of pure overwrites, the I/O may be issued with FUA enabled. h]j)}(h``IOCB_SYNC``: Ensure that the device has persisted data to disk before completing the call. In the case of pure overwrites, the I/O may be issued with FUA enabled.h](j-)}(h ``IOCB_SYNC``h]h IOCB_SYNC}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh: Ensure that the device has persisted data to disk before completing the call. In the case of pure overwrites, the I/O may be issued with FUA enabled.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(h``IOCB_HIPRI``: Poll for I/O completion instead of waiting for an interrupt. Only meaningful for asynchronous I/O, and only if the entire I/O can be issued as a single ``struct bio``. h]j)}(h``IOCB_HIPRI``: Poll for I/O completion instead of waiting for an interrupt. Only meaningful for asynchronous I/O, and only if the entire I/O can be issued as a single ``struct bio``.h](j-)}(h``IOCB_HIPRI``h]h IOCB_HIPRI}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh: Poll for I/O completion instead of waiting for an interrupt. Only meaningful for asynchronous I/O, and only if the entire I/O can be issued as a single }(hjhhhNhNubj-)}(h``struct bio``h]h struct bio}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(h|``IOCB_DIO_CALLER_COMP``: Try to run I/O completion from the caller's process context. See ``linux/fs.h`` for more details. h]j)}(h{``IOCB_DIO_CALLER_COMP``: Try to run I/O completion from the caller's process context. See ``linux/fs.h`` for more details.h](j-)}(h``IOCB_DIO_CALLER_COMP``h]hIOCB_DIO_CALLER_COMP}(hj3hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj/ubhE: Try to run I/O completion from the caller’s process context. See }(hj/hhhNhNubj-)}(h``linux/fs.h``h]h linux/fs.h}(hjEhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj/ubh for more details.}(hj/hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhj+ubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]jjuh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1j;hhhMhjhhubj)}(hFilesystems should call ``iomap_dio_rw`` from ``->read_iter`` and ``->write_iter``, and set ``FMODE_CAN_ODIRECT`` in the ``->open`` function for the file. They should not set ``->direct_IO``, which is deprecated.h](hFilesystems should call }(hjohhhNhNubj-)}(h``iomap_dio_rw``h]h iomap_dio_rw}(hjwhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjoubh from }(hjohhhNhNubj-)}(h``->read_iter``h]h ->read_iter}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjoubh and }(hjohhhNhNubj-)}(h``->write_iter``h]h ->write_iter}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjoubh , and set }(hjohhhNhNubj-)}(h``FMODE_CAN_ODIRECT``h]hFMODE_CAN_ODIRECT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjoubh in the }(hjohhhNhNubj-)}(h ``->open``h]h->open}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjoubh, function for the file. They should not set }(hjohhhNhNubj-)}(h``->direct_IO``h]h ->direct_IO}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjoubh, which is deprecated.}(hjohhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhjhhubj)}(hXIf a filesystem wishes to perform its own work before direct I/O completion, it should call ``__iomap_dio_rw``. If its return value is not an error pointer or a NULL pointer, the filesystem should pass the return value to ``iomap_dio_complete`` after finishing its internal work.h](h\If a filesystem wishes to perform its own work before direct I/O completion, it should call }(hjhhhNhNubj-)}(h``__iomap_dio_rw``h]h__iomap_dio_rw}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubhp. If its return value is not an error pointer or a NULL pointer, the filesystem should pass the return value to }(hjhhhNhNubj-)}(h``iomap_dio_complete``h]hiomap_dio_complete}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh# after finishing its internal work.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhjhhubh)}(hhh](h)}(h Return Valuesh]h Return Values}(hjhhhNhNubah}(h]h ]h"]h$]h&]jjIuh1hhjhhhhhMubj)}(h1``iomap_dio_rw`` can return one of the following:h](j-)}(h``iomap_dio_rw``h]h iomap_dio_rw}(hj0hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj,ubh! can return one of the following:}(hj,hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhjhhubj<)}(hX* A non-negative number of bytes transferred. * ``-ENOTBLK``: Fall back to buffered I/O. iomap itself will return this value if it cannot invalidate the page cache before issuing the I/O to storage. The ``->iomap_begin`` or ``->iomap_end`` functions may also return this value. * ``-EIOCBQUEUED``: The asynchronous direct I/O request has been queued and will be completed separately. * Any of the other negative error codes. h]h)}(hhh](h)}(h,A non-negative number of bytes transferred. h]j)}(h+A non-negative number of bytes transferred.h]h+A non-negative number of bytes transferred.}(hjShhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhMhjOubah}(h]h ]h"]h$]h&]uh1hhjLubh)}(h``-ENOTBLK``: Fall back to buffered I/O. iomap itself will return this value if it cannot invalidate the page cache before issuing the I/O to storage. The ``->iomap_begin`` or ``->iomap_end`` functions may also return this value. h]j)}(h``-ENOTBLK``: Fall back to buffered I/O. iomap itself will return this value if it cannot invalidate the page cache before issuing the I/O to storage. The ``->iomap_begin`` or ``->iomap_end`` functions may also return this value.h](j-)}(h ``-ENOTBLK``h]h-ENOTBLK}(hjohhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjkubh: Fall back to buffered I/O. iomap itself will return this value if it cannot invalidate the page cache before issuing the I/O to storage. The }(hjkhhhNhNubj-)}(h``->iomap_begin``h]h ->iomap_begin}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjkubh or }(hjkhhhNhNubj-)}(h``->iomap_end``h]h ->iomap_end}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjkubh& functions may also return this value.}(hjkhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhjgubah}(h]h ]h"]h$]h&]uh1hhjLubh)}(hh``-EIOCBQUEUED``: The asynchronous direct I/O request has been queued and will be completed separately. h]j)}(hg``-EIOCBQUEUED``: The asynchronous direct I/O request has been queued and will be completed separately.h](j-)}(h``-EIOCBQUEUED``h]h -EIOCBQUEUED}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubhW: The asynchronous direct I/O request has been queued and will be completed separately.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1hhjLubh)}(h'Any of the other negative error codes. h]j)}(h&Any of the other negative error codes.h]h&Any of the other negative error codes.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1hhjLubeh}(h]h ]h"]h$]h&]jjuh1hhhhMhjHubah}(h]h ]h"]h$]h&]uh1j;hhhMhjhhubeh}(h]jOah ]h"] return valuesah$]h&]uh1hhjhhhhhMubh)}(hhh](h)}(h Direct Readsh]h Direct Reads}(hjhhhNhNubah}(h]h ]h"]h$]h&]jjkuh1hhjhhhhhMubj)}(hX A direct I/O read initiates a read I/O from the storage device to the caller's buffer. Dirty parts of the pagecache are flushed to storage before initiating the read io. The ``flags`` value for ``->iomap_begin`` will be ``IOMAP_DIRECT`` with any combination of the following enhancements:h](hA direct I/O read initiates a read I/O from the storage device to the caller’s buffer. Dirty parts of the pagecache are flushed to storage before initiating the read io. The }(hjhhhNhNubj-)}(h ``flags``h]hflags}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh value for }(hjhhhNhNubj-)}(h``->iomap_begin``h]h ->iomap_begin}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh will be }(hjhhhNhNubj-)}(h``IOMAP_DIRECT``h]h IOMAP_DIRECT}(hj?hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh4 with any combination of the following enhancements:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhjhhubj<)}(h+* ``IOMAP_NOWAIT``, as defined previously. h]h)}(hhh]h)}(h)``IOMAP_NOWAIT``, as defined previously. h]j)}(h(``IOMAP_NOWAIT``, as defined previously.h](j-)}(h``IOMAP_NOWAIT``h]h IOMAP_NOWAIT}(hjfhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjbubh, as defined previously.}(hjbhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhj^ubah}(h]h ]h"]h$]h&]uh1hhj[ubah}(h]h ]h"]h$]h&]jjuh1hhhhMhjWubah}(h]h ]h"]h$]h&]uh1j;hhhMhjhhubj)}(hNCallers commonly hold ``i_rwsem`` in shared mode before calling this function.h](hCallers commonly hold }(hjhhhNhNubj-)}(h ``i_rwsem``h]hi_rwsem}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh- in shared mode before calling this function.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhjhhubeh}(h]jqah ]h"] direct readsah$]h&]uh1hhjhhhhhMubh)}(hhh](h)}(h Direct Writesh]h Direct Writes}(hjhhhNhNubah}(h]h ]h"]h$]h&]jjuh1hhjhhhhhMubj)}(hXrA direct I/O write initiates a write I/O to the storage device from the caller's buffer. Dirty parts of the pagecache are flushed to storage before initiating the write io. The pagecache is invalidated both before and after the write io. The ``flags`` value for ``->iomap_begin`` will be ``IOMAP_DIRECT | IOMAP_WRITE`` with any combination of the following enhancements:h](hA direct I/O write initiates a write I/O to the storage device from the caller’s buffer. Dirty parts of the pagecache are flushed to storage before initiating the write io. The pagecache is invalidated both before and after the write io. The }(hjhhhNhNubj-)}(h ``flags``h]hflags}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh value for }(hjhhhNhNubj-)}(h``->iomap_begin``h]h ->iomap_begin}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh will be }(hjhhhNhNubj-)}(h``IOMAP_DIRECT | IOMAP_WRITE``h]hIOMAP_DIRECT | IOMAP_WRITE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh4 with any combination of the following enhancements:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhjhhubj<)}(hX|* ``IOMAP_NOWAIT``, as defined previously. * ``IOMAP_OVERWRITE_ONLY``: Allocating blocks and zeroing partial blocks is not allowed. The entire file range must map to a single written or unwritten extent. The file I/O range must be aligned to the filesystem block size if the mapping is unwritten and the filesystem cannot handle zeroing the unaligned regions without exposing stale contents. * ``IOMAP_ATOMIC``: This write is being issued with torn-write protection. Torn-write protection may be provided based on HW-offload or by a software mechanism provided by the filesystem. For HW-offload based support, only a single bio can be created for the write, and the write must not be split into multiple I/O requests, i.e. flag REQ_ATOMIC must be set. The file range to write must be aligned to satisfy the requirements of both the filesystem and the underlying block device's atomic commit capabilities. If filesystem metadata updates are required (e.g. unwritten extent conversion or copy-on-write), all updates for the entire file range must be committed atomically as well. Untorn-writes may be longer than a single file block. In all cases, the mapping start disk block must have at least the same alignment as the write offset. The filesystems must set IOMAP_F_ATOMIC_BIO to inform iomap core of an untorn-write based on HW-offload. For untorn-writes based on a software mechanism provided by the filesystem, all the disk block alignment and single bio restrictions which apply for HW-offload based untorn-writes do not apply. The mechanism would typically be used as a fallback for when HW-offload based untorn-writes may not be issued, e.g. the range of the write covers multiple extents, meaning that it is not possible to issue a single bio. All filesystem metadata updates for the entire file range must be committed atomically as well. h]h)}(hhh](h)}(h)``IOMAP_NOWAIT``, as defined previously. h]j)}(h(``IOMAP_NOWAIT``, as defined previously.h](j-)}(h``IOMAP_NOWAIT``h]h IOMAP_NOWAIT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh, as defined previously.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hX[``IOMAP_OVERWRITE_ONLY``: Allocating blocks and zeroing partial blocks is not allowed. The entire file range must map to a single written or unwritten extent. The file I/O range must be aligned to the filesystem block size if the mapping is unwritten and the filesystem cannot handle zeroing the unaligned regions without exposing stale contents. h]j)}(hXZ``IOMAP_OVERWRITE_ONLY``: Allocating blocks and zeroing partial blocks is not allowed. The entire file range must map to a single written or unwritten extent. The file I/O range must be aligned to the filesystem block size if the mapping is unwritten and the filesystem cannot handle zeroing the unaligned regions without exposing stale contents.h](j-)}(h``IOMAP_OVERWRITE_ONLY``h]hIOMAP_OVERWRITE_ONLY}(hjAhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj=ubhXB: Allocating blocks and zeroing partial blocks is not allowed. The entire file range must map to a single written or unwritten extent. The file I/O range must be aligned to the filesystem block size if the mapping is unwritten and the filesystem cannot handle zeroing the unaligned regions without exposing stale contents.}(hj=hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhj9ubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hX``IOMAP_ATOMIC``: This write is being issued with torn-write protection. Torn-write protection may be provided based on HW-offload or by a software mechanism provided by the filesystem. For HW-offload based support, only a single bio can be created for the write, and the write must not be split into multiple I/O requests, i.e. flag REQ_ATOMIC must be set. The file range to write must be aligned to satisfy the requirements of both the filesystem and the underlying block device's atomic commit capabilities. If filesystem metadata updates are required (e.g. unwritten extent conversion or copy-on-write), all updates for the entire file range must be committed atomically as well. Untorn-writes may be longer than a single file block. In all cases, the mapping start disk block must have at least the same alignment as the write offset. The filesystems must set IOMAP_F_ATOMIC_BIO to inform iomap core of an untorn-write based on HW-offload. For untorn-writes based on a software mechanism provided by the filesystem, all the disk block alignment and single bio restrictions which apply for HW-offload based untorn-writes do not apply. The mechanism would typically be used as a fallback for when HW-offload based untorn-writes may not be issued, e.g. the range of the write covers multiple extents, meaning that it is not possible to issue a single bio. All filesystem metadata updates for the entire file range must be committed atomically as well. h](j)}(h``IOMAP_ATOMIC``: This write is being issued with torn-write protection. Torn-write protection may be provided based on HW-offload or by a software mechanism provided by the filesystem.h](j-)}(h``IOMAP_ATOMIC``h]h IOMAP_ATOMIC}(hjghhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjcubh: This write is being issued with torn-write protection. Torn-write protection may be provided based on HW-offload or by a software mechanism provided by the filesystem.}(hjchhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhj_ubj)}(hXFor HW-offload based support, only a single bio can be created for the write, and the write must not be split into multiple I/O requests, i.e. flag REQ_ATOMIC must be set. The file range to write must be aligned to satisfy the requirements of both the filesystem and the underlying block device's atomic commit capabilities. If filesystem metadata updates are required (e.g. unwritten extent conversion or copy-on-write), all updates for the entire file range must be committed atomically as well. Untorn-writes may be longer than a single file block. In all cases, the mapping start disk block must have at least the same alignment as the write offset. The filesystems must set IOMAP_F_ATOMIC_BIO to inform iomap core of an untorn-write based on HW-offload.h]hXFor HW-offload based support, only a single bio can be created for the write, and the write must not be split into multiple I/O requests, i.e. flag REQ_ATOMIC must be set. The file range to write must be aligned to satisfy the requirements of both the filesystem and the underlying block device’s atomic commit capabilities. If filesystem metadata updates are required (e.g. unwritten extent conversion or copy-on-write), all updates for the entire file range must be committed atomically as well. Untorn-writes may be longer than a single file block. In all cases, the mapping start disk block must have at least the same alignment as the write offset. The filesystems must set IOMAP_F_ATOMIC_BIO to inform iomap core of an untorn-write based on HW-offload.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhM hj_ubj)}(hXFor untorn-writes based on a software mechanism provided by the filesystem, all the disk block alignment and single bio restrictions which apply for HW-offload based untorn-writes do not apply. The mechanism would typically be used as a fallback for when HW-offload based untorn-writes may not be issued, e.g. the range of the write covers multiple extents, meaning that it is not possible to issue a single bio. All filesystem metadata updates for the entire file range must be committed atomically as well.h]hXFor untorn-writes based on a software mechanism provided by the filesystem, all the disk block alignment and single bio restrictions which apply for HW-offload based untorn-writes do not apply. The mechanism would typically be used as a fallback for when HW-offload based untorn-writes may not be issued, e.g. the range of the write covers multiple extents, meaning that it is not possible to issue a single bio. All filesystem metadata updates for the entire file range must be committed atomically as well.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhMhj_ubeh}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]jjuh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1j;hhhMhjhhubj)}(h[Callers commonly hold ``i_rwsem`` in shared or exclusive mode before calling this function.h](hCallers commonly hold }(hjhhhNhNubj-)}(h ``i_rwsem``h]hi_rwsem}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh: in shared or exclusive mode before calling this function.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhM#hjhhubeh}(h]jah ]h"] direct writesah$]h&]uh1hhjhhhhhMubh)}(hhh](h)}(hjh]j-)}(hjh]hstruct iomap_dio_ops:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubah}(h]h ]h"]h$]h&]jjuh1hhjhhhhhM'ubj)}(hX struct iomap_dio_ops { void (*submit_io)(const struct iomap_iter *iter, struct bio *bio, loff_t file_offset); int (*end_io)(struct kiocb *iocb, ssize_t size, int error, unsigned flags); struct bio_set *bio_set; };h]hX struct iomap_dio_ops { void (*submit_io)(const struct iomap_iter *iter, struct bio *bio, loff_t file_offset); int (*end_io)(struct kiocb *iocb, ssize_t size, int error, unsigned flags); struct bio_set *bio_set; };}hjsbah}(h]h ]h"]h$]h&]hhjjjj}uh1jhhhM(hjhhubj)}(h,The fields of this structure are as follows:h]h,The fields of this structure are as follows:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhM2hjhhubj<)}(hX- ``submit_io``: iomap calls this function when it has constructed a ``struct bio`` object for the I/O requested, and wishes to submit it to the block device. If no function is provided, ``submit_bio`` will be called directly. Filesystems that would like to perform additional work before (e.g. data replication for btrfs) should implement this function. - ``end_io``: This is called after the ``struct bio`` completes. This function should perform post-write conversions of unwritten extent mappings, handle write failures, etc. The ``flags`` argument may be set to a combination of the following: * ``IOMAP_DIO_UNWRITTEN``: The mapping was unwritten, so the ioend should mark the extent as written. * ``IOMAP_DIO_COW``: Writing to the space in the mapping required a copy on write operation, so the ioend should switch mappings. - ``bio_set``: This allows the filesystem to provide a custom bio_set for allocating direct I/O bios. This enables filesystems to `stash additional per-bio information `_ for private use. If this field is NULL, generic ``struct bio`` objects will be used. h]h)}(hhh](h)}(hXa``submit_io``: iomap calls this function when it has constructed a ``struct bio`` object for the I/O requested, and wishes to submit it to the block device. If no function is provided, ``submit_bio`` will be called directly. Filesystems that would like to perform additional work before (e.g. data replication for btrfs) should implement this function. h]j)}(hX```submit_io``: iomap calls this function when it has constructed a ``struct bio`` object for the I/O requested, and wishes to submit it to the block device. If no function is provided, ``submit_bio`` will be called directly. Filesystems that would like to perform additional work before (e.g. data replication for btrfs) should implement this function.h](j-)}(h ``submit_io``h]h submit_io}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh6: iomap calls this function when it has constructed a }(hjhhhNhNubj-)}(h``struct bio``h]h struct bio}(hj+hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubhh object for the I/O requested, and wishes to submit it to the block device. If no function is provided, }(hjhhhNhNubj-)}(h``submit_bio``h]h submit_bio}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh will be called directly. Filesystems that would like to perform additional work before (e.g. data replication for btrfs) should implement this function.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhM4hjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hX``end_io``: This is called after the ``struct bio`` completes. This function should perform post-write conversions of unwritten extent mappings, handle write failures, etc. The ``flags`` argument may be set to a combination of the following: * ``IOMAP_DIO_UNWRITTEN``: The mapping was unwritten, so the ioend should mark the extent as written. * ``IOMAP_DIO_COW``: Writing to the space in the mapping required a copy on write operation, so the ioend should switch mappings. h](j)}(h``end_io``: This is called after the ``struct bio`` completes. This function should perform post-write conversions of unwritten extent mappings, handle write failures, etc. The ``flags`` argument may be set to a combination of the following:h](j-)}(h ``end_io``h]hend_io}(hjchhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj_ubh: This is called after the }(hj_hhhNhNubj-)}(h``struct bio``h]h struct bio}(hjuhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj_ubh~ completes. This function should perform post-write conversions of unwritten extent mappings, handle write failures, etc. The }(hj_hhhNhNubj-)}(h ``flags``h]hflags}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj_ubh7 argument may be set to a combination of the following:}(hj_hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhM;hj[ubh)}(hhh](h)}(hd``IOMAP_DIO_UNWRITTEN``: The mapping was unwritten, so the ioend should mark the extent as written. h]j)}(hc``IOMAP_DIO_UNWRITTEN``: The mapping was unwritten, so the ioend should mark the extent as written.h](j-)}(h``IOMAP_DIO_UNWRITTEN``h]hIOMAP_DIO_UNWRITTEN}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubhL: The mapping was unwritten, so the ioend should mark the extent as written.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhM@hjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(h``IOMAP_DIO_COW``: Writing to the space in the mapping required a copy on write operation, so the ioend should switch mappings. h]j)}(h``IOMAP_DIO_COW``: Writing to the space in the mapping required a copy on write operation, so the ioend should switch mappings.h](j-)}(h``IOMAP_DIO_COW``h]h IOMAP_DIO_COW}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubhn: Writing to the space in the mapping required a copy on write operation, so the ioend should switch mappings.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMChjubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]jjuh1hhhhM@hj[ubeh}(h]h ]h"]h$]h&]uh1hhjubh)}(hX?``bio_set``: This allows the filesystem to provide a custom bio_set for allocating direct I/O bios. This enables filesystems to `stash additional per-bio information `_ for private use. If this field is NULL, generic ``struct bio`` objects will be used. h]j)}(hX>``bio_set``: This allows the filesystem to provide a custom bio_set for allocating direct I/O bios. This enables filesystems to `stash additional per-bio information `_ for private use. If this field is NULL, generic ``struct bio`` objects will be used.h](j-)}(h ``bio_set``h]hbio_set}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubhu: This allows the filesystem to provide a custom bio_set for allocating direct I/O bios. This enables filesystems to }(hjhhhNhNubj )}(hi`stash additional per-bio information `_h]h$stash additional per-bio information}(hjhhhNhNubah}(h]h ]h"]h$]h&]name$stash additional per-bio informationjM?https://lore.kernel.org/all/20220505201115.937837-3-hch@lst.de/uh1jhjubh)}(hB h]h}(h]$stash-additional-per-bio-informationah ]h"]$stash additional per-bio informationah$]h&]refurij$uh1hj\Khjubh1 for private use. If this field is NULL, generic }(hjhhhNhNubj-)}(h``struct bio``h]h struct bio}(hj6hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh objects will be used.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMFhjubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]jj9 uh1hhhhM4hj ubah}(h]h ]h"]h$]h&]uh1j;hhhM4hjhhubj)}(hFilesystems that want to perform extra work after an I/O completion should set a custom ``->bi_end_io`` function via ``->submit_io``. Afterwards, the custom endio function must call ``iomap_dio_bio_end_io`` to finish the direct I/O.h](hXFilesystems that want to perform extra work after an I/O completion should set a custom }(hj`hhhNhNubj-)}(h``->bi_end_io``h]h ->bi_end_io}(hjhhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj`ubh function via }(hj`hhhNhNubj-)}(h``->submit_io``h]h ->submit_io}(hjzhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj`ubh2. Afterwards, the custom endio function must call }(hj`hhhNhNubj-)}(h``iomap_dio_bio_end_io``h]hiomap_dio_bio_end_io}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj`ubh to finish the direct I/O.}(hj`hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMMhjhhubeh}(h]jah ]h"]struct iomap_dio_ops:ah$]h&]uh1hhjhhhhhM'ubeh}(h]j0ah ]h"] direct i/oah$]h&]uh1hhhhhhhhMxubh)}(hhh](h)}(hDAX I/Oh]hDAX I/O}(hjhhhNhNubah}(h]h ]h"]h$]h&]jjuh1hhjhhhhhMSubj)}(hSome storage devices can be directly mapped as memory. These devices support a new access mode known as "fsdax" that allows loads and stores through the CPU and memory controller.h]hSome storage devices can be directly mapped as memory. These devices support a new access mode known as “fsdax” that allows loads and stores through the CPU and memory controller.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhMUhjhhubh)}(hhh](h)}(h fsdax Readsh]h fsdax Reads}(hjhhhNhNubah}(h]h ]h"]h$]h&]jjuh1hhjhhhhhMZubj)}(hA fsdax read performs a memcpy from storage device to the caller's buffer. The ``flags`` value for ``->iomap_begin`` will be ``IOMAP_DAX`` with any combination of the following enhancements:h](hQA fsdax read performs a memcpy from storage device to the caller’s buffer. The }(hjhhhNhNubj-)}(h ``flags``h]hflags}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh value for }(hjhhhNhNubj-)}(h``->iomap_begin``h]h ->iomap_begin}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh will be }(hjhhhNhNubj-)}(h ``IOMAP_DAX``h]h IOMAP_DAX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh4 with any combination of the following enhancements:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhM\hjhhubj<)}(h+* ``IOMAP_NOWAIT``, as defined previously. h]h)}(hhh]h)}(h)``IOMAP_NOWAIT``, as defined previously. h]j)}(h(``IOMAP_NOWAIT``, as defined previously.h](j-)}(h``IOMAP_NOWAIT``h]h IOMAP_NOWAIT}(hj5hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj1ubh, as defined previously.}(hj1hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMahj-ubah}(h]h ]h"]h$]h&]uh1hhj*ubah}(h]h ]h"]h$]h&]jjuh1hhhhMahj&ubah}(h]h ]h"]h$]h&]uh1j;hhhMahjhhubj)}(hNCallers commonly hold ``i_rwsem`` in shared mode before calling this function.h](hCallers commonly hold }(hj_hhhNhNubj-)}(h ``i_rwsem``h]hi_rwsem}(hjghhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj_ubh- in shared mode before calling this function.}(hj_hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMchjhhubeh}(h]j ah ]h"] fsdax readsah$]h&]uh1hhjhhhhhMZubh)}(hhh](h)}(h fsdax Writesh]h fsdax Writes}(hjhhhNhNubah}(h]h ]h"]h$]h&]jj(uh1hhjhhhhhMgubj)}(hA fsdax write initiates a memcpy to the storage device from the caller's buffer. The ``flags`` value for ``->iomap_begin`` will be ``IOMAP_DAX | IOMAP_WRITE`` with any combination of the following enhancements:h](hWA fsdax write initiates a memcpy to the storage device from the caller’s buffer. The }(hjhhhNhNubj-)}(h ``flags``h]hflags}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh value for }(hjhhhNhNubj-)}(h``->iomap_begin``h]h ->iomap_begin}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh will be }(hjhhhNhNubj-)}(h``IOMAP_DAX | IOMAP_WRITE``h]hIOMAP_DAX | IOMAP_WRITE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh4 with any combination of the following enhancements:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMihjhhubj<)}(hX* ``IOMAP_NOWAIT``, as defined previously. * ``IOMAP_OVERWRITE_ONLY``: The caller requires a pure overwrite to be performed from this mapping. This requires the filesystem extent mapping to already exist as an ``IOMAP_MAPPED`` type and span the entire range of the write I/O request. If the filesystem cannot map this request in a way that allows the iomap infrastructure to perform a pure overwrite, it must fail the mapping operation with ``-EAGAIN``. h]h)}(hhh](h)}(h)``IOMAP_NOWAIT``, as defined previously. h]j)}(h(``IOMAP_NOWAIT``, as defined previously.h](j-)}(h``IOMAP_NOWAIT``h]h IOMAP_NOWAIT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh, as defined previously.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMnhjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(hX``IOMAP_OVERWRITE_ONLY``: The caller requires a pure overwrite to be performed from this mapping. This requires the filesystem extent mapping to already exist as an ``IOMAP_MAPPED`` type and span the entire range of the write I/O request. If the filesystem cannot map this request in a way that allows the iomap infrastructure to perform a pure overwrite, it must fail the mapping operation with ``-EAGAIN``. h]j)}(hX``IOMAP_OVERWRITE_ONLY``: The caller requires a pure overwrite to be performed from this mapping. This requires the filesystem extent mapping to already exist as an ``IOMAP_MAPPED`` type and span the entire range of the write I/O request. If the filesystem cannot map this request in a way that allows the iomap infrastructure to perform a pure overwrite, it must fail the mapping operation with ``-EAGAIN``.h](j-)}(h``IOMAP_OVERWRITE_ONLY``h]hIOMAP_OVERWRITE_ONLY}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubh: The caller requires a pure overwrite to be performed from this mapping. This requires the filesystem extent mapping to already exist as an }(hj hhhNhNubj-)}(h``IOMAP_MAPPED``h]h IOMAP_MAPPED}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubh type and span the entire range of the write I/O request. If the filesystem cannot map this request in a way that allows the iomap infrastructure to perform a pure overwrite, it must fail the mapping operation with R}(hj hhhNhNubj-)}(h ``-EAGAIN``h]h-EAGAIN}(hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubh.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMphjubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]jjuh1hhhhMnhjubah}(h]h ]h"]h$]h&]uh1j;hhhMnhjhhubj)}(hQCallers commonly hold ``i_rwsem`` in exclusive mode before calling this function.h](hCallers commonly hold }(hj^hhhNhNubj-)}(h ``i_rwsem``h]hi_rwsem}(hjfhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj^ubh0 in exclusive mode before calling this function.}(hj^hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMyhjhhubh)}(hhh](h)}(hfsdax mmap Faultsh]hfsdax mmap Faults}(hjhhhNhNubah}(h]h ]h"]h$]h&]jjGuh1hhj~hhhhhM}ubj)}(hX9The ``dax_iomap_fault`` function handles read and write faults to fsdax storage. For a read fault, ``IOMAP_DAX | IOMAP_FAULT`` will be passed as the ``flags`` argument to ``->iomap_begin``. For a write fault, ``IOMAP_DAX | IOMAP_FAULT | IOMAP_WRITE`` will be passed as the ``flags`` argument to ``->iomap_begin``.h](hThe }(hjhhhNhNubj-)}(h``dax_iomap_fault``h]hdax_iomap_fault}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubhL function handles read and write faults to fsdax storage. For a read fault, }(hjhhhNhNubj-)}(h``IOMAP_DAX | IOMAP_FAULT``h]hIOMAP_DAX | IOMAP_FAULT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh will be passed as the }(hjhhhNhNubj-)}(h ``flags``h]hflags}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh argument to }(hjhhhNhNubj-)}(h``->iomap_begin``h]h ->iomap_begin}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh. For a write fault, }(hjhhhNhNubj-)}(h)``IOMAP_DAX | IOMAP_FAULT | IOMAP_WRITE``h]h%IOMAP_DAX | IOMAP_FAULT | IOMAP_WRITE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh will be passed as the }(hjhhhNhNubj-)}(h ``flags``h]hflags}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh argument to }hjsbj-)}(h``->iomap_begin``h]h ->iomap_begin}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhj~hhubj)}(h[Callers commonly hold the same locks as they do to call their iomap pagecache counterparts.h]h[Callers commonly hold the same locks as they do to call their iomap pagecache counterparts.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhMhj~hhubeh}(h]jMah ]h"]fsdax mmap faultsah$]h&]uh1hhjhhhhhM}ubeh}(h]j.ah ]h"] fsdax writesah$]h&]uh1hhjhhhhhMgubh)}(hhh](h)}(h*fsdax Truncation, fallocate, and Unsharingh]h*fsdax Truncation, fallocate, and Unsharing}(hj:hhhNhNubah}(h]h ]h"]h$]h&]jjuuh1hhj7hhhhhMubj)}(hFor fsdax files, the following functions are provided to replace their iomap pagecache I/O counterparts. The ``flags`` argument to ``->iomap_begin`` are the same as the pagecache counterparts, with ``IOMAP_DAX`` added.h](hmFor fsdax files, the following functions are provided to replace their iomap pagecache I/O counterparts. The }(hjHhhhNhNubj-)}(h ``flags``h]hflags}(hjPhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjHubh argument to }(hjHhhhNhNubj-)}(h``->iomap_begin``h]h ->iomap_begin}(hjbhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjHubh2 are the same as the pagecache counterparts, with }(hjHhhhNhNubj-)}(h ``IOMAP_DAX``h]h IOMAP_DAX}(hjthhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjHubh added.}(hjHhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhj7hhubj<)}(hD* ``dax_file_unshare`` * ``dax_zero_range`` * ``dax_truncate_page`` h]h)}(hhh](h)}(h``dax_file_unshare``h]j)}(hjh]j-)}(hjh]hdax_file_unshare}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubah}(h]h ]h"]h$]h&]uh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(h``dax_zero_range``h]j)}(hjh]j-)}(hjh]hdax_zero_range}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubah}(h]h ]h"]h$]h&]uh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1hhjubh)}(h``dax_truncate_page`` h]j)}(h``dax_truncate_page``h]j-)}(hjh]hdax_truncate_page}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjubah}(h]h ]h"]h$]h&]uh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]jjuh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1j;hhhMhj7hhubj)}(h[Callers commonly hold the same locks as they do to call their iomap pagecache counterparts.h]h[Callers commonly hold the same locks as they do to call their iomap pagecache counterparts.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhMhj7hhubeh}(h]j{ah ]h"]*fsdax truncation, fallocate, and unsharingah$]h&]uh1hhjhhhhhMubh)}(hhh](h)}(hfsdax Deduplicationh]hfsdax Deduplication}(hj hhhNhNubah}(h]h ]h"]h$]h&]jjuh1hhj hhhhhMubj)}(hFilesystems implementing the ``FIDEDUPERANGE`` ioctl must call the ``dax_remap_file_range_prep`` function with their own iomap read ops.h](hFilesystems implementing the }(hj& hhhNhNubj-)}(h``FIDEDUPERANGE``h]h FIDEDUPERANGE}(hj. hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj& ubh ioctl must call the }(hj& hhhNhNubj-)}(h``dax_remap_file_range_prep``h]hdax_remap_file_range_prep}(hj@ hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj& ubh( function with their own iomap read ops.}(hj& hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhj hhubeh}(h]jah ]h"]fsdax deduplicationah$]h&]uh1hhjhhhhhMubeh}(h]jah ]h"]dax i/oah$]h&]uh1hhhhhhhhMSubh)}(hhh](h)}(h Seeking Filesh]h Seeking Files}(hji hhhNhNubah}(h]h ]h"]h$]h&]jjuh1hhjf hhhhhMubj)}(hNiomap implements the two iterating whence modes of the ``llseek`` system call.h](h7iomap implements the two iterating whence modes of the }(hjw hhhNhNubj-)}(h ``llseek``h]hllseek}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjw ubh system call.}(hjw hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhjf hhubh)}(hhh](h)}(h SEEK_DATAh]h SEEK_DATA}(hj hhhNhNubah}(h]h ]h"]h$]h&]jjuh1hhj hhhhhMubj)}(hThe ``iomap_seek_data`` function implements the SEEK_DATA "whence" value for llseek. ``IOMAP_REPORT`` will be passed as the ``flags`` argument to ``->iomap_begin``.h](hThe }(hj hhhNhNubj-)}(h``iomap_seek_data``h]hiomap_seek_data}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubhB function implements the SEEK_DATA “whence” value for llseek. }(hj hhhNhNubj-)}(h``IOMAP_REPORT``h]h IOMAP_REPORT}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubh will be passed as the }(hj hhhNhNubj-)}(h ``flags``h]hflags}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubh argument to }(hj hhhNhNubj-)}(h``->iomap_begin``h]h ->iomap_begin}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj ubh.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhj hhubj)}(hFor unwritten mappings, the pagecache will be searched. Regions of the pagecache with a folio mapped and uptodate fsblocks within those folios will be reported as data areas.h]hFor unwritten mappings, the pagecache will be searched. Regions of the pagecache with a folio mapped and uptodate fsblocks within those folios will be reported as data areas.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhMhj hhubj)}(hNCallers commonly hold ``i_rwsem`` in shared mode before calling this function.h](hCallers commonly hold }(hj !hhhNhNubj-)}(h ``i_rwsem``h]hi_rwsem}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj !ubh- in shared mode before calling this function.}(hj !hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhj hhubeh}(h]jah ]h"] seek_dataah$]h&]uh1hhjf hhhhhMubh)}(hhh](h)}(h SEEK_HOLEh]h SEEK_HOLE}(hj6!hhhNhNubah}(h]h ]h"]h$]h&]jjuh1hhj3!hhhhhMubj)}(hThe ``iomap_seek_hole`` function implements the SEEK_HOLE "whence" value for llseek. ``IOMAP_REPORT`` will be passed as the ``flags`` argument to ``->iomap_begin``.h](hThe }(hjD!hhhNhNubj-)}(h``iomap_seek_hole``h]hiomap_seek_hole}(hjL!hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjD!ubhB function implements the SEEK_HOLE “whence” value for llseek. }(hjD!hhhNhNubj-)}(h``IOMAP_REPORT``h]h IOMAP_REPORT}(hj^!hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjD!ubh will be passed as the }(hjD!hhhNhNubj-)}(h ``flags``h]hflags}(hjp!hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjD!ubh argument to }(hjD!hhhNhNubj-)}(h``->iomap_begin``h]h ->iomap_begin}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hjD!ubh.}(hjD!hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhj3!hhubj)}(hFor unwritten mappings, the pagecache will be searched. Regions of the pagecache with no folio mapped, or a !uptodate fsblock within a folio will be reported as sparse hole areas.h]hFor unwritten mappings, the pagecache will be searched. Regions of the pagecache with no folio mapped, or a !uptodate fsblock within a folio will be reported as sparse hole areas.}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhMhj3!hhubj)}(hNCallers commonly hold ``i_rwsem`` in shared mode before calling this function.h](hCallers commonly hold }(hj!hhhNhNubj-)}(h ``i_rwsem``h]hi_rwsem}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj!ubh- in shared mode before calling this function.}(hj!hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhj3!hhubeh}(h]j ah ]h"] seek_holeah$]h&]uh1hhjf hhhhhMubeh}(h]jah ]h"] seeking filesah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(hSwap File Activationh]hSwap File Activation}(hj!hhhNhNubah}(h]h ]h"]h$]h&]jj4uh1hhj!hhhhhMubj)}(hXThe ``iomap_swapfile_activate`` function finds all the base-page aligned regions in a file and sets them up as swap space. The file will be ``fsync()``'d before activation. ``IOMAP_REPORT`` will be passed as the ``flags`` argument to ``->iomap_begin``. All mappings must be mapped or unwritten; cannot be dirty or shared, and cannot span multiple block devices. Callers must hold ``i_rwsem`` in exclusive mode; this is already provided by ``swapon``.h](hThe }(hj!hhhNhNubj-)}(h``iomap_swapfile_activate``h]hiomap_swapfile_activate}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj!ubhm function finds all the base-page aligned regions in a file and sets them up as swap space. The file will be }(hj!hhhNhNubj-)}(h ``fsync()``h]hfsync()}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj!ubh’d before activation. }(hj!hhhNhNubj-)}(h``IOMAP_REPORT``h]h IOMAP_REPORT}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj!ubh will be passed as the }(hj!hhhNhNubj-)}(h ``flags``h]hflags}(hj%"hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj!ubh argument to }(hj!hhhNhNubj-)}(h``->iomap_begin``h]h ->iomap_begin}(hj7"hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj!ubh. All mappings must be mapped or unwritten; cannot be dirty or shared, and cannot span multiple block devices. Callers must hold }(hj!hhhNhNubj-)}(h ``i_rwsem``h]hi_rwsem}(hjI"hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj!ubh0 in exclusive mode; this is already provided by }(hj!hhhNhNubj-)}(h ``swapon``h]hswapon}(hj["hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj!ubh.}(hj!hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhj!hhubeh}(h]j:ah ]h"]swap file activationah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(hFile Space Mapping Reportingh]hFile Space Mapping Reporting}(hj}"hhhNhNubah}(h]h ]h"]h$]h&]jjVuh1hhjz"hhhhhMubj)}(hiomap_begin``. Callers commonly hold ``i_rwsem`` in shared mode before calling this function.h](hThe }(hj"hhhNhNubj-)}(h``iomap_fiemap``h]h iomap_fiemap}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj"ubhS function exports file extent mappings to userspace in the format specified by the }(hj"hhhNhNubj-)}(h``FS_IOC_FIEMAP``h]h FS_IOC_FIEMAP}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj"ubh ioctl. }(hj"hhhNhNubj-)}(h``IOMAP_REPORT``h]h IOMAP_REPORT}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj"ubh will be passed as the }(hj"hhhNhNubj-)}(h ``flags``h]hflags}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj"ubh argument to }(hj"hhhNhNubj-)}(h``->iomap_begin``h]h ->iomap_begin}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj"ubh. Callers commonly hold }(hj"hhhNhNubj-)}(h ``i_rwsem``h]hi_rwsem}(hj #hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj"ubh- in shared mode before calling this function.}(hj"hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhj"hhubeh}(h]j{ah ]h"] fs_ioc_fiemapah$]h&]uh1hhjz"hhhhhMubh)}(hhh](h)}(hFIBMAP (deprecated)h]hFIBMAP (deprecated)}(hj.#hhhNhNubah}(h]h ]h"]h$]h&]jjuh1hhj+#hhhhhMubj)}(hX``iomap_bmap`` implements FIBMAP. The calling conventions are the same as for FIEMAP. This function is only provided to maintain compatibility for filesystems that implemented FIBMAP prior to conversion. This ioctl is deprecated; do **not** add a FIBMAP implementation to filesystems that do not have it. Callers should probably hold ``i_rwsem`` in shared mode before calling this function, but this is unclear.h](j-)}(h``iomap_bmap``h]h iomap_bmap}(hj@#hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj<#ubh implements FIBMAP. The calling conventions are the same as for FIEMAP. This function is only provided to maintain compatibility for filesystems that implemented FIBMAP prior to conversion. This ioctl is deprecated; do }(hj<#hhhNhNubhstrong)}(h**not**h]hnot}(hjT#hhhNhNubah}(h]h ]h"]h$]h&]uh1jR#hj<#ubh^ add a FIBMAP implementation to filesystems that do not have it. Callers should probably hold }(hj<#hhhNhNubj-)}(h ``i_rwsem``h]hi_rwsem}(hjf#hhhNhNubah}(h]h ]h"]h$]h&]uh1j,hj<#ubhB in shared mode before calling this function, but this is unclear.}(hj<#hhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhMhj+#hhubeh}(h]jah ]h"]fibmap (deprecated)ah$]h&]uh1hhjz"hhhhhMubeh}(h]j\ah ]h"]file space mapping reportingah$]h&]uh1hhhhhhhhMubeh}(h]supported-file-operationsah ]h"]supported file operationsah$]h&]uh1hhhhhhhhK ubeh}(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}(hhj#j#jjjjjjDj jpjXjUjjjC j@ j jj+ j( jX jjjj jjkjj j j j jj9jj[jLjjjjjjjjjjxjjjjj0jj jjjjjjOjjqjjjjj.j+jc jjj j4j.j-jMj j{j\ jj!jj0!jj!j jw"j:j#j\j(#j{j#ju nametypes}(hj#jjjj jXjjC j j+ jX jj jkj j jjjLjjjjjxjjjjjjjjjj.jc jj4j-j j\ j!j0!j!jw"j#j(#j#uh}(hhj#hjhjjjDjjpjjUjOjjj@ j: jj j( j" jj jj[ jj jj j j j j j9jnj[jjjjjOjjLjjjjjjjjj0jj jjjjj jOjjqjjjjjj+j%jjj jj.jjMj~j{j7jj jjf jj j j3!j:j!j\jz"j{j"jj+#jj j>j)jjjWjjjjjjjjjjj3j*jUjLjjzjjjjjjj*j!jIj@jkjbjjjjjjjjj(jjGj>jujljjjjjjjjj4j+jVjMjujljju footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}j#K sRparse_messages]transform_messages]hsystem_message)}(hhh]j)}(hhh]h6Hyperlink target "iomap_operations" is not referenced.}hj $sbah}(h]h ]h"]h$]h&]uh1jhj$ubah}(h]h ]h"]h$]h&]levelKtypeINFOsourcehlineKuh1j$uba transformerN include_log] decorationNhhub.