Skip to contentSkip to conversation

Is LO_FLAGS_DIRECT_IO by default a good idea?

DISCUSSION Lennart Poettering 5 participants 6 messages Oct 18, 2021 – Oct 25, 2021 Block layer

lore
Share & tools
lore
#0 lore raw

eMing, Christoph, Jens!

Ming, 5 years ago or so you added support for dio/aio for the loopback block device, i.e. LO_FLAGS_DIRECT_IO. As I understood it's supposed to improve performance of loopback block devices substantially. I noticed that there's various software that enables it by default (Android, Docker), but a lot of other candidates currently do not (util-linux, Ubuntu Snaps, various systemd tools). We recently got a request to enable it by default in systemd, but information is scarce on the precise effect of enabling this, and whether there are any drawbacks.

So my question really is just: is this a flag we should all just enable by default? Is there any reason not to enable it? Should util-linux' losetup defaults be changed regarding this?

A brief answer like "yes, please, enable by default" would already make me happy.

Thank you,

Lennart

--
Lennart Poettering, Berlin

#1 lore raw
Quoted 2 lines · Lennart Poettering

A brief answer like "yes, please, enable by default" would already make me happy.

I thikn enabling it by default is a good idea. The only good use case I can think of for using buffered I/O is when the image has a smaller block size than supported on the host file.

#2 lore raw
Quoted 7 lines · Christoph Hellwig
Quoted 2 lines · Lennart Poettering

A brief answer like "yes, please, enable by default" would already make me happy.

I thikn enabling it by default is a good idea. The only good use case I can think of for using buffered I/O is when the image has a smaller block size than supported on the host file.

Excellent! Thanks for the answer!

Lennart

--
Lennart Poettering, Berlin

#3 lore raw
In reply to Christoph Hellwig
Quoted 7 lines · Christoph Hellwig
Quoted 2 lines · Lennart Poettering

A brief answer like "yes, please, enable by default" would already make me happy.

I thikn enabling it by default is a good idea. The only good use case I can think of for using buffered I/O is when the image has a smaller block size than supported on the host file.

Maybe we can enable it at default in kernel side, then fackback to buffered IO if DIO is failed.

thanks,
Ming

maintainer
#4 lore raw
Quoted 11 lines · Ming Lei
Quoted 7 lines · Christoph Hellwig
Quoted 2 lines · Lennart Poettering

A brief answer like "yes, please, enable by default" would already make me happy.

I thikn enabling it by default is a good idea. The only good use case I can think of for using buffered I/O is when the image has a smaller block size than supported on the host file.

Maybe we can enable it at default in kernel side, then fackback to buffered IO if DIO is failed.

Yes I think that's sane, pure DIO probably isn't a great idea by default. But if we have a sane fallback, then I do think it'd be the best way to run it.

Signature · 1 line
Jens Axboe
#5 lore raw
Quoted 10 lines · Jens Axboe
Quoted 9 lines · Ming Lei
Quoted 7 lines · Christoph Hellwig
Quoted 2 lines · Lennart Poettering

A brief answer like "yes, please, enable by default" would already make me happy.

I thikn enabling it by default is a good idea. The only good use case I can think of for using buffered I/O is when the image has a smaller block size than supported on the host file.

Quoted 6 lines
Quoted 2 lines

Maybe we can enable it at default in kernel side, then fackback to buffered IO if DIO is failed.

Yes I think that's sane, pure DIO probably isn't a great idea by default. But if we have a sane fallback, then I do think it'd be the best way to run it.

So, I can wait for kernel rather than enable it by default in losetup/mount, right? :-)

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com