Change the atomic_set_char to atomic_set_int and atomic_clear_char

to atomic_clear_int to ease the implementation for the sparc64.

Requested by:	Jake Burkholder <jake@locore.ca>
This commit is contained in:
Kirk McKusick 2001-12-18 18:05:17 +00:00
parent 1857e7825f
commit f305c5d199
3 changed files with 17 additions and 13 deletions

View File

@ -971,7 +971,7 @@ ffs_fragextend(ip, cg, bprev, osize, nsize)
if (DOINGSOFTDEP(ITOV(ip)))
softdep_setup_blkmapdep(bp, fs, bprev);
if (fs->fs_active != 0)
atomic_clear_char(&fs->fs_active[cg / NBBY], 1 << (cg % NBBY));
atomic_clear_int(&ACTIVECGNUM(fs, cg), ACTIVECGOFF(cg));
bdwrite(bp);
return (bprev);
}
@ -1017,8 +1017,7 @@ ffs_alloccg(ip, cg, bpref, size)
if (size == fs->fs_bsize) {
bno = ffs_alloccgblk(ip, bp, bpref);
if (fs->fs_active != 0)
atomic_clear_char(&fs->fs_active[cg / NBBY],
1 << (cg % NBBY));
atomic_clear_int(&ACTIVECGNUM(fs, cg), ACTIVECGOFF(cg));
bdwrite(bp);
return (bno);
}
@ -1052,8 +1051,7 @@ ffs_alloccg(ip, cg, bpref, size)
fs->fs_fmod = 1;
cgp->cg_frsum[i]++;
if (fs->fs_active != 0)
atomic_clear_char(&fs->fs_active[cg / NBBY],
1 << (cg % NBBY));
atomic_clear_int(&ACTIVECGNUM(fs, cg), ACTIVECGOFF(cg));
bdwrite(bp);
return (bno);
}
@ -1075,7 +1073,7 @@ ffs_alloccg(ip, cg, bpref, size)
if (DOINGSOFTDEP(ITOV(ip)))
softdep_setup_blkmapdep(bp, fs, blkno);
if (fs->fs_active != 0)
atomic_clear_char(&fs->fs_active[cg / NBBY], 1 << (cg % NBBY));
atomic_clear_int(&ACTIVECGNUM(fs, cg), ACTIVECGOFF(cg));
bdwrite(bp);
return ((u_long)blkno);
}
@ -1309,7 +1307,7 @@ ffs_clusteralloc(ip, cg, bpref, len)
if ((got = ffs_alloccgblk(ip, bp, bno + i)) != bno + i)
panic("ffs_clusteralloc: lost block");
if (fs->fs_active != 0)
atomic_clear_char(&fs->fs_active[cg / NBBY], 1 << (cg % NBBY));
atomic_clear_int(&ACTIVECGNUM(fs, cg), ACTIVECGOFF(cg));
bdwrite(bp);
return (bno);
@ -1529,7 +1527,7 @@ ffs_blkfree(ip, bno, size)
}
fs->fs_fmod = 1;
if (fs->fs_active != 0)
atomic_clear_char(&fs->fs_active[cg / NBBY], 1 << (cg % NBBY));
atomic_clear_int(&ACTIVECGNUM(fs, cg), ACTIVECGOFF(cg));
bdwrite(bp);
}

View File

@ -266,8 +266,8 @@ ffs_snapshot(mp, snapfile)
* touch up the few cylinder groups that changed during
* the suspension period.
*/
len = howmany(fs->fs_ncg, NBBY);
MALLOC(fs->fs_active, char *, len, M_DEVBUF, M_WAITOK);
len = howmany(fs->fs_ncg, (NBBY * sizeof(int)));
MALLOC(fs->fs_active, int *, len, M_DEVBUF, M_WAITOK);
bzero(fs->fs_active, len);
for (cg = 0; cg < fs->fs_ncg; cg++) {
error = bread(vp, fragstoblks(fs, cgtod(fs, cg)), fs->fs_bsize,
@ -314,7 +314,7 @@ ffs_snapshot(mp, snapfile)
if (collectsnapstats)
nanotime(&starttime);
for (cg = 0; cg < fs->fs_ncg; cg++) {
if ((fs->fs_active[cg / NBBY] & (1 << (cg % NBBY))) != 0)
if ((ACTIVECGNUM(fs, cg) & ACTIVECGOFF(cg)) != 0)
continue;
redo++;
error = bread(vp, fragstoblks(fs, cgtod(fs, cg)), fs->fs_bsize,
@ -504,7 +504,7 @@ cgaccount(cg, vp, nbp, passno)
brelse(bp);
return (EIO);
}
atomic_set_char(&fs->fs_active[cg / NBBY], 1 << (cg % NBBY));
atomic_set_int(&ACTIVECGNUM(fs, cg), ACTIVECGOFF(cg));
bcopy(bp->b_data, nbp->b_data, fs->fs_cgsize);
if (fs->fs_cgsize < fs->fs_bsize)
bzero(&nbp->b_data[fs->fs_cgsize],

View File

@ -292,7 +292,7 @@ struct fs {
u_int8_t *fs_contigdirs; /* # of contiguously allocated dirs */
struct csum *fs_csp; /* cg summary info buffer for fs_cs */
int32_t *fs_maxcluster; /* max cluster in each cyl group */
u_int8_t *fs_active; /* used by snapshots to track fs */
u_int32_t *fs_active; /* used by snapshots to track fs */
int32_t fs_cpc; /* cyl per cycle in postbl */
int16_t fs_opostbl[16][8]; /* old rotation block list head */
int32_t fs_snapinum[FSMAXSNAP];/* list of snapshot inode numbers */
@ -364,6 +364,12 @@ struct fs {
? ((fs)->fs_space) \
: ((u_int8_t *)((u_int8_t *)(fs) + (fs)->fs_rotbloff)))
/*
* Macros to access bits in the fs_active array.
*/
#define ACTIVECGNUM(fs, cg) ((fs)->fs_active[(cg) / (NBBY * sizeof(int))])
#define ACTIVECGOFF(cg) (1 << ((cg) / (NBBY * sizeof(int))))
/*
* The size of a cylinder group is calculated by CGSIZE. The maximum size
* is limited by the fact that cylinder groups are at most one block.