+ * Print out statistics on the current allocation of the buffer pool.
+ * Can be enabled to print out on every ``sync'' by setting "syncprt"
+ * above.
+ */
+bufstats()
+{
+ int s, i, j, count;
+ register struct buf *bp, *dp;
+ int counts[MAXBSIZE/CLBYTES+1];
+ static char *bname[BQUEUES] = { "LOCKED", "LRU", "AGE", "EMPTY" };
+
+ for (bp = bfreelist, i = 0; bp < &bfreelist[BQUEUES]; bp++, i++) {
+ count = 0;
+ for (j = 0; j <= MAXBSIZE/CLBYTES; j++)
+ counts[j] = 0;
+ s = splbio();
+ for (dp = bp->av_forw; dp != bp; dp = dp->av_forw) {
+ counts[dp->b_bufsize/CLBYTES]++;
+ count++;
+ }
+ splx(s);
+ printf("%s: total-%d", bname[i], count);
+ for (j = 0; j <= MAXBSIZE/CLBYTES; j++)
+ if (counts[j] != 0)
+ printf(", %d-%d", j * CLBYTES, counts[j]);
+ printf("\n");
+ }
+}
+
+/*
+ * File handle to vnode
+ */
+ufs_fhtovp(mp, fhp, vpp)
+ struct mount *mp;
+ struct fid *fhp;
+ struct vnode **vpp;
+{
+ register struct ufid *ufhp;
+ struct inode tip, *ip;
+ int error;
+
+ ufhp = (struct ufid *)fhp;
+ tip.i_dev = VFSTOUFS(mp)->um_dev;
+ tip.i_vnode.v_mount = mp;
+ if (error = iget(&tip, ufhp->ufid_ino, &ip)) {
+ *vpp = NULL;
+ return (error);
+ }
+ if (ip->i_gen != ufhp->ufid_gen) {
+ iput(ip);
+ *vpp = NULL;
+ return (EINVAL);
+ }
+ *vpp = ITOV(ip);
+ return (0);
+}
+
+/*
+ * Vnode pointer to File handle, should never happen.
+ */
+/* ARGSUSED */
+ufs_vptofh(mp, fhp, vpp)
+ struct mount *mp;
+ struct fid *fhp;
+ struct vnode **vpp;
+{
+
+ return (EINVAL);
+}
+
+/*
+ * Common code for mount and quota.