<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Dec 31, 2019 at 3:05 PM Yang Xu <<a href="mailto:xuyang2018.jy@cn.fujitsu.com">xuyang2018.jy@cn.fujitsu.com</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"><span class="gmail_default" style="font-size:small">...</span><br>
>>     I have tried this for many different systems, and it doesn't hit<br>
>>     the failure at least one time. So if no more comments, I would<br>
>>     merge the patch as below in the next step.<br>
> <br>
>     I have a question.we must call sync()? I think syncfs is more accurate.<br>
> <br>
> <br>
> Here we use sync() is to make fs metadata/cache being written back <br>
> before testing because there is no obtainable file descriptor 'fd' for <br>
> the ext4 deferred IO (e.g. initialize the journal and inode tables).<br></blockquote><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I see. For other test cases using tst_dev_bytes_written api such as <br>
fdatasync03.c,  we also need to call sync() to make this written value <br>
more accurate.  What do you think about it?<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">Good point. I think we should take care of them as we do for sync_file_range02 too. It will more easily report fail in the case of a situation that synced data is less than expected.</div><br></div><div><div class="gmail_default" style="font-size:small">$ git grep tst_dev_bytes_written </div>kernel/syscalls/fdatasync/fdatasync03.c:        tst_dev_bytes_written(tst_device->dev);<br>kernel/syscalls/fdatasync/fdatasync03.c:        written = tst_dev_bytes_written(tst_device->dev);<br>kernel/syscalls/fsync/fsync04.c:        tst_dev_bytes_written(tst_device->dev);<br>kernel/syscalls/fsync/fsync04.c:        written = tst_dev_bytes_written(tst_device->dev);<br>kernel/syscalls/sync/sync03.c:  tst_dev_bytes_written(tst_device->dev);<br>kernel/syscalls/sync/sync03.c:  written = tst_dev_bytes_written(tst_device->dev);<br>kernel/syscalls/sync_file_range/sync_file_range02.c:    tst_dev_bytes_written(tst_device->dev);<br>kernel/syscalls/sync_file_range/sync_file_range02.c:    written = tst_dev_bytes_written(tst_device->dev);<br>kernel/syscalls/syncfs/syncfs01.c:      tst_dev_bytes_written(tst_device->dev);<br>kernel/syscalls/syncfs/syncfs01.c:      written = tst_dev_bytes_written(tst_device->dev);<br><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>