From: Boaz Harrosh <boaz@xxxxxxxxxxxxx> Because of the direct_access() API which returns a PFN. partitions better start on 4K boundary, else offset ZERO of a partition will not be aligned and blk_direct_access() will fail the call. By setting blk_queue_physical_block_size(PAGE_SIZE) we can communicate this to fdisk and friends. Note that blk_queue_physical_block_size() also trashes io_min, but we can leave this one to be 512. Signed-off-by: Boaz Harrosh <boaz@xxxxxxxxxxxxx> --- drivers/block/pmem.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/block/pmem.c b/drivers/block/pmem.c index 8b0b9b0..499536c 100644 --- a/drivers/block/pmem.c +++ b/drivers/block/pmem.c @@ -258,6 +258,12 @@ static struct pmem_device *pmem_alloc(int i) blk_queue_max_hw_sectors(pmem->pmem_queue, 1024); blk_queue_bounce_limit(pmem->pmem_queue, BLK_BOUNCE_ANY); + /* This is so fdisk will align partitions on 4k, because of + * direct_access API needing 4k alignment, returning a PFN + */ + blk_queue_physical_block_size(pmem->pmem_queue, PAGE_SIZE); + pmem->pmem_queue->limits.io_min = 512; /* Don't use the accessor */ + disk = pmem->pmem_disk = alloc_disk(0); if (!disk) goto out_free_queue; -- 1.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html