diff options
author | Christopher Haster <chaster@utexas.edu> | 2019-05-22 22:24:05 +0300 |
---|---|---|
committer | Christopher Haster <chaster@utexas.edu> | 2019-05-24 00:43:10 +0300 |
commit | 12e464e9c37dd865e432716856bf2a30fd948297 (patch) | |
tree | d92547957eeef84badd4ff9515a5bbd17dc08b7e /scripts | |
parent | 9899c7fe486d4a581fb84ecf832a574896d411b7 (diff) |
Fixed issue with writes following a truncate
The problem was not setting the file state correctly after the truncate.
To truncate < size, we end up using the cache to traverse the ctz
skip-list far away from where our file->pos is.
We can leave the last block in the cache in case we're going to append
to the file, but if we do this we need to set up file->block+file->off
to tell use where we are in the file, and set the LFS_F_READING flag to
indicate that our cache contains read data.
Note this is different than the LFS_F_DIRTY, which we need also. The
purpose of the flags are as follows:
- LFS_F_DIRTY - file ctz skip-list branch is out of sync with
filesystem, need to update metadata
- LFS_F_READING - file cache is in use for reading, need to drop cache
- LFS_F_WRITING - file cache is in use for writing, need to write out
cache to disk
The difference between flags is subtle but important because read/prog
caches are handled differently. Prog caches have asserts in place to
catch programs without erases (the infamous pcache->block == 0xffffffff
assert).
Though maybe the names deserve an update...
Found by ebinans
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions