diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2018-10-29 19:41:21 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2018-10-29 19:41:21 -0400 |
commit | 2e5dfc99f2e61c42083ba742395e7a7b353513d1 (patch) | |
tree | 48bc800424405b56153ed8c8997847c8ed9aaf14 /fs/ocfs2/file.c | |
parent | 6095028b455d775e369ae27875f698ff0f6fdeb8 (diff) |
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>
Diffstat (limited to 'fs/ocfs2/file.c')
-rw-r--r-- | fs/ocfs2/file.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 9fa35cb6f6e0..0b757a24567c 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -2527,24 +2527,18 @@ out: | |||
2527 | return offset; | 2527 | return offset; |
2528 | } | 2528 | } |
2529 | 2529 | ||
2530 | static int ocfs2_file_clone_range(struct file *file_in, | 2530 | static int ocfs2_remap_file_range(struct file *file_in, |
2531 | loff_t pos_in, | 2531 | loff_t pos_in, |
2532 | struct file *file_out, | 2532 | struct file *file_out, |
2533 | loff_t pos_out, | 2533 | loff_t pos_out, |
2534 | u64 len) | 2534 | u64 len, |
2535 | unsigned int remap_flags) | ||
2535 | { | 2536 | { |
2536 | return ocfs2_reflink_remap_range(file_in, pos_in, file_out, pos_out, | 2537 | if (remap_flags & ~(REMAP_FILE_DEDUP | REMAP_FILE_ADVISORY)) |
2537 | len, false); | 2538 | return -EINVAL; |
2538 | } | ||
2539 | 2539 | ||
2540 | static int ocfs2_file_dedupe_range(struct file *file_in, | ||
2541 | loff_t pos_in, | ||
2542 | struct file *file_out, | ||
2543 | loff_t pos_out, | ||
2544 | u64 len) | ||
2545 | { | ||
2546 | return ocfs2_reflink_remap_range(file_in, pos_in, file_out, pos_out, | 2540 | return ocfs2_reflink_remap_range(file_in, pos_in, file_out, pos_out, |
2547 | len, true); | 2541 | len, remap_flags & REMAP_FILE_DEDUP); |
2548 | } | 2542 | } |
2549 | 2543 | ||
2550 | const struct inode_operations ocfs2_file_iops = { | 2544 | const struct inode_operations ocfs2_file_iops = { |
@@ -2586,8 +2580,7 @@ const struct file_operations ocfs2_fops = { | |||
2586 | .splice_read = generic_file_splice_read, | 2580 | .splice_read = generic_file_splice_read, |
2587 | .splice_write = iter_file_splice_write, | 2581 | .splice_write = iter_file_splice_write, |
2588 | .fallocate = ocfs2_fallocate, | 2582 | .fallocate = ocfs2_fallocate, |
2589 | .clone_file_range = ocfs2_file_clone_range, | 2583 | .remap_file_range = ocfs2_remap_file_range, |
2590 | .dedupe_file_range = ocfs2_file_dedupe_range, | ||
2591 | }; | 2584 | }; |
2592 | 2585 | ||
2593 | const struct file_operations ocfs2_dops = { | 2586 | const struct file_operations ocfs2_dops = { |
@@ -2633,8 +2626,7 @@ const struct file_operations ocfs2_fops_no_plocks = { | |||
2633 | .splice_read = generic_file_splice_read, | 2626 | .splice_read = generic_file_splice_read, |
2634 | .splice_write = iter_file_splice_write, | 2627 | .splice_write = iter_file_splice_write, |
2635 | .fallocate = ocfs2_fallocate, | 2628 | .fallocate = ocfs2_fallocate, |
2636 | .clone_file_range = ocfs2_file_clone_range, | 2629 | .remap_file_range = ocfs2_remap_file_range, |
2637 | .dedupe_file_range = ocfs2_file_dedupe_range, | ||
2638 | }; | 2630 | }; |
2639 | 2631 | ||
2640 | const struct file_operations ocfs2_dops_no_plocks = { | 2632 | const struct file_operations ocfs2_dops_no_plocks = { |