From: Yongpeng Yang <[email protected]>

This patchset introduces an inline extent mapping mechanism for f2fs.
Instead of storing individual block addresses in the inode's data block
address area (i_addr[]), this feature packs contiguous block ranges into
compact extent entries, significantly reducing the number of entries
needed and enabling faster block address lookups via binary search.

The inline extent format is identified by magic numbers in the inode
data area and is transparent to the rest of f2fs -- when the extent
area is full or cannot represent the mapping efficiently, it
automatically converts back to the direct block address format.

Patch 1: Preparatory refactoring -- replace raw pointer arithmetic
         with f2fs_data_blkaddr() to abstract block address access.
Patch 2: Core implementation -- data structures, extent operations
         (lookup, insert, merge, split, truncate), format conversion,
         and integration with f2fs data/node paths.
Patch 3: ioctl interface -- allow per-file enable/disable of inline
         extent format via F2FS_EXTENT_FL flag.
Patch 4: sysfs interface -- runtime enable/disable toggle and file
         extension list for automatic inline extent activation.

Test setup and results:
=======================

Platform: Xiaomi smartphone, UFS 4.0 storage

  # Enable inline extent
  echo 1 > /sys/fs/f2fs/<dev>/inline_extent_enable
  echo 'mp4' > /sys/fs/f2fs/<dev>/inline_extent_extension_list

  # Prepare data: write with 4K offset stride to create fragmented
  # extents, then overwrite sequentially so inline extent can cache
  # all mappings in compact form.
  fio --name=test --filename=data.mp4 --rw=write:4k --bs=64M \
      --size=8G --ioengine=libaio --direct=1
  sync
  fio --name=test --filename=data.mp4 --rw=write --bs=64M \
      --size=8G --ioengine=libaio --direct=1
  sync
  echo 3 > /proc/sys/vm/drop_caches

  # Benchmark: 64K random buffered read, 1GB total IO
  fio --name=buffer-read --ioengine=libaio --rw=randread --bs=64K \
      --size=8G --io_size=1G --numjobs=1 --filename=data.mp4

Results (64K random read bandwidth):

  +---------------------+------------+
  | Configuration       | Bandwidth  |
  +---------------------+------------+
  | inline extent OFF   | 284 MiB/s  |
  | inline extent ON    | 321 MiB/s  |
  +---------------------+------------+
  | Improvement         | +13%       |
  +---------------------+------------+

The improvement comes from eliminating direct/indirect node page reads
during block address lookup -- all mappings are stored directly in
the inode page and found via O(log n) binary search.

Yongpeng Yang (4):
  f2fs: replace raw dnode pointer arithmetic with f2fs_data_blkaddr()
  f2fs: introduce inline extent mapping for inode data blocks
  f2fs: support setting inline extent flag via ioctl
  f2fs: add sysfs interface for inline extent management

 fs/f2fs/Kconfig    |  18 +
 fs/f2fs/Makefile   |   1 +
 fs/f2fs/data.c     | 149 +++++++-
 fs/f2fs/debug.c    |   4 +
 fs/f2fs/dir.c      |   9 +
 fs/f2fs/f2fs.h     |  23 +-
 fs/f2fs/file.c     |  93 ++++-
 fs/f2fs/iextent.c  | 826 +++++++++++++++++++++++++++++++++++++++++++++
 fs/f2fs/iextent.h  | 170 ++++++++++
 fs/f2fs/inline.c   |   7 +
 fs/f2fs/namei.c    |  48 +++
 fs/f2fs/node.c     |  81 ++++-
 fs/f2fs/node.h     |   4 +
 fs/f2fs/recovery.c |  17 +
 fs/f2fs/super.c    |  13 +
 fs/f2fs/sysfs.c    |  51 +++
 16 files changed, 1500 insertions(+), 14 deletions(-)
 create mode 100644 fs/f2fs/iextent.c
 create mode 100644 fs/f2fs/iextent.h

--
2.43.0



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to