mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-21 15:45:02 +00:00
Add two arguments to the vfs_hash() KPI so that filesystems which do
not have unique hashes (NFS) can also use it.
This commit is contained in:
parent
9ed94841d9
commit
51f5ce0c8c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=143692
@ -661,7 +661,7 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir)
|
|||||||
struct cdev *dev;
|
struct cdev *dev;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
error = vfs_hash_get(mp, ino, flags, curthread, vpp);
|
error = vfs_hash_get(mp, ino, flags, curthread, vpp, NULL, NULL);
|
||||||
if (error || *vpp != NULL)
|
if (error || *vpp != NULL)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
@ -679,7 +679,7 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir)
|
|||||||
ip->i_vnode = vp;
|
ip->i_vnode = vp;
|
||||||
ip->i_number = ino;
|
ip->i_number = ino;
|
||||||
|
|
||||||
error = vfs_hash_insert(vp, ino, flags, curthread, vpp);
|
error = vfs_hash_insert(vp, ino, flags, curthread, vpp, NULL, NULL);
|
||||||
if (error || *vpp != NULL)
|
if (error || *vpp != NULL)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
|
@ -463,7 +463,7 @@ hpfs_vget(
|
|||||||
|
|
||||||
dprintf(("hpfs_vget(0x%x): ",ino));
|
dprintf(("hpfs_vget(0x%x): ",ino));
|
||||||
|
|
||||||
error = vfs_hash_get(mp, ino, flags, curthread, vpp);
|
error = vfs_hash_get(mp, ino, flags, curthread, vpp, NULL, NULL);
|
||||||
if (error || *vpp != NULL)
|
if (error || *vpp != NULL)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
@ -513,7 +513,7 @@ hpfs_vget(
|
|||||||
hp->h_mode = hpmp->hpm_mode;
|
hp->h_mode = hpmp->hpm_mode;
|
||||||
hp->h_devvp = hpmp->hpm_devvp;
|
hp->h_devvp = hpmp->hpm_devvp;
|
||||||
|
|
||||||
error = vfs_hash_insert(vp, ino, flags, curthread, vpp);
|
error = vfs_hash_insert(vp, ino, flags, curthread, vpp, NULL, NULL);
|
||||||
if (error || *vpp != NULL)
|
if (error || *vpp != NULL)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
|
@ -124,7 +124,8 @@ deget(pmp, dirclust, diroffset, depp)
|
|||||||
* entry that represented the file happens to be reused while the
|
* entry that represented the file happens to be reused while the
|
||||||
* deleted file is still open.
|
* deleted file is still open.
|
||||||
*/
|
*/
|
||||||
error = vfs_hash_get(mntp, hash, LK_EXCLUSIVE, curthread, &nvp);
|
error = vfs_hash_get(mntp, hash, LK_EXCLUSIVE, curthread, &nvp,
|
||||||
|
NULL, NULL);
|
||||||
if (error)
|
if (error)
|
||||||
return(error);
|
return(error);
|
||||||
if (nvp != NULL) {
|
if (nvp != NULL) {
|
||||||
@ -158,7 +159,7 @@ deget(pmp, dirclust, diroffset, depp)
|
|||||||
ldep->de_diroffset = diroffset;
|
ldep->de_diroffset = diroffset;
|
||||||
fc_purge(ldep, 0); /* init the fat cache for this denode */
|
fc_purge(ldep, 0); /* init the fat cache for this denode */
|
||||||
|
|
||||||
error = vfs_hash_insert(nvp, hash, 0, curthread, &xvp);
|
error = vfs_hash_insert(nvp, hash, 0, curthread, &xvp, NULL, NULL);
|
||||||
if (error) {
|
if (error) {
|
||||||
*depp = NULL;
|
*depp = NULL;
|
||||||
return (error);
|
return (error);
|
||||||
|
@ -581,7 +581,7 @@ udf_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp)
|
|||||||
struct file_entry *fe;
|
struct file_entry *fe;
|
||||||
int error, sector, size;
|
int error, sector, size;
|
||||||
|
|
||||||
error = vfs_hash_get(mp, ino, flags, curthread, vpp);
|
error = vfs_hash_get(mp, ino, flags, curthread, vpp, NULL, NULL);
|
||||||
if (error || *vpp != NULL)
|
if (error || *vpp != NULL)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
@ -601,7 +601,7 @@ udf_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp)
|
|||||||
unode->udfmp = udfmp;
|
unode->udfmp = udfmp;
|
||||||
vp->v_data = unode;
|
vp->v_data = unode;
|
||||||
|
|
||||||
error = vfs_hash_insert(vp, ino, flags, curthread, vpp);
|
error = vfs_hash_insert(vp, ino, flags, curthread, vpp, NULL, NULL);
|
||||||
if (error || *vpp != NULL)
|
if (error || *vpp != NULL)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
|
@ -915,7 +915,7 @@ ext2_vget(mp, ino, flags, vpp)
|
|||||||
int i, error;
|
int i, error;
|
||||||
int used_blocks;
|
int used_blocks;
|
||||||
|
|
||||||
error = vfs_hash_get(mp, ino, flags, curthread, vpp);
|
error = vfs_hash_get(mp, ino, flags, curthread, vpp, NULL, NULL);
|
||||||
if (error || *vpp != NULL)
|
if (error || *vpp != NULL)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
@ -942,7 +942,7 @@ ext2_vget(mp, ino, flags, vpp)
|
|||||||
ip->i_e2fs = fs = ump->um_e2fs;
|
ip->i_e2fs = fs = ump->um_e2fs;
|
||||||
ip->i_number = ino;
|
ip->i_number = ino;
|
||||||
|
|
||||||
error = vfs_hash_insert(vp, ino, flags, curthread, vpp);
|
error = vfs_hash_insert(vp, ino, flags, curthread, vpp, NULL, NULL);
|
||||||
if (error || *vpp != NULL)
|
if (error || *vpp != NULL)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
|
@ -915,7 +915,7 @@ ext2_vget(mp, ino, flags, vpp)
|
|||||||
int i, error;
|
int i, error;
|
||||||
int used_blocks;
|
int used_blocks;
|
||||||
|
|
||||||
error = vfs_hash_get(mp, ino, flags, curthread, vpp);
|
error = vfs_hash_get(mp, ino, flags, curthread, vpp, NULL, NULL);
|
||||||
if (error || *vpp != NULL)
|
if (error || *vpp != NULL)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
@ -942,7 +942,7 @@ ext2_vget(mp, ino, flags, vpp)
|
|||||||
ip->i_e2fs = fs = ump->um_e2fs;
|
ip->i_e2fs = fs = ump->um_e2fs;
|
||||||
ip->i_number = ino;
|
ip->i_number = ino;
|
||||||
|
|
||||||
error = vfs_hash_insert(vp, ino, flags, curthread, vpp);
|
error = vfs_hash_insert(vp, ino, flags, curthread, vpp, NULL, NULL);
|
||||||
if (error || *vpp != NULL)
|
if (error || *vpp != NULL)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
|
@ -661,7 +661,7 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir)
|
|||||||
struct cdev *dev;
|
struct cdev *dev;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
error = vfs_hash_get(mp, ino, flags, curthread, vpp);
|
error = vfs_hash_get(mp, ino, flags, curthread, vpp, NULL, NULL);
|
||||||
if (error || *vpp != NULL)
|
if (error || *vpp != NULL)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
@ -679,7 +679,7 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir)
|
|||||||
ip->i_vnode = vp;
|
ip->i_vnode = vp;
|
||||||
ip->i_number = ino;
|
ip->i_number = ino;
|
||||||
|
|
||||||
error = vfs_hash_insert(vp, ino, flags, curthread, vpp);
|
error = vfs_hash_insert(vp, ino, flags, curthread, vpp, NULL, NULL);
|
||||||
if (error || *vpp != NULL)
|
if (error || *vpp != NULL)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ vfs_hash_index(struct mount *mp, u_int hash)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
vfs_hash_get(struct mount *mp, u_int hash, int flags, struct thread *td, struct vnode **vpp)
|
vfs_hash_get(struct mount *mp, u_int hash, int flags, struct thread *td, struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg)
|
||||||
{
|
{
|
||||||
struct vnode *vp;
|
struct vnode *vp;
|
||||||
int error;
|
int error;
|
||||||
@ -74,6 +74,8 @@ vfs_hash_get(struct mount *mp, u_int hash, int flags, struct thread *td, struct
|
|||||||
continue;
|
continue;
|
||||||
if (vp->v_mount != mp)
|
if (vp->v_mount != mp)
|
||||||
continue;
|
continue;
|
||||||
|
if (fn != NULL && fn(vp, arg))
|
||||||
|
continue;
|
||||||
VI_LOCK(vp);
|
VI_LOCK(vp);
|
||||||
mtx_unlock(&vfs_hash_mtx);
|
mtx_unlock(&vfs_hash_mtx);
|
||||||
error = vget(vp, flags | LK_INTERLOCK, td);
|
error = vget(vp, flags | LK_INTERLOCK, td);
|
||||||
@ -102,7 +104,7 @@ vfs_hash_remove(struct vnode *vp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
vfs_hash_insert(struct vnode *vp, u_int hash, int flags, struct thread *td, struct vnode **vpp)
|
vfs_hash_insert(struct vnode *vp, u_int hash, int flags, struct thread *td, struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg)
|
||||||
{
|
{
|
||||||
struct vnode *vp2;
|
struct vnode *vp2;
|
||||||
int error;
|
int error;
|
||||||
@ -117,6 +119,8 @@ vfs_hash_insert(struct vnode *vp, u_int hash, int flags, struct thread *td, stru
|
|||||||
continue;
|
continue;
|
||||||
if (vp2->v_mount != vp->v_mount)
|
if (vp2->v_mount != vp->v_mount)
|
||||||
continue;
|
continue;
|
||||||
|
if (fn != NULL && fn(vp, arg))
|
||||||
|
continue;
|
||||||
VI_LOCK(vp2);
|
VI_LOCK(vp2);
|
||||||
mtx_unlock(&vfs_hash_mtx);
|
mtx_unlock(&vfs_hash_mtx);
|
||||||
error = vget(vp2, flags | LK_INTERLOCK, td);
|
error = vget(vp2, flags | LK_INTERLOCK, td);
|
||||||
|
@ -693,8 +693,10 @@ extern struct vop_vector default_vnodeops;
|
|||||||
#define VOP_EOPNOTSUPP ((void*)(uintptr_t)vop_eopnotsupp)
|
#define VOP_EOPNOTSUPP ((void*)(uintptr_t)vop_eopnotsupp)
|
||||||
|
|
||||||
/* vfs_hash.c */
|
/* vfs_hash.c */
|
||||||
int vfs_hash_get(struct mount *mp, u_int hash, int flags, struct thread *td, struct vnode **vpp);
|
typedef int vfs_hash_cmp_t(struct vnode *vp, void *arg);
|
||||||
int vfs_hash_insert(struct vnode *vp, u_int hash, int flags, struct thread *td, struct vnode **vpp);
|
|
||||||
|
int vfs_hash_get(struct mount *mp, u_int hash, int flags, struct thread *td, struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg);
|
||||||
|
int vfs_hash_insert(struct vnode *vp, u_int hash, int flags, struct thread *td, struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg);
|
||||||
void vfs_hash_rehash(struct vnode *vp, u_int hash);
|
void vfs_hash_rehash(struct vnode *vp, u_int hash);
|
||||||
void vfs_hash_remove(struct vnode *vp);
|
void vfs_hash_remove(struct vnode *vp);
|
||||||
|
|
||||||
|
@ -1172,7 +1172,7 @@ ffs_vget(mp, ino, flags, vpp)
|
|||||||
struct cdev *dev;
|
struct cdev *dev;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
error = vfs_hash_get(mp, ino, flags, curthread, vpp);
|
error = vfs_hash_get(mp, ino, flags, curthread, vpp, NULL, NULL);
|
||||||
if (error || *vpp != NULL)
|
if (error || *vpp != NULL)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
@ -1225,7 +1225,7 @@ ffs_vget(mp, ino, flags, vpp)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
error = vfs_hash_insert(vp, ino, flags, curthread, vpp);
|
error = vfs_hash_insert(vp, ino, flags, curthread, vpp, NULL, NULL);
|
||||||
if (error || *vpp != NULL)
|
if (error || *vpp != NULL)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user