<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Cyril,</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 6, 2020 at 6:06 PM Cyril Hrubis <<a href="mailto:chrubis@suse.cz">chrubis@suse.cz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi!<br>
> > > To avoid FS deferred IO metadata/cache interferes test result, so we<br>
> > > do sync simply before the tst_dev_bytes_written invocation.<br>
> ><br>
> > Can we do fsync() on the fd instead of full sync()? That should be<br>
> > slightly faster.<br>
> ><br>
> <br>
> Probably you miss the previous discussed [1], we use sync() here because we<br>
> do want to make sure all FS metadata/cache being written back before the<br>
> testing since there is no obtainable file descriptor 'fd' for the ext4<br>
> deferred IO (e.g. initialize the journal and inode tables).<br>
<br>
Ah, right, we measure I/O to the whole device, so we would have to sync<br>
the device in question. Then syncfs() on the fd we got should work<br>
right? And it should avoid syncing unrelated filesystems as well.<br>
</blockquote><div> </div></div>Good point, I double read the fsync() and syncfs() manual page. It looks like syncfs() is not the same as the previous function, it synchronizes the file system containing file referred to by the open file descriptor fd<span class="gmail_default" style="font-size:small">,</span> I mixed them <span class="gmail_default" style="font-size:small">before</span><span class="gmail_default" style="font-size:small">, </span>to be honest.<div><div><br></div><div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div></div></div>