Volume::Ummount() now use the NO_WRITES mode for remove_cached_device_blocks()
if the volume is read-only. Some style changes. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1600 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -65,6 +65,8 @@ Volume::Panic()
|
||||
fFlags |= VOLUME_READ_ONLY;
|
||||
#ifdef USER
|
||||
debugger("BFS panics!");
|
||||
#elif defined(DEBUG)
|
||||
kernel_debugger("BFS panics!");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -189,7 +191,7 @@ Volume::Unmount()
|
||||
|
||||
delete fIndicesNode;
|
||||
|
||||
remove_cached_device_blocks(fDevice,ALLOW_WRITES);
|
||||
remove_cached_device_blocks(fDevice, IsReadOnly() ? NO_WRITES : ALLOW_WRITES);
|
||||
close(fDevice);
|
||||
|
||||
return B_OK;
|
||||
@@ -266,7 +268,8 @@ Volume::WriteSuperBlock()
|
||||
|
||||
|
||||
void
|
||||
Volume::UpdateLiveQueries(Inode *inode,const char *attribute,int32 type,const uint8 *oldKey,size_t oldLength,const uint8 *newKey,size_t newLength)
|
||||
Volume::UpdateLiveQueries(Inode *inode, const char *attribute, int32 type, const uint8 *oldKey,
|
||||
size_t oldLength, const uint8 *newKey, size_t newLength)
|
||||
{
|
||||
if (fQueryLock.Lock() < B_OK)
|
||||
return;
|
||||
|
||||
@@ -41,9 +41,9 @@ class Volume {
|
||||
status_t Unmount();
|
||||
|
||||
bool IsValidSuperBlock();
|
||||
bool IsReadOnly() const { return fFlags & VOLUME_READ_ONLY; }
|
||||
bool IsReadOnly() const;
|
||||
void Panic();
|
||||
Benaphore &Lock() { return fLock; }
|
||||
Benaphore &Lock();
|
||||
|
||||
block_run Root() const { return fSuperBlock.root_dir; }
|
||||
Inode *RootNode() const { return fRootNode; }
|
||||
@@ -79,30 +79,35 @@ class Volume {
|
||||
|
||||
status_t CreateIndicesRoot(Transaction *transaction);
|
||||
|
||||
status_t AllocateForInode(Transaction *transaction,const Inode *parent,mode_t type,block_run &run);
|
||||
status_t AllocateForInode(Transaction *transaction,const block_run *parent,mode_t type,block_run &run);
|
||||
status_t Allocate(Transaction *transaction,const Inode *inode,off_t numBlocks,block_run &run,uint16 minimum = 1);
|
||||
// block bitmap
|
||||
BlockAllocator &Allocator();
|
||||
status_t AllocateForInode(Transaction *transaction, const Inode *parent,
|
||||
mode_t type, block_run &run);
|
||||
status_t AllocateForInode(Transaction *transaction, const block_run *parent,
|
||||
mode_t type, block_run &run);
|
||||
status_t Allocate(Transaction *transaction,const Inode *inode,
|
||||
off_t numBlocks, block_run &run, uint16 minimum = 1);
|
||||
status_t Free(Transaction *transaction, block_run run);
|
||||
|
||||
#ifdef DEBUG
|
||||
BlockAllocator &Allocator() { return fBlockAllocator; }
|
||||
#endif
|
||||
BufferPool &Pool() { return fBufferPool; }
|
||||
|
||||
status_t Sync();
|
||||
Journal *GetJournal(off_t /*refBlock*/) const { return fJournal; }
|
||||
|
||||
// cache access
|
||||
status_t WriteSuperBlock();
|
||||
status_t WriteBlocks(off_t blockNumber, const uint8 *block, uint32 numBlocks);
|
||||
void WriteCachedBlocksIfNecessary();
|
||||
status_t FlushDevice();
|
||||
|
||||
void UpdateLiveQueries(Inode *inode,const char *attribute,int32 type,const uint8 *oldKey,size_t oldLength,const uint8 *newKey,size_t newLength);
|
||||
// queries
|
||||
void UpdateLiveQueries(Inode *inode, const char *attribute, int32 type,
|
||||
const uint8 *oldKey, size_t oldLength,
|
||||
const uint8 *newKey, size_t newLength);
|
||||
void AddQuery(Query *query);
|
||||
void RemoveQuery(Query *query);
|
||||
|
||||
uint32 GetUniqueID() { return atomic_add(&fUniqueID,1); }
|
||||
status_t Sync();
|
||||
Journal *GetJournal(off_t refBlock) const;
|
||||
|
||||
BufferPool &Pool();
|
||||
|
||||
uint32 GetUniqueID();
|
||||
|
||||
protected:
|
||||
nspace_id fID;
|
||||
@@ -127,8 +132,30 @@ class Volume {
|
||||
BufferPool fBufferPool;
|
||||
};
|
||||
|
||||
|
||||
// inline functions
|
||||
|
||||
inline bool
|
||||
Volume::IsReadOnly() const
|
||||
{
|
||||
return fFlags & VOLUME_READ_ONLY;
|
||||
}
|
||||
|
||||
|
||||
inline Benaphore &
|
||||
Volume::Lock()
|
||||
{
|
||||
return fLock;
|
||||
}
|
||||
|
||||
|
||||
inline BlockAllocator &
|
||||
Volume::Allocator()
|
||||
{
|
||||
return fBlockAllocator;
|
||||
}
|
||||
|
||||
|
||||
inline status_t
|
||||
Volume::AllocateForInode(Transaction *transaction, const block_run *parent, mode_t type, block_run &run)
|
||||
{
|
||||
@@ -177,4 +204,24 @@ Volume::FlushDevice()
|
||||
}
|
||||
|
||||
|
||||
inline Journal *
|
||||
Volume::GetJournal(off_t /*refBlock*/) const
|
||||
{
|
||||
return fJournal;
|
||||
}
|
||||
|
||||
|
||||
inline BufferPool &
|
||||
Volume::Pool()
|
||||
{
|
||||
return fBufferPool;
|
||||
}
|
||||
|
||||
|
||||
inline uint32
|
||||
Volume::GetUniqueID()
|
||||
{
|
||||
return atomic_add(&fUniqueID, 1);
|
||||
}
|
||||
|
||||
#endif /* VOLUME_H */
|
||||
|
||||
Reference in New Issue
Block a user