/* To do O_SYNC writes, just queue the buffer writes with ll_rw_block as you dirty the buffers, and then use osync_inode_buffers to wait for completion. Any other dirty buffers which are not yet queued for write will not be flushed to disk by the osync.  */
static int osync_buffers_list(spinlock_t *lock, struct list_head *list)
/* To do O_SYNC writes, just queue the buffer writes with ll_rw_block as you dirty the buffers, and then use osync_inode_buffers to wait for completion. Any other dirty buffers which are not yet queued for write will not be flushed to disk by the osync.  */
static int osync_buffers_list(spinlock_t *lock, struct list_head *list)
{
	struct buffer_head *bh;
	struct list_head *p;
	int err = 0;
	spin_lock(lock);
repeat:
	list_for_each_prev(p, list) {
		bh = BH_ENTRY(p);
		if (buffer_locked(bh)) {
			get_bh(bh);
			spin_unlock(lock);
			wait_on_buffer(bh);
			if (!buffer_uptodate(bh))
				err = -EIO;
			brelse(bh);
			spin_lock(lock);
			goto repeat;
		}
	}
	spin_unlock(lock);
	return err;
}