diff mbox

brd: Only request 4K sectors if DAX is enabled

Message ID 54EEDC4A.8090000@plexistor.com (mailing list archive)
State New, archived
Headers show

Commit Message

Boaz Harrosh Feb. 26, 2015, 8:41 a.m. UTC
People systems have been using ramdisk with
smaller-than-page-size blocks in their mkfs.

The 4K sectors is only important if we will be
using brd with a DAX filesystem.

So only enable 4K sectors if DAX is configured

Signed-off-by: Boaz Harrosh <boaz@plexistor.com>
---
 drivers/block/brd.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Boaz Harrosh Feb. 26, 2015, 8:48 a.m. UTC | #1
On 02/26/2015 10:41 AM, Boaz Harrosh wrote:
> 
> People systems have been using ramdisk with
> smaller-than-page-size blocks in their mkfs.
> 
> The 4K sectors is only important if we will be
> using brd with a DAX filesystem.
> 
> So only enable 4K sectors if DAX is configured
> 
> Signed-off-by: Boaz Harrosh <boaz@plexistor.com>
> ---
>  drivers/block/brd.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/block/brd.c b/drivers/block/brd.c
> index 6e0775b..e875f12 100644
> --- a/drivers/block/brd.c
> +++ b/drivers/block/brd.c
> @@ -495,6 +495,7 @@ static struct brd_device *brd_alloc(int i)
>  	blk_queue_max_hw_sectors(brd->brd_queue, 1024);
>  	blk_queue_bounce_limit(brd->brd_queue, BLK_BOUNCE_ANY);
>  
> +#ifdef CONFIG_BLK_DEV_RAM_DAX
>  	/* This is so fdisk will align partitions on 4k, because of
>  	 * direct_access API needing 4k alignment, returning a PFN
>  	 * (This is only a problem on very small devices <= 4M,
> @@ -502,6 +503,7 @@ static struct brd_device *brd_alloc(int i)
>  	 *  is harmless)
>  	 */

Hi Dave

I was just thinking should we also do

+	if (part_show)
>  		blk_queue_physical_block_size(brd->brd_queue, PAGE_SIZE);

The rational is that if part_show is off then we are not using partitions
at all and then there can be no problems?

I'll try to run your tests here. I never test xfs always ext4, maybe I should
start to ;-). Actually I do have xfsprogs so why not. But if you could run
a quick test as well it could be great.

Thanks
Boaz

<>
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dave Chinner Feb. 27, 2015, 12:23 a.m. UTC | #2
On Thu, Feb 26, 2015 at 10:41:46AM +0200, Boaz Harrosh wrote:
> 
> People systems have been using ramdisk with
> smaller-than-page-size blocks in their mkfs.
> 
> The 4K sectors is only important if we will be
> using brd with a DAX filesystem.
> 
> So only enable 4K sectors if DAX is configured

4k sectors are not a problem - we should be handling them fine and
because it makes the ramdisk look like a 512e drive, no applications
should fail, either.

The main "unexpected" part about it was how much of xfstests didn't
handle 4k sectors in mkfs output properly. This isn't a problem with
the kernel change and so doesn't need fixing.

Cheers,

Dave.
Boaz Harrosh March 1, 2015, 8:30 a.m. UTC | #3
On 02/27/2015 02:23 AM, Dave Chinner wrote:
> On Thu, Feb 26, 2015 at 10:41:46AM +0200, Boaz Harrosh wrote:
>>
>> People systems have been using ramdisk with
>> smaller-than-page-size blocks in their mkfs.
>>
>> The 4K sectors is only important if we will be
>> using brd with a DAX filesystem.
>>
>> So only enable 4K sectors if DAX is configured
> 
> 4k sectors are not a problem - we should be handling them fine and
> because it makes the ramdisk look like a 512e drive, no applications
> should fail, either.
> 
> The main "unexpected" part about it was how much of xfstests didn't
> handle 4k sectors in mkfs output properly. This isn't a problem with
> the kernel change and so doesn't need fixing.
> 

Glad to be of service ;-)

Please tell me if there is anything I can help with

> Cheers,
> Dave.
> 

Thanks
Boaz

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 6e0775b..e875f12 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -495,6 +495,7 @@  static struct brd_device *brd_alloc(int i)
 	blk_queue_max_hw_sectors(brd->brd_queue, 1024);
 	blk_queue_bounce_limit(brd->brd_queue, BLK_BOUNCE_ANY);
 
+#ifdef CONFIG_BLK_DEV_RAM_DAX
 	/* This is so fdisk will align partitions on 4k, because of
 	 * direct_access API needing 4k alignment, returning a PFN
 	 * (This is only a problem on very small devices <= 4M,
@@ -502,6 +503,7 @@  static struct brd_device *brd_alloc(int i)
 	 *  is harmless)
 	 */
 	blk_queue_physical_block_size(brd->brd_queue, PAGE_SIZE);
+#endif
 
 	brd->brd_queue->limits.discard_granularity = PAGE_SIZE;
 	brd->brd_queue->limits.max_discard_sectors = UINT_MAX;