Skip to content

loop: support different logical block sizes

Omar Sandoval linux-block 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 8 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4loop: get rid of lo_blocksizedrivers/block/loop.c drivers/block/loop.h+2 -91 reply
2/4loop: set physical block size to PAGE_SIZEdrivers/block/loop.c+2 -01 reply
3/4loop: add ioctl for changing logical block sizedrivers/block/loop.c include/uapi/linux/loop.h+25 -03 replies
4/4loop: fold loop_switch() into callersdrivers/block/loop.c+11 -651 reply

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchHannes ReineckeMing Lei
SeriesR-b
1/4R-b
2/4R-b
3/4R-b
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/4] loop: support different logical block sizes

From: Omar Sandoval <[email protected]>

Hi, everyone,

Here's another attempt at supporting different logical block sizes for loop devices. First, some terminology:

* Logical block size: the lowest possible block size that the storage device can address.
* Physical block size: the lowest possible sector size that the hardware can operate on without reverting to read-modify-write operations. Always greater than or equal to the logical block size.

These are characteristics of the device itself tracked in the request_queue. For loop devices, both are currently always 512 bytes.

struct block_device also has another block size, basically a "soft" block size which is the preferred I/O size and can be changed from userspace. For loop devices, this is PAGE_SIZE if the backing file is a regular file or otherwise the soft block size of the backing block device.

Patch 1 simplifies how the soft block size is set. I'm tempted to not set it at all and use the default of PAGE_SIZE, but maybe someone is depending on inheriting the soft block size from the backing block device...

Patch 2 sets the physical block size of loop devices to a more meaningful value for loop, PAGE_SIZE.

Patch 3 allows us to change the logical block size. It adds a new ioctl instead of the previous approach (which extends LOOP_{GET,SET}_STATUS). Hannes, I assume you had a specific reason for doing it the way you did, care to explain?

Patch 4 is a cleanup.

This is based on my patch reverting the original block size support, targeting 4.14. Thanks!

Omar Sandoval (4):
loop: get rid of lo_blocksize
loop: set physical block size to PAGE_SIZE
loop: add ioctl for changing logical block size
loop: fold loop_switch() into callers

 drivers/block/loop.c      | 112 ++++++++++++++++------------------------------
 drivers/block/loop.h      |   1 -
 include/uapi/linux/loop.h |   1 +
 3 files changed, 40 insertions(+), 74 deletions(-)
Signature · 1 line
2.14.1