diff options
author | Christopher Haster <chaster@utexas.edu> | 2018-07-02 06:29:42 +0300 |
---|---|---|
committer | Christopher Haster <chaster@utexas.edu> | 2018-10-14 03:35:45 +0300 |
commit | cebf7aa0fec09c04a4b9b2ddacec50809269e37d (patch) | |
tree | 3ed3ee68b243da3e1d23f0fdb20a49506e9f2483 /tests | |
parent | 3ffcedb95b330f53f1caa505f112a2729f90aa6d (diff) |
Switched back to simple deorphan-step on directory remove
Originally I tried to reuse the indirect delete to accomplish truely
atomic directory removes, however this fell apart when it came to
implementing directory removes as a side-effect of renames.
A single indirect-delete simply can't handle renames with removes as
a side effects. When copying an entry to its destination, we need to
atomically delete both the old entry, and the source of our copy. We
can't delete both with only a single indirect-delete. It is possible to
accomplish this with two indirect-deletes, but this is such an uncommon
case that it's really not worth supporting efficiently due to how
expensive globals are.
I also dropped indirect-deletes for normal directory removes. I may add
it back later, but at the moment it's extra code cost for that's not
traveled very often.
As a result, restructured the indirect delete handling to be a bit more
generic, now with a multipurpose lfs_globals_t struct instead of the
delete specific lfs_entry_t struct.
Also worked on integrating xored-globals, now with several primitive
global operations to manage fetching/updating globals on disk.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test_move.sh | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/tests/test_move.sh b/tests/test_move.sh index ff02553..11dfecc 100755 --- a/tests/test_move.sh +++ b/tests/test_move.sh @@ -59,7 +59,7 @@ tests/test.py << TEST lfs_rename(&lfs, "b/hello", "c/hello") => 0; lfs_unmount(&lfs) => 0; TEST -truncate -s-7 blocks/6 +truncate -s-11 blocks/6 tests/test.py << TEST lfs_mount(&lfs, &cfg) => 0; lfs_dir_open(&lfs, &dir[0], "b") => 0; @@ -86,8 +86,8 @@ tests/test.py << TEST lfs_rename(&lfs, "c/hello", "d/hello") => 0; lfs_unmount(&lfs) => 0; TEST -truncate -s-7 blocks/8 -truncate -s-7 blocks/a +truncate -s-11 blocks/8 +truncate -s-11 blocks/a tests/test.py << TEST lfs_mount(&lfs, &cfg) => 0; lfs_dir_open(&lfs, &dir[0], "c") => 0; @@ -108,6 +108,32 @@ tests/test.py << TEST lfs_unmount(&lfs) => 0; TEST +echo "--- Move file after corrupt ---" +tests/test.py -s << TEST + lfs_mount(&lfs, &cfg) => 0; + lfs_rename(&lfs, "c/hello", "d/hello") => 0; + lfs_unmount(&lfs) => 0; +TEST +tests/test.py << TEST + lfs_mount(&lfs, &cfg) => 0; + lfs_dir_open(&lfs, &dir[0], "c") => 0; + lfs_dir_read(&lfs, &dir[0], &info) => 1; + strcmp(info.name, ".") => 0; + lfs_dir_read(&lfs, &dir[0], &info) => 1; + strcmp(info.name, "..") => 0; + lfs_dir_read(&lfs, &dir[0], &info) => 0; + lfs_dir_close(&lfs, &dir[0]) => 0; + lfs_dir_open(&lfs, &dir[0], "d") => 0; + lfs_dir_read(&lfs, &dir[0], &info) => 1; + strcmp(info.name, ".") => 0; + lfs_dir_read(&lfs, &dir[0], &info) => 1; + strcmp(info.name, "..") => 0; + lfs_dir_read(&lfs, &dir[0], &info) => 1; + strcmp(info.name, "hello") => 0; + lfs_dir_read(&lfs, &dir[0], &info) => 0; + lfs_unmount(&lfs) => 0; +TEST + echo "--- Move dir ---" tests/test.py << TEST lfs_mount(&lfs, &cfg) => 0; |