Linux block layer
 help / color / mirror / Atom feed
* [PATCH 0/3] vfs: add inode iteration method super_iter_inodes
@ 2026-10-15  9:38 Huang Shijie
  2026-10-15  9:38 ` [PATCH 1/3] " Huang Shijie
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Huang Shijie @ 2026-10-15  9:38 UTC (permalink / raw)
  To: axboe, viro, brauner
  Cc: zhongyuan, fangbaoshun, yingzhiwei, jack, agruenba, mic, gnoack,
	paul, jmorris, serge, aleksa, legion, david, sandeen, ebiggers,
	linux-block, linux-kernel, linux-fsdevel, gfs2,
	linux-security-module, sunjunchao, Huang Shijie

This series adds a single superblock inode iteration helper,
super_iter_inodes(), and converts the open-coded sb->s_inodes walks in
the VFS to it.  The design is based on Dave Chinner's patch set:
  "vfs: improving inode cache iteration scalability"
  https://lore.kernel.org/all/20241002014017.3801899-1-david@fromorbit.com/

The helper takes a callback, a private data pointer and flags:

  int super_iter_inodes(struct super_block *sb, ino_iter_fn iter_fn,
                        void *private_data, int flags);

  - Without a flag, @iter_fn runs with a valid, referenced inode and may
    block; the iterator owns the inode lifecycle and filters out
    I_NEW/I_FREEING/I_WILL_FREE inodes.

  - %INO_ITER_F_REFERENCED additionally restricts the iteration to
    inodes that still have a reference.  This preserves the "only handle
    referenced inodes" rule of landlock's sb-delete walk.

  - %INO_ITER_F_UNSAFE runs @iter_fn in atomic context (rcu_read_lock()
    plus sb->s_inode_list_lock) without taking a reference.  The
    callback must do its own state checks, must not block and must do its
    own rescheduling by returning %INO_ITER_RET_ABORT.

   Patch 1 adds the iterator.  
   Patch 2 converts the callers that cannot use
           referenced inodes (dquot removal, inode eviction, nr_blockdev_pages and
           the generic_shutdown_super() poisoning loop) to %INO_ITER_F_UNSAFE.
   Patch 3 converts the remaining callers (sync_bdevs, drop_pagecache_sb,
           gfs2_kill_sb, add_dquot_ref and landlock's hook_sb_delete).

BTW:
  This patch set depends a small patch:
  "fs/drop_caches: skip filesystems without fs writeback"
  https://lkml.org/lkml/2026/9/23/675
  

Huang Shijie (3):
  vfs: add inode iteration method super_iter_inodes
  vfs: convert inode iterators to the unsafe super_iter_inodes()
  vfs: convert sb->s_inodes iteration to super_iter_inodes()

 block/bdev.c                   |  84 ++++++++-----------
 fs/drop_caches.c               |  36 ++-------
 fs/gfs2/ops_fstype.c           |  68 +++++-----------
 fs/inode.c                     |  68 ++++++++--------
 fs/quota/dquot.c               | 132 ++++++++++++++----------------
 fs/super.c                     | 131 +++++++++++++++++++++++++++---
 include/linux/fs/super_types.h |  14 ++++
 security/landlock/fs.c         | 142 +++++++++++----------------------
 8 files changed, 340 insertions(+), 335 deletions(-)

-- 
2.34.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-10-16  2:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-15  9:38 [PATCH 0/3] vfs: add inode iteration method super_iter_inodes Huang Shijie
2026-10-15  9:38 ` [PATCH 1/3] " Huang Shijie
2026-10-15 15:23   ` Stephen Smalley
2026-10-16  2:45     ` Huang Shijie
2026-10-15  9:38 ` [PATCH 2/3] vfs: convert inode iterators to the unsafe super_iter_inodes() Huang Shijie
2026-10-15  9:38 ` [PATCH 3/3] vfs: convert sb->s_inodes iteration to super_iter_inodes() Huang Shijie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox