<table><tr><td style="">meven created this task.<br />meven triaged this task as "Normal" priority.<br />meven added projects: Frameworks, Dolphin.
</td></tr></table><br /><div><strong>TASK DESCRIPTION</strong><div><p>Our man file copy function has some glaring issues that I'd like to tackle in a few steps:</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">Split the sendfile and read/write code path to function, to make evolution easier</li>
<li class="remarkup-list-item">Then Make those function io calls  (read, write, sendfile) O_NONBLOCK and use select/poll freeing user space CPU time to for instance notify the user of progressand  and reducing chances of blocking in both ways (file io blocking or socket/ksmserver blocking)</li>
<li class="remarkup-list-item">Then make the sendFile/write operation O_DIRECT and O_SYNC (<a href="https://linux.die.net/man/2/open" class="remarkup-link" target="_blank" rel="noreferrer">https://linux.die.net/man/2/open</a>), perhaps by default, or option or depending on the fs destination. Fixing <a href="https://bugs.kde.org/show_bug.cgi?id=281270" class="remarkup-link" target="_blank" rel="noreferrer">https://bugs.kde.org/show_bug.cgi?id=281270</a> <tt style="background: #ebebeb; font-size: 13px;">Inconsistent notifications during/after file operations (copying, moving, deleting, compressing, extracting) depending on amount of data/items involved</tt> (another to fix this is to mount usb sticks with the sync mount option)</li>
</ul>

<p>Then if needed :</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">Tune the parameters of the sendFile code path to copy data by chunks bigger than 32kB, I am thinking 128/512 to keep granular progress reporting,</li>
<li class="remarkup-list-item">Tune the read/write (it reads and write by chunks of 32kB at the moment</li>
</ul>

<p>Bonus steps</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">Add a io_uring (<a href="https://lwn.net/Articles/778411/" class="remarkup-link" target="_blank" rel="noreferrer">https://lwn.net/Articles/778411/</a>) code path for recent linux kernels</li>
</ul>

<p>All of those steps should make the code more async, maintainable and performant, and fix a few longstanding bugs.</p>

<p>It should help on <br />
 *<tt style="background: #ebebeb; font-size: 13px;">Ridiculously slow file copy (multiple small files)</tt> <a href="https://bugs.kde.org/show_bug.cgi?id=342056" class="remarkup-link" target="_blank" rel="noreferrer">https://bugs.kde.org/show_bug.cgi?id=342056</a></p></div></div><br /><div><strong>TASK DETAIL</strong><div><a href="https://phabricator.kde.org/T12641">https://phabricator.kde.org/T12641</a></div></div><br /><div><strong>To: </strong>meven<br /><strong>Cc: </strong>apol, dfaure, Frameworks, Dolphin, ognarb, broulik, meven, pberestov, iasensio, fprice, LeGast00n, MrPepe, fbampaloukas, alexde, GB_2, Codezela, feverfew, michaelh, spoorun, navarromorales, firef, ngraham, andrebarros, bruns, emmanuelp, mikesomov<br /></div>