Added new method block_run::MergeableWith() which checks if two different

block_runs can be merged together.
Added a constant for the maximum length of a block_run.
Added a flag constant to the inode that prevents freeing up its space
after it has been removed - this is only useful for the "chkbfs" stuff.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1985 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2002-11-18 01:12:56 +00:00
parent 8ea2f57ddd
commit 2afbd5e712

View File

@ -26,6 +26,7 @@ struct block_run
inline bool operator==(const block_run &run) const;
inline bool operator!=(const block_run &run) const;
inline bool IsZero();
inline bool MergeableWith(block_run run) const;
inline void SetTo(int32 group, uint16 start, uint16 length = 1);
inline static block_run Run(int32 group, uint16 start, uint16 length = 1);
@ -34,6 +35,11 @@ struct block_run
typedef block_run inode_addr;
// Since the block_run::length field spans 16 bits, the largest number of
// blocks covered by a block_run is 65535 (as long as we don't want to
// break compatibility and take a zero length for 65536).
#define MAX_BLOCK_RUN_LENGTH 65535
//**************************************
@ -165,6 +171,7 @@ enum inode_flags
INODE_NO_CACHE = 0x00010000,
INODE_WAS_WRITTEN = 0x00020000,
INODE_NO_TRANSACTION = 0x00040000,
INODE_DONT_FREE_SPACE = 0x00080000, // only used by the "chkbfs" functionality
};
//**************************************
@ -242,6 +249,19 @@ block_run::IsZero()
}
inline bool
block_run::MergeableWith(block_run run) const
{
// 65535 is the maximum allowed run size for BFS
if (allocation_group == run.allocation_group
&& start + length == run.start
&& (uint32)length + run.length <= MAX_BLOCK_RUN_LENGTH)
return true;
return false;
}
inline void
block_run::SetTo(int32 _group,uint16 _start,uint16 _length)
{