Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--is-reflink gets stuck in holes #529

Closed
cebtenzzre opened this issue Sep 16, 2021 · 0 comments · May be fixed by #531
Closed

--is-reflink gets stuck in holes #529

cebtenzzre opened this issue Sep 16, 2021 · 0 comments · May be fixed by #531
Labels

Comments

@cebtenzzre
Copy link
Collaborator

Description

rmlint --is-reflink does redundant work when met with a hole in a file.

Steps to reproduce

Build rmlint from the develop branch with _RM_OFFSET_DEBUG=1 and fixes for #527 and #528 applied.
Then run these commands:

$ dd if=/dev/urandom of=foo bs=100K oflag=sync count=1
$ dd if=/dev/urandom of=foo bs=100K oflag=sync count=2 seek=4
$ cp --reflink foo bar
$ filefrag -vb1 foo bar
Filesystem type is: 9123683e
File size of foo is 614400 (614400 blocks of 1 bytes)
 ext:     logical_offset:        physical_offset: length:   expected: flags:
   0:        0..  102399: 699643879424..699643981823: 102400:             shared
   1:   409600..  511999: 700793454592..700793556991: 102400: 699644289024: shared
   2:   512000..  614399: 700861808640..700861911039: 102400: 700793556992: last,shared,eof
foo: 3 extents found
File size of bar is 614400 (614400 blocks of 1 bytes)
 ext:     logical_offset:        physical_offset: length:   expected: flags:
   0:        0..  102399: 699643879424..699643981823: 102400:             shared
   1:   409600..  511999: 700793454592..700793556991: 102400: 699644289024: shared
   2:   512000..  614399: 700861808640..700861911039: 102400: 700793556992: last,shared,eof
bar: 3 extents found
$ rmlint --is-reflink -vv foo bar
DEBUG: Testing if foo is clone of bar
DEBUG: Checking link type for foo vs bar
DEBUG: rm_offset_get_fiemap: fd=3, n_extents=1, file_offset=0
DEBUG: rm_offset_get_fiemap: fd=3, n_extents=1, file_offset=102400
DEBUG: rm_offset_get_fiemap: fd=4, n_extents=1, file_offset=0
DEBUG: rm_offset_get_fiemap: fd=4, n_extents=1, file_offset=102400
DEBUG: Offsets match at fd1=3, fd2=4, logical=0, physical=699643879424
DEBUG: rm_offset_get_fiemap: fd=3, n_extents=1, file_offset=102400
DEBUG: rm_offset_get_fiemap: fd=3, n_extents=1, file_offset=204800
DEBUG: rm_offset_get_fiemap: fd=4, n_extents=1, file_offset=102400
DEBUG: rm_offset_get_fiemap: fd=4, n_extents=1, file_offset=204800
DEBUG: Offsets match at fd1=3, fd2=4, logical=102400, physical=700793454592
DEBUG: rm_offset_get_fiemap: fd=3, n_extents=1, file_offset=204800
DEBUG: rm_offset_get_fiemap: fd=3, n_extents=1, file_offset=307200
DEBUG: rm_offset_get_fiemap: fd=4, n_extents=1, file_offset=204800
DEBUG: rm_offset_get_fiemap: fd=4, n_extents=1, file_offset=307200
DEBUG: Offsets match at fd1=3, fd2=4, logical=204800, physical=700793454592
DEBUG: rm_offset_get_fiemap: fd=3, n_extents=1, file_offset=307200
DEBUG: rm_offset_get_fiemap: fd=3, n_extents=1, file_offset=409600
DEBUG: rm_offset_get_fiemap: fd=4, n_extents=1, file_offset=307200
DEBUG: rm_offset_get_fiemap: fd=4, n_extents=1, file_offset=409600
DEBUG: Offsets match at fd1=3, fd2=4, logical=307200, physical=700793454592
DEBUG: rm_offset_get_fiemap: fd=3, n_extents=1, file_offset=409600
DEBUG: rm_offset_get_fiemap: fd=3, n_extents=1, file_offset=512000
DEBUG: rm_offset_get_fiemap: fd=4, n_extents=1, file_offset=409600
DEBUG: rm_offset_get_fiemap: fd=4, n_extents=1, file_offset=512000
DEBUG: Offsets match at fd1=3, fd2=4, logical=409600, physical=700793454592
DEBUG: rm_offset_get_fiemap: fd=3, n_extents=1, file_offset=512000
DEBUG: rm_offset_get_fiemap: fd=4, n_extents=1, file_offset=512000
DEBUG: Offsets match at fd1=3, fd2=4, logical=512000, physical=700861808640
DEBUG: Files are clones (share same data)
Link type for 'foo' and 'bar', result:
Reflink

Actual result

rmlint checks the physical offset of the second extent (700793454592) four times.

Expected result

rmlint checks each pair of offsets only once, for a total of three physical offset comparisons.

Versions

rmlint version 2.10.1 built from develop commit bdb591f, with _RM_OFFSET_DEBUG=1 and fixes for #527 and #528 applied.

cebtenzzre added a commit to cebtenzzre/rmlint that referenced this issue Sep 16, 2021
Holes are represented by logical gaps in the FIEMAP mapping. Summing the
extent lengths to get a file offset causes file_offset to get out of
sync. If the hole is smaller than the following extent, the next few
FIEMAP calls may return the same extent.

Fixes sahib#529
cebtenzzre added a commit to cebtenzzre/rmlint that referenced this issue Sep 25, 2021
Holes are represented by logical gaps in the FIEMAP mapping. Summing the
extent lengths to get a file offset causes file_offset to get out of
sync. If the hole is smaller than the following extent, the next few
FIEMAP calls may return the same extent.

Fixes sahib#529
cebtenzzre added a commit to cebtenzzre/rmlint that referenced this issue Sep 28, 2021
Holes are represented by logical gaps in the FIEMAP mapping. Summing the
extent lengths to get a file offset causes file_offset to get out of
sync. If the hole is smaller than the following extent, the next few
FIEMAP calls may return the same extent.

Fixes sahib#529
cebtenzzre added a commit to cebtenzzre/rmlint that referenced this issue Aug 7, 2022
Holes are represented by logical gaps in the FIEMAP mapping. Summing the
extent lengths to get a file offset causes file_offset to get out of
sync. If the hole is smaller than the following extent, the next few
FIEMAP calls may return the same extent.

Fixes sahib#529
@cebtenzzre cebtenzzre linked a pull request Aug 9, 2022 that will close this issue
@cebtenzzre cebtenzzre removed the has-pr label Aug 9, 2022
cebtenzzre added a commit to cebtenzzre/rmlint that referenced this issue Sep 18, 2022
Holes are represented by logical gaps in the FIEMAP mapping. Summing the
extent lengths to get a file offset causes file_offset to get out of
sync. If the hole is smaller than the following extent, the next few
FIEMAP calls may return the same extent.

Fixes sahib#529
cebtenzzre added a commit to cebtenzzre/rmlint that referenced this issue Feb 24, 2023
Holes are represented by logical gaps in the FIEMAP mapping. Summing the
extent lengths to get a file offset causes file_offset to get out of
sync. If the hole is smaller than the following extent, the next few
FIEMAP calls may return the same extent.

Fixes sahib#529
intelfx pushed a commit to intelfx/rmlint that referenced this issue Mar 9, 2023
Holes are represented by logical gaps in the FIEMAP mapping. Summing the
extent lengths to get a file offset causes file_offset to get out of
sync. If the hole is smaller than the following extent, the next few
FIEMAP calls may return the same extent.

Fixes sahib#529
intelfx pushed a commit to intelfx/rmlint that referenced this issue Mar 9, 2023
Holes are represented by logical gaps in the FIEMAP mapping. Summing the
extent lengths to get a file offset causes file_offset to get out of
sync. If the hole is smaller than the following extent, the next few
FIEMAP calls may return the same extent.

Fixes sahib#529
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant