read_cache_pages() also working copied from write_cache_pages()

- Need to remove old versions
- Need to merge the two.
- Need to investigate occasional page fault on NMOP sequence. (resembles an error ipc_extended test)
  Could be related to new page cache read/write routines.
This commit is contained in:
Bahadir Balban
2009-10-14 01:48:05 +03:00
parent ee2bf8e7f3
commit 3a3204986e
5 changed files with 92 additions and 24 deletions

View File

@@ -16,7 +16,7 @@ int small_io_test(void)
char strbuf[30];
char strbuf2[30];
char *path = "/text.txt";
// char stackbuf[PAGE_SIZE*2];
char stackbuf[PAGE_SIZE*2];
fd1 = open(path, O_TRUNC | O_RDWR | O_CREAT, S_IRWXU);
fd2 = open(path, O_RDWR, 0);
@@ -26,7 +26,7 @@ int small_io_test(void)
for (int i = 0; i < 4; i++) {
sprintf(strbuf, "%s%d", string, i);
printf("Writing to %s offset %x, string: %s\n",
test_printf("Writing to %s offset %x, string: %s\n",
path, i*PAGE_SIZE, strbuf);
lseek(fd1, i*PAGE_SIZE, SEEK_SET);
write(fd1, strbuf, strlen(strbuf) + 1);
@@ -38,19 +38,23 @@ int small_io_test(void)
sprintf(strbuf2, "%s%d", string, i);
lseek(fd2, i*PAGE_SIZE, SEEK_SET);
read(fd2, strbuf, 30);
printf("Read %s, offset %x as %s\n",
test_printf("Read %s, offset %x as %s\n",
path, i*PAGE_SIZE, strbuf);
if (strcmp(strbuf, strbuf2))
goto out_err;
}
#if 0
/* Now read into an unaligned buffer larger than page size */
lseek(fd2, 0, SEEK_SET);
read(fd2, stackbuf, PAGE_SIZE * 2);
printf("stackbuf beginning: %s\n second page beginning: %s\n",
stackbuf, &stackbuf[PAGE_SIZE]);
#endif
sprintf(strbuf2, "%s%d", string, 0);
if (strcmp(stackbuf, strbuf2))
goto out_err;
sprintf(strbuf2, "%s%d", string, 1);
if (strcmp(&stackbuf[PAGE_SIZE], strbuf2))
goto out_err;
close(fd2);

View File

@@ -17,7 +17,7 @@ int forktest(void)
/* 16 forks */
for (int i = 0; i < 1; i++) {
for (int i = 0; i < 3; i++) {
test_printf("%d: Forking...\n", getpid());
if (fork() < 0)
goto out_err;