mirror of
https://github.com/versity/scoutfs.git
synced 2026-02-11 04:51:08 +00:00
Move to static mapping items instead of unbounded extents. We get more predictable data structures and simpler code but still get reasonably dense metadata. We no longer need all the extent code needed to split and merge extents, test for overlaps, and all that. The functions that use the mappings (get_block, fiemap, truncate) now have a pattern where they decode the mapping item into an allocated native representation, do their work, and encode the result back into the dense item. We do have to grow the largest possible item value to fit the worst case encoding expansion of random block numbers. The local allocators are no longer two extents but are instead simple bitmaps: one for full segments and one for individual blocks. There are helper functions to free and allocate segments and blocks, with careful coordination of, for example, freeing a segment once all of its constituent blocks are free. _fiemap is refactored a bit to make it more clear what's going on. There's one function that either merges the next bit with the currently building extent or fills the current and starts recording from a non-mergable additional block. The old loop worked this way but was implemented with a single squirrely iteration over the extents. This wasn't feasible now that we're also iterating over blocks inside the mapping items. It's a lot clearer to call out to merge or fill the fiemap entry. The dirty item reservation counts for using the mappings is reduced significantly because each modification no longer has to assume that it might merge with two adjacent contiguous neighbours. Signed-off-by: Zach Brown <zab@versity.com>
18 lines
530 B
C
18 lines
530 B
C
#ifndef _SCOUTFS_FILERW_H_
|
|
#define _SCOUTFS_FILERW_H_
|
|
|
|
extern const struct address_space_operations scoutfs_file_aops;
|
|
extern const struct file_operations scoutfs_file_fops;
|
|
|
|
int scoutfs_data_truncate_items(struct super_block *sb, u64 ino, u64 iblock,
|
|
u64 len, bool offline);
|
|
int scoutfs_data_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
|
|
u64 start, u64 len);
|
|
|
|
int scoutfs_data_setup(struct super_block *sb);
|
|
void scoutfs_data_destroy(struct super_block *sb);
|
|
|
|
int __init scoutfs_data_test(void);
|
|
|
|
#endif
|