Whamcloud - gitweb
LU-11830 lov: avoid signed vs. unsigned comparison
[fs/lustre-release.git] / lustre / utils / liblustreapi_mirror.c
index 4a59b46..c7e5726 100644 (file)
@@ -252,7 +252,7 @@ ssize_t llapi_mirror_copy_many(int fd, unsigned int src, unsigned int *dst,
 
                /* 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;