Commit 25f07b48 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 7bdbe18e
......@@ -1125,9 +1125,9 @@ void test_pagefault_savestate()
struct BigFileMMap {
BigFile;
int fd; /* fd of file to mmap */
int nstoreblk; /* number of times storeblk called */
// XXX nremmap + check
int nmunmap; /* ----//---- munmap called */
int nstoreblk; /* number of times storeblk called */
int nremmapblk; /* ----//---- remmap_blk_read called */
int nmunmap; /* ----//---- munmap called */
};
typedef struct BigFileMMap BigFileMMap;
......@@ -1183,6 +1183,7 @@ int mmapfile_remmap_blk_read(VMA *vma, BigFile *file, blk_t blk) {
uintptr_t addr = vma->addr_start + pgoff_invma*f->blksize;
void *mapped;
f->nremmapblk++;
mapped = mmap((void *)addr, 1*f->blksize, PROT_READ, MAP_SHARED | MAP_FIXED, f->fd, blk*f->blksize);
if (mapped == MAP_FAILED)
return -1;
......@@ -1250,6 +1251,7 @@ void test_file_access_mmapoverlay(void)
.file_ops = &mmapfile_ops,
.fd = fd,
.nstoreblk = 0,
.nremmapblk = 0,
.nmunmap = 0,
};
......@@ -1468,7 +1470,9 @@ void test_file_access_mmapoverlay(void)
/* discard - changes should go away */
diag("discard");
ok1(file.nremmapblk == 0);
fileh_dirty_discard(fh);
ok1(file.nremmapblk == 3); /* 3 previously dirty pages remmaped from base layer */
CHECK_NOPAGE( 100 );
......@@ -1532,10 +1536,12 @@ void test_file_access_mmapoverlay(void)
}
diag("writeout (store)");
file.nstoreblk = 0;
file.nremmapblk = 0;
mkdirty2(10);
file.nstoreblk = 0;
ok1(!fileh_dirty_writeout(fh, WRITEOUT_STORE));
ok1(file.nstoreblk == 2);
ok1(file.nstoreblk == 2);
ok1(file.nremmapblk == 0);
ok1( M(vma, 0)); CHECK_PAGE (page0, 100, PAGE_DIRTY, 1);
ok1(!M(vma, 1)); CHECK_NOPAGE( 101 );
......@@ -1563,9 +1569,11 @@ void test_file_access_mmapoverlay(void)
xmunmap(b2, PS);
diag("writeout (mark)");
file.nstoreblk = 0;
file.nstoreblk = 0;
file.nremmapblk = 0;
ok1(!fileh_dirty_writeout(fh, WRITEOUT_MARKSTORED));
ok1(file.nstoreblk == 0);
ok1(file.nstoreblk == 0);
ok1(file.nremmapblk == 1); /* only 1 (not 2) page was mmaped */
ok1(!M(vma, 0)); CHECK_NOPAGE( 100 );
ok1(!M(vma, 1)); CHECK_NOPAGE( 101 );
......@@ -1594,9 +1602,11 @@ void test_file_access_mmapoverlay(void)
diag("writeout (store+mark)");
mkdirty2(1000);
file.nstoreblk = 0;
file.nstoreblk = 0;
file.nremmapblk = 0;
ok1(!fileh_dirty_writeout(fh, WRITEOUT_STORE | WRITEOUT_MARKSTORED));
ok1(file.nstoreblk == 2);
ok1(file.nstoreblk == 2);
ok1(file.nremmapblk == 1); /* only 1 (not 2) page was mmaped */
ok1(!M(vma, 0)); CHECK_NOPAGE( 100 );
ok1(!M(vma, 1)); CHECK_NOPAGE( 101 );
......
......@@ -446,7 +446,7 @@ int fileh_dirty_writeout(BigFileH *fileh, enum WriteoutFlags flags)
/* wcfs: remmap RW pages to base layer
* !wcfs: page.state -> PAGE_LOADED and correct mappings RW -> R
*
* NOTE for transaction storage (ZODB and ZBigFile) storeblk creates
* NOTE for transactional storage (ZODB and ZBigFile) storeblk creates
* new transaction on database side, but does not update current DB
* connection to view that transaction. Thus if loadblk will be loaded
* with not-yet-resynced DB connection, it will return old - not stored
......
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