nfs4: Do not create new Inode object when deleting a vnode

This commit is contained in:
Pawel Dziepak
2013-01-02 20:18:32 +01:00
parent 47e68f1c7a
commit 345a659337
2 changed files with 12 additions and 4 deletions
@@ -23,13 +23,14 @@ public:
inline void Lock(); inline void Lock();
inline void Unlock(); inline void Unlock();
inline Inode* GetPointer() const;
Inode* Get(); Inode* Get();
void Replace(Inode* newInode); void Replace(Inode* newInode);
inline void Remove(); inline void Remove();
inline void Clear(); inline void Clear();
inline ino_t ID(); inline ino_t ID() const;
private: private:
ino_t fID; ino_t fID;
rw_lock fLock; rw_lock fLock;
@@ -105,8 +106,15 @@ VnodeToInode::Clear()
} }
inline Inode*
VnodeToInode::GetPointer() const
{
return fInode;
}
inline ino_t inline ino_t
VnodeToInode::ID() VnodeToInode::ID() const
{ {
return fID; return fID;
} }
@@ -339,10 +339,10 @@ nfs4_remove_vnode(fs_volume* volume, fs_vnode* vnode, bool reenter)
VnodeToInode* vti = reinterpret_cast<VnodeToInode*>(vnode->private_node); VnodeToInode* vti = reinterpret_cast<VnodeToInode*>(vnode->private_node);
TRACE("volume = %p, vnode = %llu", volume, vti->ID()); TRACE("volume = %p, vnode = %llu", volume, vti->ID());
if (fs->Root() == vti->Get()) if (fs->Root() == vti->GetPointer())
return B_OK; return B_OK;
ASSERT(vti->Get() == NULL); ASSERT(vti->GetPointer() == NULL);
delete vti; delete vti;
return B_OK; return B_OK;