mirror of
https://github.com/versity/scoutfs.git
synced 2026-09-19 22:44:19 +00:00
scoutfs: add block visited bit
Add functions for callers to maintain a visited bit in cached blocks. The radix allocator is going to use this to count the number of clean blocks it sees across paths through the radix which can share parent blocks. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
@@ -67,6 +67,7 @@ enum {
|
||||
BLOCK_BIT_PAGE_ALLOC, /* page (possibly high order) allocation */
|
||||
BLOCK_BIT_VIRT, /* mapped virt allocation */
|
||||
BLOCK_BIT_CRC_VALID, /* crc has been verified */
|
||||
BLOCK_BIT_VISITED, /* used by callers to track blocks */
|
||||
};
|
||||
|
||||
struct block_private {
|
||||
@@ -128,6 +129,22 @@ bool scoutfs_block_valid_ref(struct super_block *sb,
|
||||
hdr->blkno == blkno;
|
||||
}
|
||||
|
||||
bool scoutfs_block_tas_visited(struct super_block *sb,
|
||||
struct scoutfs_block *bl)
|
||||
{
|
||||
struct block_private *bp = BLOCK_PRIVATE(bl);
|
||||
|
||||
return test_bit(BLOCK_BIT_VISITED, &bp->bits) != 0;
|
||||
}
|
||||
|
||||
void scoutfs_block_clear_visited(struct super_block *sb,
|
||||
struct scoutfs_block *bl)
|
||||
{
|
||||
struct block_private *bp = BLOCK_PRIVATE(bl);
|
||||
|
||||
clear_bit(BLOCK_BIT_VISITED, &bp->bits);
|
||||
}
|
||||
|
||||
static struct block_private *block_alloc(struct super_block *sb, u64 blkno)
|
||||
{
|
||||
struct block_private *bp;
|
||||
|
||||
@@ -17,6 +17,10 @@ bool scoutfs_block_valid_crc(struct scoutfs_block_header *hdr);
|
||||
bool scoutfs_block_valid_ref(struct super_block *sb,
|
||||
struct scoutfs_block_header *hdr,
|
||||
__le64 seq, __le64 blkno);
|
||||
bool scoutfs_block_tas_visited(struct super_block *sb,
|
||||
struct scoutfs_block *bl);
|
||||
void scoutfs_block_clear_visited(struct super_block *sb,
|
||||
struct scoutfs_block *bl);
|
||||
|
||||
struct scoutfs_block *scoutfs_block_create(struct super_block *sb, u64 blkno);
|
||||
struct scoutfs_block *scoutfs_block_read(struct super_block *sb, u64 blkno);
|
||||
|
||||
Reference in New Issue
Block a user