Message ID | 1522400003-11319-1-git-send-email-yangx.jy@cn.fujitsu.com |
---|---|
State | Changes Requested |
Headers | show |
Series | [1/2] syscalls/preadv01: Run test for all filesystems | expand |
Hi! Looking at the test running it for all filesystems would not make much sense as it is since as far as I can tell: 1) setup() creates a file and writes data to it - dirty pagecache record is created 2) test() reads data from the file - kernel will copy the data from pagecache 3) test library cleanup will umount() the device - dirty pagecache is written at this point So we will not reach any filesystem specific code at all. I guess that we may fix that by opening second file descriptor with O_DIRECT which would bypass pagecache so each read/write request would trigger I/O request from the block device.
On 2018/04/05 17:52, Cyril Hrubis wrote: > Hi! > Looking at the test running it for all filesystems would not make much > sense as it is since as far as I can tell: > > 1) setup() creates a file and writes data to it > - dirty pagecache record is created > > 2) test() reads data from the file > - kernel will copy the data from pagecache > > 3) test library cleanup will umount() the device > - dirty pagecache is written at this point > > So we will not reach any filesystem specific code at all. > > I guess that we may fix that by opening second file descriptor with > O_DIRECT which would bypass pagecache so each read/write request would > trigger I/O request from the block device. Hi Cyril, Sorry, i ignored the fact that they use pagecache. Can we just keep them and add two new tests as you suggested? Thanks, Xiao Yang
Hi! > > Looking at the test running it for all filesystems would not make much > > sense as it is since as far as I can tell: > > > > 1) setup() creates a file and writes data to it > > - dirty pagecache record is created > > > > 2) test() reads data from the file > > - kernel will copy the data from pagecache > > > > 3) test library cleanup will umount() the device > > - dirty pagecache is written at this point > > > > So we will not reach any filesystem specific code at all. > > > > I guess that we may fix that by opening second file descriptor with > > O_DIRECT which would bypass pagecache so each read/write request would > > trigger I/O request from the block device. > Hi Cyril, > > Sorry, i ignored the fact that they use pagecache. > Can we just keep them and add two new tests as you suggested? I was simply thinking about opening second fd with O_DIRECT in the test setup and running the test twice, once for the regular fd and once for the O_DIRECT one, however creating new test would work as well and may be even cleaner solution.
diff --git a/testcases/kernel/syscalls/preadv/preadv01.c b/testcases/kernel/syscalls/preadv/preadv01.c index 5ee27fb..1f3f714 100644 --- a/testcases/kernel/syscalls/preadv/preadv01.c +++ b/testcases/kernel/syscalls/preadv/preadv01.c @@ -30,6 +30,8 @@ #include "preadv.h" #define CHUNK 64 +#define MNTPOINT "mntpoint" +#define FNAME MNTPOINT"/file" static int fd; static char buf[CHUNK]; @@ -97,7 +99,7 @@ void setup(void) { char buf[CHUNK]; - fd = SAFE_OPEN("file", O_RDWR | O_CREAT, 0644); + fd = SAFE_OPEN(FNAME, O_RDWR | O_CREAT, 0644); memset(buf, 'a', sizeof(buf)); SAFE_WRITE(1, fd, buf, sizeof(buf)); @@ -119,4 +121,7 @@ static struct tst_test test = { .test = verify_preadv, .min_kver = "2.6.30", .needs_tmpdir = 1, + .mntpoint = MNTPOINT, + .mount_device = 1, + .all_filesystems = 1, };
Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com> --- testcases/kernel/syscalls/preadv/preadv01.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)