/* loop_switch performs the hard work of switching a backing store. First it needs to flush existing IO, it does this by sending a magic BIO down the pipe. The completion of this BIO does the actual switch.  */
static int loop_switch(struct loop_device *lo, struct file *file)
/* loop_switch performs the hard work of switching a backing store. First it needs to flush existing IO, it does this by sending a magic BIO down the pipe. The completion of this BIO does the actual switch.  */
static int loop_switch(struct loop_device *lo, struct file *file)
{
	struct switch_request w;
	struct bio *bio = bio_alloc(GFP_KERNEL, 0);
	if (!bio)
		return -ENOMEM;
	init_completion(&w.wait);
	w.file = file;
	bio->bi_private = &w;
	bio->bi_bdev = NULL;
	loop_make_request(lo->lo_queue, bio);
	wait_for_completion(&w.wait);
	return 0;
}