diff options
author | Ariel Miculas <ariel.miculas@gmail.com> | 2024-06-14 21:46:52 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-06-16 14:09:13 -0400 |
commit | 3a4a096cd27146ce0b66f0be29b1af7a50f7f789 (patch) | |
tree | 30454be14b68e9f3b177699541e667eecaae53cd | |
parent | ed675b8d641b70aef97e7e6cc996b98af075f3bf (diff) |
Fix incomplete file copy due to copy_data misuse
The copy_data function takes a start and an end parameter as the range
of bytes to copy, but it was called with a start and a length parameter.
This resulted in incomplete file copies. Fix it by passing the end of
the range instead of the length.
Signed-off-by: Ariel Miculas <ariel.miculas@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | c_src/posix_to_bcachefs.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/c_src/posix_to_bcachefs.c b/c_src/posix_to_bcachefs.c index 131913d1..c66b9734 100644 --- a/c_src/posix_to_bcachefs.c +++ b/c_src/posix_to_bcachefs.c @@ -288,7 +288,7 @@ static void copy_file(struct bch_fs *c, struct bch_inode_unpacked *dst, FIEMAP_EXTENT_NOT_ALIGNED| FIEMAP_EXTENT_DATA_INLINE))) { copy_data(c, dst, src_fd, e.fe_logical, - min(src_size - e.fe_logical, + e.fe_logical + min(src_size - e.fe_logical, e.fe_length)); continue; } @@ -299,7 +299,7 @@ static void copy_file(struct bch_fs *c, struct bch_inode_unpacked *dst, */ if (e.fe_physical < 1 << 20) { copy_data(c, dst, src_fd, e.fe_logical, - min(src_size - e.fe_logical, + e.fe_logical + min(src_size - e.fe_logical, e.fe_length)); continue; } |