* \result > 0 Number of mirrors successfully copied
* \result < 0 The last seen error
*/
-ssize_t llapi_mirror_copy_many(int fd, unsigned int src, unsigned int *dst,
- size_t count)
+ssize_t llapi_mirror_copy_many(int fd, __u16 src, __u16 *dst, size_t count)
{
const size_t buflen = 4 * 1024 * 1024; /* 4M */
void *buf;
/* round up to page align to make direct IO happy.
* this implies the last segment to write. */
- to_write = (bytes_read + page_size - 1) & ~(page_size - 1);
+ to_write = ((bytes_read - 1) | (page_size - 1)) + 1;
for (i = 0; i < nr; i++) {
ssize_t written;