Deleted Added
full compact
vfs_bio.c (18737) vfs_bio.c (18975)
1/*
2 * Copyright (c) 1994 John S. Dyson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

13 * documentation and/or other materials provided with the distribution.
14 * 3. Absolutely no warranty of function or purpose is made by the author
15 * John S. Dyson.
16 * 4. This work was done expressly for inclusion into FreeBSD. Other use
17 * is allowed if this notation is included.
18 * 5. Modifications may be freely made to this file if the above conditions
19 * are met.
20 *
1/*
2 * Copyright (c) 1994 John S. Dyson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

13 * documentation and/or other materials provided with the distribution.
14 * 3. Absolutely no warranty of function or purpose is made by the author
15 * John S. Dyson.
16 * 4. This work was done expressly for inclusion into FreeBSD. Other use
17 * is allowed if this notation is included.
18 * 5. Modifications may be freely made to this file if the above conditions
19 * are met.
20 *
21 * $Id: vfs_bio.c,v 1.102 1996/09/20 02:26:35 dyson Exp $
21 * $Id: vfs_bio.c,v 1.103 1996/10/06 07:50:05 dyson Exp $
22 */
23
24/*
25 * this file contains a new buffer I/O scheme implementing a coherent
26 * VM object and buffer cache scheme. Pains have been taken to make
27 * sure that the performance degradation associated with schemes such
28 * as this is not realized.
29 *

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

650 struct buf *bp;
651{
652 int i;
653 vm_page_t m;
654
655 for (i = 0; i < bp->b_npages; i++) {
656 m = bp->b_pages[i];
657 bp->b_pages[i] = NULL;
22 */
23
24/*
25 * this file contains a new buffer I/O scheme implementing a coherent
26 * VM object and buffer cache scheme. Pains have been taken to make
27 * sure that the performance degradation associated with schemes such
28 * as this is not realized.
29 *

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

650 struct buf *bp;
651{
652 int i;
653 vm_page_t m;
654
655 for (i = 0; i < bp->b_npages; i++) {
656 m = bp->b_pages[i];
657 bp->b_pages[i] = NULL;
658 if ((bp->b_flags & B_ASYNC) == 0) {
659 while ((m->flags & PG_BUSY) || (m->busy != 0)) {
660 m->flags |= PG_WANTED;
661 tsleep(m, PVM, "vmiorl", 0);
662 }
663 }
664
665 vm_page_unwire(m);
658 vm_page_unwire(m);
666
659 /*
660 * We don't mess with busy pages, it is
661 * the responsibility of the process that
662 * busied the pages to deal with them.
663 */
664 if ((m->flags & PG_BUSY) || (m->busy != 0))
665 continue;
666
667 if (m->wire_count == 0) {
668
669 if (m->flags & PG_WANTED) {
670 m->flags &= ~PG_WANTED;
671 wakeup(m);
672 }
673
667 if (m->wire_count == 0) {
668
669 if (m->flags & PG_WANTED) {
670 m->flags &= ~PG_WANTED;
671 wakeup(m);
672 }
673
674 if (bp->b_flags & B_ASYNC) {
675 if (m->hold_count == 0) {
676 if ((m->flags & PG_BUSY) == 0 &&
677 (m->busy == 0) &&
678 (m->valid == 0)) {
679 if(m->dirty == 0)
680 vm_page_test_dirty(m);
681 if (m->dirty == 0) {
682 vm_page_protect(m, VM_PROT_NONE);
683 vm_page_free(m);
684 } else {
685 pagedaemon_wakeup();
686 }
674 /*
675 * If this is an async free -- we cannot place
676 * pages onto the cache queue, so our policy for
677 * such buffers is to avoid the cache queue, and
678 * only modify the active queue or free queue.
679 */
680 if ((bp->b_flags & B_ASYNC) == 0) {
681
682 /*
683 * In the case of sync buffer frees, we can do pretty much
684 * anything to any of the memory queues. Specifically,
685 * the cache queue is free to be modified.
686 */
687 if (m->valid) {
688 if(m->dirty == 0)
689 vm_page_test_dirty(m);
687 /*
690 /*
688 * This is likely at interrupt time,
689 * and we cannot block here.
691 * this keeps pressure off of the process memory
690 */
692 */
691 } else if (cnt.v_free_count < cnt.v_free_min) {
692 pagedaemon_wakeup();
693 if ((vm_swap_size == 0) ||
694 (cnt.v_free_count < cnt.v_free_min)) {
695 if ((m->dirty == 0) &&
696 (m->hold_count == 0))
697 vm_page_cache(m);
698 else
699 vm_page_deactivate(m);
693 }
700 }
701 } else if (m->hold_count == 0) {
702 vm_page_protect(m, VM_PROT_NONE);
703 vm_page_free(m);
694 }
704 }
695 continue;
696 }
697
698 if (m->valid) {
699 if(m->dirty == 0)
700 vm_page_test_dirty(m);
705 } else {
701 /*
706 /*
702 * this keeps pressure off of the process memory
707 * If async, then at least we clear the
708 * act_count.
703 */
709 */
704 if ((vm_swap_size == 0) ||
705 (cnt.v_free_count < cnt.v_free_min)) {
706 if ((m->dirty == 0) &&
707 (m->hold_count == 0))
708 vm_page_cache(m);
709 else
710 vm_page_deactivate(m);
711 }
712 } else if (m->hold_count == 0) {
713 vm_page_protect(m, VM_PROT_NONE);
714 vm_page_free(m);
710 m->act_count = 0;
715 }
716 }
717 }
718 bufspace -= bp->b_bufsize;
719 vmiospace -= bp->b_bufsize;
720 pmap_qremove(trunc_page((vm_offset_t) bp->b_data), bp->b_npages);
721 bp->b_npages = 0;
722 bp->b_bufsize = 0;

--- 1156 unchanged lines hidden ---
711 }
712 }
713 }
714 bufspace -= bp->b_bufsize;
715 vmiospace -= bp->b_bufsize;
716 pmap_qremove(trunc_page((vm_offset_t) bp->b_data), bp->b_npages);
717 bp->b_npages = 0;
718 bp->b_bufsize = 0;

--- 1156 unchanged lines hidden ---