iterate_xarray(): only of the first iteration we might get offset != 0
recalculating offset on each iteration is pointless - on all subsequent passes through the loop it will be zero anyway. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
+3
-3
@@ -70,9 +70,9 @@
|
|||||||
__label__ __out; \
|
__label__ __out; \
|
||||||
size_t __off = 0; \
|
size_t __off = 0; \
|
||||||
struct page *head = NULL; \
|
struct page *head = NULL; \
|
||||||
size_t offset; \
|
|
||||||
loff_t start = i->xarray_start + i->iov_offset; \
|
loff_t start = i->xarray_start + i->iov_offset; \
|
||||||
pgoff_t index = start >> PAGE_SHIFT; \
|
unsigned offset = start % PAGE_SIZE; \
|
||||||
|
pgoff_t index = start / PAGE_SIZE; \
|
||||||
int j; \
|
int j; \
|
||||||
\
|
\
|
||||||
XA_STATE(xas, i->xarray, index); \
|
XA_STATE(xas, i->xarray, index); \
|
||||||
@@ -89,7 +89,6 @@
|
|||||||
for (j = (head->index < index) ? index - head->index : 0; \
|
for (j = (head->index < index) ? index - head->index : 0; \
|
||||||
j < thp_nr_pages(head); j++) { \
|
j < thp_nr_pages(head); j++) { \
|
||||||
void *kaddr = kmap_local_page(head + j); \
|
void *kaddr = kmap_local_page(head + j); \
|
||||||
offset = (start + __off) % PAGE_SIZE; \
|
|
||||||
base = kaddr + offset; \
|
base = kaddr + offset; \
|
||||||
len = PAGE_SIZE - offset; \
|
len = PAGE_SIZE - offset; \
|
||||||
len = min(n, len); \
|
len = min(n, len); \
|
||||||
@@ -100,6 +99,7 @@
|
|||||||
n -= len; \
|
n -= len; \
|
||||||
if (left || n == 0) \
|
if (left || n == 0) \
|
||||||
goto __out; \
|
goto __out; \
|
||||||
|
offset = 0; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
__out: \
|
__out: \
|
||||||
|
|||||||
Reference in New Issue
Block a user