UFS: unaligned read from GELI with 8k sectorsize

Anton Yuzhaninov citrin at citrin.ru
Mon Oct 3 20:38:47 UTC 2016

On 2016-10-03 13:49, Konstantin Belousov wrote:
> I did several bug fixing and read passes over the patch, below is the
> current version, hopefully more robust. BTW, do you have INVARIANTS and
> perhaps WITNESS in your kernel config ?

I didn't have in previous tests, but I've added INVARIANTS and WITNESS 
for last one.
With INVARIANTS I see a LOR on reboot/shutdown:
but may be it unrelated to vnode pager.

I can confirm, that with this patch (applied to fresh stable/11) geli 
with 8k sector can be used as root filesystem.

I don't know thought will it have some performance benefits compare to 
geli with 4k when vnode pager is used.

Even for raw device I can't provide benchmark data, that it is useless 
to read from this SSD in blocks less than 8k.

Samsung for some reason doesn't publish full spec for the SSD (with NAND 
page size and erase block size). Info about 8k pages comes from random 
posts on internet forums.

In may case attempt to use 8k sector in geli is attempt to get optimal 
performance, but may be there are cases when >4k sectors are used in 
hardware. See e. g. this old thread:

> +SYSCTL_INT(_vfs_ffs, OID_AUTO, use_buf_pager, CTLFLAG_RW, &use_buf_pager, 0,
> +    "always use buffer pager instead of bmap");

Small nit: most sysctl descriptions begin with a capital letter.

I prefer CTLFLAG_RWTUN because this settings affects boot process (I 
haven't tested use_buf_pager=1 yet).

> +	if (!use_buf_pager && um->um_devvp->v_bufobj.bo_bsize <= PAGE_SIZE)
> +		return (vnode_pager_generic_getpages(vp, mm, count,
> +		    ap->a_rbehind, ap->a_rahead, NULL, NULL));

Also I don't like one more if statement in performance critical path 
(one more place for branch misprediction in CPU), but probably it effect 
is negligible.

More information about the freebsd-fs mailing list