From 14c5be99b682c3b7a81c36181ffb2bf3eb77e93a Mon Sep 17 00:00:00 2001 From: Nickolai Zeldovich Date: Wed, 15 Jan 2003 00:28:46 +0000 Subject: [PATCH] callbacks-later-linked-list-fix-20030114 the linked list code was never updated for multiple passes when we started doing that. ==================== This delta was composed from multiple commits as part of the CVS->Git migration. The checkin message with each commit was inconsistent. The following are the additional commit messages. ==================== the linked list code was never updated for multiple passes when we started doing that. --- src/viced/callback.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/viced/callback.c b/src/viced/callback.c index 400d291..0973849 100644 --- a/src/viced/callback.c +++ b/src/viced/callback.c @@ -1287,7 +1287,7 @@ extern char fsync_wait[]; int BreakVolumeCallBacksLater(afs_uint32 volume) { int hash; - u_short *feip; + afs_int32 *feip; struct FileEntry *fe; struct CallBack *cb; struct host *host; @@ -1333,11 +1333,11 @@ int BreakLaterCallBacks(void) { struct AFSFid fid; int hash; - u_short *feip; + afs_int32 *feip; struct CallBack *cb; struct FileEntry *fe = NULL; struct FileEntry *myfe = NULL; - struct FileEntry *tmpfe; + struct FileEntry **fepp; struct host *host; struct VCBParams henumParms; unsigned short tthead = 0; /* zero is illegal value */ @@ -1373,7 +1373,7 @@ restart: /* Clear for next pass */ fid.Volume = 0, fid.Vnode = fid.Unique = 0; tthead = 0; - for (fe = myfe; fe; ) { + for (fepp = &myfe; fe = *fepp; ) { /* Pick up first volid we see and break callbacks for it */ if (fid.Volume == 0 || fid.Volume == fe->volid) { register struct CallBack *cbnext; @@ -1391,14 +1391,11 @@ restart: FreeCB(cb); /* leave hold for MultiBreakVolumeCallBack to clear */ } - /* if we delete the head element, relink chain */ - if (myfe == fe) - (struct object *)myfe = ((struct object *)fe)->next; - tmpfe = fe; - (struct object *)fe = ((struct object *)fe)->next; - FreeFE(tmpfe); + /* relink chain */ + (struct object *) *fepp = ((struct object *)fe)->next; + FreeFE(fe); } else { - (struct object *)fe = ((struct object *)fe)->next; + (struct object **) fepp = &(((struct object *)fe)->next); } } -- 1.9.4