Skip to content

libfs: group and simplify linux fs code

Emanuele Giuseppe Esposito linux-fsdevel 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest7 patches 3 repliesIn review
  2. v27 patches 2 repliesSuperseded
  3. v18 patches 16 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7apparmor: just use vfs_kern_mount to make .nullsecurity/apparmor/apparmorfs.c+7 -60 replies
2/7libfs: wrap simple_pin_fs/simple_release_fs arguments in a structdrivers/gpu/drm/drm_drv.c drivers/misc/cxl/api.c drivers/scsi/cxlflash/ocxl_hw.c +8 more+103 -850 replies
3/7libfs: introduce new_inode_current_timefs/libfs.c include/linux/fs.h+21 -00 replies
4/7libfs: add alloc_anon_inode wrapperdrivers/gpu/drm/drm_drv.c drivers/misc/cxl/api.c drivers/scsi/cxlflash/ocxl_hw.c +2 more+14 -40 replies
5/7libfs: add file creation functionsfs/libfs.c include/linux/fs.h+244 -00 replies
6/7debugfs: switch to simplefs inode creation APIfs/debugfs/inode.c+15 -1400 replies
7/7tracefs: switch to simplefs inode creation APIfs/tracefs/inode.c+7 -891 reply

Reviews trailers per patch

1 of 7 patches has a Reviewed-by or Acked-by.

PatchSteven Rostedt (VMware)
1/7
2/7
3/7
4/7
5/7
6/7
7/7A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/7] libfs: group and simplify linux fs code

libfs.c has many functions that are useful to implement dentry and inode operations, but not many at the filesystem level. As a result, code to create files and inodes has a lot of duplication, to the point that tracefs has copied several hundred lines from debugfs.

The main two libfs.c functions for filesystems are simple_pin_fs and simple_release_fs, which hide a somewhat complicated locking sequence that is needed to serialize vfs_kern_mount and mntget. In this series, my aim is to add functions that create dentries and inodes of various kinds (either anonymous inodes, or directory/file/symlink). These functions take the code that was duplicated across debugfs and tracefs and move it to libfs.c.

In order to limit the number of arguments to the new functions, the series first creates a data type that is passed to both simple_pin_fs/simple_release_fs and the new creation functions. The new struct, introduced in patch 2, simply groups the "mount" and "count" arguments to simple_pin_fs and simple_release_fs.

Patches 1-4 are preparations to introduce the new simple_fs struct and new functions that are useful in the remainder of the series. Patch 5 introduces the dentry and inode creation functions. Patch 6-7 can then adopt them in debugfs and tracefs.

v1->v2: rename simple_new_inode in new_inode_current_time, more detailed explanations, put all common code in fs/libfs.c

v2->v3: remove unused debugfs_get_inode and tracefs_get_inode functions

Emanuele Giuseppe Esposito (7):
apparmor: just use vfs_kern_mount to make .null
libfs: wrap simple_pin_fs/simple_release_fs arguments in a struct
libfs: introduce new_inode_current_time
libfs: add alloc_anon_inode wrapper
libfs: add file creation functions
debugfs: switch to simplefs inode creation API
tracefs: switch to simplefs inode creation API

 drivers/gpu/drm/drm_drv.c       |  11 +-
 drivers/misc/cxl/api.c          |  13 +-
 drivers/scsi/cxlflash/ocxl_hw.c |  14 +-
 fs/binfmt_misc.c                |   9 +-
 fs/configfs/mount.c             |  10 +-
 fs/debugfs/inode.c              | 169 +++---------------
 fs/libfs.c                      | 299 ++++++++++++++++++++++++++++++--
 fs/tracefs/inode.c              | 106 ++---------
 include/linux/fs.h              |  31 +++-
 security/apparmor/apparmorfs.c  |  38 ++--
 security/inode.c                |  11 +-
 11 files changed, 399 insertions(+), 312 deletions(-)
Signature · 1 line
2.25.2