Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/makefs/ffs/ffs_alloc.c
Show First 20 Lines • Show All 151 Lines • ▼ Show 20 Lines | |||||
ffs_blkpref_ufs1(struct inode *ip, daddr_t lbn, int indx, int32_t *bap) | ffs_blkpref_ufs1(struct inode *ip, daddr_t lbn, int indx, int32_t *bap) | ||||
{ | { | ||||
struct fs *fs; | struct fs *fs; | ||||
int cg; | int cg; | ||||
int avgbfree, startcg; | int avgbfree, startcg; | ||||
fs = ip->i_fs; | fs = ip->i_fs; | ||||
if (indx % fs->fs_maxbpg == 0 || bap[indx - 1] == 0) { | if (indx % fs->fs_maxbpg == 0 || bap[indx - 1] == 0) { | ||||
if (lbn < NDADDR + NINDIR(fs)) { | if (lbn < UFS_NDADDR + NINDIR(fs)) { | ||||
cg = ino_to_cg(fs, ip->i_number); | cg = ino_to_cg(fs, ip->i_number); | ||||
return (fs->fs_fpg * cg + fs->fs_frag); | return (fs->fs_fpg * cg + fs->fs_frag); | ||||
} | } | ||||
/* | /* | ||||
* Find a cylinder with greater than average number of | * Find a cylinder with greater than average number of | ||||
* unused data blocks. | * unused data blocks. | ||||
*/ | */ | ||||
if (indx == 0 || bap[indx - 1] == 0) | if (indx == 0 || bap[indx - 1] == 0) | ||||
Show All 22 Lines | |||||
ffs_blkpref_ufs2(struct inode *ip, daddr_t lbn, int indx, int64_t *bap) | ffs_blkpref_ufs2(struct inode *ip, daddr_t lbn, int indx, int64_t *bap) | ||||
{ | { | ||||
struct fs *fs; | struct fs *fs; | ||||
int cg; | int cg; | ||||
int avgbfree, startcg; | int avgbfree, startcg; | ||||
fs = ip->i_fs; | fs = ip->i_fs; | ||||
if (indx % fs->fs_maxbpg == 0 || bap[indx - 1] == 0) { | if (indx % fs->fs_maxbpg == 0 || bap[indx - 1] == 0) { | ||||
if (lbn < NDADDR + NINDIR(fs)) { | if (lbn < UFS_NDADDR + NINDIR(fs)) { | ||||
cg = ino_to_cg(fs, ip->i_number); | cg = ino_to_cg(fs, ip->i_number); | ||||
return (fs->fs_fpg * cg + fs->fs_frag); | return (fs->fs_fpg * cg + fs->fs_frag); | ||||
} | } | ||||
/* | /* | ||||
* Find a cylinder with greater than average number of | * Find a cylinder with greater than average number of | ||||
* unused data blocks. | * unused data blocks. | ||||
*/ | */ | ||||
if (indx == 0 || bap[indx - 1] == 0) | if (indx == 0 || bap[indx - 1] == 0) | ||||
▲ Show 20 Lines • Show All 474 Lines • Show Last 20 Lines |