fd = open("/dev/xzram0", O_RDWR); read(fd, buf, count); lseek(fd, 0, SEEK_SET); write(fd, wbuf, count);
count=4K,执行结果是内核先预读4个页面,然后写一个页面。
fd = open("/dev/xzram0", O_RDWR); write(fd, wbuf, count); lseek(fd, 0, SEEK_SET); read(fd, buf, count);
count=4K,执行结果是先写一个页面,读页面操作直接在页面缓冲层完成,没有提交到块设备层。