From mboxrd@z Thu Jan 1 00:00:00 1970 From: greg@kroah.com (Greg KH) Date: Fri, 28 Mar 2014 11:01:38 -0700 Subject: Wait for an IO to complete In-Reply-To: References: Message-ID: <20140328180138.GA29170@kroah.com> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org 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? > 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? thanks, greg k-h