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.
This commit is contained in:
@@ -129,7 +129,7 @@ enum lfs_type {
|
||||
// internal sources
|
||||
LFS_FROM_REGION = 0x000,
|
||||
LFS_FROM_DISK = 0x200,
|
||||
LFS_FROM_MOVE = 0x004,
|
||||
LFS_FROM_MOVE = 0x0ff,
|
||||
};
|
||||
|
||||
// File open flags
|
||||
@@ -296,10 +296,17 @@ typedef struct lfs_mattrlist {
|
||||
struct lfs_mattrlist *next;
|
||||
} lfs_mattrlist_t;
|
||||
|
||||
typedef struct lfs_entry {
|
||||
lfs_block_t pair[2];
|
||||
uint16_t id;
|
||||
} lfs_entry_t;
|
||||
//typedef struct lfs_entry {
|
||||
// lfs_block_t pair[2];
|
||||
// uint16_t id;
|
||||
//} lfs_entry_t;
|
||||
|
||||
typedef struct lfs_globals {
|
||||
struct lfs_move {
|
||||
lfs_block_t pair[2];
|
||||
uint16_t id;
|
||||
} move;
|
||||
} lfs_globals_t;
|
||||
|
||||
typedef struct lfs_mdir {
|
||||
lfs_block_t pair[2];
|
||||
@@ -310,7 +317,7 @@ typedef struct lfs_mdir {
|
||||
uint16_t count;
|
||||
bool erased;
|
||||
bool split;
|
||||
lfs_entry_t idelete;
|
||||
lfs_globals_t globals;
|
||||
bool stop_at_commit; // TODO hmmm
|
||||
uint16_t moveid; // TODO rm me
|
||||
} lfs_mdir_t;
|
||||
@@ -380,8 +387,8 @@ typedef struct lfs {
|
||||
|
||||
lfs_free_t free;
|
||||
bool deorphaned;
|
||||
lfs_entry_t idelete;
|
||||
lfs_entry_t diff;
|
||||
lfs_globals_t globals;
|
||||
lfs_globals_t diff;
|
||||
|
||||
lfs_size_t inline_size;
|
||||
lfs_size_t attrs_size;
|
||||
|
||||
Reference in New Issue
Block a user