Commit b88272e3 authored by Julius Plenz's avatar Julius Plenz

Remove debugging code (use "cachestats" for that)

parent 0aa836ce
...@@ -106,29 +106,9 @@ static void store_pageinfo(int fd) ...@@ -106,29 +106,9 @@ static void store_pageinfo(int fd)
goto cleanup; goto cleanup;
if(mincore(file, st.st_size, pageinfo) == -1) if(mincore(file, st.st_size, pageinfo) == -1)
goto cleanup; goto cleanup;
fds[i].info = pageinfo; fds[i].info = pageinfo;
#if DEBUG
fprintf(stderr, "cache stats: ");
int j;
for(j=0; i<pages; i++) {
fprintf(stderr, "%c", (pageinfo[j] & 1) ? 'Y' : 'N');
}
fprintf(stderr, "\n");
int j;
for(j=0; j<pages; j++)
if(!(pageinfo[j] & 1))
break;
if(j == pages)
fprintf(stderr, "was fully in cache: %d: %d/%d\n", fd, j, pages);
else
fprintf(stderr, "was not fully in cache: %d: %d/%d\n", fd, j, pages);
#endif
munmap(file, st.st_size); munmap(file, st.st_size);
return; return;
cleanup: cleanup:
...@@ -142,6 +122,7 @@ static void store_pageinfo(int fd) ...@@ -142,6 +122,7 @@ static void store_pageinfo(int fd)
static void free_unclaimed_pages(int fd) static void free_unclaimed_pages(int fd)
{ {
int i, j; int i, j;
int start;
if(fd == -1) if(fd == -1)
return; return;
...@@ -154,7 +135,6 @@ static void free_unclaimed_pages(int fd) ...@@ -154,7 +135,6 @@ static void free_unclaimed_pages(int fd)
sync_if_writable(fd); sync_if_writable(fd);
int start;
start = j = 0; start = j = 0;
while(j < fds[i].nr_pages) { while(j < fds[i].nr_pages) {
if(fds[i].info[j] & 1) { if(fds[i].info[j] & 1) {
...@@ -168,7 +148,6 @@ static void free_unclaimed_pages(int fd) ...@@ -168,7 +148,6 @@ static void free_unclaimed_pages(int fd)
/* forget written contents that go beyond previous file size */ /* forget written contents that go beyond previous file size */
fadv_dontneed(fd, start < j ? start*PAGESIZE : fds[i].size, 0); fadv_dontneed(fd, start < j ? start*PAGESIZE : fds[i].size, 0);
if(fds[i].info)
free(fds[i].info); free(fds[i].info);
fds[i].fd = -1; fds[i].fd = -1;
} }
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