Files
haiku-beta6/src/add-ons/kernel/file_systems/bfs/BlockAllocator.h
T
Axel Dörfler b5a0c65c19 Added support for aborted "chkbfs" runs (so that they won't do any harm).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2059 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-11-22 03:32:53 +00:00

61 lines
1.6 KiB
C++

#ifndef BLOCK_ALLOCATOR_H
#define BLOCK_ALLOCATOR_H
/* BlockAllocator - block bitmap handling and allocation policies
**
** Initial version by Axel Dörfler, [email protected]
** This file may be used under the terms of the OpenBeOS License.
*/
#include "Lock.h"
class AllocationGroup;
class Transaction;
class Volume;
class Inode;
struct disk_super_block;
struct block_run;
struct check_control;
struct check_cookie;
class BlockAllocator {
public:
BlockAllocator(Volume *volume);
~BlockAllocator();
status_t Initialize();
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);
status_t AllocateBlocks(Transaction *transaction, int32 group, uint16 start,
uint16 numBlocks, uint16 minimum, block_run &run);
status_t StartChecking(check_control *control);
status_t StopChecking(check_control *control);
status_t CheckNextNode(check_control *control);
status_t CheckBlockRun(block_run run, const char *type = NULL, check_control *control = NULL);
status_t CheckInode(Inode *inode, check_control *control = NULL);
private:
bool CheckBitmapIsUsedAt(off_t block) const;
void SetCheckBitmapAt(off_t block);
static status_t initialize(BlockAllocator *);
Volume *fVolume;
Semaphore fLock;
AllocationGroup *fGroups;
int32 fNumGroups, fBlocksPerGroup;
uint32 *fCheckBitmap;
check_cookie *fCheckCookie;
};
#endif /* BLOCK_ALLOCATOR_H */