Deleted Added
full compact
vfs_cluster.c (86089) vfs_cluster.c (91690)
1/*-
2 * Copyright (c) 1993
3 * The Regents of the University of California. All rights reserved.
4 * Modifications/enhancements:
5 * Copyright (c) 1995 John S. Dyson. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 19 unchanged lines hidden (view full) ---

28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * @(#)vfs_cluster.c 8.7 (Berkeley) 2/13/94
1/*-
2 * Copyright (c) 1993
3 * The Regents of the University of California. All rights reserved.
4 * Modifications/enhancements:
5 * Copyright (c) 1995 John S. Dyson. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 19 unchanged lines hidden (view full) ---

28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * @(#)vfs_cluster.c 8.7 (Berkeley) 2/13/94
36 * $FreeBSD: head/sys/kern/vfs_cluster.c 86089 2001-11-05 18:48:54Z dillon $
36 * $FreeBSD: head/sys/kern/vfs_cluster.c 91690 2002-03-05 15:38:49Z eivind $
37 */
38
39#include "opt_debug_cluster.h"
40
41#include <sys/param.h>
42#include <sys/systm.h>
43#include <sys/kernel.h>
44#include <sys/proc.h>

--- 7 unchanged lines hidden (view full) ---

52#include <vm/vm.h>
53#include <vm/vm_object.h>
54#include <vm/vm_page.h>
55#include <sys/sysctl.h>
56
57#if defined(CLUSTERDEBUG)
58#include <sys/sysctl.h>
59static int rcluster= 0;
37 */
38
39#include "opt_debug_cluster.h"
40
41#include <sys/param.h>
42#include <sys/systm.h>
43#include <sys/kernel.h>
44#include <sys/proc.h>

--- 7 unchanged lines hidden (view full) ---

52#include <vm/vm.h>
53#include <vm/vm_object.h>
54#include <vm/vm_page.h>
55#include <sys/sysctl.h>
56
57#if defined(CLUSTERDEBUG)
58#include <sys/sysctl.h>
59static int rcluster= 0;
60SYSCTL_INT(_debug, OID_AUTO, rcluster, CTLFLAG_RW, &rcluster, 0, "");
60SYSCTL_INT(_debug, OID_AUTO, rcluster, CTLFLAG_RW, &rcluster, 0,
61 "Debug VFS clustering code");
61#endif
62
63static MALLOC_DEFINE(M_SEGMENT, "cluster_save buffer", "cluster_save buffer");
64
65static struct cluster_save *
66 cluster_collectbufs __P((struct vnode *vp, struct buf *last_bp));
67static struct buf *
68 cluster_rbuild __P((struct vnode *vp, u_quad_t filesize, daddr_t lbn,
69 daddr_t blkno, long size, int run, struct buf *fbp));
70
71static int write_behind = 1;
62#endif
63
64static MALLOC_DEFINE(M_SEGMENT, "cluster_save buffer", "cluster_save buffer");
65
66static struct cluster_save *
67 cluster_collectbufs __P((struct vnode *vp, struct buf *last_bp));
68static struct buf *
69 cluster_rbuild __P((struct vnode *vp, u_quad_t filesize, daddr_t lbn,
70 daddr_t blkno, long size, int run, struct buf *fbp));
71
72static int write_behind = 1;
72SYSCTL_INT(_vfs, OID_AUTO, write_behind, CTLFLAG_RW, &write_behind, 0, "");
73SYSCTL_INT(_vfs, OID_AUTO, write_behind, CTLFLAG_RW, &write_behind, 0,
74 "Cluster write-behind; 0: disable, 1: enable, 2: backed off");
73
75
76/* Page expended to mark partially backed buffers */
74extern vm_page_t bogus_page;
75
77extern vm_page_t bogus_page;
78
79/*
80 * Number of physical bufs (pbufs) this subsystem is allowed.
81 * Manipulated by vm_pager.c
82 */
76extern int cluster_pbuf_freecnt;
77
78/*
79 * Maximum number of blocks for read-ahead.
80 */
81#define MAXRA 32
82
83/*
83extern int cluster_pbuf_freecnt;
84
85/*
86 * Maximum number of blocks for read-ahead.
87 */
88#define MAXRA 32
89
90/*
84 * This replaces bread.
91 * Read data to a buf, including read-ahead if we find this to be beneficial.
92 * cluster_read replaces bread.
85 */
86int
87cluster_read(vp, filesize, lblkno, size, cred, totread, seqcount, bpp)
88 struct vnode *vp;
89 u_quad_t filesize;
90 daddr_t lblkno;
91 long size;
92 struct ucred *cred;

--- 909 unchanged lines hidden ---
93 */
94int
95cluster_read(vp, filesize, lblkno, size, cred, totread, seqcount, bpp)
96 struct vnode *vp;
97 u_quad_t filesize;
98 daddr_t lblkno;
99 long size;
100 struct ucred *cred;

--- 909 unchanged lines hidden ---