SCCS-vsn: sys/ufs/ffs/ffs_balloc.c 7.14
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)ffs_balloc.c 7.13 (Berkeley) %G%
+ * @(#)ffs_balloc.c 7.14 (Berkeley) %G%
-#include "param.h"
-#include "systm.h"
-#include "buf.h"
-#include "proc.h"
-#include "file.h"
-#include "vnode.h"
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/buf.h>
+#include <sys/proc.h>
+#include <sys/file.h>
+#include <sys/vnode.h>
-#include "quota.h"
-#include "inode.h"
-#include "fs.h"
+#include <ufs/ufs/quota.h>
+#include <ufs/ufs/inode.h>
+
+#include <ufs/ffs/fs.h>
+#include <ufs/ffs/ffs_extern.h>
/*
* Bmap converts a the logical block number of a file
/*
* Bmap converts a the logical block number of a file
* is done by using the logical block number to index into
* the array of block pointers described by the dinode.
*/
* is done by using the logical block number to index into
* the array of block pointers described by the dinode.
*/
register struct inode *ip;
register daddr_t bn;
daddr_t *bnp;
register struct inode *ip;
register daddr_t bn;
daddr_t *bnp;
* by allocating the physical blocks on a device given
* the inode and the logical block number in a file.
*/
* by allocating the physical blocks on a device given
* the inode and the logical block number in a file.
*/
-balloc(ip, bn, size, bpp, flags)
+ffs_balloc(ip, bn, size, bpp, flags)
register struct inode *ip;
register daddr_t bn;
int size;
register struct inode *ip;
register daddr_t bn;
int size;
struct buf *bp, *nbp;
struct vnode *vp = ITOV(ip);
int osize, nsize, i, j, sh, error;
struct buf *bp, *nbp;
struct vnode *vp = ITOV(ip);
int osize, nsize, i, j, sh, error;
- daddr_t newb, lbn, *bap, pref, blkpref();
+ daddr_t newb, lbn, *bap, pref;
*bpp = (struct buf *)0;
if (bn < 0)
*bpp = (struct buf *)0;
if (bn < 0)
if (nb < NDADDR && nb < bn) {
osize = blksize(fs, ip, nb);
if (osize < fs->fs_bsize && osize > 0) {
if (nb < NDADDR && nb < bn) {
osize = blksize(fs, ip, nb);
if (osize < fs->fs_bsize && osize > 0) {
- error = realloccg(ip, nb,
- blkpref(ip, nb, (int)nb, &ip->i_db[0]),
+ error = ffs_realloccg(ip, nb,
+ ffs_blkpref(ip, nb, (int)nb, &ip->i_db[0]),
osize, (int)fs->fs_bsize, &bp);
if (error)
return (error);
osize, (int)fs->fs_bsize, &bp);
if (error)
return (error);
return (error);
}
} else {
return (error);
}
} else {
- error = realloccg(ip, bn,
- blkpref(ip, bn, (int)bn, &ip->i_db[0]),
- osize, nsize, &bp);
+ error = ffs_realloccg(ip, bn,
+ ffs_blkpref(ip, bn, (int)bn, &ip->i_db[0]),
+ osize, nsize, &bp);
if (error)
return (error);
}
if (error)
return (error);
}
nsize = fragroundup(fs, size);
else
nsize = fs->fs_bsize;
nsize = fragroundup(fs, size);
else
nsize = fs->fs_bsize;
- error = alloc(ip, bn,
- blkpref(ip, bn, (int)bn, &ip->i_db[0]),
- nsize, &newb);
+ error = ffs_alloc(ip, bn,
+ ffs_blkpref(ip, bn, (int)bn, &ip->i_db[0]),
+ nsize, &newb);
if (error)
return (error);
bp = getblk(vp, bn, nsize);
if (error)
return (error);
bp = getblk(vp, bn, nsize);
*/
nb = ip->i_ib[NIADDR - j];
if (nb == 0) {
*/
nb = ip->i_ib[NIADDR - j];
if (nb == 0) {
- pref = blkpref(ip, lbn, 0, (daddr_t *)0);
- if (error = alloc(ip, lbn, pref, (int)fs->fs_bsize, &newb))
+ pref = ffs_blkpref(ip, lbn, 0, (daddr_t *)0);
+ if (error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, &newb))
return (error);
nb = newb;
bp = getblk(ip->i_devvp, fsbtodb(fs, nb), fs->fs_bsize);
return (error);
nb = newb;
bp = getblk(ip->i_devvp, fsbtodb(fs, nb), fs->fs_bsize);
* never point at garbage.
*/
if (error = bwrite(bp)) {
* never point at garbage.
*/
if (error = bwrite(bp)) {
- blkfree(ip, nb, fs->fs_bsize);
+ ffs_blkfree(ip, nb, fs->fs_bsize);
return (error);
}
ip->i_ib[NIADDR - j] = nb;
return (error);
}
ip->i_ib[NIADDR - j] = nb;
continue;
}
if (pref == 0)
continue;
}
if (pref == 0)
- pref = blkpref(ip, lbn, 0, (daddr_t *)0);
- if (error = alloc(ip, lbn, pref, (int)fs->fs_bsize, &newb)) {
+ pref = ffs_blkpref(ip, lbn, 0, (daddr_t *)0);
+ if (error =
+ ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, &newb)) {
brelse(bp);
return (error);
}
brelse(bp);
return (error);
}
* never point at garbage.
*/
if (error = bwrite(nbp)) {
* never point at garbage.
*/
if (error = bwrite(nbp)) {
- blkfree(ip, nb, fs->fs_bsize);
+ ffs_blkfree(ip, nb, fs->fs_bsize);
brelse(bp);
return (error);
}
brelse(bp);
return (error);
}
* Get the data block, allocating if necessary.
*/
if (nb == 0) {
* Get the data block, allocating if necessary.
*/
if (nb == 0) {
- pref = blkpref(ip, lbn, i, &bap[0]);
- if (error = alloc(ip, lbn, pref, (int)fs->fs_bsize, &newb)) {
+ pref = ffs_blkpref(ip, lbn, i, &bap[0]);
+ if (error =
+ ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, &newb)) {
brelse(bp);
return (error);
}
brelse(bp);
return (error);
}