Skip to content

Commit

Permalink
bcachefs: support REMAP_FILE_DEDUP in bch2_remap_file_range
Browse files Browse the repository at this point in the history
By removing the early-exit when REMAP_FILE_DEDUP is set, we should be
able to support the fideduperange ioctl, albeit less efficiently than if
we handled some of the extent locking and comparison logic inside
bcachefs.  Extent comparison logic already exists inside of
`__generic_remap_file_range_prep`.

Signed-off-by: Reed Riley <reed@riley.engineer>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
  • Loading branch information
reedriley authored and Kent Overstreet committed Jun 21, 2024
1 parent 4bf7b0d commit 8d67f57
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions fs/bcachefs/fs-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -867,9 +867,6 @@ loff_t bch2_remap_file_range(struct file *file_src, loff_t pos_src,
if (remap_flags & ~(REMAP_FILE_DEDUP|REMAP_FILE_ADVISORY))
return -EINVAL;

if (remap_flags & REMAP_FILE_DEDUP)
return -EOPNOTSUPP;

if ((pos_src & (block_bytes(c) - 1)) ||
(pos_dst & (block_bytes(c) - 1)))
return -EINVAL;
Expand Down Expand Up @@ -902,7 +899,8 @@ loff_t bch2_remap_file_range(struct file *file_src, loff_t pos_src,
if (ret)
goto err;

file_update_time(file_dst);
if (!(remap_flags & REMAP_FILE_DEDUP))
file_update_time(file_dst);

bch2_mark_pagecache_unallocated(src, pos_src >> 9,
(pos_src + aligned_len) >> 9);
Expand Down

0 comments on commit 8d67f57

Please sign in to comment.