aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2014-07-23 09:15:32 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2014-08-07 14:40:09 -0400
commit80ace85c915d0f41016f82917218997b72431258 (patch)
tree59fa51e5968e831c5079a148f21f58b099fdb13b /fs/btrfs
parenta0dbc56610b3e157f19241404e738744b7e7877e (diff)
btrfs: add RENAME_NOREPLACE
RENAME_NOREPLACE is trivial to implement for most filesystems: switch over to ->rename2() and check for the supported flags. The rest is done by the VFS. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Cc: Chris Mason <clm@fb.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/inode.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 3668048e16f8..3183742d6f0d 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8476,6 +8476,16 @@ out_notrans:
8476 return ret; 8476 return ret;
8477} 8477}
8478 8478
8479static int btrfs_rename2(struct inode *old_dir, struct dentry *old_dentry,
8480 struct inode *new_dir, struct dentry *new_dentry,
8481 unsigned int flags)
8482{
8483 if (flags & ~RENAME_NOREPLACE)
8484 return -EINVAL;
8485
8486 return btrfs_rename(old_dir, old_dentry, new_dir, new_dentry);
8487}
8488
8479static void btrfs_run_delalloc_work(struct btrfs_work *work) 8489static void btrfs_run_delalloc_work(struct btrfs_work *work)
8480{ 8490{
8481 struct btrfs_delalloc_work *delalloc_work; 8491 struct btrfs_delalloc_work *delalloc_work;
@@ -9019,7 +9029,7 @@ static const struct inode_operations btrfs_dir_inode_operations = {
9019 .link = btrfs_link, 9029 .link = btrfs_link,
9020 .mkdir = btrfs_mkdir, 9030 .mkdir = btrfs_mkdir,
9021 .rmdir = btrfs_rmdir, 9031 .rmdir = btrfs_rmdir,
9022 .rename = btrfs_rename, 9032 .rename2 = btrfs_rename2,
9023 .symlink = btrfs_symlink, 9033 .symlink = btrfs_symlink,
9024 .setattr = btrfs_setattr, 9034 .setattr = btrfs_setattr,
9025 .mknod = btrfs_mknod, 9035 .mknod = btrfs_mknod,