pcache_set_dirty(pcache, pg);
+ pg->len = pg_off + wr_bytes;
buf_off += wr_bytes;
fpos += wr_bytes;
}
} else if (errno < 0) {
break;
}
+ pg->len = errno;
}
- uint32_t rd_bytes = MIN(PG_SIZE - pg_off, len - buf_off);
+ uint32_t rd_bytes = MIN(pg->len - pg_off, len - buf_off);
+
+ if (!rd_bytes)
+ break;
+
memcpy((data + buf_off), pg->pg + pg_off, rd_bytes);
buf_off += rd_bytes;