In preparation for adding inode check-hashes, change the fsck_ffs

inodirty() function to have a pointer to the inode being dirtied.
No functional change (as for now the parameter is ununsed).

Sponsored by: Netflix
This commit is contained in:
Kirk McKusick 2018-10-31 05:17:53 +00:00
parent ec9e3fb095
commit 2c288c95d9
6 changed files with 38 additions and 38 deletions

View File

@ -323,7 +323,7 @@ adjust(struct inodesc *idesc, int lcnt)
if (preen || reply("ADJUST") == 1) {
if (bkgrdflag == 0) {
DIP_SET(dp, di_nlink, DIP(dp, di_nlink) - lcnt);
inodirty();
inodirty(dp);
} else {
cmd.value = idesc->id_number;
cmd.size = -lcnt;
@ -449,7 +449,7 @@ linkup(ino_t orphan, ino_t parentdir, char *name)
pfatal("SORRY. CANNOT CREATE lost+found DIRECTORY\n\n");
return (0);
}
inodirty();
inodirty(dp);
idesc.id_type = ADDR;
idesc.id_func = pass4check;
idesc.id_number = oldlfdir;
@ -474,7 +474,7 @@ linkup(ino_t orphan, ino_t parentdir, char *name)
(void)makeentry(orphan, lfdir, "..");
dp = ginode(lfdir);
DIP_SET(dp, di_nlink, DIP(dp, di_nlink) + 1);
inodirty();
inodirty(dp);
inoinfo(lfdir)->ino_linkcnt++;
pwarn("DIR I=%lu CONNECTED. ", (u_long)orphan);
if (parentdir != (ino_t)-1) {
@ -535,7 +535,7 @@ makeentry(ino_t parent, ino_t ino, const char *name)
dp = ginode(parent);
if (DIP(dp, di_size) % DIRBLKSIZ) {
DIP_SET(dp, di_size, roundup(DIP(dp, di_size), DIRBLKSIZ));
inodirty();
inodirty(dp);
}
if ((ckinode(dp, &idesc) & ALTERED) != 0)
return (1);
@ -591,7 +591,7 @@ expanddir(union dinode *dp, char *name)
else if (reply("EXPAND") == 0)
goto bad;
dirty(bp);
inodirty();
inodirty(dp);
return (1);
bad:
DIP_SET(dp, di_db[lastbn], DIP(dp, di_db[lastbn + 1]));
@ -632,7 +632,7 @@ allocdir(ino_t parent, ino_t request, int mode)
memmove(cp, &emptydir, sizeof emptydir);
dirty(bp);
DIP_SET(dp, di_nlink, 2);
inodirty();
inodirty(dp);
if (ino == UFS_ROOTINO) {
inoinfo(ino)->ino_linkcnt = DIP(dp, di_nlink);
cacheino(dp, ino);
@ -653,7 +653,7 @@ allocdir(ino_t parent, ino_t request, int mode)
}
dp = ginode(parent);
DIP_SET(dp, di_nlink, DIP(dp, di_nlink) + 1);
inodirty();
inodirty(dp);
return (ino);
}
@ -668,7 +668,7 @@ freedir(ino_t ino, ino_t parent)
if (ino != parent) {
dp = ginode(parent);
DIP_SET(dp, di_nlink, DIP(dp, di_nlink) - 1);
inodirty();
inodirty(dp);
}
freeino(ino);
}

View File

@ -448,7 +448,7 @@ union dinode *ginode(ino_t inumber);
void infohandler(int sig);
void alarmhandler(int sig);
void inocleanup(void);
void inodirty(void);
void inodirty(union dinode *);
struct inostat *inoinfo(ino_t inum);
void IOstats(char *what);
int linkup(ino_t orphan, ino_t parentdir, char *name);

View File

@ -102,7 +102,7 @@ ckinode(union dinode *dp, struct inodesc *idesc)
printf(
"YOU MUST RERUN FSCK AFTERWARDS\n");
rerun = 1;
inodirty();
inodirty(dp);
}
}
@ -142,7 +142,7 @@ ckinode(union dinode *dp, struct inodesc *idesc)
printf(
"YOU MUST RERUN FSCK AFTERWARDS\n");
rerun = 1;
inodirty();
inodirty(dp);
break;
}
}
@ -221,7 +221,7 @@ iblock(struct inodesc *idesc, long ilevel, off_t isize, int type)
printf(
"YOU MUST RERUN FSCK AFTERWARDS\n");
rerun = 1;
inodirty();
inodirty(dp);
bp->b_flags &= ~B_INUSE;
return(STOP);
}
@ -519,7 +519,7 @@ inocleanup(void)
}
void
inodirty(void)
inodirty(union dinode *dp)
{
dirty(pbp);
@ -544,7 +544,7 @@ clri(struct inodesc *idesc, const char *type, int flag)
(void)ckinode(dp, idesc);
inoinfo(idesc->id_number)->ino_state = USTATE;
clearinode(dp);
inodirty();
inodirty(dp);
} else {
cmd.value = idesc->id_number;
cmd.size = -DIP(dp, di_nlink);
@ -711,7 +711,7 @@ allocino(ino_t request, int type)
DIP_SET(dp, di_size, sblock.fs_fsize);
DIP_SET(dp, di_blocks, btodb(sblock.fs_fsize));
n_files++;
inodirty();
inodirty(dp);
inoinfo(ino)->ino_type = IFTODT(type);
return (ino);
}
@ -732,7 +732,7 @@ freeino(ino_t ino)
dp = ginode(ino);
(void)ckinode(dp, &idesc);
clearinode(dp);
inodirty();
inodirty(dp);
inoinfo(ino)->ino_state = USTATE;
n_files--;
}

View File

@ -270,7 +270,7 @@ checkinode(ino_t inumber, struct inodesc *idesc, int rebuildcg)
if (reply("CLEAR") == 1) {
dp = ginode(inumber);
clearinode(dp);
inodirty();
inodirty(dp);
}
}
inoinfo(inumber)->ino_state = USTATE;
@ -293,7 +293,7 @@ checkinode(ino_t inumber, struct inodesc *idesc, int rebuildcg)
dp = ginode(inumber);
DIP_SET(dp, di_size, sblock.fs_fsize);
DIP_SET(dp, di_mode, IFREG|0600);
inodirty();
inodirty(dp);
}
if ((mode == IFBLK || mode == IFCHR || mode == IFIFO ||
mode == IFSOCK) && DIP(dp, di_size) != 0) {
@ -410,7 +410,7 @@ checkinode(ino_t inumber, struct inodesc *idesc, int rebuildcg)
if (bkgrdflag == 0) {
dp = ginode(inumber);
DIP_SET(dp, di_blocks, idesc->id_entryno);
inodirty();
inodirty(dp);
} else {
cmd.value = idesc->id_number;
cmd.size = idesc->id_entryno - DIP(dp, di_blocks);
@ -430,7 +430,7 @@ checkinode(ino_t inumber, struct inodesc *idesc, int rebuildcg)
inoinfo(inumber)->ino_state = USTATE;
dp = ginode(inumber);
clearinode(dp);
inodirty();
inodirty(dp);
}
return (1);
}

View File

@ -114,7 +114,7 @@ pass2(void)
dp = ginode(UFS_ROOTINO);
DIP_SET(dp, di_mode, DIP(dp, di_mode) & ~IFMT);
DIP_SET(dp, di_mode, DIP(dp, di_mode) | IFDIR);
inodirty();
inodirty(dp);
break;
case DSTATE:
@ -160,7 +160,7 @@ pass2(void)
if (reply("FIX") == 1) {
dp = ginode(inp->i_number);
DIP_SET(dp, di_size, inp->i_isize);
inodirty();
inodirty(dp);
}
} else if ((inp->i_isize & (DIRBLKSIZ - 1)) != 0) {
getpathname(pathbuf, inp->i_number, inp->i_number);
@ -179,7 +179,7 @@ pass2(void)
dp = ginode(inp->i_number);
DIP_SET(dp, di_size,
roundup(inp->i_isize, DIRBLKSIZ));
inodirty();
inodirty(dp);
}
}
dp = &dino;

View File

@ -340,7 +340,7 @@ CMDFUNCSTART(zapi)
GETINUM(1,inum);
dp = ginode(inum);
clearinode(dp);
inodirty();
inodirty(dp);
if (curinode) /* re-set after potential change */
curinode = ginode(curinum);
return 0;
@ -370,7 +370,7 @@ CMDFUNCSTART(uplink)
DIP_SET(curinode, di_nlink, DIP(curinode, di_nlink) + 1);
printf("inode %ju link count now %d\n",
(uintmax_t)curinum, DIP(curinode, di_nlink));
inodirty();
inodirty(curinode);
return 0;
}
@ -381,7 +381,7 @@ CMDFUNCSTART(downlink)
DIP_SET(curinode, di_nlink, DIP(curinode, di_nlink) - 1);
printf("inode %ju link count now %d\n",
(uintmax_t)curinum, DIP(curinode, di_nlink));
inodirty();
inodirty(curinode);
return 0;
}
@ -919,7 +919,7 @@ CMDFUNCSTART(newtype)
}
DIP_SET(curinode, di_mode, DIP(curinode, di_mode) & ~IFMT);
DIP_SET(curinode, di_mode, DIP(curinode, di_mode) | type);
inodirty();
inodirty(curinode);
printactive(0);
return 0;
}
@ -940,7 +940,7 @@ CMDFUNCSTART(chlen)
}
DIP_SET(curinode, di_size, len);
inodirty();
inodirty(curinode);
printactive(0);
return rval;
}
@ -962,7 +962,7 @@ CMDFUNCSTART(chmode)
DIP_SET(curinode, di_mode, DIP(curinode, di_mode) & ~07777);
DIP_SET(curinode, di_mode, DIP(curinode, di_mode) | modebits);
inodirty();
inodirty(curinode);
printactive(0);
return rval;
}
@ -987,7 +987,7 @@ CMDFUNCSTART(chaflags)
return(1);
}
DIP_SET(curinode, di_flags, flags);
inodirty();
inodirty(curinode);
printactive(0);
return rval;
}
@ -1012,7 +1012,7 @@ CMDFUNCSTART(chgen)
return(1);
}
DIP_SET(curinode, di_gen, gen);
inodirty();
inodirty(curinode);
printactive(0);
return rval;
}
@ -1037,7 +1037,7 @@ CMDFUNCSTART(linkcount)
}
DIP_SET(curinode, di_nlink, lcnt);
inodirty();
inodirty(curinode);
printactive(0);
return rval;
}
@ -1064,7 +1064,7 @@ CMDFUNCSTART(chowner)
}
DIP_SET(curinode, di_uid, uid);
inodirty();
inodirty(curinode);
printactive(0);
return rval;
}
@ -1090,7 +1090,7 @@ CMDFUNCSTART(chgroup)
}
DIP_SET(curinode, di_gid, gid);
inodirty();
inodirty(curinode);
printactive(0);
return rval;
}
@ -1159,7 +1159,7 @@ CMDFUNCSTART(chbtime)
return 1;
curinode->dp2.di_birthtime = _time_to_time64(secs);
curinode->dp2.di_birthnsec = nsecs;
inodirty();
inodirty(curinode);
printactive(0);
return 0;
}
@ -1176,7 +1176,7 @@ CMDFUNCSTART(chmtime)
else
curinode->dp2.di_mtime = _time_to_time64(secs);
DIP_SET(curinode, di_mtimensec, nsecs);
inodirty();
inodirty(curinode);
printactive(0);
return 0;
}
@ -1193,7 +1193,7 @@ CMDFUNCSTART(chatime)
else
curinode->dp2.di_atime = _time_to_time64(secs);
DIP_SET(curinode, di_atimensec, nsecs);
inodirty();
inodirty(curinode);
printactive(0);
return 0;
}
@ -1210,7 +1210,7 @@ CMDFUNCSTART(chctime)
else
curinode->dp2.di_ctime = _time_to_time64(secs);
DIP_SET(curinode, di_ctimensec, nsecs);
inodirty();
inodirty(curinode);
printactive(0);
return 0;
}