Skip to content

Commit 93b4d70

Browse files
jtlaytonaalexandrovich
authored andcommitted
fs/ntfs3: remove atomic_open
atomic_open is an optional VFS operation, and is primarily for network filesystems. NFS (for instance) can just send an open call for the last path component rather than doing a lookup and then having to follow that up with an open when it doesn't have a dentry in cache. ntfs3 is a local filesystem however, and its atomic_open just does a typical lookup + open, but in a convoluted way. atomic_open will also make directory leases more difficult to implement on the filesystem. Remove ntfs_atomic_open. Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Konstantin Komarov <[email protected]>
1 parent cef3590 commit 93b4d70

File tree

1 file changed

+0
-90
lines changed

1 file changed

+0
-90
lines changed

fs/ntfs3/namei.c

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -358,95 +358,6 @@ static int ntfs_rename(struct mnt_idmap *idmap, struct inode *dir,
358358
return err;
359359
}
360360

361-
/*
362-
* ntfs_atomic_open
363-
*
364-
* inode_operations::atomic_open
365-
*/
366-
static int ntfs_atomic_open(struct inode *dir, struct dentry *dentry,
367-
struct file *file, u32 flags, umode_t mode)
368-
{
369-
int err;
370-
struct inode *inode;
371-
struct ntfs_fnd *fnd = NULL;
372-
struct ntfs_inode *ni = ntfs_i(dir);
373-
struct dentry *d = NULL;
374-
struct cpu_str *uni = __getname();
375-
bool locked = false;
376-
377-
if (!uni)
378-
return -ENOMEM;
379-
380-
err = ntfs_nls_to_utf16(ni->mi.sbi, dentry->d_name.name,
381-
dentry->d_name.len, uni, NTFS_NAME_LEN,
382-
UTF16_HOST_ENDIAN);
383-
if (err < 0)
384-
goto out;
385-
386-
#ifdef CONFIG_NTFS3_FS_POSIX_ACL
387-
if (IS_POSIXACL(dir)) {
388-
/*
389-
* Load in cache current acl to avoid ni_lock(dir):
390-
* ntfs_create_inode -> ntfs_init_acl -> posix_acl_create ->
391-
* ntfs_get_acl -> ntfs_get_acl_ex -> ni_lock
392-
*/
393-
struct posix_acl *p = get_inode_acl(dir, ACL_TYPE_DEFAULT);
394-
395-
if (IS_ERR(p)) {
396-
err = PTR_ERR(p);
397-
goto out;
398-
}
399-
posix_acl_release(p);
400-
}
401-
#endif
402-
403-
if (d_in_lookup(dentry)) {
404-
ni_lock_dir(ni);
405-
locked = true;
406-
fnd = fnd_get();
407-
if (!fnd) {
408-
err = -ENOMEM;
409-
goto out1;
410-
}
411-
412-
d = d_splice_alias(dir_search_u(dir, uni, fnd), dentry);
413-
if (IS_ERR(d)) {
414-
err = PTR_ERR(d);
415-
d = NULL;
416-
goto out2;
417-
}
418-
419-
if (d)
420-
dentry = d;
421-
}
422-
423-
if (!(flags & O_CREAT) || d_really_is_positive(dentry)) {
424-
err = finish_no_open(file, d);
425-
goto out2;
426-
}
427-
428-
file->f_mode |= FMODE_CREATED;
429-
430-
/*
431-
* fnd contains tree's path to insert to.
432-
* If fnd is not NULL then dir is locked.
433-
*/
434-
inode = ntfs_create_inode(file_mnt_idmap(file), dir, dentry, uni,
435-
mode, 0, NULL, 0, fnd);
436-
err = IS_ERR(inode) ? PTR_ERR(inode) :
437-
finish_open(file, dentry, ntfs_file_open);
438-
dput(d);
439-
440-
out2:
441-
fnd_put(fnd);
442-
out1:
443-
if (locked)
444-
ni_unlock(ni);
445-
out:
446-
__putname(uni);
447-
return err;
448-
}
449-
450361
struct dentry *ntfs3_get_parent(struct dentry *child)
451362
{
452363
struct inode *inode = d_inode(child);
@@ -612,7 +523,6 @@ const struct inode_operations ntfs_dir_inode_operations = {
612523
.setattr = ntfs3_setattr,
613524
.getattr = ntfs_getattr,
614525
.listxattr = ntfs_listxattr,
615-
.atomic_open = ntfs_atomic_open,
616526
.fiemap = ntfs_fiemap,
617527
};
618528

0 commit comments

Comments
 (0)