vfs: combine the clone and dedupe into a single remap_file_range
Combine the clone_file_range and dedupe_file_range operations into a single remap_file_range file operation dispatch since they're fundamentally the same operation. The differences between the two can be made in the prep functions. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com>
此提交包含在:
@@ -975,8 +975,9 @@ const struct inode_operations cifs_symlink_inode_ops = {
|
||||
.listxattr = cifs_listxattr,
|
||||
};
|
||||
|
||||
static int cifs_clone_file_range(struct file *src_file, loff_t off,
|
||||
struct file *dst_file, loff_t destoff, u64 len)
|
||||
static int cifs_remap_file_range(struct file *src_file, loff_t off,
|
||||
struct file *dst_file, loff_t destoff, u64 len,
|
||||
unsigned int remap_flags)
|
||||
{
|
||||
struct inode *src_inode = file_inode(src_file);
|
||||
struct inode *target_inode = file_inode(dst_file);
|
||||
@@ -986,6 +987,9 @@ static int cifs_clone_file_range(struct file *src_file, loff_t off,
|
||||
unsigned int xid;
|
||||
int rc;
|
||||
|
||||
if (remap_flags & ~REMAP_FILE_ADVISORY)
|
||||
return -EINVAL;
|
||||
|
||||
cifs_dbg(FYI, "clone range\n");
|
||||
|
||||
xid = get_xid();
|
||||
@@ -1134,7 +1138,7 @@ const struct file_operations cifs_file_ops = {
|
||||
.llseek = cifs_llseek,
|
||||
.unlocked_ioctl = cifs_ioctl,
|
||||
.copy_file_range = cifs_copy_file_range,
|
||||
.clone_file_range = cifs_clone_file_range,
|
||||
.remap_file_range = cifs_remap_file_range,
|
||||
.setlease = cifs_setlease,
|
||||
.fallocate = cifs_fallocate,
|
||||
};
|
||||
@@ -1153,7 +1157,7 @@ const struct file_operations cifs_file_strict_ops = {
|
||||
.llseek = cifs_llseek,
|
||||
.unlocked_ioctl = cifs_ioctl,
|
||||
.copy_file_range = cifs_copy_file_range,
|
||||
.clone_file_range = cifs_clone_file_range,
|
||||
.remap_file_range = cifs_remap_file_range,
|
||||
.setlease = cifs_setlease,
|
||||
.fallocate = cifs_fallocate,
|
||||
};
|
||||
@@ -1172,7 +1176,7 @@ const struct file_operations cifs_file_direct_ops = {
|
||||
.splice_write = iter_file_splice_write,
|
||||
.unlocked_ioctl = cifs_ioctl,
|
||||
.copy_file_range = cifs_copy_file_range,
|
||||
.clone_file_range = cifs_clone_file_range,
|
||||
.remap_file_range = cifs_remap_file_range,
|
||||
.llseek = cifs_llseek,
|
||||
.setlease = cifs_setlease,
|
||||
.fallocate = cifs_fallocate,
|
||||
@@ -1191,7 +1195,7 @@ const struct file_operations cifs_file_nobrl_ops = {
|
||||
.llseek = cifs_llseek,
|
||||
.unlocked_ioctl = cifs_ioctl,
|
||||
.copy_file_range = cifs_copy_file_range,
|
||||
.clone_file_range = cifs_clone_file_range,
|
||||
.remap_file_range = cifs_remap_file_range,
|
||||
.setlease = cifs_setlease,
|
||||
.fallocate = cifs_fallocate,
|
||||
};
|
||||
@@ -1209,7 +1213,7 @@ const struct file_operations cifs_file_strict_nobrl_ops = {
|
||||
.llseek = cifs_llseek,
|
||||
.unlocked_ioctl = cifs_ioctl,
|
||||
.copy_file_range = cifs_copy_file_range,
|
||||
.clone_file_range = cifs_clone_file_range,
|
||||
.remap_file_range = cifs_remap_file_range,
|
||||
.setlease = cifs_setlease,
|
||||
.fallocate = cifs_fallocate,
|
||||
};
|
||||
@@ -1227,7 +1231,7 @@ const struct file_operations cifs_file_direct_nobrl_ops = {
|
||||
.splice_write = iter_file_splice_write,
|
||||
.unlocked_ioctl = cifs_ioctl,
|
||||
.copy_file_range = cifs_copy_file_range,
|
||||
.clone_file_range = cifs_clone_file_range,
|
||||
.remap_file_range = cifs_remap_file_range,
|
||||
.llseek = cifs_llseek,
|
||||
.setlease = cifs_setlease,
|
||||
.fallocate = cifs_fallocate,
|
||||
@@ -1239,7 +1243,7 @@ const struct file_operations cifs_dir_ops = {
|
||||
.read = generic_read_dir,
|
||||
.unlocked_ioctl = cifs_ioctl,
|
||||
.copy_file_range = cifs_copy_file_range,
|
||||
.clone_file_range = cifs_clone_file_range,
|
||||
.remap_file_range = cifs_remap_file_range,
|
||||
.llseek = generic_file_llseek,
|
||||
.fsync = cifs_dir_fsync,
|
||||
};
|
||||
|
新增問題並參考
封鎖使用者