Commit 4dbf0329 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 24826389
...@@ -218,7 +218,7 @@ int M(VMA *vma, pgoff_t idx) { return bitmap_test_bit(vma->page_ismappedv, idx) ...@@ -218,7 +218,7 @@ int M(VMA *vma, pgoff_t idx) { return bitmap_test_bit(vma->page_ismappedv, idx)
ok1((page)->refcnt == (pgrefcnt)); \ ok1((page)->refcnt == (pgrefcnt)); \
} while (0) } while (0)
/* check that fileh->pagemap[pgfosset] is empty */ /* check that fileh->pagemap[pgoffset] is empty */
#define __CHECK_NOPAGE(fileh, pgoffset) do { \ #define __CHECK_NOPAGE(fileh, pgoffset) do { \
ok1(!pagemap_get(&(fileh)->pagemap, (pgoffset))); \ ok1(!pagemap_get(&(fileh)->pagemap, (pgoffset))); \
} while (0) } while (0)
...@@ -259,16 +259,14 @@ void _assert_pagev(const char *subj, Page **vok, int nok, Page **pagev, int n, ...@@ -259,16 +259,14 @@ void _assert_pagev(const char *subj, Page **vok, int nok, Page **pagev, int n,
/* _check_mru checks that ram has MRU pages as specified by pagev */ /* _check_mru checks that ram has MRU pages as specified by pagev */
void _check_mru(RAM *ram, Page *mruok[], int nok, const char *func, const char *file, int line) { void _check_mru(RAM *ram, Page *mruok[], int nok, const char *func, const char *file, int line) {
Page **mruv = NULL, *page; Page **mruv = NULL;
int n = 0; int n = 0;
struct list_head *h; struct list_head *h;
// collect mruv // collect mruv
list_for_each_backwardly(h, &ram->lru_list) { list_for_each_backwardly(h, &ram->lru_list) {
page = list_entry(h, typeof(*page), lru);
n++;
mruv = realloc(mruv, n*sizeof(*mruv)); mruv = realloc(mruv, n*sizeof(*mruv));
mruv[n-1] = page; mruv[n++] = list_entry(h, Page, lru);
} }
_assert_pagev("check_mru", mruok, nok, mruv, n, func, file, line); _assert_pagev("check_mru", mruok, nok, mruv, n, func, file, line);
...@@ -283,18 +281,16 @@ void _check_mru(RAM *ram, Page *mruok[], int nok, const char *func, const char * ...@@ -283,18 +281,16 @@ void _check_mru(RAM *ram, Page *mruok[], int nok, const char *func, const char *
/* _check_dirty checks that fileh has dirty pages as specified. /* _check_dirty checks that fileh has dirty pages as specified.
* the orderof dirty list traversal is to go through most recently dirtied pages first */ * the order of dirty list traversal is to go through most recently dirtied pages first */
void _check_dirty(BigFileH *fileh, Page *dirtyok[], int nok, const char *func, const char *file, int line) { void _check_dirty(BigFileH *fileh, Page *dirtyok[], int nok, const char *func, const char *file, int line) {
Page **dirtyv = NULL, *page; Page **dirtyv = NULL;
int n = 0; int n = 0;
struct list_head *h; struct list_head *h;
// collect dirtyv // collect dirtyv
list_for_each_backwardly(h, &fileh->dirty_pages) { list_for_each_backwardly(h, &fileh->dirty_pages) {
page = list_entry(h, typeof(*page), in_dirty);
n++;
dirtyv = realloc(dirtyv, n*sizeof(*dirtyv)); dirtyv = realloc(dirtyv, n*sizeof(*dirtyv));
dirtyv[n-1] = page; dirtyv[n++] = list_entry(h, Page, in_dirty);
} }
_assert_pagev("check_dirty", dirtyok, nok, dirtyv, n, func, file, line); _assert_pagev("check_dirty", dirtyok, nok, dirtyv, n, func, file, line);
......
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