Deleted Added
full compact
vfs_cluster.c (16086) vfs_cluster.c (17304)
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 * $Id: vfs_cluster.c,v 1.35 1996/03/02 04:40:56 dyson Exp $
36 * $Id: vfs_cluster.c,v 1.36 1996/06/03 04:40:35 dyson Exp $
37 */
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/proc.h>
42#include <sys/buf.h>
43#include <sys/vnode.h>
44#include <sys/mount.h>

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

611 --len;
612 continue;
613 }
614
615 TAILQ_INIT(&bp->b_cluster.cluster_head);
616 bp->b_bcount = 0;
617 bp->b_bufsize = 0;
618 bp->b_npages = 0;
37 */
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/proc.h>
42#include <sys/buf.h>
43#include <sys/vnode.h>
44#include <sys/mount.h>

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

611 --len;
612 continue;
613 }
614
615 TAILQ_INIT(&bp->b_cluster.cluster_head);
616 bp->b_bcount = 0;
617 bp->b_bufsize = 0;
618 bp->b_npages = 0;
619 if (tbp->b_wcred != NOCRED) {
620 bp->b_wcred = tbp->b_wcred;
621 crhold(bp->b_wcred);
622 }
619
620 bp->b_blkno = tbp->b_blkno;
621 bp->b_lblkno = tbp->b_lblkno;
622 (vm_offset_t) bp->b_data |= ((vm_offset_t) tbp->b_data) & PAGE_MASK;
623
624 bp->b_blkno = tbp->b_blkno;
625 bp->b_lblkno = tbp->b_lblkno;
626 (vm_offset_t) bp->b_data |= ((vm_offset_t) tbp->b_data) & PAGE_MASK;
623 bp->b_flags |= B_CALL | B_BUSY | B_CLUSTER | (tbp->b_flags & B_VMIO);
627 bp->b_flags |= B_CALL | B_BUSY | B_CLUSTER | (tbp->b_flags & (B_VMIO|B_NEEDCOMMIT));
624 bp->b_iodone = cluster_callback;
625 pbgetvp(vp, bp);
626
627 for (i = 0; i < len; ++i, ++start_lbn) {
628 if (i != 0) {
629 s = splbio();
630 if ((tbp = gbincore(vp, start_lbn)) == NULL) {
631 splx(s);
632 break;
633 }
634
628 bp->b_iodone = cluster_callback;
629 pbgetvp(vp, bp);
630
631 for (i = 0; i < len; ++i, ++start_lbn) {
632 if (i != 0) {
633 s = splbio();
634 if ((tbp = gbincore(vp, start_lbn)) == NULL) {
635 splx(s);
636 break;
637 }
638
635 if ((tbp->b_flags & (B_VMIO|B_CLUSTEROK|B_INVAL|B_BUSY|B_DELWRI)) != (B_DELWRI|B_CLUSTEROK|(bp->b_flags & B_VMIO))) {
639 if ((tbp->b_flags & (B_VMIO|B_CLUSTEROK|B_INVAL|B_BUSY|B_DELWRI|B_NEEDCOMMIT)) != (B_DELWRI|B_CLUSTEROK|(bp->b_flags & (B_VMIO|B_NEEDCOMMIT)))) {
636 splx(s);
637 break;
638 }
639
640 splx(s);
641 break;
642 }
643
644 if (tbp->b_wcred != bp->b_wcred) {
645 splx(s);
646 break;
647 }
648
640 if ((tbp->b_bcount != size) ||
641 ((bp->b_blkno + dbsize * i) != tbp->b_blkno) ||
642 ((tbp->b_npages + bp->b_npages) > (MAXPHYS / PAGE_SIZE))) {
643 splx(s);
644 break;
645 }
646 bremfree(tbp);
647 tbp->b_flags |= B_BUSY;

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

671 ++tbp->b_vp->v_numoutput;
672 splx(s);
673 TAILQ_INSERT_TAIL(&bp->b_cluster.cluster_head,
674 tbp, b_cluster.cluster_entry);
675 }
676 pmap_qenter(trunc_page((vm_offset_t) bp->b_data),
677 (vm_page_t *) bp->b_pages, bp->b_npages);
678 totalwritten += bp->b_bufsize;
649 if ((tbp->b_bcount != size) ||
650 ((bp->b_blkno + dbsize * i) != tbp->b_blkno) ||
651 ((tbp->b_npages + bp->b_npages) > (MAXPHYS / PAGE_SIZE))) {
652 splx(s);
653 break;
654 }
655 bremfree(tbp);
656 tbp->b_flags |= B_BUSY;

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

680 ++tbp->b_vp->v_numoutput;
681 splx(s);
682 TAILQ_INSERT_TAIL(&bp->b_cluster.cluster_head,
683 tbp, b_cluster.cluster_entry);
684 }
685 pmap_qenter(trunc_page((vm_offset_t) bp->b_data),
686 (vm_page_t *) bp->b_pages, bp->b_npages);
687 totalwritten += bp->b_bufsize;
688 bp->b_dirtyoff = 0;
689 bp->b_dirtyend = bp->b_bufsize;
679 bawrite(bp);
680
681 len -= i;
682 }
683 return totalwritten;
684}
685
686#ifdef notyet_block_reallocation_enabled

--- 26 unchanged lines hidden ---
690 bawrite(bp);
691
692 len -= i;
693 }
694 return totalwritten;
695}
696
697#ifdef notyet_block_reallocation_enabled

--- 26 unchanged lines hidden ---