Provide rump_getvninfo() and use that in libp2k_lookup() to avoid an
extra getattr for stuff the file system already cached in the vnode.
This commit is contained in:
parent
804db68101
commit
24c0b6d0d0
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: p2k.c,v 1.3 2007/08/07 21:24:40 pooka Exp $ */
|
||||
/* $NetBSD: p2k.c,v 1.4 2007/08/08 14:09:07 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
|
||||
|
@ -240,7 +240,9 @@ p2k_node_lookup(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
|
|||
{
|
||||
struct componentname *cn;
|
||||
struct vnode *vp;
|
||||
struct vattr va;
|
||||
enum vtype vtype;
|
||||
voff_t vsize;
|
||||
dev_t rdev;
|
||||
int rv;
|
||||
|
||||
cn = P2K_MAKECN(pcn);
|
||||
|
@ -252,17 +254,11 @@ p2k_node_lookup(struct puffs_cc *pcc, void *opc, struct puffs_newinfo *pni,
|
|||
return rv;
|
||||
}
|
||||
|
||||
rv = VOP_GETATTR(vp, &va, NULL, curlwp);
|
||||
/* XXX: "unlookup" */
|
||||
if (rv) {
|
||||
warn("%s: lookup succesful but failed GETATTR", __func__);
|
||||
abort();
|
||||
}
|
||||
|
||||
puffs_newinfo_setcookie(pni, vp);
|
||||
puffs_newinfo_setvtype(pni, va.va_type);
|
||||
puffs_newinfo_setsize(pni, va.va_size);
|
||||
puffs_newinfo_setrdev(pni, va.va_rdev);
|
||||
rump_getvninfo(vp, &vtype, &vsize, &rdev);
|
||||
puffs_newinfo_setvtype(pni, vtype);
|
||||
puffs_newinfo_setsize(pni, vsize);
|
||||
puffs_newinfo_setrdev(pni, rdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rump.c,v 1.3 2007/08/07 20:40:53 pooka Exp $ */
|
||||
/* $NetBSD: rump.c,v 1.4 2007/08/08 14:09:07 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
|
||||
|
@ -38,6 +38,8 @@
|
|||
|
||||
#include <machine/cpu.h>
|
||||
|
||||
#include <miscfs/specfs/specdev.h>
|
||||
|
||||
#include "rump.h"
|
||||
#include "rumpuser.h"
|
||||
|
||||
|
@ -200,3 +202,15 @@ rump_fakeblk_deregister(const char *path)
|
|||
LIST_REMOVE(fblk, entries);
|
||||
rumpuser_free(fblk);
|
||||
}
|
||||
|
||||
void
|
||||
rump_getvninfo(struct vnode *vp, enum vtype *vtype, voff_t *vsize, dev_t *vdev)
|
||||
{
|
||||
|
||||
*vtype = vp->v_type;
|
||||
*vsize = vp->v_size;
|
||||
if (vp->v_specinfo)
|
||||
*vdev = vp->v_rdev;
|
||||
else
|
||||
*vdev = 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rump.h,v 1.4 2007/08/07 19:40:17 pooka Exp $ */
|
||||
/* $NetBSD: rump.h,v 1.5 2007/08/08 14:09:07 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
|
||||
|
@ -67,6 +67,8 @@ int rump_recyclenode(struct vnode *);
|
|||
int rump_ubc_magic_uiomove(size_t, struct uio *);
|
||||
int rump_vopwrite_fault(struct vnode *, voff_t, size_t, kauth_cred_t);
|
||||
|
||||
void rump_getvninfo(struct vnode *, enum vtype *, voff_t *, dev_t *);
|
||||
|
||||
int rump_fakeblk_register(const char *);
|
||||
int rump_fakeblk_find(const char *);
|
||||
void rump_fakeblk_deregister(const char *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vfs.c,v 1.3 2007/08/07 21:23:19 pooka Exp $ */
|
||||
/* $NetBSD: vfs.c,v 1.4 2007/08/08 14:09:07 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
|
||||
|
@ -96,6 +96,8 @@ void
|
|||
rump_putnode(struct vnode *vp)
|
||||
{
|
||||
|
||||
if (vp->v_specinfo)
|
||||
rumpuser_free(vp->v_specinfo);
|
||||
rumpuser_free(vp);
|
||||
}
|
||||
|
||||
|
@ -405,10 +407,13 @@ vfs_unbusy(struct mount *mp)
|
|||
}
|
||||
|
||||
struct vnode *
|
||||
checkalias(struct vnode *nvp, dev_t ndvp_rdev, struct mount *mp)
|
||||
checkalias(struct vnode *nvp, dev_t nvp_rdev, struct mount *mp)
|
||||
{
|
||||
|
||||
/* Can this cause any funnies? */
|
||||
|
||||
nvp->v_specinfo = rumpuser_malloc(sizeof(struct specinfo), 0);
|
||||
nvp->v_rdev = nvp_rdev;
|
||||
return NULLVP;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue