Rename pass4check() to freeblock() and move from pass4.c to inode.c.
The new name more accurately describes what it does and the file move puts it with other similar functions. Done in preparation for future cleanups. No functional differences intended. Sponsored by: Netflix Historic Footnote: my last FreeBSD svn commit
This commit is contained in:
parent
673e2dd652
commit
7180f1ab40
@ -532,7 +532,7 @@ linkup(ino_t orphan, ino_t parentdir, char *name)
|
||||
}
|
||||
inodirty(dp);
|
||||
idesc.id_type = ADDR;
|
||||
idesc.id_func = pass4check;
|
||||
idesc.id_func = freeblock;
|
||||
idesc.id_number = oldlfdir;
|
||||
adjust(&idesc, inoinfo(oldlfdir)->ino_linkcnt + 1);
|
||||
inoinfo(oldlfdir)->ino_linkcnt = 0;
|
||||
@ -635,6 +635,7 @@ expanddir(union dinode *dp, char *name)
|
||||
{
|
||||
ufs2_daddr_t lastbn, newblk;
|
||||
struct bufarea *bp;
|
||||
struct inodesc idesc;
|
||||
char *cp, firstblk[DIRBLKSIZ];
|
||||
|
||||
lastbn = lblkno(&sblock, DIP(dp, di_size));
|
||||
@ -679,7 +680,10 @@ expanddir(union dinode *dp, char *name)
|
||||
DIP_SET(dp, di_db[lastbn + 1], 0);
|
||||
DIP_SET(dp, di_size, DIP(dp, di_size) - sblock.fs_bsize);
|
||||
DIP_SET(dp, di_blocks, DIP(dp, di_blocks) - btodb(sblock.fs_bsize));
|
||||
freeblk(newblk, sblock.fs_frag);
|
||||
/* Free the block we allocated above */
|
||||
idesc.id_blkno = newblk;
|
||||
idesc.id_numfrags = sblock.fs_frag;
|
||||
(void)freeblock(&idesc);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -438,7 +438,7 @@ void finalIOstats(void);
|
||||
int findino(struct inodesc *);
|
||||
int findname(struct inodesc *);
|
||||
void flush(int fd, struct bufarea *bp);
|
||||
void freeblk(ufs2_daddr_t blkno, long frags);
|
||||
int freeblock(struct inodesc *);
|
||||
void freeino(ino_t ino);
|
||||
void freeinodebuf(void);
|
||||
void fsutilinit(void);
|
||||
@ -465,7 +465,6 @@ int pass1check(struct inodesc *);
|
||||
void pass2(void);
|
||||
void pass3(void);
|
||||
void pass4(void);
|
||||
int pass4check(struct inodesc *);
|
||||
void pass5(void);
|
||||
void pfatal(const char *fmt, ...) __printflike(1, 2);
|
||||
void propagate(void);
|
||||
|
@ -800,20 +800,9 @@ allocblk(long frags)
|
||||
}
|
||||
|
||||
/*
|
||||
* Free a previously allocated block
|
||||
* Slow down IO so as to leave some disk bandwidth for other processes
|
||||
*/
|
||||
void
|
||||
freeblk(ufs2_daddr_t blkno, long frags)
|
||||
{
|
||||
struct inodesc idesc;
|
||||
|
||||
idesc.id_blkno = blkno;
|
||||
idesc.id_numfrags = frags;
|
||||
(void)pass4check(&idesc);
|
||||
}
|
||||
|
||||
/* Slow down IO so as to leave some disk bandwidth for other processes */
|
||||
void
|
||||
slowio_start()
|
||||
{
|
||||
|
||||
|
@ -641,6 +641,37 @@ clearentry(struct inodesc *idesc)
|
||||
return (STOP|FOUND|ALTERED);
|
||||
}
|
||||
|
||||
int
|
||||
freeblock(struct inodesc *idesc)
|
||||
{
|
||||
struct dups *dlp;
|
||||
ufs2_daddr_t blkno;
|
||||
long nfrags, res;
|
||||
|
||||
res = KEEPON;
|
||||
blkno = idesc->id_blkno;
|
||||
for (nfrags = idesc->id_numfrags; nfrags > 0; blkno++, nfrags--) {
|
||||
if (chkrange(blkno, 1)) {
|
||||
res = SKIP;
|
||||
} else if (testbmap(blkno)) {
|
||||
for (dlp = duplist; dlp; dlp = dlp->next) {
|
||||
if (dlp->dup != blkno)
|
||||
continue;
|
||||
dlp->dup = duplist->dup;
|
||||
dlp = duplist;
|
||||
duplist = duplist->next;
|
||||
free((char *)dlp);
|
||||
break;
|
||||
}
|
||||
if (dlp == NULL) {
|
||||
clrbmap(blkno);
|
||||
n_blks--;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (res);
|
||||
}
|
||||
|
||||
void
|
||||
prtinode(ino_t ino, union dinode *dp)
|
||||
{
|
||||
@ -767,7 +798,7 @@ freeino(ino_t ino)
|
||||
|
||||
memset(&idesc, 0, sizeof(struct inodesc));
|
||||
idesc.id_type = ADDR;
|
||||
idesc.id_func = pass4check;
|
||||
idesc.id_func = freeblock;
|
||||
idesc.id_number = ino;
|
||||
dp = ginode(ino);
|
||||
(void)ckinode(dp, &idesc);
|
||||
|
@ -58,7 +58,7 @@ pass4(void)
|
||||
|
||||
memset(&idesc, 0, sizeof(struct inodesc));
|
||||
idesc.id_type = ADDR;
|
||||
idesc.id_func = pass4check;
|
||||
idesc.id_func = freeblock;
|
||||
for (cg = 0; cg < sblock.fs_ncg; cg++) {
|
||||
if (got_siginfo) {
|
||||
printf("%s: phase 4: cyl group %d of %d (%d%%)\n",
|
||||
@ -124,32 +124,3 @@ pass4(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
pass4check(struct inodesc *idesc)
|
||||
{
|
||||
struct dups *dlp;
|
||||
int nfrags, res = KEEPON;
|
||||
ufs2_daddr_t blkno = idesc->id_blkno;
|
||||
|
||||
for (nfrags = idesc->id_numfrags; nfrags > 0; blkno++, nfrags--) {
|
||||
if (chkrange(blkno, 1)) {
|
||||
res = SKIP;
|
||||
} else if (testbmap(blkno)) {
|
||||
for (dlp = duplist; dlp; dlp = dlp->next) {
|
||||
if (dlp->dup != blkno)
|
||||
continue;
|
||||
dlp->dup = duplist->dup;
|
||||
dlp = duplist;
|
||||
duplist = duplist->next;
|
||||
free((char *)dlp);
|
||||
break;
|
||||
}
|
||||
if (dlp == NULL) {
|
||||
clrbmap(blkno);
|
||||
n_blks--;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (res);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user