Re: Wait for an IO to complete

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

 



2014-03-28 23:16 GMT+05:30 Rishi Agrawal <rishi.b.agrawal@xxxxxxxxx>:
> Hi All,
>
> I want to wait in my code till the IO actually goes to the disk.
>
> 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.
>

My memory is very rusty. So I may be wrong.

Look for what sync_filesystem does.

However, there is no guarantee that the data will be actually written
to disk. I have heard instances where a caching layer in the disk
tells the filesystem that the data is written but the data was not
written and there was a power failure and an ensuing loss of data.

So from the filesystem side, you can only provide a somewhat
unreliable confirmation only most of the times.

> I need something
>
> write_buffer_to_disk(bh)
>
> Which will return only if the data has been written on disk.
>
> Please help
> --
>
> Regards,
> Rishi Agrawal
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@xxxxxxxxxxxxxxxxx
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>



-- 
Sankar P
http://psankar.blogspot.com

_______________________________________________
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