Skip to contentSkip to conversation

xenblk: Add O_DIRECT and O_SYNC support.

PATCH Joe Jin 2 participants 2 messages Nov 5, 2008 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): C535B4C2.1ED81%[email protected]

Joe Jin

author
#2 lore raw
Quoted 5 lines
Quoted 4 lines

To direct-io answer is yes for request have marked if write request with O_DIRECT flag, but to O_SYNC, filesystem implentation it at filesystem, layer, I think do not touch filesystem codes to implement O_SYNC support is impossible.

Quoted 9 lines

O_DIRECT has no meaning really across the xenblk interface. The intention is that blkback talks at a raw block device below the buffer cache anyway.

For O_SYNC it can be implemented by pushing out all I/Os into the ring buffer and then wait for all required responses. Why do you think that doesn't work? Indeed it should work already if such logic exists in the generic Linux block layer, since blkfront notifies that layer as responses come in from blkback.

Do you think when xenblk backend make_reponse() means the request have commited to disk?
We have did a sample testing and found without BI_RW_SYNC flag setted, either O_DIRECT or O_SYNC flag, when vm crashed/power outage, lots of data lost, sometimes more than 1M data lost, that means vm under high data lost risk. With BI_RW_SYNC flag when call submit_bio, open file with O_DIRECT or O_SYNC flag, could sync data very well.

Thanks,
Joe

#3 lore raw
Quoted 9 lines · Joe Jin
Quoted 9 lines

O_DIRECT has no meaning really across the xenblk interface. The intention is that blkback talks at a raw block device below the buffer cache anyway.

For O_SYNC it can be implemented by pushing out all I/Os into the ring buffer and then wait for all required responses. Why do you think that doesn't work? Indeed it should work already if such logic exists in the generic Linux block layer, since blkfront notifies that layer as responses come in from blkback.

Quoted 7 lines

Do you think when xenblk backend make_reponse() means the request have commited to disk?
We have did a sample testing and found without BI_RW_SYNC flag setted, either O_DIRECT or O_SYNC flag, when vm crashed/power outage, lots of data lost, sometimes more than 1M data lost, that means vm under high data lost risk. With BI_RW_SYNC flag when call submit_bio, open file with O_DIRECT or O_SYNC flag, could sync data very well.

What's the vbd type in this case: raw partition, lvm, qcow file, ...?

The existing BLKIF_OP_WRITE_BARRIER and BLKIF_OP_FLUSH_DISKCACHE should suffice to implement O_SYNC on the blkfront side, I think. O_DIRECT doesn't mean writes are synchronous to the platters -- just means the buffer cache is bypassed -- which should generally be the case on the blkback side always anyway.

-- Keir