Skip to content

Commit

Permalink
loop: set physical block size to PAGE_SIZE
Browse files Browse the repository at this point in the history
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 <ming.lei@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Omar Sandoval authored and Jens Axboe committed Aug 31, 2017
1 parent 8a0740c commit 6c6b6f2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/block/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1764,6 +1764,8 @@ 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);

/*
* It doesn't make sense to enable merge because the I/O
* submitted to backing file is handled page by page.
Expand Down

0 comments on commit 6c6b6f2

Please sign in to comment.