KernelNewbies:

iomap

iomap grew out of need to provide modern block mapping abstraction for filesystems to read/write for three different IO access methods:

Block mapping provides a mapping between data cached in memory, in the page cache, and the location on persistent storage where that data lives. LWN has an incredible review of the old buffer-heads block-mapping and why they are inefficient, since the the inception of Linux. Since buffer-heads work on a 512-byte block based paradigm, it creates an overhead for modern storage media which no longer necessarily works only on 512-blocks. This document strives to provide a template for LSFMM for what will hopefully eventually become upstream Linux kernel documentation for iomap and guidance for developers on converting a filesystem over from buffer-heads to iomap.

A modern block abstraction

Instead of assuming a granularity of storage media 512-blocks at time, iomap allows filesystems to query storage media for data using block ranges. Since block mapping are provided for a block ranges for cache data in memory, in the page cache, naturally this implies operations on block ranges will also deal with multipage operations in the page cache. Folios are used to help provide multipage operations in memory.

struct iomap_ops

A filesystem is encouraged to provide struct iomap_ops for beginning an IO operation and ending an IO operation on a block range, and so the struct iomap_ops data structure has iomap_begin() and iomap_end() callbacks. Experience in adopting iomap on XFS has has shown that the filesystem implementation of these operations can be simplified considerably if one struct iomap_ops is provided per major filesystem IO operation. For example:

struct iomap_dio_ops

struct iomap_writeback_ops

Converting filesystems from buffer-head to iomap guide

Defining a simple filesystem

The easiest

KernelNewbies: KernelProjects/iomap (last edited 2023-05-04 22:56:48 by mcgrof)