<div dir="ltr"><div>The block size is 1024.</div><div># dumpe2fs -h /dev/pmem0 | grep "Block size"</div><div>dumpe2fs 1.42.13 (17-May-2015)</div><div>Block size: 1024</div><div><br></div><div>I tried it out on xfs and I succeeded. There are the prompting messages:<br></div><div><div># mkfs.xfs -f -b size=1024 /dev/pmem0</div><div>meta-data=/dev/pmem0 isize=512 agcount=4, agsize=32768 blks</div><div> = sectsz=512 attr=2, projid32bit=1</div><div> = crc=1 finobt=1</div><div>data = bsize=1024 blocks=131072, imaxpct=25</div><div> = sunit=0 swidth=0 blks</div><div>naming =version 2 bsize=4096 ascii-ci=0 ftype=1</div><div>log =internal log bsize=1024 blocks=2571, version=2</div><div> = sectsz=512 sunit=0 blks, lazy-count=1</div><div>realtime =none extsz=4096 blocks=0, rtextents=0</div></div><div># mount -o dax /dev/pmem0 /mnt/mem<br></div><div><br></div><div>The mount command doesn't return any message, and I can successfully read or write files in /mnt/mem.</div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-12-24 8:00 GMT+08:00 Dave Chinner <span dir="ltr"><<a href="mailto:david@fromorbit.com" target="_blank">david@fromorbit.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Wed, Dec 23, 2015 at 09:18:05PM +0000, Elliott, Robert (Persistent Memory) wrote:<br>
><br>
> > -----Original Message-----<br>
> > From: Linux-nvdimm [mailto:<a href="mailto:linux-nvdimm-bounces@lists.01.org">linux-nvdimm-bounces@lists.01.org</a>] On Behalf Of<br>
> > Dan Williams<br>
> > Sent: Wednesday, December 23, 2015 11:16 AM<br>
> > To: Cholerae Hu <<a href="mailto:choleraehyq@gmail.com">choleraehyq@gmail.com</a>><br>
> > Cc: <a href="mailto:linux-nvdimm@lists.01.org">linux-nvdimm@lists.01.org</a><br>
> > Subject: Re: A blocksize problem about dax and ext4<br>
> ><br>
> > On Wed, Dec 23, 2015 at 4:03 AM, Cholerae Hu <<a href="mailto:choleraehyq@gmail.com">choleraehyq@gmail.com</a>><br>
> > wrote:<br>
> ...<br>
> > > [root@localhost cholerae]# mount -o dax /dev/pmem0 /mnt/mem<br>
> > > mount: wrong fs type, bad option, bad superblock on /dev/pmem0,<br>
> > > missing codepage or helper program, or other error<br>
> > ><br>
> > > In some cases useful info is found in syslog - try<br>
> > > dmesg | tail or so.<br>
> > > [root@localhost cholerae]# dmesg | tail<br>
> ...<br>
> > > [ 81.779582] EXT4-fs (pmem0): error: unsupported blocksize for dax<br>
> ...<br>
><br>
> > What's the fs block size? For example:<br>
> > # dumpe2fs -h /dev/pmem0 | grep "Block size"<br>
> > dumpe2fs 1.42.9 (28-Dec-2013)<br>
> > Block size: 4096<br>
> > Depending on the size of /dev/pmem0 it may have automatically set it<br>
> > to a block size less than 4 KiB which is incompatible with "-o dax".<br>
><br>
> I noticed a few things while trying that out on both ext4 and xfs.<br>
><br>
> $ sudo mkfs.ext4 -F -b 1024 /dev/pmem0<br>
> $ sudo mount -o dax /dev/pmem0 /mnt/ext4-pmem0<br>
> $ sudo mkfs.xfs -f -b size=1024 /dev/pmem0<br>
> $ sudo mount -o dax /dev/pmem0 /mnt/xfs-pmem0<br>
><br>
> [ 199.679195] EXT4-fs (pmem0): DAX enabled. Warning: EXPERIMENTAL, use at your own risk<br>
> [ 199.724931] EXT4-fs (pmem0): error: unsupported block size 1024 for dax<br>
> [ 859.077766] XFS (pmem0): DAX enabled. Warning: EXPERIMENTAL, use at your own risk<br>
> [ 859.118106] XFS (pmem0): Filesystem block size invalid for DAX Turning DAX off.<br>
> [ 859.156950] XFS (pmem0): Mounting V4 Filesystem<br>
> [ 859.183626] XFS (pmem0): Ending clean mount<br>
><br>
> 1. ext4 fails to mount the filesystem, while xfs just disables DAX.<br>
> It seems like they should they be the same.<br>
<br>
</div></div>I don't really care what is done to ext4 here, but I'm not changing<br>
XFS behaviour. I'm expecting mixed dax/non-dax fileystems to be a<br>
thing, with DAX turned on by an inode flag on disk. Indeed, I see<br>
the mount option going away permanently for XFS, and DAX being<br>
controlled completely from on-disk flags. E.g. ext4 encrypted files<br>
need to turn off DAX, while clear text files can be accessed using<br>
DAX. This should happen completely transparently to the user....<br>
<br>
In the situation of block size < page size, there's things we can do<br>
to ensure that XFS will allocate page size aligned/sized extents<br>
(extent size hints FTW). This is the same mechanism that we'll use<br>
to ensure that extents are aligned/sized for reliable huge page<br>
mappings. Hence while DAX /as a global option/ needs to be turned<br>
off for sub-page block size filesystems, there's no reason why we<br>
can't turn DAX on for files that will always allocate blocks<br>
according to DAX constraints.<br>
<br>
Cheers,<br>
<br>
Dave.<br>
<span class="HOEnZb"><font color="#888888">--<br>
Dave Chinner<br>
<a href="mailto:david@fromorbit.com">david@fromorbit.com</a><br>
</font></span></blockquote></div><br></div>