Page MenuHomeFreeBSD

Add kqueue support for ZFS.
Needs ReviewPublic

Authored by pfg on Sep 13 2019, 5:22 PM.

Details

Reviewers
mav
kib
jmg
asomers
Group Reviewers
ZFS
Summary

UFS and ext2fs both support kqueue(2) events for vnodes, NetBSD recently added
support for kqueue[1], which seems that is missing from FreeBSD.

Looking at UFS, it seems like the attached patch should do the trick, but I
am no expert on this.

[1]
https://github.com/NetBSD/src/commit/aabc405a6a5bfdd07c072fb9a58985ad177229f1

Test Plan

Good question.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Lint Skipped
Unit
Unit Tests Skipped
Build Status
Buildable 26479

Event Timeline

pfg created this revision.Sep 13 2019, 5:22 PM
pfg added a reviewer: ZFS.Sep 13 2019, 5:24 PM
mav added inline comments.Sep 13 2019, 5:30 PM
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
5319

I am not familiar with this KPI, but this looks like a typo ('p' instead of 'q').

pfg added inline comments.Sep 13 2019, 6:56 PM
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
5319

Yes it is ... now I wonder how trhis compiled!

pfg updated this revision to Diff 62055.EditedSep 13 2019, 7:01 PM

Fix typo

kib added inline comments.Sep 13 2019, 7:02 PM
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
5319

More interesting question is what is the case that did not worked before your patch but works after.

I highly suspect that these filters in UFS are just dead code. I suggest you to take a look at fifospecops.vop_kqfilter. If actually reachable, this is a panic.

pfg added inline comments.Sep 13 2019, 7:12 PM
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
5319

fifofs is rather particular in that most fifo_specops operations are invalid:

struct vop_vector fifo_specops = {
	.vop_default =		&default_vnodeops,

	.vop_advlock =		fifo_advlock,
	.vop_close =		fifo_close,
	.vop_create =		VOP_PANIC,
	.vop_getattr =		VOP_EBADF,
	.vop_ioctl =		VOP_PANIC,
	.vop_kqfilter =		VOP_PANIC,
	.vop_link =		VOP_PANIC,
	.vop_mkdir =		VOP_PANIC,
	.vop_mknod =		VOP_PANIC,
	.vop_open =		fifo_open,
	.vop_pathconf =		VOP_PANIC,
	.vop_print =		fifo_print,
	.vop_read =		VOP_PANIC,
	.vop_readdir =		VOP_PANIC,
	.vop_readlink =		VOP_PANIC,
	.vop_reallocblks =	VOP_PANIC,
	.vop_reclaim =		VOP_NULL,
	.vop_remove =		VOP_PANIC,
	.vop_rename =		VOP_PANIC,
	.vop_rmdir =		VOP_PANIC,
	.vop_setattr =		VOP_EBADF,
	.vop_symlink =		VOP_PANIC,
	.vop_write =		VOP_PANIC,
};
pfg added reviewers: jmg, asomers.EditedSep 17 2019, 3:30 AM

I am starting to concur that this call may be obsoleted.
Let me add the kqueue maintainer and the fuse maintainer (Alan added kqueue support to fuse) as they may shed some more light on this

My experience is not directly applicable. All I did was add kqueue support for /dev/fuse, not for files stored on fusefs, and I was only concerned with EVFILT_(READ|WRITE), not EVFILT_VNODE. I would suggest that before you continue working on this patch, you write a test case.