summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sbin/sysctl/sysctl.813
-rw-r--r--share/man/man9/VOP_LOOKUP.920
-rw-r--r--sys/kern/vfs_vops.c17
-rw-r--r--sys/sys/buf.h16
-rw-r--r--sys/sys/vnode.h9
-rw-r--r--sys/ufs/ffs/ffs_alloc.c626
-rw-r--r--sys/ufs/ffs/ffs_extern.h7
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c8
-rw-r--r--sys/ufs/ffs/ffs_vnops.c3
9 files changed, 14 insertions, 705 deletions
diff --git a/sbin/sysctl/sysctl.8 b/sbin/sysctl/sysctl.8
index ca9dc82b194..87d74b4d650 100644
--- a/sbin/sysctl/sysctl.8
+++ b/sbin/sysctl/sysctl.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sysctl.8,v 1.194 2016/05/19 11:34:40 jca Exp $
+.\" $OpenBSD: sysctl.8,v 1.195 2016/05/23 09:31:28 natano Exp $
.\" $NetBSD: sysctl.8,v 1.4 1995/09/30 07:12:49 thorpej Exp $
.\"
.\" Copyright (c) 1993
@@ -30,7 +30,7 @@
.\"
.\" @(#)sysctl.8 8.2 (Berkeley) 5/9/95
.\"
-.Dd $Mdocdate: May 19 2016 $
+.Dd $Mdocdate: May 23 2016 $
.Dt SYSCTL 8
.Os
.Sh NAME
@@ -334,11 +334,6 @@ and a few require a kernel compiled with non-standard
.It net.pipex.outq.drops=0 Ta integer Ta no
.It debug.syncprt Ta integer Ta yes
.It debug.busyprt Ta integer Ta yes
-.It debug.doclusterread Ta integer Ta yes
-.It debug.doclusterwrite Ta integer Ta yes
-.It debug.doreallocblks Ta integer Ta yes
-.It debug.doasyncfree Ta integer Ta yes
-.It debug.prtrealloc Ta integer Ta yes
.It hw.machine Ta string Ta no
.It hw.model Ta string Ta no
.It hw.ncpu Ta integer Ta no
@@ -384,10 +379,6 @@ and a few require a kernel compiled with non-standard
.It ddb.log Ta integer Ta yes
.It ddb.trigger Ta integer Ta yes
.It vfs.mounts.* Ta struct Ta no
-.It vfs.ffs.doclusterread Ta integer Ta yes
-.It vfs.ffs.doclusterwrite Ta integer Ta yes
-.It vfs.ffs.doreallocblks Ta integer Ta yes
-.It vfs.ffs.doasyncfree Ta integer Ta yes
.It vfs.ffs.max_softdeps Ta integer Ta yes
.It vfs.ffs.sd_tickdelay Ta integer Ta yes
.It vfs.ffs.sd_worklist_push Ta integer Ta no
diff --git a/share/man/man9/VOP_LOOKUP.9 b/share/man/man9/VOP_LOOKUP.9
index ca334579550..773ed80b0b3 100644
--- a/share/man/man9/VOP_LOOKUP.9
+++ b/share/man/man9/VOP_LOOKUP.9
@@ -1,4 +1,4 @@
-.\" $OpenBSD: VOP_LOOKUP.9,v 1.34 2016/03/19 15:03:55 jmc Exp $
+.\" $OpenBSD: VOP_LOOKUP.9,v 1.35 2016/05/23 09:31:28 natano Exp $
.\"
.\" Copyright (c) 2003 Ted Unangst
.\" All rights reserved.
@@ -23,7 +23,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: March 19 2016 $
+.Dd $Mdocdate: May 23 2016 $
.Dt VOP_LOOKUP 9
.Os
.Sh NAME
@@ -52,7 +52,6 @@
.Nm VOP_READ ,
.Nm VOP_READDIR ,
.Nm VOP_READLINK ,
-.Nm VOP_REALLOCBLKS ,
.Nm VOP_RECLAIM ,
.Nm VOP_REMOVE ,
.Nm VOP_RENAME ,
@@ -226,11 +225,6 @@
.Fa "struct ucred *cred"
.Fc
.Ft int
-.Fo VOP_REALLOCBLKS
-.Fa "struct vnode *vp"
-.Fa "struct cluster_save *buflist"
-.Fc
-.Ft int
.Fo VOP_RECLAIM
.Fa "struct vnode *vp"
.Fa "struct proc *p"
@@ -766,16 +760,6 @@ Read a symbolic link and return the target's name in
.Fa vp
is locked on entry and exit and must be a symlink.
.Pp
-.It Fn VOP_REALLOCBLKS vp buflist
-Called by the VFS write clustering code.
-It gives the file system an opportunity to rearrange the on-disk blocks
-for a file to reduce fragmentation.
-.Fa vp
-is the locked vnode for the file, and
-.Fa buflist
-is a cluster of the outstanding buffers about to be written.
-Currently, only FFS implements this call.
-.Pp
.It Fn VOP_RECLAIM vp p
Used by
.Xr vclean 9
diff --git a/sys/kern/vfs_vops.c b/sys/kern/vfs_vops.c
index 5941466ad32..f579134aeed 100644
--- a/sys/kern/vfs_vops.c
+++ b/sys/kern/vfs_vops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_vops.c,v 1.15 2016/03/19 12:04:15 natano Exp $ */
+/* $OpenBSD: vfs_vops.c,v 1.16 2016/05/23 09:31:28 natano Exp $ */
/*
* Copyright (c) 2010 Thordur I. Bjornsson <thib@openbsd.org>
*
@@ -612,21 +612,6 @@ VOP_ADVLOCK(struct vnode *vp, void *id, int op, struct flock *fl, int flags)
}
int
-VOP_REALLOCBLKS(struct vnode *vp, struct cluster_save *buflist)
-{
- struct vop_reallocblks_args a;
- a.a_vp = vp;
- a.a_buflist = buflist;
-
- ASSERT_VP_ISLOCKED(vp);
-
- if (vp->v_op->vop_reallocblks == NULL)
- return (EOPNOTSUPP);
-
- return ((vp->v_op->vop_reallocblks)(&a));
-}
-
-int
VOP_STRATEGY(struct buf *bp)
{
struct vop_strategy_args a;
diff --git a/sys/sys/buf.h b/sys/sys/buf.h
index 4ae8b2ec59c..f80cefeb8b9 100644
--- a/sys/sys/buf.h
+++ b/sys/sys/buf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: buf.h,v 1.102 2016/03/10 06:52:37 dlg Exp $ */
+/* $OpenBSD: buf.h,v 1.103 2016/05/23 09:31:28 natano Exp $ */
/* $NetBSD: buf.h,v 1.25 1997/04/09 21:12:17 mycroft Exp $ */
/*
@@ -229,20 +229,6 @@ struct bufcache {
"\025SCANNED\026DAEMON\027RELEASED\030WARM\031COLD\032BC\033DMA"
/*
- * This structure describes a clustered I/O. It is stored in the b_saveaddr
- * field of the buffer on which I/O is done. At I/O completion, cluster
- * callback uses the structure to parcel I/O's to individual buffers, and
- * then free's this structure.
- */
-struct cluster_save {
- long bs_bcount; /* Saved b_bcount. */
- long bs_bufsize; /* Saved b_bufsize. */
- void *bs_saveaddr; /* Saved b_addr. */
- int bs_nchildren; /* Number of associated buffers. */
- struct buf **bs_children; /* List of associated buffers. */
-};
-
-/*
* Zero out the buffer's data area.
*/
#define clrbuf(bp) { \
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index ffe8b21f74d..a94e6e9fa30 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vnode.h,v 1.134 2016/03/19 12:04:16 natano Exp $ */
+/* $OpenBSD: vnode.h,v 1.135 2016/05/23 09:31:28 natano Exp $ */
/* $NetBSD: vnode.h,v 1.38 1996/02/29 20:59:05 cgd Exp $ */
/*
@@ -276,7 +276,6 @@ struct vops {
int (*vop_read)(void *);
int (*vop_readdir)(void *);
int (*vop_readlink)(void *);
- int (*vop_reallocblks)(void *);
int (*vop_reclaim)(void *);
int (*vop_remove)(void *);
int (*vop_rename)(void *);
@@ -550,12 +549,6 @@ struct vop_advlock_args {
};
int VOP_ADVLOCK(struct vnode *, void *, int, struct flock *, int);
-struct vop_reallocblks_args {
- struct vnode *a_vp;
- struct cluster_save *a_buflist;
-};
-int VOP_REALLOCBLKS(struct vnode *, struct cluster_save *);
-
/* Special cases: */
struct vop_strategy_args {
struct buf *a_bp;
diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c
index 152b42c9f5d..61787119859 100644
--- a/sys/ufs/ffs/ffs_alloc.c
+++ b/sys/ufs/ffs/ffs_alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_alloc.c,v 1.106 2015/11/28 21:52:02 beck Exp $ */
+/* $OpenBSD: ffs_alloc.c,v 1.107 2016/05/23 09:31:28 natano Exp $ */
/* $NetBSD: ffs_alloc.c,v 1.11 1996/05/11 18:27:09 mycroft Exp $ */
/*
@@ -66,7 +66,6 @@
daddr_t ffs_alloccg(struct inode *, int, daddr_t, int);
struct buf * ffs_cgread(struct fs *, struct inode *, int);
daddr_t ffs_alloccgblk(struct inode *, struct buf *, daddr_t);
-daddr_t ffs_clusteralloc(struct inode *, int, daddr_t, int);
ufsino_t ffs_dirpref(struct inode *);
daddr_t ffs_fragextend(struct inode *, int, daddr_t, int, int);
daddr_t ffs_hashalloc(struct inode *, int, daddr_t, int,
@@ -74,15 +73,6 @@ daddr_t ffs_hashalloc(struct inode *, int, daddr_t, int,
daddr_t ffs_nodealloccg(struct inode *, int, daddr_t, int);
daddr_t ffs_mapsearch(struct fs *, struct cg *, daddr_t, int);
-int ffs1_reallocblks(void *);
-#ifdef FFS2
-int ffs2_reallocblks(void *);
-#endif
-
-#ifdef DIAGNOSTIC
-int ffs_checkblk(struct inode *, daddr_t, long);
-#endif
-
static const struct timeval fserr_interval = { 2, 0 };
@@ -347,465 +337,6 @@ error:
}
/*
- * Reallocate a sequence of blocks into a contiguous sequence of blocks.
- *
- * The vnode and an array of buffer pointers for a range of sequential
- * logical blocks to be made contiguous are given. The allocator attempts
- * to find a range of sequential blocks starting as close as possible to
- * an fs_rotdelay offset from the end of the allocation for the logical
- * block immediately preceding the current range. If successful, the
- * physical block numbers in the buffer pointers and in the inode are
- * changed to reflect the new allocation. If unsuccessful, the allocation
- * is left unchanged. The success in doing the reallocation is returned.
- * Note that the error return is not reflected back to the user. Rather
- * the previous block allocation will be used.
- */
-
-int doasyncfree = 1;
-int doreallocblks = 1;
-int prtrealloc = 0;
-
-int
-ffs1_reallocblks(void *v)
-{
- struct vop_reallocblks_args *ap = v;
- struct fs *fs;
- struct inode *ip;
- struct vnode *vp;
- struct buf *sbp, *ebp;
- int32_t *bap, *sbap, *ebap = NULL;
- struct cluster_save *buflist;
- daddr_t start_lbn, end_lbn, soff, newblk, blkno;
- struct indir start_ap[NIADDR + 1], end_ap[NIADDR + 1], *idp;
- int i, len, start_lvl, end_lvl, pref, ssize;
-
- vp = ap->a_vp;
- ip = VTOI(vp);
- fs = ip->i_fs;
- if (fs->fs_contigsumsize <= 0)
- return (ENOSPC);
- buflist = ap->a_buflist;
- len = buflist->bs_nchildren;
- start_lbn = buflist->bs_children[0]->b_lblkno;
- end_lbn = start_lbn + len - 1;
-
-#ifdef DIAGNOSTIC
- for (i = 0; i < len; i++)
- if (!ffs_checkblk(ip,
- dbtofsb(fs, buflist->bs_children[i]->b_blkno), fs->fs_bsize))
- panic("ffs1_reallocblks: unallocated block 1");
-
- for (i = 1; i < len; i++)
- if (buflist->bs_children[i]->b_lblkno != start_lbn + i)
- panic("ffs1_reallocblks: non-logical cluster");
-
- blkno = buflist->bs_children[0]->b_blkno;
- ssize = fsbtodb(fs, fs->fs_frag);
- for (i = 1; i < len - 1; i++)
- if (buflist->bs_children[i]->b_blkno != blkno + (i * ssize))
- panic("ffs1_reallocblks: non-physical cluster %d", i);
-#endif
- /*
- * If the latest allocation is in a new cylinder group, assume that
- * the filesystem has decided to move and do not force it back to
- * the previous cylinder group.
- */
- if (dtog(fs, dbtofsb(fs, buflist->bs_children[0]->b_blkno)) !=
- dtog(fs, dbtofsb(fs, buflist->bs_children[len - 1]->b_blkno)))
- return (ENOSPC);
- if (ufs_getlbns(vp, start_lbn, start_ap, &start_lvl) ||
- ufs_getlbns(vp, end_lbn, end_ap, &end_lvl))
- return (ENOSPC);
- /*
- * Get the starting offset and block map for the first block.
- */
- if (start_lvl == 0) {
- sbap = &ip->i_ffs1_db[0];
- soff = start_lbn;
- } else {
- idp = &start_ap[start_lvl - 1];
- if (bread(vp, idp->in_lbn, (int)fs->fs_bsize, &sbp)) {
- brelse(sbp);
- return (ENOSPC);
- }
- sbap = (int32_t *)sbp->b_data;
- soff = idp->in_off;
- }
- /*
- * Find the preferred location for the cluster.
- */
- pref = ffs1_blkpref(ip, start_lbn, soff, sbap);
- /*
- * If the block range spans two block maps, get the second map.
- */
- if (end_lvl == 0 || (idp = &end_ap[end_lvl - 1])->in_off + 1 >= len) {
- ssize = len;
- } else {
-#ifdef DIAGNOSTIC
- if (start_lvl > 1 &&
- start_ap[start_lvl-1].in_lbn == idp->in_lbn)
- panic("ffs1_reallocblk: start == end");
-#endif
- ssize = len - (idp->in_off + 1);
- if (bread(vp, idp->in_lbn, (int)fs->fs_bsize, &ebp))
- goto fail;
- ebap = (int32_t *)ebp->b_data;
- }
- /*
- * Search the block map looking for an allocation of the desired size.
- */
- if ((newblk = ffs_hashalloc(ip, dtog(fs, pref), pref, len,
- ffs_clusteralloc)) == 0)
- goto fail;
- /*
- * We have found a new contiguous block.
- *
- * First we have to replace the old block pointers with the new
- * block pointers in the inode and indirect blocks associated
- * with the file.
- */
-#ifdef DEBUG
- if (prtrealloc)
- printf("realloc: ino %u, lbns %lld-%lld\n\told:", ip->i_number,
- (long long)start_lbn, (long long)end_lbn);
-#endif
- blkno = newblk;
- for (bap = &sbap[soff], i = 0; i < len; i++, blkno += fs->fs_frag) {
- if (i == ssize) {
- bap = ebap;
- soff = -i;
- }
-#ifdef DIAGNOSTIC
- if (!ffs_checkblk(ip,
- dbtofsb(fs, buflist->bs_children[i]->b_blkno), fs->fs_bsize))
- panic("ffs1_reallocblks: unallocated block 2");
- if (dbtofsb(fs, buflist->bs_children[i]->b_blkno) != *bap)
- panic("ffs1_reallocblks: alloc mismatch");
-#endif
-#ifdef DEBUG
- if (prtrealloc)
- printf(" %d,", *bap);
-#endif
- if (DOINGSOFTDEP(vp)) {
- if (sbap == &ip->i_ffs1_db[0] && i < ssize)
- softdep_setup_allocdirect(ip, start_lbn + i,
- blkno, *bap, fs->fs_bsize, fs->fs_bsize,
- buflist->bs_children[i]);
- else
- softdep_setup_allocindir_page(ip, start_lbn + i,
- i < ssize ? sbp : ebp, soff + i, blkno,
- *bap, buflist->bs_children[i]);
- }
-
- *bap++ = blkno;
- }
- /*
- * Next we must write out the modified inode and indirect blocks.
- * For strict correctness, the writes should be synchronous since
- * the old block values may have been written to disk. In practise
- * they are almost never written, but if we are concerned about
- * strict correctness, the `doasyncfree' flag should be set to zero.
- *
- * The test on `doasyncfree' should be changed to test a flag
- * that shows whether the associated buffers and inodes have
- * been written. The flag should be set when the cluster is
- * started and cleared whenever the buffer or inode is flushed.
- * We can then check below to see if it is set, and do the
- * synchronous write only when it has been cleared.
- */
- if (sbap != &ip->i_ffs1_db[0]) {
- if (doasyncfree)
- bdwrite(sbp);
- else
- bwrite(sbp);
- } else {
- ip->i_flag |= IN_CHANGE | IN_UPDATE;
- if (!doasyncfree) {
- UFS_UPDATE(ip, 1);
- }
- }
- if (ssize < len) {
- if (doasyncfree)
- bdwrite(ebp);
- else
- bwrite(ebp);
- }
- /*
- * Last, free the old blocks and assign the new blocks to the buffers.
- */
-#ifdef DEBUG
- if (prtrealloc)
- printf("\n\tnew:");
-#endif
- for (blkno = newblk, i = 0; i < len; i++, blkno += fs->fs_frag) {
- if (!DOINGSOFTDEP(vp))
- ffs_blkfree(ip,
- dbtofsb(fs, buflist->bs_children[i]->b_blkno),
- fs->fs_bsize);
- buflist->bs_children[i]->b_blkno = fsbtodb(fs, blkno);
-#ifdef DIAGNOSTIC
- if (!ffs_checkblk(ip,
- dbtofsb(fs, buflist->bs_children[i]->b_blkno), fs->fs_bsize))
- panic("ffs1_reallocblks: unallocated block 3");
- if (prtrealloc)
- printf(" %lld,", (long long)blkno);
-#endif
- }
-#ifdef DEBUG
- if (prtrealloc) {
- prtrealloc--;
- printf("\n");
- }
-#endif
- return (0);
-
-fail:
- if (ssize < len)
- brelse(ebp);
- if (sbap != &ip->i_ffs1_db[0])
- brelse(sbp);
- return (ENOSPC);
-}
-
-#ifdef FFS2
-int
-ffs2_reallocblks(void *v)
-{
- struct vop_reallocblks_args *ap = v;
- struct fs *fs;
- struct inode *ip;
- struct vnode *vp;
- struct buf *sbp, *ebp;
- daddr_t *bap, *sbap, *ebap = NULL;
- struct cluster_save *buflist;
- daddr_t start_lbn, end_lbn;
- daddr_t soff, newblk, blkno, pref;
- struct indir start_ap[NIADDR + 1], end_ap[NIADDR + 1], *idp;
- int i, len, start_lvl, end_lvl, ssize;
-
- vp = ap->a_vp;
- ip = VTOI(vp);
- fs = ip->i_fs;
-
- if (fs->fs_contigsumsize <= 0)
- return (ENOSPC);
-
- buflist = ap->a_buflist;
- len = buflist->bs_nchildren;
- start_lbn = buflist->bs_children[0]->b_lblkno;
- end_lbn = start_lbn + len - 1;
-
-#ifdef DIAGNOSTIC
- for (i = 0; i < len; i++)
- if (!ffs_checkblk(ip,
- dbtofsb(fs, buflist->bs_children[i]->b_blkno), fs->fs_bsize))
- panic("ffs2_reallocblks: unallocated block 1");
-
- for (i = 1; i < len; i++)
- if (buflist->bs_children[i]->b_lblkno != start_lbn + i)
- panic("ffs2_reallocblks: non-logical cluster");
-
- blkno = buflist->bs_children[0]->b_blkno;
- ssize = fsbtodb(fs, fs->fs_frag);
-
- for (i = 1; i < len - 1; i++)
- if (buflist->bs_children[i]->b_blkno != blkno + (i * ssize))
- panic("ffs2_reallocblks: non-physical cluster %d", i);
-#endif
-
- /*
- * If the latest allocation is in a new cylinder group, assume that
- * the filesystem has decided to move and do not force it back to
- * the previous cylinder group.
- */
- if (dtog(fs, dbtofsb(fs, buflist->bs_children[0]->b_blkno)) !=
- dtog(fs, dbtofsb(fs, buflist->bs_children[len - 1]->b_blkno)))
- return (ENOSPC);
- if (ufs_getlbns(vp, start_lbn, start_ap, &start_lvl) ||
- ufs_getlbns(vp, end_lbn, end_ap, &end_lvl))
- return (ENOSPC);
-
- /*
- * Get the starting offset and block map for the first block.
- */
- if (start_lvl == 0) {
- sbap = &ip->i_din2->di_db[0];
- soff = start_lbn;
- } else {
- idp = &start_ap[start_lvl - 1];
- if (bread(vp, idp->in_lbn, (int)fs->fs_bsize, &sbp)) {
- brelse(sbp);
- return (ENOSPC);
- }
- sbap = (daddr_t *)sbp->b_data;
- soff = idp->in_off;
- }
-
- /*
- * If the block range spans two block maps, get the second map.
- */
- if (end_lvl == 0 || (idp = &end_ap[end_lvl - 1])->in_off + 1 >= len) {
- ssize = len;
- } else {
-#ifdef DIAGNOSTIC
- if (start_ap[start_lvl-1].in_lbn == idp->in_lbn)
- panic("ffs2_reallocblk: start == end");
-#endif
- ssize = len - (idp->in_off + 1);
- if (bread(vp, idp->in_lbn, (int)fs->fs_bsize, &ebp))
- goto fail;
- ebap = (daddr_t *)ebp->b_data;
- }
-
- /*
- * Find the preferred location for the cluster.
- */
- pref = ffs2_blkpref(ip, start_lbn, soff, sbap);
-
- /*
- * Search the block map looking for an allocation of the desired size.
- */
- if ((newblk = ffs_hashalloc(ip, dtog(fs, pref), pref,
- len, ffs_clusteralloc)) == 0)
- goto fail;
-
- /*
- * We have found a new contiguous block.
- *
- * First we have to replace the old block pointers with the new
- * block pointers in the inode and indirect blocks associated
- * with the file.
- */
-#ifdef DEBUG
- if (prtrealloc)
- printf("realloc: ino %u, lbns %lld-%lld\n\told:", ip->i_number,
- (long long)start_lbn, (long long)end_lbn);
-#endif
-
- blkno = newblk;
-
- for (bap = &sbap[soff], i = 0; i < len; i++, blkno += fs->fs_frag) {
- if (i == ssize) {
- bap = ebap;
- soff = -i;
- }
-#ifdef DIAGNOSTIC
- if (!ffs_checkblk(ip,
- dbtofsb(fs, buflist->bs_children[i]->b_blkno), fs->fs_bsize))
- panic("ffs2_reallocblks: unallocated block 2");
- if (dbtofsb(fs, buflist->bs_children[i]->b_blkno) != *bap)
- panic("ffs2_reallocblks: alloc mismatch");
-#endif
-#ifdef DEBUG
- if (prtrealloc)
- printf(" %lld,", (long long)*bap);
-#endif
- if (DOINGSOFTDEP(vp)) {
- if (sbap == &ip->i_din2->di_db[0] && i < ssize)
- softdep_setup_allocdirect(ip, start_lbn + i,
- blkno, *bap, fs->fs_bsize, fs->fs_bsize,
- buflist->bs_children[i]);
- else
- softdep_setup_allocindir_page(ip, start_lbn + i,
- i < ssize ? sbp : ebp, soff + i, blkno,
- *bap, buflist->bs_children[i]);
- }
- *bap++ = blkno;
- }
-
- /*
- * Next we must write out the modified inode and indirect blocks.
- * For strict correctness, the writes should be synchronous since
- * the old block values may have been written to disk. In practise
- * they are almost never written, but if we are concerned about
- * strict correctness, the `doasyncfree' flag should be set to zero.
- *
- * The test on `doasyncfree' should be changed to test a flag
- * that shows whether the associated buffers and inodes have
- * been written. The flag should be set when the cluster is
- * started and cleared whenever the buffer or inode is flushed.
- * We can then check below to see if it is set, and do the
- * synchronous write only when it has been cleared.
- */
- if (sbap != &ip->i_din2->di_db[0]) {
- if (doasyncfree)
- bdwrite(sbp);
- else
- bwrite(sbp);
- } else {
- ip->i_flag |= IN_CHANGE | IN_UPDATE;
- if (!doasyncfree)
- ffs_update(ip, 1);
- }
-
- if (ssize < len) {
- if (doasyncfree)
- bdwrite(ebp);
- else
- bwrite(ebp);
- }
-
- /*
- * Last, free the old blocks and assign the new blocks to the buffers.
- */
-#ifdef DEBUG
- if (prtrealloc)
- printf("\n\tnew:");
-#endif
- for (blkno = newblk, i = 0; i < len; i++, blkno += fs->fs_frag) {
- if (!DOINGSOFTDEP(vp))
- ffs_blkfree(ip, dbtofsb(fs,
- buflist->bs_children[i]->b_blkno), fs->fs_bsize);
- buflist->bs_children[i]->b_blkno = fsbtodb(fs, blkno);
-#ifdef DIAGNOSTIC
- if (!ffs_checkblk(ip,
- dbtofsb(fs, buflist->bs_children[i]->b_blkno), fs->fs_bsize))
- panic("ffs2_reallocblks: unallocated block 3");
-#endif
-#ifdef DEBUG
- if (prtrealloc)
- printf(" %lld,", (long long)blkno);
-#endif
- }
-#ifdef DEBUG
- if (prtrealloc) {
- prtrealloc--;
- printf("\n");
- }
-#endif
-
- return (0);
-
-fail:
- if (ssize < len)
- brelse(ebp);
-
- if (sbap != &ip->i_din2->di_db[0])
- brelse(sbp);
-
- return (ENOSPC);
-}
-#endif /* FFS2 */
-
-int
-ffs_reallocblks(void *v)
-{
-#ifdef FFS2
- struct vop_reallocblks_args *ap = v;
-#endif
-
- if (!doreallocblks)
- return (ENOSPC);
-
-#ifdef FFS2
- if (VTOI(ap->a_vp)->i_ump->um_fstype == UM_UFS2)
- return (ffs2_reallocblks(v));
-#endif
-
- return (ffs1_reallocblks(v));
-}
-
-/*
* Allocate an inode in the file system.
*
* If allocating a directory, use ffs_dirpref to select the inode.
@@ -1548,119 +1079,6 @@ gotit:
return (blkno);
}
-/*
- * Determine whether a cluster can be allocated.
- *
- * We do not currently check for optimal rotational layout if there
- * are multiple choices in the same cylinder group. Instead we just
- * take the first one that we find following bpref.
- */
-daddr_t
-ffs_clusteralloc(struct inode *ip, int cg, daddr_t bpref, int len)
-{
- struct fs *fs;
- struct cg *cgp;
- struct buf *bp;
- int i, got, run, bno, bit, map;
- u_char *mapp;
- int32_t *lp;
-
- fs = ip->i_fs;
- if (fs->fs_maxcluster[cg] < len)
- return (0);
-
- if (!(bp = ffs_cgread(fs, ip, cg)))
- return (0);
-
- cgp = (struct cg *)bp->b_data;
-
- /*
- * Check to see if a cluster of the needed size (or bigger) is
- * available in this cylinder group.
- */
- lp = &cg_clustersum(cgp)[len];
- for (i = len; i <= fs->fs_contigsumsize; i++)
- if (*lp++ > 0)
- break;
- if (i > fs->fs_contigsumsize) {
- /*
- * This is the first time looking for a cluster in this
- * cylinder group. Update the cluster summary information
- * to reflect the true maximum sized cluster so that
- * future cluster allocation requests can avoid reading
- * the cylinder group map only to find no clusters.
- */
- lp = &cg_clustersum(cgp)[len - 1];
- for (i = len - 1; i > 0; i--)
- if (*lp-- > 0)
- break;
- fs->fs_maxcluster[cg] = i;
- goto fail;
- }
- /*
- * Search the cluster map to find a big enough cluster.
- * We take the first one that we find, even if it is larger
- * than we need as we prefer to get one close to the previous
- * block allocation. We do not search before the current
- * preference point as we do not want to allocate a block
- * that is allocated before the previous one (as we will
- * then have to wait for another pass of the elevator
- * algorithm before it will be read). We prefer to fail and
- * be recalled to try an allocation in the next cylinder group.
- */
- if (dtog(fs, bpref) != cg)
- bpref = cgdata(fs, cg);
- else
- bpref = blknum(fs, bpref);
- bpref = fragstoblks(fs, dtogd(fs, bpref));
- mapp = &cg_clustersfree(cgp)[bpref / NBBY];
- map = *mapp++;
- bit = 1 << (bpref % NBBY);
- for (run = 0, got = bpref; got < cgp->cg_nclusterblks; got++) {
- if ((map & bit) == 0) {
- run = 0;
- } else {
- run++;
- if (run == len)
- break;
- }
- if ((got & (NBBY - 1)) != (NBBY - 1)) {
- bit <<= 1;
- } else {
- map = *mapp++;
- bit = 1;
- }
- }
- if (got >= cgp->cg_nclusterblks)
- goto fail;
- /*
- * Allocate the cluster that we have found.
- */
- cgp->cg_ffs2_time = cgp->cg_time = time_second;
-
-#ifdef DIAGNOSTIC
- for (i = 1; i <= len; i++)
- if (!ffs_isblock(fs, cg_blksfree(cgp), got - run + i))
- panic("ffs_clusteralloc: map mismatch");
-#endif
- bno = cgbase(fs, cg) + blkstofrags(fs, got - run + 1);
-#ifdef DIAGNOSTIC
- if (dtog(fs, bno) != cg)
- panic("ffs_clusteralloc: allocated out of group");
-#endif
-
- len = blkstofrags(fs, len);
- for (i = 0; i < len; i += fs->fs_frag)
- if (ffs_alloccgblk(ip, bp, bno + i) != bno + i)
- panic("ffs_clusteralloc: lost block");
- bdwrite(bp);
- return (bno);
-
-fail:
- brelse(bp);
- return (0);
-}
-
/* inode allocation routine */
daddr_t
ffs_nodealloccg(struct inode *ip, int cg, daddr_t ipref, int mode)
@@ -1986,48 +1404,6 @@ ffs_freefile(struct inode *pip, ufsino_t ino, mode_t mode)
return (0);
}
-#ifdef DIAGNOSTIC
-/*
- * Verify allocation of a block or fragment. Returns true if block or
- * fragment is allocated, false if it is free.
- */
-int
-ffs_checkblk(struct inode *ip, daddr_t bno, long size)
-{
- struct fs *fs;
- struct cg *cgp;
- struct buf *bp;
- int i, frags, free;
-
- fs = ip->i_fs;
- if ((u_int)size > fs->fs_bsize || fragoff(fs, size) != 0) {
- printf("bsize = %d, size = %ld, fs = %s\n",
- fs->fs_bsize, size, fs->fs_fsmnt);
- panic("ffs_checkblk: bad size");
- }
- if ((u_int)bno >= fs->fs_size)
- panic("ffs_checkblk: bad block %lld", (long long)bno);
-
- if (!(bp = ffs_cgread(fs, ip, dtog(fs, bno))))
- return (0);
-
- cgp = (struct cg *)bp->b_data;
- bno = dtogd(fs, bno);
- if (size == fs->fs_bsize) {
- free = ffs_isblock(fs, cg_blksfree(cgp), fragstoblks(fs, bno));
- } else {
- frags = numfrags(fs, size);
- for (free = 0, i = 0; i < frags; i++)
- if (isset(cg_blksfree(cgp), bno + i))
- free++;
- if (free != 0 && free != frags)
- panic("ffs_checkblk: partially free fragment");
- }
- brelse(bp);
- return (!free);
-}
-#endif /* DIAGNOSTIC */
-
/*
* Find a block of the specified size in the specified cylinder group.
diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h
index 85aa2c30466..ecb37e464ff 100644
--- a/sys/ufs/ffs/ffs_extern.h
+++ b/sys/ufs/ffs/ffs_extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_extern.h,v 1.41 2016/01/12 11:41:00 mpi Exp $ */
+/* $OpenBSD: ffs_extern.h,v 1.42 2016/05/23 09:31:28 natano Exp $ */
/* $NetBSD: ffs_extern.h,v 1.4 1996/02/09 22:22:22 christos Exp $ */
/*
@@ -57,8 +57,8 @@
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
- { "doreallocblks", CTLTYPE_INT }, \
- { "doasyncfree", CTLTYPE_INT }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
{ "max_softdeps", CTLTYPE_INT }, \
{ "sd_tickdelay", CTLTYPE_INT }, \
{ "sd_worklist_push", CTLTYPE_INT }, \
@@ -103,7 +103,6 @@ int ffs_alloc(struct inode *, daddr_t, daddr_t , int, struct ucred *,
daddr_t *);
int ffs_realloccg(struct inode *, daddr_t, daddr_t, int, int ,
struct ucred *, struct buf **, daddr_t *);
-int ffs_reallocblks(void *);
int ffs_inode_alloc(struct inode *, mode_t, struct ucred *, struct vnode **);
int ffs_inode_free(struct inode *, ufsino_t, mode_t);
int ffs_freefile(struct inode *, ufsino_t, mode_t);
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 1768b0c6412..9ee397121b9 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_vfsops.c,v 1.157 2016/05/22 20:27:04 bluhm Exp $ */
+/* $OpenBSD: ffs_vfsops.c,v 1.158 2016/05/23 09:31:28 natano Exp $ */
/* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */
/*
@@ -1541,7 +1541,6 @@ int
ffs_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
size_t newlen, struct proc *p)
{
- extern int doreallocblks, doasyncfree;
#ifdef FFS_SOFTUPDATES
extern int max_softdeps, tickdelay, stat_worklist_push;
extern int stat_blk_limit_push, stat_ino_limit_push, stat_blk_limit_hit;
@@ -1556,12 +1555,9 @@ ffs_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
switch (name[0]) {
case FFS_CLUSTERREAD:
case FFS_CLUSTERWRITE:
- return (EOPNOTSUPP);
case FFS_REALLOCBLKS:
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &doreallocblks));
case FFS_ASYNCFREE:
- return (sysctl_int(oldp, oldlenp, newp, newlen, &doasyncfree));
+ return (EOPNOTSUPP);
#ifdef FFS_SOFTUPDATES
case FFS_MAX_SOFTDEPS:
return (sysctl_int(oldp, oldlenp, newp, newlen, &max_softdeps));
diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c
index 63e211542c1..a855bb929e9 100644
--- a/sys/ufs/ffs/ffs_vnops.c
+++ b/sys/ufs/ffs/ffs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_vnops.c,v 1.86 2016/04/07 11:13:01 mpi Exp $ */
+/* $OpenBSD: ffs_vnops.c,v 1.87 2016/05/23 09:31:28 natano Exp $ */
/* $NetBSD: ffs_vnops.c,v 1.7 1996/05/11 18:27:24 mycroft Exp $ */
/*
@@ -93,7 +93,6 @@ struct vops ffs_vops = {
.vop_islocked = ufs_islocked,
.vop_pathconf = ufs_pathconf,
.vop_advlock = ufs_advlock,
- .vop_reallocblks = ffs_reallocblks,
.vop_bwrite = vop_generic_bwrite
};