diff options
author | Kirk McKusick <mckusick@FreeBSD.org> | 2001-12-18 18:05:17 +0000 |
---|---|---|
committer | Kirk McKusick <mckusick@FreeBSD.org> | 2001-12-18 18:05:17 +0000 |
commit | f305c5d1999ac9c31aab102bf000b1ca8f974d4f (patch) | |
tree | 308349f289245644e341b5abbc226a4626914f01 /sys/ufs | |
parent | 1857e7825fa89717d4a30971c78a5c36490e6d09 (diff) | |
download | src-f305c5d1999ac9c31aab102bf000b1ca8f974d4f.tar.gz src-f305c5d1999ac9c31aab102bf000b1ca8f974d4f.zip |
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>
Notes
Notes:
svn path=/head/; revision=88138
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ffs/ffs_alloc.c | 14 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_snapshot.c | 8 | ||||
-rw-r--r-- | sys/ufs/ffs/fs.h | 8 |
3 files changed, 17 insertions, 13 deletions
diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index a45a7fefcdf3..e2fb3abe837d 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -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); } diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index 5e677741a652..fbbc67ffb558 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -266,8 +266,8 @@ restart: * 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 @@ restart: 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], diff --git a/sys/ufs/ffs/fs.h b/sys/ufs/ffs/fs.h index 82f07af67330..7d4bfc873bcb 100644 --- a/sys/ufs/ffs/fs.h +++ b/sys/ufs/ffs/fs.h @@ -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 */ @@ -365,6 +365,12 @@ struct fs { : ((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. * Its size is derived from the size of the maps maintained in the |