Core "disk file" reading code assumed that if the globally stored disk.offset
matches the desired offset, there is no reason to seek. This was probably done
to reduce seek overhead between consecutive reads. Unfortunately, the disk
writing code did not know about that optimization and left F->disk.offset
unchanged after writing.
This may have worked OK for UFS if it never writes to the file it reads from,
but it does not work for store modules that do both kinds of I/O at different
offsets of the same disk file.
TODO: Implement this optimization correctly or remove disk.offset.
PROF_start(diskHandleRead);
+#if WRITES_MAINTAIN_DISK_OFFSET
if (F->disk.offset != ctrl_dat->offset) {
+#else
+ {
+#endif
debugs(6, 3, "diskHandleRead: FD " << fd << " seeking to offset " << ctrl_dat->offset);
lseek(fd, ctrl_dat->offset, SEEK_SET); /* XXX ignore return? */
statCounter.syscalls.disk.seeks++;