UFS: unaligned read from GELI with 8k sectorsize

Anton Yuzhaninov citrin at citrin.ru
Sat Oct 1 20:26:36 UTC 2016

On 2016-10-01 07:54, Konstantin Belousov wrote:
> It might be not too hard to make this case working, although the speed
> of the pagein will be detrimental.  Try this, please.

> diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c
> index a80a9c2..01e2ea2 100644
> --- a/sys/vm/vnode_pager.c
> +++ b/sys/vm/vnode_pager.c
> @@ -796,7 +796,7 @@ vnode_pager_generic_getpages(struct vnode *vp, vm_page_t *m, int count,
>  	 * getting pages via VOP_READ.
>  	 */
>  	error = VOP_BMAP(vp, foff / bsize, &bo, &bp->b_blkno, &after, &before);
> -	if (error == EOPNOTSUPP) {
> +	if (error == EOPNOTSUPP || (error == 0 && bo->bo_bsize > PAGE_SIZE)) {
>  		relpbuf(bp, freecnt);
>  		VM_OBJECT_WLOCK(object);
>  		for (i = 0; i < count; i++) {

With this patch there is no panic, but boot process stops after message:
start_init: trying /sbin/init
(boot -v was used)

And nothing happens after.

There is two reasons why I tried to use GELI on SSD with 8k sector size:

1. SSD internally reads data by pages. Host can request from SSD 512 
bytes, but full page will be read inside SSD. For my SSD page size is 8k.

2. GELI work faster with big blocks. Quick benchmark for geli on gzero 
(AES-NI, single geli thread, several parallel dd if=/dev/gzero.eli):
4k sector ~ 350 Mb/s
8k sector ~ 400 Mb/s
Bigger sector sizes works even faster, but not useful on real workloads 
because on small reads by user application more data then necessary will 
be read and decrypted.

Given that vnode_pager is not designed to work with sector size > VM 
page size it will be more easy for me to reinstall FreeBSD on geli with 
4k sectors.

More information about the freebsd-fs mailing list