version 1.138, 2013/06/23 22:03:34 |
version 1.138.2.1, 2014/05/18 17:46:21 |
Line 635 ffs_valloc(struct vnode *pvp, int mode, |
|
Line 635 ffs_valloc(struct vnode *pvp, int mode, |
|
panic("ffs_valloc: dup alloc"); |
panic("ffs_valloc: dup alloc"); |
} |
} |
if (DIP(ip, blocks)) { /* XXX */ |
if (DIP(ip, blocks)) { /* XXX */ |
printf("free inode %s/%llu had %" PRId64 " blocks\n", |
printf("free inode %llu on %s had %" PRId64 " blocks\n", |
fs->fs_fsmnt, (unsigned long long)ino, DIP(ip, blocks)); |
(unsigned long long)ino, fs->fs_fsmnt, DIP(ip, blocks)); |
DIP_ASSIGN(ip, blocks, 0); |
DIP_ASSIGN(ip, blocks, 0); |
} |
} |
ip->i_flag &= ~IN_SPACECOUNTED; |
ip->i_flag &= ~IN_SPACECOUNTED; |
Line 720 ffs_dirpref(struct inode *pip) |
|
Line 720 ffs_dirpref(struct inode *pip) |
|
/* |
/* |
* Count various limits which used for |
* Count various limits which used for |
* optimal allocation of a directory inode. |
* optimal allocation of a directory inode. |
|
* Try cylinder groups with >75% avgifree and avgbfree. |
|
* Avoid cylinder groups with no free blocks or inodes as that |
|
* triggers an I/O-expensive cylinder group scan. |
*/ |
*/ |
maxndir = min(avgndir + fs->fs_ipg / 16, fs->fs_ipg); |
maxndir = min(avgndir + fs->fs_ipg / 16, fs->fs_ipg); |
minifree = avgifree - fs->fs_ipg / 4; |
minifree = avgifree - avgifree / 4; |
if (minifree < 0) |
if (minifree < 1) |
minifree = 0; |
minifree = 1; |
minbfree = avgbfree - ffs_fragstoblks(fs, fs->fs_fpg) / 4; |
minbfree = avgbfree - avgbfree / 4; |
if (minbfree < 0) |
if (minbfree < 1) |
minbfree = 0; |
minbfree = 1; |
cgsize = (int64_t)fs->fs_fsize * fs->fs_fpg; |
cgsize = (int64_t)fs->fs_fsize * fs->fs_fpg; |
dirsize = (int64_t)fs->fs_avgfilesize * fs->fs_avgfpdir; |
dirsize = (int64_t)fs->fs_avgfilesize * fs->fs_avgfpdir; |
if (avgndir != 0) { |
if (avgndir != 0) { |
Line 736 ffs_dirpref(struct inode *pip) |
|
Line 739 ffs_dirpref(struct inode *pip) |
|
dirsize = curdsz; |
dirsize = curdsz; |
} |
} |
if (cgsize < dirsize * 255) |
if (cgsize < dirsize * 255) |
maxcontigdirs = cgsize / dirsize; |
maxcontigdirs = (avgbfree * fs->fs_bsize) / dirsize; |
else |
else |
maxcontigdirs = 255; |
maxcontigdirs = 255; |
if (fs->fs_avgfpdir > 0) |
if (fs->fs_avgfpdir > 0) |
Line 1092 ffs_alloccg(struct inode *ip, int cg, da |
|
Line 1095 ffs_alloccg(struct inode *ip, int cg, da |
|
daddr_t blkno; |
daddr_t blkno; |
int error, frags, allocsiz, i; |
int error, frags, allocsiz, i; |
u_int8_t *blksfree; |
u_int8_t *blksfree; |
#ifdef FFS_EI |
|
const int needswap = UFS_FSNEEDSWAP(fs); |
const int needswap = UFS_FSNEEDSWAP(fs); |
#endif |
|
|
|
ump = ip->i_ump; |
ump = ip->i_ump; |
|
|
Line 1202 ffs_alloccg(struct inode *ip, int cg, da |
|
Line 1203 ffs_alloccg(struct inode *ip, int cg, da |
|
static daddr_t |
static daddr_t |
ffs_alloccgblk(struct inode *ip, struct buf *bp, daddr_t bpref, int flags) |
ffs_alloccgblk(struct inode *ip, struct buf *bp, daddr_t bpref, int flags) |
{ |
{ |
struct ufsmount *ump; |
|
struct fs *fs = ip->i_fs; |
struct fs *fs = ip->i_fs; |
struct cg *cgp; |
struct cg *cgp; |
int cg; |
int cg; |
daddr_t blkno; |
daddr_t blkno; |
int32_t bno; |
int32_t bno; |
u_int8_t *blksfree; |
u_int8_t *blksfree; |
#ifdef FFS_EI |
|
const int needswap = UFS_FSNEEDSWAP(fs); |
const int needswap = UFS_FSNEEDSWAP(fs); |
#endif |
|
|
|
ump = ip->i_ump; |
|
|
|
KASSERT(mutex_owned(&ump->um_lock)); |
KASSERT(mutex_owned(&ip->i_ump->um_lock)); |
|
|
cgp = (struct cg *)bp->b_data; |
cgp = (struct cg *)bp->b_data; |
blksfree = cg_blksfree(cgp, needswap); |
blksfree = cg_blksfree(cgp, needswap); |
Line 1290 ffs_nodealloccg(struct inode *ip, int cg |
|
Line 1286 ffs_nodealloccg(struct inode *ip, int cg |
|
int32_t initediblk; |
int32_t initediblk; |
daddr_t nalloc; |
daddr_t nalloc; |
struct ufs2_dinode *dp2; |
struct ufs2_dinode *dp2; |
#ifdef FFS_EI |
|
const int needswap = UFS_FSNEEDSWAP(fs); |
const int needswap = UFS_FSNEEDSWAP(fs); |
#endif |
|
|
|
KASSERT(mutex_owned(&ump->um_lock)); |
KASSERT(mutex_owned(&ump->um_lock)); |
UFS_WAPBL_JLOCK_ASSERT(ip->i_ump->um_mountp); |
UFS_WAPBL_JLOCK_ASSERT(ip->i_ump->um_mountp); |
Line 1562 ffs_blkfree_cg(struct fs *fs, struct vno |
|
Line 1556 ffs_blkfree_cg(struct fs *fs, struct vno |
|
int error, cg; |
int error, cg; |
dev_t dev; |
dev_t dev; |
const bool devvp_is_snapshot = (devvp->v_type != VBLK); |
const bool devvp_is_snapshot = (devvp->v_type != VBLK); |
#ifdef FFS_EI |
|
const int needswap = UFS_FSNEEDSWAP(fs); |
const int needswap = UFS_FSNEEDSWAP(fs); |
#endif |
|
|
|
KASSERT(!devvp_is_snapshot); |
KASSERT(!devvp_is_snapshot); |
|
|
cg = dtog(fs, bno); |
cg = dtog(fs, bno); |
dev = devvp->v_rdev; |
dev = devvp->v_rdev; |
ump = VFSTOUFS(devvp->v_specmountpoint); |
ump = VFSTOUFS(spec_node_getmountedfs(devvp)); |
KASSERT(fs == ump->um_fs); |
KASSERT(fs == ump->um_fs); |
cgblkno = FFS_FSBTODB(fs, cgtod(fs, cg)); |
cgblkno = FFS_FSBTODB(fs, cgtod(fs, cg)); |
|
|
Line 1630 ffs_discardcb(struct work *wk, void *arg |
|
Line 1622 ffs_discardcb(struct work *wk, void *arg |
|
struct discarddata *ts = arg; |
struct discarddata *ts = arg; |
struct fs *fs = ts->fs; |
struct fs *fs = ts->fs; |
struct disk_discard_range ta; |
struct disk_discard_range ta; |
|
#ifdef TRIMDEBUG |
int error; |
int error; |
|
#endif |
|
|
ta.bno = FFS_FSBTODB(fs, td->bno); |
ta.bno = FFS_FSBTODB(fs, td->bno); |
ta.size = td->size >> DEV_BSHIFT; |
ta.size = td->size >> DEV_BSHIFT; |
error = VOP_IOCTL(td->devvp, DIOCDISCARD, &ta, FWRITE, FSCRED); |
#ifdef TRIMDEBUG |
|
error = |
|
#endif |
|
VOP_IOCTL(td->devvp, DIOCDISCARD, &ta, FWRITE, FSCRED); |
#ifdef TRIMDEBUG |
#ifdef TRIMDEBUG |
printf("trim(%" PRId64 ",%ld):%d\n", td->bno, td->size, error); |
printf("trim(%" PRId64 ",%ld):%d\n", td->bno, td->size, error); |
#endif |
#endif |
Line 1730 ffs_blkfree(struct fs *fs, struct vnode |
|
Line 1727 ffs_blkfree(struct fs *fs, struct vnode |
|
struct discardopdata *td; |
struct discardopdata *td; |
|
|
dev = devvp->v_rdev; |
dev = devvp->v_rdev; |
ump = VFSTOUFS(devvp->v_specmountpoint); |
ump = VFSTOUFS(spec_node_getmountedfs(devvp)); |
if (ffs_snapblkfree(fs, devvp, bno, size, inum)) |
if (ffs_snapblkfree(fs, devvp, bno, size, inum)) |
return; |
return; |
|
|
Line 1829 ffs_blkfree_snap(struct fs *fs, struct v |
|
Line 1826 ffs_blkfree_snap(struct fs *fs, struct v |
|
int error, cg; |
int error, cg; |
dev_t dev; |
dev_t dev; |
const bool devvp_is_snapshot = (devvp->v_type != VBLK); |
const bool devvp_is_snapshot = (devvp->v_type != VBLK); |
#ifdef FFS_EI |
|
const int needswap = UFS_FSNEEDSWAP(fs); |
const int needswap = UFS_FSNEEDSWAP(fs); |
#endif |
|
|
|
KASSERT(devvp_is_snapshot); |
KASSERT(devvp_is_snapshot); |
|
|
Line 1992 ffs_freefile(struct mount *mp, ino_t ino |
|
Line 1987 ffs_freefile(struct mount *mp, ino_t ino |
|
int error, cg; |
int error, cg; |
daddr_t cgbno; |
daddr_t cgbno; |
dev_t dev; |
dev_t dev; |
#ifdef FFS_EI |
|
const int needswap = UFS_FSNEEDSWAP(fs); |
const int needswap = UFS_FSNEEDSWAP(fs); |
#endif |
|
|
|
cg = ino_to_cg(fs, ino); |
cg = ino_to_cg(fs, ino); |
devvp = ump->um_devvp; |
devvp = ump->um_devvp; |
Line 2031 ffs_freefile_snap(struct fs *fs, struct |
|
Line 2024 ffs_freefile_snap(struct fs *fs, struct |
|
int error, cg; |
int error, cg; |
daddr_t cgbno; |
daddr_t cgbno; |
dev_t dev; |
dev_t dev; |
#ifdef FFS_EI |
|
const int needswap = UFS_FSNEEDSWAP(fs); |
const int needswap = UFS_FSNEEDSWAP(fs); |
#endif |
|
|
|
KASSERT(devvp->v_type != VBLK); |
KASSERT(devvp->v_type != VBLK); |
|
|
Line 2069 ffs_freefile_common(struct ufsmount *ump |
|
Line 2060 ffs_freefile_common(struct ufsmount *ump |
|
int cg; |
int cg; |
struct cg *cgp; |
struct cg *cgp; |
u_int8_t *inosused; |
u_int8_t *inosused; |
#ifdef FFS_EI |
|
const int needswap = UFS_FSNEEDSWAP(fs); |
const int needswap = UFS_FSNEEDSWAP(fs); |
#endif |
|
|
|
cg = ino_to_cg(fs, ino); |
cg = ino_to_cg(fs, ino); |
cgp = (struct cg *)bp->b_data; |
cgp = (struct cg *)bp->b_data; |
Line 2159 ffs_mapsearch(struct fs *fs, struct cg * |
|
Line 2148 ffs_mapsearch(struct fs *fs, struct cg * |
|
int blk, field, subfield, pos; |
int blk, field, subfield, pos; |
int ostart, olen; |
int ostart, olen; |
u_int8_t *blksfree; |
u_int8_t *blksfree; |
#ifdef FFS_EI |
|
const int needswap = UFS_FSNEEDSWAP(fs); |
const int needswap = UFS_FSNEEDSWAP(fs); |
#endif |
|
|
|
/* KASSERT(mutex_owned(&ump->um_lock)); */ |
/* KASSERT(mutex_owned(&ump->um_lock)); */ |
|
|