aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/loop.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/loop.c')
-rw-r--r--drivers/block/loop.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 7b3b94ddddcc..c774121684d7 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -662,7 +662,8 @@ static void do_loop_switch(struct loop_device *lo, struct switch_request *p)
662 662
663 mapping_set_gfp_mask(old_file->f_mapping, lo->old_gfp_mask); 663 mapping_set_gfp_mask(old_file->f_mapping, lo->old_gfp_mask);
664 lo->lo_backing_file = file; 664 lo->lo_backing_file = file;
665 lo->lo_blocksize = mapping->host->i_blksize; 665 lo->lo_blocksize = S_ISBLK(mapping->host->i_mode) ?
666 mapping->host->i_bdev->bd_block_size : PAGE_SIZE;
666 lo->old_gfp_mask = mapping_gfp_mask(mapping); 667 lo->old_gfp_mask = mapping_gfp_mask(mapping);
667 mapping_set_gfp_mask(mapping, lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS)); 668 mapping_set_gfp_mask(mapping, lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS));
668 complete(&p->wait); 669 complete(&p->wait);
@@ -794,7 +795,9 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file,
794 if (!(lo_flags & LO_FLAGS_USE_AOPS) && !file->f_op->write) 795 if (!(lo_flags & LO_FLAGS_USE_AOPS) && !file->f_op->write)
795 lo_flags |= LO_FLAGS_READ_ONLY; 796 lo_flags |= LO_FLAGS_READ_ONLY;
796 797
797 lo_blocksize = inode->i_blksize; 798 lo_blocksize = S_ISBLK(inode->i_mode) ?
799 inode->i_bdev->bd_block_size : PAGE_SIZE;
800
798 error = 0; 801 error = 0;
799 } else { 802 } else {
800 goto out_putf; 803 goto out_putf;