On Mon, Nov 9, 2015 at 6:29 PM, Karel Zak <kzak@xxxxxxxxxx> wrote: > On Sat, Nov 07, 2015 at 08:40:16AM +0800, Ming Lei wrote: >> The loop direct I/O patches[1] have been merged to linus kernel tree >> and will be released in v4.4. >> >> So the two patches provide interfaces for using direct IO/AIO >> in losetup. > > Thanks! > >> include/loopdev.h | 4 ++++ >> lib/loopdev.c | 40 ++++++++++++++++++++++++++++++++++++++++ >> sys-utils/losetup.c | 30 +++++++++++++++++++++++++++--- >> 3 files changed, 71 insertions(+), 3 deletions(-) >> >> [1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=bc07c10a3603a5ab3ef01ba42b3d41f9ac63d1b6 > > If I read correctly the kernel code than LO_FLAGS_DIRECT_IO is not > possible to use when initialize loop device by LOOP_SET_FD ioctl. I > need extra LOOP_SET_DIRECT_IO ioctl. Why? > > Why kernel function loop_set_fd() does not initialize lo->use_dio > according to "lo_flags & LO_FLAGS_DIRECT_IO" as we use for another > loopdev stuff? See for example LO_FLAGS_PARTSCAN. Would be possible > to improve kernel a little bit? One case we need to support is 'mount -o loop', which is a bit different with PARTSCAN. > > > Now you have to use two commands (ioctls): > > # losetup /dev/loop0 file.img > # losetup --direct-io 1 /dev/loop0 > > It's fine to use --direct-io as toggle, but it would be nice to > support it also when initialize the device. OK, looks a good idea, but we still need to support the standalone command for direct-io for the case of 'mount -o loop'. > > Karel > > > -- > Karel Zak <kzak@xxxxxxxxxx> > http://karelzak.blogspot.com -- Ming Lei -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html