Use sync_file_range() instead of fsync(), sync()
Posted: Fri Jun 15, 2012 8:51 pm
Today I tried using MakeMKV to convert some .iso images into episode files, all on a single 2TB drive. At the same time, I have a massive filesystem copy happening between two other drives.
MakeMKV is horrendously slow in this situation, and when it gets to almost the end it just sits there with all three drives (including the two unrelated ones) busy as heck.
I strongly suspect the culprit at the end to be MakeMKV invoking sync(), which won't complete because of all of the unrelated I/O that is happening in the filesystem copies.
MakeMKV should not use sync(). If anything (debateable), it should use fsync(fd) on the specific files it is writing to. Or even better, use sync_file_range().
Performance would be much improved.
If I had the source, I'd happily fix this and send you a patch.
Cheers
MakeMKV is horrendously slow in this situation, and when it gets to almost the end it just sits there with all three drives (including the two unrelated ones) busy as heck.
I strongly suspect the culprit at the end to be MakeMKV invoking sync(), which won't complete because of all of the unrelated I/O that is happening in the filesystem copies.
MakeMKV should not use sync(). If anything (debateable), it should use fsync(fd) on the specific files it is writing to. Or even better, use sync_file_range().
Performance would be much improved.
If I had the source, I'd happily fix this and send you a patch.
Cheers