* [PATCH] loop: set physical block size to logical block size
@ 2017-09-05 21:24 Omar Sandoval
2017-09-06 17:06 ` Chandan Rajendra
0 siblings, 1 reply; 2+ messages in thread
From: Omar Sandoval @ 2017-09-05 21:24 UTC (permalink / raw)
To: linux-block
Cc: kernel-team, Hannes Reinecke, Ming Lei, Karel Zak, Milan Broz,
Chandan Rajendra, Christoph Hellwig, linux-xfs
From: Omar Sandoval <osandov@fb.com>
Commit 6c6b6f28b333 ("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
Signed-off-by: Omar Sandoval <osandov@fb.com>
---
drivers/block/loop.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 78c47c4b584d..85de67334695 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1036,6 +1036,8 @@ static int loop_clr_fd(struct loop_device *lo)
memset(lo->lo_crypt_name, 0, LO_NAME_SIZE);
memset(lo->lo_file_name, 0, LO_NAME_SIZE);
blk_queue_logical_block_size(lo->lo_queue, 512);
+ blk_queue_physical_block_size(lo->lo_queue, 512);
+ blk_queue_io_min(lo->lo_queue, 512);
if (bdev) {
bdput(bdev);
invalidate_bdev(bdev);
@@ -1330,6 +1332,8 @@ static int loop_set_block_size(struct loop_device *lo, unsigned long arg)
blk_mq_freeze_queue(lo->lo_queue);
blk_queue_logical_block_size(lo->lo_queue, arg);
+ blk_queue_physical_block_size(lo->lo_queue, arg);
+ blk_queue_io_min(lo->lo_queue, arg);
loop_update_dio(lo);
blk_mq_unfreeze_queue(lo->lo_queue);
@@ -1777,8 +1781,6 @@ static int loop_add(struct loop_device **l, int i)
}
lo->lo_queue->queuedata = lo;
- blk_queue_physical_block_size(lo->lo_queue, PAGE_SIZE);
-
blk_queue_max_hw_sectors(lo->lo_queue, BLK_DEF_MAX_SECTORS);
/*
--
2.14.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] loop: set physical block size to logical block size
2017-09-05 21:24 [PATCH] loop: set physical block size to logical block size Omar Sandoval
@ 2017-09-06 17:06 ` Chandan Rajendra
0 siblings, 0 replies; 2+ messages in thread
From: Chandan Rajendra @ 2017-09-06 17:06 UTC (permalink / raw)
To: Omar Sandoval
Cc: linux-block, kernel-team, Hannes Reinecke, Ming Lei, Karel Zak,
Milan Broz, Christoph Hellwig, linux-xfs
On Wednesday, September 6, 2017 2:54:47 AM IST Omar Sandoval wrote:
> From: Omar Sandoval <osandov@fb.com>
>
> Commit 6c6b6f28b333 ("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.
>
With this patch applied, On ppc64 I get,
# blockdev --getss /dev/loop0
512
# blockdev --getpbsz /dev/loop0
512
i.e. we are back to what was being reported before commit 6c6b6f28b333
was applied.
I also executed xfstests on xfs filesystems with 4k and 32k block sizes and
did not notice any regressions.
Tested-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
--
chandan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-06 17:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-05 21:24 [PATCH] loop: set physical block size to logical block size Omar Sandoval
2017-09-06 17:06 ` Chandan Rajendra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox