<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"><<a href="mailto:greg@kroah.com" target="_blank">greg@kroah.com</a>></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>
> Hi All,<br>
><br>
> I want to wait in my code till the IO actually goes to the disk.<br>
<br>
</div>That's an issue, as you really don't know what a "disk" 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="">
> For example<br>
><br>
> struct buffer_head *bh=sb_bread(sb, 20)<br>
><br>
> strcpy(bh->b_data, "Some Data");<br>
><br>
> /* mark and sync */<br>
> mark_buffer_dirty(bh);<br>
> sync_dirty_buffer(bh);<br>
><br>
> The above code only adds the bh to the request queue and returns.<br>
<br>
</div>And that'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>