haiku/src/system/kernel/cache/vnode_store.h
Ingo Weinhold 3caec2871a * Resolved TODO in free_vnode(): There was a race condition between vnode
destruction and VMVnodeCache::AcquireUnreferencedStoreRef(). Solved by
  adding a flag to VMVnodeCache and letting AcquireUnreferencedStoreRef()
  fail, if set.
* Added TODO regarding replacing the snooze() waiting for busy vnodes.
* get_vnode(): Unlock sVnodeMutex while calling the put_vnode() hook on
  error.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34841 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-01 20:20:11 +00:00

54 lines
1.3 KiB
C++

/*
* Copyright 2008-2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2004-2007, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*/
#ifndef VNODE_STORE_H
#define VNODE_STORE_H
#include <vm/VMCache.h>
struct file_cache_ref;
class VMVnodeCache : public VMCache {
public:
status_t Init(struct vnode *vnode);
virtual bool HasPage(off_t offset);
virtual status_t Read(off_t offset, const iovec *vecs, size_t count,
uint32 flags, size_t *_numBytes);
virtual status_t Write(off_t offset, const iovec *vecs, size_t count,
uint32 flags, size_t *_numBytes);
virtual status_t WriteAsync(off_t offset, const iovec* vecs,
size_t count, size_t numBytes, uint32 flags,
AsyncIOCallback* callback);
virtual bool CanWritePage(off_t offset);
virtual status_t Fault(struct VMAddressSpace *aspace, off_t offset);
virtual status_t AcquireUnreferencedStoreRef();
virtual void AcquireStoreRef();
virtual void ReleaseStoreRef();
void SetFileCacheRef(file_cache_ref* ref)
{ fFileCacheRef = ref; }
file_cache_ref* FileCacheRef() const
{ return fFileCacheRef; }
void VnodeDeleted() { fVnodeDeleted = true; }
private:
struct vnode* fVnode;
file_cache_ref* fFileCacheRef;
ino_t fInode;
dev_t fDevice;
volatile bool fVnodeDeleted;
};
#endif /* VNODE_STORE_H */