* Added acquire_vnode() call that you can use to get another reference to an

inode - unlike get_vnode() the busy flag won't prevent you from getting that
  reference.
* Changed put_vnode() to return an error in case the vnode couldn't be found.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26713 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2008-08-01 09:59:19 +00:00
parent aaad303e67
commit 9f6ae76f02
5 changed files with 44 additions and 4 deletions

View File

@ -309,6 +309,7 @@ extern status_t publish_vnode(fs_volume *volume, ino_t vnodeID,
extern status_t get_vnode(fs_volume *volume, ino_t vnodeID,
void **_privateNode);
extern status_t put_vnode(fs_volume *volume, ino_t vnodeID);
extern status_t acquire_vnode(fs_volume *volume, ino_t vnodeID);
extern status_t remove_vnode(fs_volume *volume, ino_t vnodeID);
extern status_t unremove_vnode(fs_volume *volume, ino_t vnodeID);
extern status_t get_vnode_removed(fs_volume *volume, ino_t vnodeID,

View File

@ -905,6 +905,7 @@
#define publish_vnode fssh_publish_vnode
#define get_vnode fssh_get_vnode
#define put_vnode fssh_put_vnode
#define acquire_vnode fssh_acquire_vnode
#define remove_vnode fssh_remove_vnode
#define unremove_vnode fssh_unremove_vnode
#define get_vnode_removed fssh_get_vnode_removed

View File

@ -347,6 +347,8 @@ extern fssh_status_t fssh_get_vnode(fssh_fs_volume *volume,
fssh_vnode_id vnodeID, void **_privateNode);
extern fssh_status_t fssh_put_vnode(fssh_fs_volume *volume,
fssh_vnode_id vnodeID);
extern fssh_status_t fssh_acquire_vnode(fssh_fs_volume *volume,
fssh_vnode_id vnodeID);
extern fssh_status_t fssh_remove_vnode(fssh_fs_volume *volume,
fssh_vnode_id vnodeID);
extern fssh_status_t fssh_unremove_vnode(fssh_fs_volume *volume,

View File

@ -3193,6 +3193,23 @@ get_vnode(fs_volume *volume, ino_t vnodeID, void **_fsNode)
}
extern "C" status_t
acquire_vnode(fs_volume *volume, ino_t vnodeID)
{
struct vnode *vnode;
mutex_lock(&sVnodeMutex);
vnode = lookup_vnode(volume->id, vnodeID);
mutex_unlock(&sVnodeMutex);
if (vnode == NULL)
return B_BAD_VALUE;
inc_vnode_ref_count(vnode);
return B_OK;
}
extern "C" status_t
put_vnode(fs_volume *volume, ino_t vnodeID)
{
@ -3202,9 +3219,10 @@ put_vnode(fs_volume *volume, ino_t vnodeID)
vnode = lookup_vnode(volume->id, vnodeID);
mutex_unlock(&sVnodeMutex);
if (vnode)
dec_vnode_ref_count(vnode, false, true);
if (vnode == NULL)
return B_BAD_VALUE;
dec_vnode_ref_count(vnode, false, true);
return B_OK;
}

View File

@ -2017,6 +2017,23 @@ fssh_get_vnode(fssh_fs_volume *volume, fssh_vnode_id vnodeID, void **fsNode)
}
extern "C" fssh_status_t
fssh_acquire_vnode(fssh_fs_volume *volume, fssh_vnode_id vnodeID)
{
struct vnode *vnode;
fssh_mutex_lock(&sVnodeMutex);
vnode = lookup_vnode(volume->id, vnodeID);
fssh_mutex_unlock(&sVnodeMutex);
if (vnode == NULL)
return FSSH_B_BAD_VALUE;
inc_vnode_ref_count(vnode);
return FSSH_B_OK;
}
extern "C" fssh_status_t
fssh_put_vnode(fssh_fs_volume *volume, fssh_vnode_id vnodeID)
{
@ -2026,9 +2043,10 @@ fssh_put_vnode(fssh_fs_volume *volume, fssh_vnode_id vnodeID)
vnode = lookup_vnode(volume->id, vnodeID);
fssh_mutex_unlock(&sVnodeMutex);
if (vnode)
dec_vnode_ref_count(vnode, true);
if (vnode == NULL)
return FSSH_B_BAD_VALUE;
dec_vnode_ref_count(vnode, true);
return FSSH_B_OK;
}