Skip to content

Commit bf09375

Browse files
osandovaxboe
authored andcommitted
loop: set physical block size to logical block size
Commit 6c6b6f2 ("loop: set physical block size to PAGE_SIZE") caused mkfs.xfs to barf on ppc64 [1]. Always using PAGE_SIZE as the physical block size still makes the most sense semantically, but let's just lie and always set it to the same value as the logical block size (same goes for io_min). In the future we might want to at least bump up io_min to PAGE_SIZE but I'm sick of these stupid changes so let's play it safe. 1: https://marc.info/?l=linux-xfs&m=150459024723753&w=2 Tested-by: Chandan Rajendra <[email protected]> Signed-off-by: Omar Sandoval <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 9276717 commit bf09375

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/block/loop.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,8 @@ static int loop_clr_fd(struct loop_device *lo)
10361036
memset(lo->lo_crypt_name, 0, LO_NAME_SIZE);
10371037
memset(lo->lo_file_name, 0, LO_NAME_SIZE);
10381038
blk_queue_logical_block_size(lo->lo_queue, 512);
1039+
blk_queue_physical_block_size(lo->lo_queue, 512);
1040+
blk_queue_io_min(lo->lo_queue, 512);
10391041
if (bdev) {
10401042
bdput(bdev);
10411043
invalidate_bdev(bdev);
@@ -1330,6 +1332,8 @@ static int loop_set_block_size(struct loop_device *lo, unsigned long arg)
13301332
blk_mq_freeze_queue(lo->lo_queue);
13311333

13321334
blk_queue_logical_block_size(lo->lo_queue, arg);
1335+
blk_queue_physical_block_size(lo->lo_queue, arg);
1336+
blk_queue_io_min(lo->lo_queue, arg);
13331337
loop_update_dio(lo);
13341338

13351339
blk_mq_unfreeze_queue(lo->lo_queue);
@@ -1777,8 +1781,6 @@ static int loop_add(struct loop_device **l, int i)
17771781
}
17781782
lo->lo_queue->queuedata = lo;
17791783

1780-
blk_queue_physical_block_size(lo->lo_queue, PAGE_SIZE);
1781-
17821784
blk_queue_max_hw_sectors(lo->lo_queue, BLK_DEF_MAX_SECTORS);
17831785

17841786
/*

0 commit comments

Comments
 (0)