Fix assertion that checks that pages are consecutive to properly

handle bogus_page insertion(s).
This commit is contained in:
Gleb Smirnoff 2017-01-04 22:31:09 +00:00
parent bfc8c24c73
commit 1e0c121f3a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=311338

View File

@ -974,10 +974,14 @@ vnode_pager_generic_getpages(struct vnode *vp, vm_page_t *m, int count,
#ifdef INVARIANTS
KASSERT(bp->b_npages <= nitems(bp->b_pages),
("%s: buf %p overflowed", __func__, bp));
for (int j = 1; j < bp->b_npages; j++)
KASSERT(bp->b_pages[j]->pindex - 1 ==
bp->b_pages[j - 1]->pindex,
("%s: pages array not consecutive, bp %p", __func__, bp));
for (int j = 1, prev = 1; j < bp->b_npages; j++) {
if (bp->b_pages[j] == bogus_page)
continue;
KASSERT(bp->b_pages[j]->pindex - bp->b_pages[prev]->pindex ==
j - prev, ("%s: pages array not consecutive, bp %p",
__func__, bp));
prev = j;
}
#endif
/*