Re: Wait for an IO to complete

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Hi Greg,

On Fri, Mar 28, 2014 at 11:31 PM, Greg KH <greg@xxxxxxxxx> wrote:
On Fri, Mar 28, 2014 at 11:16:30PM +0530, Rishi Agrawal wrote:
> Hi All,
>
> I want to wait in my code till the IO actually goes to the disk.

That's an issue, as you really don't know what a "disk" is from within
the kernel :)

Back up, what exactly are you trying to do?

Its a virtual machine, so no worries here, more over I am using a loop device.
 
> For example
>
> struct buffer_head *bh=sb_bread(sb, 20)
>
> strcpy(bh->b_data, "Some Data");
>
> /* mark and sync */
> mark_buffer_dirty(bh);
> sync_dirty_buffer(bh);
>
> The above code only adds the bh to the request queue and returns.

And that's all you should need.  Why do you feel you need more?

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.

I want to wait till the write completes as performance is not I am worried about right now.
 
thanks,

greg k-h



--
Regards,
Rishi Agrawal
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux