svn commit: r356335 - head/sys/sys

Mateusz Guzik mjg at FreeBSD.org
Fri Jan 3 22:10:12 UTC 2020


Author: mjg
Date: Fri Jan  3 22:10:11 2020
New Revision: 356335
URL: https://svnweb.freebsd.org/changeset/base/356335

Log:
  vfs: add VOP_UNLOCK_FLAGS
  
  The flags argument from VOP_UNLOCK is about to be removed and some
  filesystems unlock the interlock as a convienience with it.
  
  Add a helper to retain the behavior for the few cases it is needed.

Modified:
  head/sys/sys/vnode.h

Modified: head/sys/sys/vnode.h
==============================================================================
--- head/sys/sys/vnode.h	Fri Jan  3 21:40:32 2020	(r356334)
+++ head/sys/sys/vnode.h	Fri Jan  3 22:10:11 2020	(r356335)
@@ -955,6 +955,21 @@ int vn_chown(struct file *fp, uid_t uid, gid_t gid, st
 
 void vn_fsid(struct vnode *vp, struct vattr *va);
 
+#define VOP_UNLOCK_FLAGS(vp, flags)	({				\
+	struct vnode *_vp = (vp);					\
+	int _flags = (flags);						\
+	int _error;							\
+									\
+	CTASSERT(__builtin_constant_p(flags) ? 				\
+	    (flags & ~(LK_INTERLOCK | LK_RELEASE)) == 0 : 1);		\
+        if ((_flags & ~(LK_INTERLOCK | LK_RELEASE)) != 0)		\
+                panic("%s: unsupported flags %x\n", __func__, flags);	\
+        _error = VOP_UNLOCK(_vp, 0);					\
+        if (_flags & LK_INTERLOCK)					\
+                VI_UNLOCK(_vp);						\
+        _error;								\
+})
+
 #include <sys/kernel.h>
 
 #define VFS_VOP_VECTOR_REGISTER(vnodeops) \


More information about the svn-src-all mailing list