Move the fstrans-aware lock vnops from ufs to ffs. Other ufs file systems
do not need them. Ride on 4.99.28
This commit is contained in:
parent
37698f56d6
commit
d56e8d1456
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ffs_extern.h,v 1.59 2007/08/09 07:34:27 hannken Exp $ */
|
||||
/* $NetBSD: ffs_extern.h,v 1.60 2007/08/09 09:22:34 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993, 1994
|
||||
@ -128,6 +128,9 @@ int ffs_getextattr(void *);
|
||||
int ffs_setextattr(void *);
|
||||
int ffs_listextattr(void *);
|
||||
int ffs_deleteextattr(void *);
|
||||
int ffs_lock(void *);
|
||||
int ffs_unlock(void *);
|
||||
int ffs_islocked(void *);
|
||||
|
||||
#ifdef SYSCTL_SETUP_PROTO
|
||||
SYSCTL_SETUP_PROTO(sysctl_vfs_ffs_setup);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ffs_vnops.c,v 1.89 2007/07/20 16:46:45 pooka Exp $ */
|
||||
/* $NetBSD: ffs_vnops.c,v 1.90 2007/08/09 09:22:34 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_vnops.c,v 1.89 2007/07/20 16:46:45 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_vnops.c,v 1.90 2007/08/09 09:22:34 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -101,12 +101,12 @@ const struct vnodeopv_entry_desc ffs_vnodeop_entries[] = {
|
||||
{ &vop_abortop_desc, ufs_abortop }, /* abortop */
|
||||
{ &vop_inactive_desc, ufs_inactive }, /* inactive */
|
||||
{ &vop_reclaim_desc, ffs_reclaim }, /* reclaim */
|
||||
{ &vop_lock_desc, ufs_lock }, /* lock */
|
||||
{ &vop_unlock_desc, ufs_unlock }, /* unlock */
|
||||
{ &vop_lock_desc, ffs_lock }, /* lock */
|
||||
{ &vop_unlock_desc, ffs_unlock }, /* unlock */
|
||||
{ &vop_bmap_desc, ufs_bmap }, /* bmap */
|
||||
{ &vop_strategy_desc, ufs_strategy }, /* strategy */
|
||||
{ &vop_print_desc, ufs_print }, /* print */
|
||||
{ &vop_islocked_desc, ufs_islocked }, /* islocked */
|
||||
{ &vop_islocked_desc, ffs_islocked }, /* islocked */
|
||||
{ &vop_pathconf_desc, ufs_pathconf }, /* pathconf */
|
||||
{ &vop_advlock_desc, ufs_advlock }, /* advlock */
|
||||
{ &vop_bwrite_desc, vn_bwrite }, /* bwrite */
|
||||
@ -156,12 +156,12 @@ const struct vnodeopv_entry_desc ffs_specop_entries[] = {
|
||||
{ &vop_abortop_desc, spec_abortop }, /* abortop */
|
||||
{ &vop_inactive_desc, ufs_inactive }, /* inactive */
|
||||
{ &vop_reclaim_desc, ffs_reclaim }, /* reclaim */
|
||||
{ &vop_lock_desc, ufs_lock }, /* lock */
|
||||
{ &vop_unlock_desc, ufs_unlock }, /* unlock */
|
||||
{ &vop_lock_desc, ffs_lock }, /* lock */
|
||||
{ &vop_unlock_desc, ffs_unlock }, /* unlock */
|
||||
{ &vop_bmap_desc, spec_bmap }, /* bmap */
|
||||
{ &vop_strategy_desc, spec_strategy }, /* strategy */
|
||||
{ &vop_print_desc, ufs_print }, /* print */
|
||||
{ &vop_islocked_desc, ufs_islocked }, /* islocked */
|
||||
{ &vop_islocked_desc, ffs_islocked }, /* islocked */
|
||||
{ &vop_pathconf_desc, spec_pathconf }, /* pathconf */
|
||||
{ &vop_advlock_desc, spec_advlock }, /* advlock */
|
||||
{ &vop_bwrite_desc, vn_bwrite }, /* bwrite */
|
||||
@ -211,12 +211,12 @@ const struct vnodeopv_entry_desc ffs_fifoop_entries[] = {
|
||||
{ &vop_abortop_desc, fifo_abortop }, /* abortop */
|
||||
{ &vop_inactive_desc, ufs_inactive }, /* inactive */
|
||||
{ &vop_reclaim_desc, ffs_reclaim }, /* reclaim */
|
||||
{ &vop_lock_desc, ufs_lock }, /* lock */
|
||||
{ &vop_unlock_desc, ufs_unlock }, /* unlock */
|
||||
{ &vop_lock_desc, ffs_lock }, /* lock */
|
||||
{ &vop_unlock_desc, ffs_unlock }, /* unlock */
|
||||
{ &vop_bmap_desc, fifo_bmap }, /* bmap */
|
||||
{ &vop_strategy_desc, fifo_strategy }, /* strategy */
|
||||
{ &vop_print_desc, ufs_print }, /* print */
|
||||
{ &vop_islocked_desc, ufs_islocked }, /* islocked */
|
||||
{ &vop_islocked_desc, ffs_islocked }, /* islocked */
|
||||
{ &vop_pathconf_desc, fifo_pathconf }, /* pathconf */
|
||||
{ &vop_advlock_desc, fifo_advlock }, /* advlock */
|
||||
{ &vop_bwrite_desc, vn_bwrite }, /* bwrite */
|
||||
@ -727,3 +727,70 @@ ffs_deleteextattr(void *v)
|
||||
/* XXX Not implemented for UFS2 file systems. */
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
|
||||
/*
|
||||
* Lock the node.
|
||||
*/
|
||||
int
|
||||
ffs_lock(void *v)
|
||||
{
|
||||
struct vop_lock_args /* {
|
||||
struct vnode *a_vp;
|
||||
int a_flags;
|
||||
} */ *ap = v;
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct mount *mp = vp->v_mount;
|
||||
|
||||
/*
|
||||
* Fake lock during file system suspension.
|
||||
*/
|
||||
if ((vp->v_type == VREG || vp->v_type == VDIR) &&
|
||||
fstrans_is_owner(mp) &&
|
||||
fstrans_getstate(mp) == FSTRANS_SUSPENDING) {
|
||||
if ((ap->a_flags & LK_INTERLOCK) != 0)
|
||||
simple_unlock(&vp->v_interlock);
|
||||
return 0;
|
||||
}
|
||||
return (lockmgr(vp->v_vnlock, ap->a_flags, &vp->v_interlock));
|
||||
}
|
||||
|
||||
/*
|
||||
* Unlock the node.
|
||||
*/
|
||||
int
|
||||
ffs_unlock(void *v)
|
||||
{
|
||||
struct vop_unlock_args /* {
|
||||
struct vnode *a_vp;
|
||||
int a_flags;
|
||||
} */ *ap = v;
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct mount *mp = vp->v_mount;
|
||||
|
||||
/*
|
||||
* Fake unlock during file system suspension.
|
||||
*/
|
||||
if ((vp->v_type == VREG || vp->v_type == VDIR) &&
|
||||
fstrans_is_owner(mp) &&
|
||||
fstrans_getstate(mp) == FSTRANS_SUSPENDING) {
|
||||
if ((ap->a_flags & LK_INTERLOCK) != 0)
|
||||
simple_unlock(&vp->v_interlock);
|
||||
return 0;
|
||||
}
|
||||
return (lockmgr(vp->v_vnlock, ap->a_flags | LK_RELEASE,
|
||||
&vp->v_interlock));
|
||||
}
|
||||
|
||||
/*
|
||||
* Return whether or not the node is locked.
|
||||
*/
|
||||
int
|
||||
ffs_islocked(void *v)
|
||||
{
|
||||
struct vop_islocked_args /* {
|
||||
struct vnode *a_vp;
|
||||
} */ *ap = v;
|
||||
struct vnode *vp = ap->a_vp;
|
||||
|
||||
return (lockstatus(vp->v_vnlock));
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ufs_extern.h,v 1.53 2007/07/10 09:50:09 hannken Exp $ */
|
||||
/* $NetBSD: ufs_extern.h,v 1.54 2007/08/09 09:22:34 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993, 1994
|
||||
@ -66,10 +66,10 @@ int ufs_getattr(void *);
|
||||
int ufs_inactive(void *);
|
||||
#define ufs_fcntl genfs_fcntl
|
||||
#define ufs_ioctl genfs_enoioctl
|
||||
int ufs_islocked(void *);
|
||||
#define ufs_islocked genfs_islocked
|
||||
#define ufs_lease_check genfs_lease_check
|
||||
int ufs_link(void *);
|
||||
int ufs_lock(void *);
|
||||
#define ufs_lock genfs_lock
|
||||
int ufs_lookup(void *);
|
||||
int ufs_mkdir(void *);
|
||||
int ufs_mknod(void *);
|
||||
@ -88,7 +88,7 @@ int ufs_rmdir(void *);
|
||||
int ufs_setattr(void *);
|
||||
int ufs_strategy(void *);
|
||||
int ufs_symlink(void *);
|
||||
int ufs_unlock(void *);
|
||||
#define ufs_unlock genfs_unlock
|
||||
int ufs_whiteout(void *);
|
||||
int ufsspec_close(void *);
|
||||
int ufsspec_read(void *);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ufs_vnops.c,v 1.155 2007/07/29 13:31:16 ad Exp $ */
|
||||
/* $NetBSD: ufs_vnops.c,v 1.156 2007/08/09 09:22:34 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993, 1995
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.155 2007/07/29 13:31:16 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.156 2007/08/09 09:22:34 hannken Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
@ -2273,70 +2273,3 @@ ufs_gop_markupdate(struct vnode *vp, int flags)
|
||||
ip->i_flag |= mask;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Lock the node.
|
||||
*/
|
||||
int
|
||||
ufs_lock(void *v)
|
||||
{
|
||||
struct vop_lock_args /* {
|
||||
struct vnode *a_vp;
|
||||
int a_flags;
|
||||
} */ *ap = v;
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct mount *mp = vp->v_mount;
|
||||
|
||||
/*
|
||||
* Fake lock during file system suspension.
|
||||
*/
|
||||
if ((vp->v_type == VREG || vp->v_type == VDIR) &&
|
||||
fstrans_is_owner(mp) &&
|
||||
fstrans_getstate(mp) == FSTRANS_SUSPENDING) {
|
||||
if ((ap->a_flags & LK_INTERLOCK) != 0)
|
||||
simple_unlock(&vp->v_interlock);
|
||||
return 0;
|
||||
}
|
||||
return (lockmgr(vp->v_vnlock, ap->a_flags, &vp->v_interlock));
|
||||
}
|
||||
|
||||
/*
|
||||
* Unlock the node.
|
||||
*/
|
||||
int
|
||||
ufs_unlock(void *v)
|
||||
{
|
||||
struct vop_unlock_args /* {
|
||||
struct vnode *a_vp;
|
||||
int a_flags;
|
||||
} */ *ap = v;
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct mount *mp = vp->v_mount;
|
||||
|
||||
/*
|
||||
* Fake unlock during file system suspension.
|
||||
*/
|
||||
if ((vp->v_type == VREG || vp->v_type == VDIR) &&
|
||||
fstrans_is_owner(mp) &&
|
||||
fstrans_getstate(mp) == FSTRANS_SUSPENDING) {
|
||||
if ((ap->a_flags & LK_INTERLOCK) != 0)
|
||||
simple_unlock(&vp->v_interlock);
|
||||
return 0;
|
||||
}
|
||||
return (lockmgr(vp->v_vnlock, ap->a_flags | LK_RELEASE,
|
||||
&vp->v_interlock));
|
||||
}
|
||||
|
||||
/*
|
||||
* Return whether or not the node is locked.
|
||||
*/
|
||||
int
|
||||
ufs_islocked(void *v)
|
||||
{
|
||||
struct vop_islocked_args /* {
|
||||
struct vnode *a_vp;
|
||||
} */ *ap = v;
|
||||
struct vnode *vp = ap->a_vp;
|
||||
|
||||
return (lockstatus(vp->v_vnlock));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user