Skip to content

Commit

Permalink
exfat: vfs: get rid of old '->iterate' directory operation
Browse files Browse the repository at this point in the history
All users now just use '->iterate_shared()', which only takes the
directory inode lock for reading.

Filesystems that never got convered to shared mode now instead use a
wrapper that drops the lock, re-takes it in write mode, calls the old
function, and then downgrades the lock back to read mode.

This way the VFS layer and other callers no longer need to care about
filesystems that never got converted to the modern era.

The filesystems that use the new wrapper are ceph, coda, exfat, jfs,
ntfs, ocfs2, overlayfs, and vboxsf.

Honestly, several of them look like they really could just iterate their
directories in shared mode and skip the wrapper entirely, but the point
of this change is to not change semantics or fix filesystems that
haven't been fixed in the last 7+ years, but to finally get rid of the
dual iterators.

Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Christian Brauner <[email protected]>
Signed-off-by: Namjae Jeon <[email protected]>
  • Loading branch information
torvalds authored and namjaejeon committed Aug 30, 2023
1 parent 2a0023b commit 967fa6b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,17 @@ static int exfat_iterate(struct file *filp, struct dir_context *ctx)
return err;
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 5, 0)
WRAP_DIR_ITER(exfat_iterate) // FIXME!
#endif
const struct file_operations exfat_dir_operations = {
.llseek = generic_file_llseek,
.read = generic_read_dir,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 5, 0)
.iterate_shared = shared_exfat_iterate,
#else
.iterate = exfat_iterate,
#endif
.unlocked_ioctl = exfat_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = exfat_compat_ioctl,
Expand Down

0 comments on commit 967fa6b

Please sign in to comment.