- } else {
- memcpy(pg->pg + pg_off, (data + buf_off), wr_bytes);
- pcache_set_dirty(pcache, pg);
-
- pg->len = pg_off + wr_bytes;
+ if (errno < (int)PAGE_SIZE) {
+ // EOF
+ len = MIN(len, buf_off + errno);
+ }
+ } else if (!pg) {
+ errno = inode->default_fops->write(inode, data, wr_bytes, fpos);
+ continue;