allisonkarlitskaya / cimg

1 stars 0 forks source link

More old python troubles #7

Open croissanne opened 3 years ago

croissanne commented 3 years ago
Traceback (most recent call last):
  File "/home/sanne/.local/bin/cimg", line 199, in <module>
    sys.exit(main())
  File "/home/sanne/.local/bin/cimg", line 194, in main
    args.func(args, None)
  File "/home/sanne/.local/bin/cimg", line 150, in cmd_download
    image_download.get_image(image.filename)
  File "/home/sanne/workstuff/cimg/image_download.py", line 422, in get_image
    download(destination, prefixes, path, ui)
  File "/home/sanne/workstuff/cimg/image_download.py", line 197, in download
    gather_blocks(destination, all_blocks)
  File "/home/sanne/workstuff/cimg/image_download.py", line 127, in gather_blocks
    os.copy_file_range(src.fileno(), result.fileno(), src_size, 0, start)
AttributeError: module 'os' has no attribute 'copy_file_range'
croissanne commented 3 years ago

:rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit: :rabbit:

allisonkarlitskaya commented 3 years ago

This code needs a bit of a rethink anyway: I'm not 100% sure if copy_file_range() will result in the use of reflinks on btrfs. Also: the fallocate() that we do here might actually break the reflinking.

allisonkarlitskaya commented 3 years ago

That being said, there is a tradeoff here probably, between performance (reflinks) and lower fragmentation (fallocate and copy).

Maybe we should construct the destination file at the same time as the blocks...