Skip to content

Commit 6c6b6f2

Browse files
osandovaxboe
authored andcommitted
loop: set physical block size to PAGE_SIZE
The physical block size is "the lowest possible sector size that the hardware can operate on without reverting to read-modify-write operations" (from the comment on blk_queue_physical_block_size()). Since loop does buffered I/O on the backing file by default, the RMW unit is a page. This isn't the case for direct I/O mode, but let's keep it simple. Reviewed-by: Ming Lei <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: Omar Sandoval <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 8a0740c commit 6c6b6f2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/block/loop.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,6 +1764,8 @@ static int loop_add(struct loop_device **l, int i)
17641764
}
17651765
lo->lo_queue->queuedata = lo;
17661766

1767+
blk_queue_physical_block_size(lo->lo_queue, PAGE_SIZE);
1768+
17671769
/*
17681770
* It doesn't make sense to enable merge because the I/O
17691771
* submitted to backing file is handled page by page.

0 commit comments

Comments
 (0)