UFS/FFS split for LFS version 1
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 2 Nov 1991 08:56:57 +0000 (00:56 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 2 Nov 1991 08:56:57 +0000 (00:56 -0800)
SCCS-vsn: sys/ufs/ffs/ffs_balloc.c 7.14

usr/src/sys/ufs/ffs/ffs_balloc.c

index a6393db..7ba086a 100644 (file)
@@ -4,19 +4,21 @@
  *
  * %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
@@ -24,7 +26,7 @@
  * 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.
  */
-bmap(ip, bn, bnp)
+ffs_bmap(ip, bn, bnp)
        register struct inode *ip;
        register daddr_t bn;
        daddr_t *bnp;
        register struct inode *ip;
        register daddr_t bn;
        daddr_t *bnp;
@@ -99,7 +101,7 @@ bmap(ip, bn, 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;
@@ -111,7 +113,7 @@ balloc(ip, bn, size, bpp, flags)
        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)
@@ -127,8 +129,8 @@ balloc(ip, bn, size, bpp, flags)
        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);
@@ -169,9 +171,9 @@ balloc(ip, bn, size, bpp, flags)
                                        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);
                        }
@@ -180,9 +182,9 @@ balloc(ip, bn, size, bpp, flags)
                                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);
@@ -215,8 +217,8 @@ balloc(ip, bn, size, bpp, flags)
         */
        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);
@@ -226,7 +228,7 @@ balloc(ip, bn, size, bpp, flags)
                 * 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;
@@ -253,8 +255,9 @@ balloc(ip, bn, size, bpp, flags)
                        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);
                }
@@ -266,7 +269,7 @@ balloc(ip, bn, size, bpp, flags)
                 * 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);
                }
@@ -290,8 +293,9 @@ balloc(ip, bn, size, bpp, flags)
         * 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);
                }