diff options
author | Christopher Haster <chaster@utexas.edu> | 2018-04-10 23:14:27 +0300 |
---|---|---|
committer | Christopher Haster <chaster@utexas.edu> | 2018-04-11 22:38:25 +0300 |
commit | 9637b9606965d40692724e9a5a742e8e87d6c602 (patch) | |
tree | 5221d9e2107d3a5ad3c9a90bd324a80d2b4719e1 /lfs.h | |
parent | 89a7630d84f1529549f6aa2528fb7b22f4edf1b2 (diff) |
Fixed lookahead overflow and removed unbounded lookahead pointers
As pointed out by davidefer, the lookahead pointer modular arithmetic
does not work around integer overflow when the pointer size is not a
multiple of the block count.
To avoid overflow problems, the easy solution is to stop trying to
work around integer overflows and keep the lookahead offset inside the
block device. To make this work, the ack was modified into a resetable
counter that is decremented every block allocation.
As a plus, quite a bit of the allocation logic ended up simplified.
Diffstat (limited to 'lfs.h')
-rw-r--r-- | lfs.h | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -259,9 +259,9 @@ typedef struct lfs_superblock { } lfs_superblock_t; typedef struct lfs_free { - lfs_block_t begin; - lfs_block_t size; lfs_block_t off; + lfs_block_t size; + lfs_block_t i; lfs_block_t ack; uint32_t *buffer; } lfs_free_t; |