summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2025-03-08 22:22:29 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2025-11-17 23:59:05 -0500
commit6ca67378d0e79a914420cbc8f300b7aaf8dadde6 (patch)
treee0935eb1457bea5fa3abffc27b39e1cf0a430338
parentc7747fafaba0dcdad3d7da240e961927b4865f98 (diff)
convert functionfs
All files are regular; ep0 is there all along, other ep* may appear and go away during the filesystem lifetime; all of those are guaranteed to be gone by the time we umount it. Object creation is in ffs_sb_create_file(), removals - at ->kill_sb() time (for ep0) or by simple_remove_by_name() from ffs_epfiles_destroy() (for the rest of them). Switch ffs_sb_create_file() to simple_start_creating()/d_make_persistent()/ simple_done_creating() and that's it. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--drivers/usb/gadget/function/f_fs.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index 40868ceb765c..4bf61017b42d 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -1899,17 +1899,18 @@ static int ffs_sb_create_file(struct super_block *sb, const char *name,
struct dentry *dentry;
struct inode *inode;
- dentry = d_alloc_name(sb->s_root, name);
- if (!dentry)
- return -ENOMEM;
-
inode = ffs_sb_make_inode(sb, data, fops, NULL, &ffs->file_perms);
- if (!inode) {
- dput(dentry);
+ if (!inode)
return -ENOMEM;
+ dentry = simple_start_creating(sb->s_root, name);
+ if (IS_ERR(dentry)) {
+ iput(inode);
+ return PTR_ERR(dentry);
}
- d_add(dentry, inode);
+ d_make_persistent(dentry, inode);
+
+ simple_done_creating(dentry);
return 0;
}
@@ -2098,7 +2099,7 @@ static void ffs_data_reset(struct ffs_data *ffs);
static void
ffs_fs_kill_sb(struct super_block *sb)
{
- kill_litter_super(sb);
+ kill_anon_super(sb);
if (sb->s_fs_info) {
struct ffs_data *ffs = sb->s_fs_info;
ffs->state = FFS_CLOSING;