Skip to content

Commit 18fc84d

Browse files
author
Miklos Szeredi
committed
vfs: remove unused i_op->rename
No in-tree uses remain. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
1 parent 1cd66c9 commit 18fc84d

7 files changed

Lines changed: 10 additions & 31 deletions

File tree

‎Documentation/filesystems/Locking‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ prototypes:
5050
int (*mkdir) (struct inode *,struct dentry *,umode_t);
5151
int (*rmdir) (struct inode *,struct dentry *);
5252
int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
53-
int (*rename) (struct inode *, struct dentry *,
54-
struct inode *, struct dentry *);
5553
int (*rename2) (struct inode *, struct dentry *,
5654
struct inode *, struct dentry *, unsigned int);
5755
int (*readlink) (struct dentry *, char __user *,int);
@@ -83,7 +81,6 @@ symlink: yes
8381
mkdir: yes
8482
unlink: yes (both)
8583
rmdir: yes (both) (see below)
86-
rename: yes (all) (see below)
8784
rename2: yes (all) (see below)
8885
readlink: no
8986
get_link: no
@@ -102,8 +99,7 @@ tmpfile: no
10299

103100
Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on
104101
victim.
105-
cross-directory ->rename() and rename2() has (per-superblock)
106-
->s_vfs_rename_sem.
102+
cross-directory ->rename2() has (per-superblock) ->s_vfs_rename_sem.
107103

108104
See Documentation/filesystems/directory-locking for more detailed discussion
109105
of the locking scheme for directory operations.

‎Documentation/filesystems/directory-locking‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ locks victim and calls the method. Locks are exclusive.
1919

2020
4) rename() that is _not_ cross-directory. Locking rules: caller locks
2121
the parent and finds source and target. In case of exchange (with
22-
RENAME_EXCHANGE in rename2() flags argument) lock both. In any case,
22+
RENAME_EXCHANGE in flags argument) lock both. In any case,
2323
if the target already exists, lock it. If the source is a non-directory,
2424
lock it. If we need to lock both, lock them in inode pointer order.
2525
Then call the method. All locks are exclusive.

‎Documentation/filesystems/vfs.txt‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,6 @@ struct inode_operations {
345345
int (*mkdir) (struct inode *,struct dentry *,umode_t);
346346
int (*rmdir) (struct inode *,struct dentry *);
347347
int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
348-
int (*rename) (struct inode *, struct dentry *,
349-
struct inode *, struct dentry *);
350348
int (*rename2) (struct inode *, struct dentry *,
351349
struct inode *, struct dentry *, unsigned int);
352350
int (*readlink) (struct dentry *, char __user *,int);
@@ -416,11 +414,8 @@ otherwise noted.
416414
rename: called by the rename(2) system call to rename the object to
417415
have the parent and name given by the second inode and dentry.
418416

419-
rename2: this has an additional flags argument compared to rename.
420-
If no flags are supported by the filesystem then this method
421-
need not be implemented. If some flags are supported then the
422-
filesystem must return -EINVAL for any unsupported or unknown
423-
flags. Currently the following flags are implemented:
417+
The filesystem must return -EINVAL for any unsupported or
418+
unknown flags. Currently the following flags are implemented:
424419
(1) RENAME_NOREPLACE: this flag indicates that if the target
425420
of the rename exists the rename should fail with -EEXIST
426421
instead of replacing the target. The VFS already checks for

‎fs/cachefiles/namei.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,8 +804,7 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache,
804804
!d_backing_inode(subdir)->i_op->lookup ||
805805
!d_backing_inode(subdir)->i_op->mkdir ||
806806
!d_backing_inode(subdir)->i_op->create ||
807-
(!d_backing_inode(subdir)->i_op->rename &&
808-
!d_backing_inode(subdir)->i_op->rename2) ||
807+
!d_backing_inode(subdir)->i_op->rename2 ||
809808
!d_backing_inode(subdir)->i_op->rmdir ||
810809
!d_backing_inode(subdir)->i_op->unlink)
811810
goto check_error;

‎fs/namei.c‎

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4369,12 +4369,9 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
43694369
if (error)
43704370
return error;
43714371

4372-
if (!old_dir->i_op->rename && !old_dir->i_op->rename2)
4372+
if (!old_dir->i_op->rename2)
43734373
return -EPERM;
43744374

4375-
if (flags && !old_dir->i_op->rename2)
4376-
return -EINVAL;
4377-
43784375
/*
43794376
* If we are going to change the parent - check write permissions,
43804377
* we'll need to flip '..'.
@@ -4428,14 +4425,8 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
44284425
if (error)
44294426
goto out;
44304427
}
4431-
if (!old_dir->i_op->rename2) {
4432-
error = old_dir->i_op->rename(old_dir, old_dentry,
4433-
new_dir, new_dentry);
4434-
} else {
4435-
WARN_ON(old_dir->i_op->rename != NULL);
4436-
error = old_dir->i_op->rename2(old_dir, old_dentry,
4437-
new_dir, new_dentry, flags);
4438-
}
4428+
error = old_dir->i_op->rename2(old_dir, old_dentry,
4429+
new_dir, new_dentry, flags);
44394430
if (error)
44404431
goto out;
44414432

‎include/linux/fs.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1732,8 +1732,6 @@ struct inode_operations {
17321732
int (*mkdir) (struct inode *,struct dentry *,umode_t);
17331733
int (*rmdir) (struct inode *,struct dentry *);
17341734
int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
1735-
int (*rename) (struct inode *, struct dentry *,
1736-
struct inode *, struct dentry *);
17371735
int (*rename2) (struct inode *, struct dentry *,
17381736
struct inode *, struct dentry *, unsigned int);
17391737
int (*setattr) (struct dentry *, struct iattr *);

‎security/tomoyo/realpath.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ static char *tomoyo_get_local_path(struct dentry *dentry, char * const buffer,
173173
* Use filesystem name if filesystem does not support rename()
174174
* operation.
175175
*/
176-
if (!inode->i_op->rename && !inode->i_op->rename2)
176+
if (!inode->i_op->rename2)
177177
goto prepend_filesystem_name;
178178
}
179179
/* Prepend device name. */
@@ -283,7 +283,7 @@ char *tomoyo_realpath_from_path(const struct path *path)
283283
* or dentry without vfsmount.
284284
*/
285285
if (!path->mnt ||
286-
(!inode->i_op->rename && !inode->i_op->rename2))
286+
(!inode->i_op->rename2))
287287
pos = tomoyo_get_local_path(path->dentry, buf,
288288
buf_len - 1);
289289
/* Get absolute name for the rest. */

0 commit comments

Comments
 (0)