summaryrefslogtreecommitdiff
path: root/drivers/block/loop.c
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-01-18 18:05:31 -0800
committerLinus Torvalds <torvalds@home.osdl.org>2004-01-18 18:05:31 -0800
commit9644d0d98484be61fefb397ea59e8902046d98eb (patch)
tree2ec3b28cf3805ddaa26403d42af48be3f058c8fb /drivers/block/loop.c
parent59d997a581a444cac2facfed0feea408de40efdc (diff)
[PATCH] loop: fix hard sector size
From: Ben Slusky <sluskyb@paranoiacs.org> We need to set the hardsect_size of the loop device to that of the real device. The loop device advertises a block size of 1024 even when configured over a cdrom. When burning a ext2 on a cd, and mounting it directly, I get: blocksize=2048; when I losetup /dev/loop0 /dev/cdrom, and then try to mount, I get: blocksize=1024; and then misaligned transfer; this results in not being able to read the superblock. The loop device should be changed to export the same blocksize of the underlying device
Diffstat (limited to 'drivers/block/loop.c')
-rw-r--r--drivers/block/loop.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 8f66c6e457e7..0b6755114df5 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -732,8 +732,6 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file,
mapping_set_gfp_mask(inode->i_mapping,
lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS));
- set_blocksize(bdev, lo_blocksize);
-
lo->lo_bio = lo->lo_biotail = NULL;
/*
@@ -752,11 +750,14 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file,
blk_queue_max_sectors(lo->lo_queue, q->max_sectors);
blk_queue_max_phys_segments(lo->lo_queue,q->max_phys_segments);
blk_queue_max_hw_segments(lo->lo_queue, q->max_hw_segments);
+ blk_queue_hardsect_size(lo->lo_queue, queue_hardsect_size(q));
blk_queue_max_segment_size(lo->lo_queue, q->max_segment_size);
blk_queue_segment_boundary(lo->lo_queue, q->seg_boundary_mask);
blk_queue_merge_bvec(lo->lo_queue, q->merge_bvec_fn);
}
+ set_blocksize(bdev, lo_blocksize);
+
kernel_thread(loop_thread, lo, CLONE_KERNEL);
down(&lo->lo_sem);