Open unquietwiki opened 5 years ago
Some of the operations are inherently sequential so the potential gains from parallelism are limited. This would be possible in some cases to split the parsing part and callbacks that eg. create files. Error handling of the asynchronous calls becomes harder.
In case of receive I don't see much potential gain, the parsing overhead is really small and the file operations are executed one after another. They touch the same filesystem so serialization still happens in kernel. There might be some gain, I can't tell for sure just by looking at the code. Prototype and analysis would be needed.
What about compression , crc32c and threading?
For btrfs-image we're already multi-threading, especially for compression.
For btrfs-check, no, please no. We're far from being fully functional and chasing limited performance gain can easily screw up performance.
IMHO, only compression/decompress can take advantage, while btrfs-progs doesn't really do compression/decompression except btrfs-image, so we won't get much improvement.
@adam900710 @Gatak @kdave Based on the multi-TB recover process I've had running, the threading would be useful for the restore function; especially if it's waiting for certain files to decompress & de-duplicate, or restoring multiple smaller files. If there was a way to have btrfs-progs manage the compression level of files en masse, as you suggested; then threading would be good there as well. I haven't used the send or receive functions; that might benefit alongside how recover works?
https://en.wikipedia.org/wiki/POSIX_Threads
Not entirely sure how to go about it (currently), but it might knock a few days off longer operations by being able to queue up several files at a time to be worked on for things like send, restore, and rescue.