<div dir="ltr">It turned out that I was looking at a 4.11.x kernel where it only has '--direct-io' but there was no '--sector-size' supported.<div><br></div><div>With latest kernel, we can do AIO+DIO so there is no changes necessary from kernel. Patch <a href="https://review.whamcloud.com/32416">https://review.whamcloud.com/32416</a> attempts to accomplish that. Since AIO is used, the I/O size from loop device is no longer important because the I/Os will be merged at OSC layer.</div><div><br></div><div>If everything works eventually, we can set up loop device over lustre like: losetup --direct-io -f --sector-size=4096 <lustre_reg_file></div><div><br></div><div>Thanks,</div><div>Jinshan<br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 22, 2018 at 3:55 PM, NeilBrown <span dir="ltr"><<a href="mailto:neilb@suse.com" target="_blank">neilb@suse.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">On Fri, Mar 30 2018, Jinshan Xiong wrote:<br>
<br>
> + Andreas.<br>
><br>
> A few problems:<br>
<br>
</span>Sorry that it has been 7 weeks, but I've finally scheduled time to<br>
have a proper look at this.<br>
<span class="gmail-"><br>
> 1. Linux loop device won't work upon Lustre with direct IO mode because<br>
> Lustre direct IO has to be pagesize aligned, and there seems no way of<br>
> changing sector size to pagesize for Linux loop device;<br>
<br>
</span>The sector size for a loop device can be set with the --sector-size<br>
argument to losetup (or the LOOP_SET_BLOCK_SIZE ioctl). This is done<br>
from user-space, not from in the lustre module of course.<br>
open(O_DIRECT) is documented as having size/alignment restrictions,<br>
so I think a good case could be made to change the handling of<br>
"losetup --raw" to imply a "--sector-size" setting, if we could<br>
determine an appropriate size automatically.<br>
The XFS_IOC_DIOINFO ioctl (see man xfsctl) can be used to ask a<br>
filesystem about alignment requirements, but is currently only<br>
supported for XFS. If we added support to lustre, and asked util-linux<br>
to use it to help configure a loop device, I suspect we could get<br>
success.<br>
<br>
There would probably be a request to hoist the ioctl out of xfs and add<br>
it to VFS. I cannot predict how that would go, but I think it would be<br>
good to pursue this approach.<br>
<br>
You could try it in you own testing by using<br>
losetup -r --sector=size=4096 /dev/loopX filename<br>
to create a loop device.<br>
<span class="gmail-"><br>
> 2. 64KB is not an optimal RPC size for Lustre, so yes eventually we are<br>
> going to see throughput issue if the RPC size is limited to 64KB;<br>
<br>
</span>So let's find out where the 64KB limit is imposed, and raise it.<br>
Maybe it comes from<br>
lo->tag_set.queue_depth = 128;<br>
combined with the default sector size of 512.<br>
If so, then increasing the sector size to 4K should raise the RPC<br>
size 512K.<br>
<span class="gmail-"><br>
> 3. It's hard to do I/O optimization more with Linux loop device. With<br>
> direct I/O by default, it has to wait for the current I/O to complete<br>
> before it can send the next one. This is not good. I have revised<br>
> llite_lloop driver so that it can do async direct I/O. The performance<br>
> boosts significantly by doing so.<br>
<br>
</span>This surprises me. Looking at the code in loop.c, I see a field<br>
->use_aio which is set when direct_io is used (->use_dio), except<br>
for FLUSH DISCARD and WRITE_ZEROES.<br>
->use_dio is disabled if the filesystem has a block device<br>
(->i_sb->s_bdev != NULL) and alignment doesn't match, but that<br>
wouldn't apply to lustre.<br>
Linux gained aio in loop in Linux 4.4. What kernel version were you<br>
looking at?<br>
<span class="gmail-"><br>
><br>
> I tried to increase the sector size of Linux loop device and also<br>
> max_{hw_}sectors_kb but it didn't work. Please let me know if there exists<br>
> ways of doing that.<br>
<br>
</span>If --sector-size option to losetup doesn't work, we will have to make it<br>
work.<br>
<br>
Thanks,<br>
NeilBrown<br>
</blockquote></div><br></div></div></div>