mirror of
https://git.openafs.org/openafs.git
synced 2025-01-22 17:00:15 +00:00
DAFS: Add explicit 'valid' field for index maps
The CB, FE, and host serialization structures were just using the relevant indices to determine whether or not an entry mapping and old index to a new index was populated with actual data. For host structures, this really isn't sufficient, since our index can be 0, and the structure is calloc'd, so the index in the structure could also be 0. Add a flag explicitly stating whether or not the structure has been filled in, to make this unambiguous. Change-Id: Ia69e25fa73e10dc10cf3ddf08bb4feb2c9958674 Reviewed-on: http://gerrit.openafs.org/5526 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
parent
d43438bb91
commit
d54a9994d3
@ -39,6 +39,9 @@
|
||||
|
||||
#define HOST_STATE_VALID_WINDOW 1800 /* 30 minutes */
|
||||
|
||||
/* values for the 'valid' field in idx_map_entry_t */
|
||||
#define FS_STATE_IDX_VALID 1
|
||||
|
||||
/*
|
||||
* on-disk structures
|
||||
*/
|
||||
@ -205,6 +208,7 @@ struct AVDiskEntry {
|
||||
* dump runtime state
|
||||
*/
|
||||
struct idx_map_entry_t {
|
||||
byte valid; /* whether or not this entry has been populated */
|
||||
afs_uint32 old_idx; /* host hash id from last runtime */
|
||||
afs_uint32 new_idx; /* host hash id for this runtime */
|
||||
};
|
||||
|
@ -2522,6 +2522,7 @@ cb_stateDiskEntryToFE(struct fs_dump_state * state,
|
||||
ret = 1;
|
||||
goto done;
|
||||
}
|
||||
state->fe_map.entries[in->index].valid = FS_STATE_IDX_VALID;
|
||||
state->fe_map.entries[in->index].old_idx = in->index;
|
||||
state->fe_map.entries[in->index].new_idx = fetoi(out);
|
||||
|
||||
@ -2552,6 +2553,7 @@ cb_stateDiskEntryToCB(struct fs_dump_state * state,
|
||||
ret = 1;
|
||||
goto done;
|
||||
}
|
||||
state->cb_map.entries[in->index].valid = FS_STATE_IDX_VALID;
|
||||
state->cb_map.entries[in->index].old_idx = in->index;
|
||||
state->cb_map.entries[in->index].new_idx = cbtoi(out);
|
||||
|
||||
@ -2586,7 +2588,8 @@ fe_OldToNew(struct fs_dump_state * state, afs_uint32 old, afs_uint32 * new)
|
||||
if (old >= state->fe_map.len) {
|
||||
ViceLog(0, ("fe_OldToNew: index %d is out of range\n", old));
|
||||
ret = 1;
|
||||
} else if (state->fe_map.entries[old].old_idx != old) { /* sanity check */
|
||||
} else if (state->fe_map.entries[old].valid != FS_STATE_IDX_VALID ||
|
||||
state->fe_map.entries[old].old_idx != old) { /* sanity check */
|
||||
ViceLog(0, ("fe_OldToNew: index %d points to an invalid FileEntry record\n", old));
|
||||
ret = 1;
|
||||
} else {
|
||||
@ -2611,7 +2614,8 @@ cb_OldToNew(struct fs_dump_state * state, afs_uint32 old, afs_uint32 * new)
|
||||
if (old >= state->cb_map.len) {
|
||||
ViceLog(0, ("cb_OldToNew: index %d is out of range\n", old));
|
||||
ret = 1;
|
||||
} else if (state->cb_map.entries[old].old_idx != old) { /* sanity check */
|
||||
} else if (state->cb_map.entries[old].valid != FS_STATE_IDX_VALID ||
|
||||
state->cb_map.entries[old].old_idx != old) { /* sanity check */
|
||||
ViceLog(0, ("cb_OldToNew: index %d points to an invalid CallBack record\n", old));
|
||||
ret = 1;
|
||||
} else {
|
||||
|
@ -3399,6 +3399,7 @@ h_stateRestoreHost(struct fs_dump_state * state)
|
||||
h_InsertList_r(host);
|
||||
|
||||
/* setup host id map entry */
|
||||
state->h_map.entries[hdsk.index].valid = FS_STATE_IDX_VALID;
|
||||
state->h_map.entries[hdsk.index].old_idx = hdsk.index;
|
||||
state->h_map.entries[hdsk.index].new_idx = host->index;
|
||||
|
||||
@ -3464,7 +3465,8 @@ h_OldToNew(struct fs_dump_state * state, afs_uint32 old, afs_uint32 * new)
|
||||
if (old >= state->h_map.len) {
|
||||
ViceLog(0, ("h_OldToNew: index %d is out of range\n", old));
|
||||
ret = 1;
|
||||
} else if (state->h_map.entries[old].old_idx != old) { /* sanity check */
|
||||
} else if (state->h_map.entries[old].valid != FS_STATE_IDX_VALID ||
|
||||
state->h_map.entries[old].old_idx != old) { /* sanity check */
|
||||
ViceLog(0, ("h_OldToNew: index %d points to an invalid host record\n", old));
|
||||
ret = 1;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user