int ret;
/*
- * BLKDISCARD goes straight to disk and doesn't do anything
+ * BLKZEROOUT goes straight to disk and doesn't do anything
* about dirty buffers. This means we need to flush so that
*
* write 0..3M
*
* returns "data 0000 data" rather than "data data data" in
* case 1..2M was cached.
+ *
+ * Note: These cache coherency issues are supposed to be fixed
+ * in recent kernels.
*/
ret = __krbd_flush(ctx, true);
if (ret < 0)
return ret;
/*
- * off and len must be 512-byte aligned, otherwise BLKDISCARD
+ * off and len must be 512-byte aligned, otherwise BLKZEROOUT
* will fail with -EINVAL. This means that -K (enable krbd
* mode) requires -h 512 or similar.
*/
- if (ioctl(ctx->krbd_fd, BLKDISCARD, &range) < 0) {
+ if (ioctl(ctx->krbd_fd, BLKZEROOUT, &range) < 0) {
ret = -errno;
- prt("BLKDISCARD(%llu, %llu) failed\n", off, len);
+ prt("BLKZEROOUT(%llu, %llu) failed\n", off, len);
return ret;
}