Skip to content

Commit

Permalink
Compute Total bytes deduped in default mode
Browse files Browse the repository at this point in the history
Until now, we skiped making use of bytes_deduped status code. This caused a bug
discussed here #30

Signed-off-by: Lakshmipathi <[email protected]>
  • Loading branch information
Lakshmipathi committed Aug 28, 2020
1 parent 6015ab7 commit 7b0cec0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions dduper
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ def ioctl_ficlonerange(dst_fd, s):
def ioctl_fideduperange(src_fd, s):

try:
ioctl(src_fd, FIDEDUPERANGE, s)
v = ioctl(src_fd, FIDEDUPERANGE, s)
_,_,_,_,_,_,_,bytes_dup,status,_ = struct.unpack("QQHHIqQQiH",v)
return bytes_dup,status
except Exception as e:
print("error({0})".format(e))

Expand Down Expand Up @@ -258,9 +260,9 @@ def do_dedupe(src_file, dst_file, dry_run):
s = struct.pack("QQHHIqQQiH", src_offset, src_len, 1,
0, 0, dst_fd, dst_offset,
bytes_deduped, status, 0)
ioctl_fideduperange(src_fd, s)
bytes_deduped,status = ioctl_fideduperange(src_fd, s)
total_bytes_deduped += bytes_deduped
# print("\n bytes_deduped=%s",bytes_deduped)
#print("\n bytes_deduped= %d %d " % (bytes_deduped, status))

print("Dedupe completed for " + src_file + ":" + dst_file)

Expand Down

0 comments on commit 7b0cec0

Please sign in to comment.