Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions drivers/td-ctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ __xenio_blkif_get_requests(struct td_xenblkif * const blkif,

xenio_blkif_get_request(blkif, dst, rc);

if (unlikely(dst->operation == BLKIF_OP_WRITE_BARRIER))
if (unlikely(dst->operation == BLKIF_OP_WRITE_BARRIER ||
dst->operation == BLKIF_OP_FLUSH_DISKCACHE))
barrier = true;
}

Expand Down Expand Up @@ -278,7 +279,8 @@ xenio_blkif_get_requests(struct td_xenblkif * const blkif,

n += __xenio_blkif_get_requests(blkif, reqs + n, count - n);

if (unlikely(n && reqs[(n - 1)]->operation == BLKIF_OP_WRITE_BARRIER))
if (unlikely(n && (reqs[(n - 1)]->operation == BLKIF_OP_WRITE_BARRIER ||
reqs[(n - 1)]->operation == BLKIF_OP_FLUSH_DISKCACHE)))
break;

} while (1);
Expand Down Expand Up @@ -327,8 +329,8 @@ tapdisk_xenio_ctx_process_ring(struct td_xenblkif *blkif,
limit -= n_reqs;
final = 1;

if (unlikely(reqs[(n_reqs - 1)]->operation ==
BLKIF_OP_WRITE_BARRIER)) {
if (unlikely(reqs[(n_reqs - 1)]->operation == BLKIF_OP_WRITE_BARRIER ||
reqs[(n_reqs - 1)]->operation == BLKIF_OP_FLUSH_DISKCACHE)) {
ASSERT(!blkif->barrier.msg);
blkif->barrier.msg = reqs[(n_reqs - 1)];
blkif->barrier.io_done = false;
Expand Down
9 changes: 6 additions & 3 deletions drivers/td-req.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,9 @@ tapdisk_xenblkif_complete_request(struct td_xenblkif * const blkif,

depth++;

processing_barrier_message =
tapreq->msg.operation == BLKIF_OP_WRITE_BARRIER;
processing_barrier_message = (
tapreq->msg.operation == BLKIF_OP_WRITE_BARRIER ||
tapreq->msg.operation == BLKIF_OP_FLUSH_DISKCACHE);

/*
* If a barrier request completes, check whether it's an I/O completion
Expand Down Expand Up @@ -763,6 +764,7 @@ tapdisk_xenblkif_make_vbd_request(struct td_xenblkif * const blkif,
break;
case BLKIF_OP_WRITE:
case BLKIF_OP_WRITE_BARRIER:
case BLKIF_OP_FLUSH_DISKCACHE:
if (likely(blkif->stats.xenvbd))
blkif->stats.xenvbd->st_wr_req++;
if (likely(blkif->vbd_stats.stats))
Expand All @@ -783,7 +785,8 @@ tapdisk_xenblkif_make_vbd_request(struct td_xenblkif * const blkif,
* Check that the number of segments is sane.
*/
if (unlikely((tapreq->msg.nr_segments == 0 &&
tapreq->msg.operation != BLKIF_OP_WRITE_BARRIER) ||
(tapreq->msg.operation != BLKIF_OP_WRITE_BARRIER &&
tapreq->msg.operation != BLKIF_OP_FLUSH_DISKCACHE)) ||
tapreq->msg.nr_segments > BLKIF_MMAX_SEGMENTS_PER_REQUEST)) {
RING_ERR(blkif, "req %lu: bad number of segments in request (%d)\n",
tapreq->msg.id, tapreq->msg.nr_segments);
Expand Down
6 changes: 6 additions & 0 deletions tapback/frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,12 @@ connect_frontend(vbd_t *device) {
break;
}

if ((err = tapback_device_printf(device, xst, "feature-flush-cache", true,
"%d", 1))) {
WARN(device, "failed to write feature-flush-cache: %s\n", strerror(-err));
break;
}

if ((err = tapback_device_printf(device, xst, "sector-size", true,
"%u", device->sector_size))) {
WARN(device, "failed to write sector-size: %s\n", strerror(-err));
Expand Down