<div dir="ltr"><br><div class="gmail_extra">Hi Greg,<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 28, 2014 at 11:31 PM, Greg KH <span dir="ltr">&lt;<a href="mailto:greg@kroah.com" target="_blank">greg@kroah.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On Fri, Mar 28, 2014 at 11:16:30PM +0530, Rishi Agrawal wrote:<br>
&gt; Hi All,<br>
&gt;<br>
&gt; I want to wait in my code till the IO actually goes to the disk.<br>
<br>
</div>That&#39;s an issue, as you really don&#39;t know what a &quot;disk&quot; is from within<br>
the kernel :)<br>
<br>
Back up, what exactly are you trying to do?<br>
<div class=""><br></div></blockquote><div>Its a virtual machine, so no worries here, more over I am using a loop device.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="">
&gt; For example<br>
&gt;<br>
&gt; struct buffer_head *bh=sb_bread(sb, 20)<br>
&gt;<br>
&gt; strcpy(bh-&gt;b_data, &quot;Some Data&quot;);<br>
&gt;<br>
&gt; /* mark and sync */<br>
&gt; mark_buffer_dirty(bh);<br>
&gt; sync_dirty_buffer(bh);<br>
&gt;<br>
&gt; The above code only adds the bh to the request queue and returns.<br>
<br>
</div>And that&#39;s all you should need.  Why do you feel you need more?<br>
<br></blockquote><div>Actually I am developing a kernel module through which I am writing to the device. I am not able to the written data in some cases, the code path is same everywhere. So I thought maybe its not getting flushed on the disk and I am expecting the write on the disk too early.<br>

<br></div><div>I want to wait till the write completes as performance is not I am worried about right now.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


thanks,<br>
<br>
greg k-h<br>
</blockquote></div><br><br clear="all"><br>-- <br>Regards,<br>Rishi Agrawal<br>
</div></div>