mirror of
https://github.com/versity/scoutfs.git
synced 2026-09-20 15:04:42 +00:00
scoutfs: track inode 512b block count
We weren't doing anything with the inode blocks field. We weren't even initializing it which explains why we'd sometimes see garbage i_blocks values in scoutfs inodes in segments. The logical blocks field reflects the contents of the file regardless of whether its online or not. It's the sum of our online and offline block tracking. So we can initialize it to our persistent online and offline counts and then keep it in sync as blocks are allocated and freed. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
+7
-1
@@ -234,9 +234,15 @@ static void load_inode(struct inode *inode, struct scoutfs_inode *cinode)
|
||||
ci->online_blocks = le64_to_cpu(cinode->online_blocks);
|
||||
ci->offline_blocks = le64_to_cpu(cinode->offline_blocks);
|
||||
ci->next_readdir_pos = le64_to_cpu(cinode->next_readdir_pos);
|
||||
|
||||
ci->flags = le32_to_cpu(cinode->flags);
|
||||
|
||||
/*
|
||||
* i_blocks is initialized from online and offline and is then
|
||||
* maintained as blocks come and go.
|
||||
*/
|
||||
inode->i_blocks = (ci->online_blocks = + ci->offline_blocks)
|
||||
<< SCOUTFS_BLOCK_SECTOR_SHIFT;
|
||||
|
||||
set_item_info(ci, cinode);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user