Commit 971e395e authored by Mike Rapoport's avatar Mike Rapoport Committed by Andrei Vagin

lazy-pages: rename iov->*base to iov->*start

Signed-off-by: 's avatarMike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 8e2f9574
...@@ -63,9 +63,9 @@ static mutex_t *lazy_sock_mutex; ...@@ -63,9 +63,9 @@ static mutex_t *lazy_sock_mutex;
struct lazy_iov { struct lazy_iov {
struct list_head l; struct list_head l;
unsigned long base; /* run-time start address, tracks remaps */ unsigned long start; /* run-time start address, tracks remaps */
unsigned long end; /* run-time end address, tracks remaps */ unsigned long end; /* run-time end address, tracks remaps */
unsigned long img_base; /* start address at the dump time */ unsigned long img_start; /* start address at the dump time */
bool queued; bool queued;
}; };
...@@ -384,7 +384,7 @@ static struct lazy_iov *find_iov(struct lazy_pages_info *lpi, ...@@ -384,7 +384,7 @@ static struct lazy_iov *find_iov(struct lazy_pages_info *lpi,
struct lazy_iov *iov; struct lazy_iov *iov;
list_for_each_entry(iov, &lpi->iovs, l) list_for_each_entry(iov, &lpi->iovs, l)
if (addr >= iov->base && addr < iov->end) if (addr >= iov->start && addr < iov->end)
return iov; return iov;
return NULL; return NULL;
...@@ -398,8 +398,8 @@ static int split_iov(struct lazy_iov *iov, unsigned long addr) ...@@ -398,8 +398,8 @@ static int split_iov(struct lazy_iov *iov, unsigned long addr)
if (!new) if (!new)
return -1; return -1;
new->base = addr; new->start = addr;
new->img_base = iov->img_base + addr - iov->base; new->img_start = iov->img_start + addr - iov->start;
new->end = iov->end; new->end = iov->end;
iov->end = addr; iov->end = addr;
list_add(&new->l, &iov->l); list_add(&new->l, &iov->l);
...@@ -417,14 +417,14 @@ static int copy_iovs(struct lazy_pages_info *src, struct lazy_pages_info *dst) ...@@ -417,14 +417,14 @@ static int copy_iovs(struct lazy_pages_info *src, struct lazy_pages_info *dst)
if (!new) if (!new)
return -1; return -1;
new->base = iov->base; new->start = iov->start;
new->img_base = iov->img_base; new->img_start = iov->img_start;
new->end = iov->end; new->end = iov->end;
list_add_tail(&new->l, &dst->iovs); list_add_tail(&new->l, &dst->iovs);
if (new->end - new->base > max_iov_len) if (new->end - new->start > max_iov_len)
max_iov_len = new->end - new->base; max_iov_len = new->end - new->start;
} }
if (posix_memalign(&dst->buf, PAGE_SIZE, max_iov_len)) if (posix_memalign(&dst->buf, PAGE_SIZE, max_iov_len))
...@@ -446,7 +446,7 @@ static int drop_iovs(struct lazy_pages_info *lpi, unsigned long addr, int len) ...@@ -446,7 +446,7 @@ static int drop_iovs(struct lazy_pages_info *lpi, unsigned long addr, int len)
struct lazy_iov *iov, *n; struct lazy_iov *iov, *n;
list_for_each_entry_safe(iov, n, &lpi->iovs, l) { list_for_each_entry_safe(iov, n, &lpi->iovs, l) {
unsigned long start = iov->base; unsigned long start = iov->start;
unsigned long end = iov->end; unsigned long end = iov->end;
if (len <= 0 || addr + len < start) if (len <= 0 || addr + len < start)
...@@ -464,15 +464,15 @@ static int drop_iovs(struct lazy_pages_info *lpi, unsigned long addr, int len) ...@@ -464,15 +464,15 @@ static int drop_iovs(struct lazy_pages_info *lpi, unsigned long addr, int len)
/* /*
* The range completely fits into the current IOV. * The range completely fits into the current IOV.
* If addr equals iov_base we just "drop" the * If addr equals iov_start we just "drop" the
* beginning of the IOV. Otherwise, we make the IOV to * beginning of the IOV. Otherwise, we make the IOV to
* end at addr, and add a new IOV start starts at * end at addr, and add a new IOV start starts at
* addr + len. * addr + len.
*/ */
if (addr + len < end) { if (addr + len < end) {
if (addr == start) { if (addr == start) {
iov->base += len; iov->start += len;
iov->img_base += len; iov->img_start += len;
} else { } else {
if (split_iov(iov, addr + len)) if (split_iov(iov, addr + len))
return -1; return -1;
...@@ -483,7 +483,7 @@ static int drop_iovs(struct lazy_pages_info *lpi, unsigned long addr, int len) ...@@ -483,7 +483,7 @@ static int drop_iovs(struct lazy_pages_info *lpi, unsigned long addr, int len)
/* /*
* The range spawns beyond the end of the current IOV. * The range spawns beyond the end of the current IOV.
* If addr equals iov_base we just "drop" the entire * If addr equals iov_start we just "drop" the entire
* IOV. Otherwise, we cut the beginning of the IOV * IOV. Otherwise, we cut the beginning of the IOV
* and continue to the next one with the updated range * and continue to the next one with the updated range
*/ */
...@@ -512,15 +512,15 @@ static int remap_iovs(struct lazy_pages_info *lpi, unsigned long from, ...@@ -512,15 +512,15 @@ static int remap_iovs(struct lazy_pages_info *lpi, unsigned long from,
if (from >= iov->end) if (from >= iov->end)
continue; continue;
if (len <= 0 || from + len < iov->base) if (len <= 0 || from + len < iov->start)
break; break;
if (from < iov->base) { if (from < iov->start) {
len -= (iov->base - from); len -= (iov->start - from);
from = iov->base; from = iov->start;
} }
if (from > iov->base) { if (from > iov->start) {
if (split_iov(iov, from)) if (split_iov(iov, from))
return -1; return -1;
list_safe_reset_next(iov, n, l); list_safe_reset_next(iov, n, l);
...@@ -533,22 +533,22 @@ static int remap_iovs(struct lazy_pages_info *lpi, unsigned long from, ...@@ -533,22 +533,22 @@ static int remap_iovs(struct lazy_pages_info *lpi, unsigned long from,
list_safe_reset_next(iov, n, l); list_safe_reset_next(iov, n, l);
} }
/* here we have iov->base = from, iov->end <= from + len */ /* here we have iov->start = from, iov->end <= from + len */
from = iov->end; from = iov->end;
len -= iov->end - iov->base; len -= iov->end - iov->start;
iov->base += off; iov->start += off;
iov->end += off; iov->end += off;
list_move_tail(&iov->l, &remaps); list_move_tail(&iov->l, &remaps);
} }
list_for_each_entry_safe(iov, n, &remaps, l) { list_for_each_entry_safe(iov, n, &remaps, l) {
list_for_each_entry(p, &lpi->iovs, l) { list_for_each_entry(p, &lpi->iovs, l) {
if (iov->base < p->base) { if (iov->start < p->start) {
list_move_tail(&iov->l, &p->l); list_move_tail(&iov->l, &p->l);
break; break;
} }
if (list_is_last(&p->l, &lpi->iovs) && if (list_is_last(&p->l, &lpi->iovs) &&
iov->base > p->base) { iov->start > p->start) {
list_move(&iov->l, &p->l); list_move(&iov->l, &p->l);
break; break;
} }
...@@ -598,9 +598,9 @@ static int collect_iovs(struct lazy_pages_info *lpi) ...@@ -598,9 +598,9 @@ static int collect_iovs(struct lazy_pages_info *lpi)
goto free_iovs; goto free_iovs;
len = min_t(uint64_t, end, vma->end) - start; len = min_t(uint64_t, end, vma->end) - start;
iov->base = start; iov->start = start;
iov->img_base = start; iov->img_start = start;
iov->end = iov->base + len; iov->end = iov->start + len;
list_add_tail(&iov->l, &lpi->iovs); list_add_tail(&iov->l, &lpi->iovs);
if (len > max_iov_len) if (len > max_iov_len)
...@@ -861,7 +861,7 @@ static bool is_iov_queued(struct lazy_pages_info *lpi, struct lazy_iov *iov) ...@@ -861,7 +861,7 @@ static bool is_iov_queued(struct lazy_pages_info *lpi, struct lazy_iov *iov)
struct lp_req *req; struct lp_req *req;
list_for_each_entry(req, &lpi->reqs, l) list_for_each_entry(req, &lpi->reqs, l)
if (req->addr >= iov->base && req->addr < iov->end) if (req->addr >= iov->start && req->addr < iov->end)
return true; return true;
return false; return false;
...@@ -884,9 +884,9 @@ static int handle_remaining_pages(struct lazy_pages_info *lpi) ...@@ -884,9 +884,9 @@ static int handle_remaining_pages(struct lazy_pages_info *lpi)
if (!req) if (!req)
return -1; return -1;
req->addr = iov->base; req->addr = iov->start;
req->img_addr = iov->img_base; req->img_addr = iov->img_start;
req->len = iov->end - iov->base; req->len = iov->end - iov->start;
list_add(&req->l, &lpi->reqs); list_add(&req->l, &lpi->reqs);
iov->queued = true; iov->queued = true;
...@@ -1034,7 +1034,7 @@ static int handle_page_fault(struct lazy_pages_info *lpi, struct uffd_msg *msg) ...@@ -1034,7 +1034,7 @@ static int handle_page_fault(struct lazy_pages_info *lpi, struct uffd_msg *msg)
if (!req) if (!req)
return -1; return -1;
req->addr = address; req->addr = address;
req->img_addr = iov->img_base + (address - iov->base); req->img_addr = iov->img_start + (address - iov->start);
req->len = PAGE_SIZE; req->len = PAGE_SIZE;
list_add(&req->l, &lpi->reqs); list_add(&req->l, &lpi->reqs);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment