vfs_cluster.c (117879) | vfs_cluster.c (119521) |
---|---|
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 --- 22 unchanged lines hidden (view full) --- 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 */ 37 38#include <sys/cdefs.h> | 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 --- 22 unchanged lines hidden (view full) --- 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 */ 37 38#include <sys/cdefs.h> |
39__FBSDID("$FreeBSD: head/sys/kern/vfs_cluster.c 117879 2003-07-22 10:36:36Z phk $"); | 39__FBSDID("$FreeBSD: head/sys/kern/vfs_cluster.c 119521 2003-08-28 06:55:18Z jeff $"); |
40 41#include "opt_debug_cluster.h" 42 43#include <sys/param.h> 44#include <sys/systm.h> 45#include <sys/kernel.h> 46#include <sys/proc.h> 47#include <sys/bio.h> --- 346 unchanged lines hidden (view full) --- 394 395 /* 396 * Stop scanning if the buffer is fully valid 397 * (marked B_CACHE), or locked (may be doing a 398 * background write), or if the buffer is not 399 * VMIO backed. The clustering code can only deal 400 * with VMIO-backed buffers. 401 */ | 40 41#include "opt_debug_cluster.h" 42 43#include <sys/param.h> 44#include <sys/systm.h> 45#include <sys/kernel.h> 46#include <sys/proc.h> 47#include <sys/bio.h> --- 346 unchanged lines hidden (view full) --- 394 395 /* 396 * Stop scanning if the buffer is fully valid 397 * (marked B_CACHE), or locked (may be doing a 398 * background write), or if the buffer is not 399 * VMIO backed. The clustering code can only deal 400 * with VMIO-backed buffers. 401 */ |
402 if ((tbp->b_flags & (B_CACHE|B_LOCKED)) || 403 (tbp->b_flags & B_VMIO) == 0) { | 402 VI_LOCK(bp->b_vp); 403 if ((tbp->b_vflags & BV_BKGRDINPROG) || 404 (tbp->b_flags & B_CACHE) || 405 (tbp->b_flags & B_VMIO) == 0) { 406 VI_UNLOCK(bp->b_vp); |
404 bqrelse(tbp); 405 break; 406 } | 407 bqrelse(tbp); 408 break; 409 } |
410 VI_UNLOCK(bp->b_vp); |
|
407 408 /* 409 * The buffer must be completely invalid in order to 410 * take part in the cluster. If it is partially valid 411 * then we stop. 412 */ 413 for (j = 0;j < tbp->b_npages; j++) { 414 if (tbp->b_pages[j]->valid) --- 348 unchanged lines hidden (view full) --- 763 while (len > 0) { 764 s = splbio(); 765 /* 766 * If the buffer is not delayed-write (i.e. dirty), or it 767 * is delayed-write but either locked or inval, it cannot 768 * partake in the clustered write. 769 */ 770 VI_LOCK(vp); | 411 412 /* 413 * The buffer must be completely invalid in order to 414 * take part in the cluster. If it is partially valid 415 * then we stop. 416 */ 417 for (j = 0;j < tbp->b_npages; j++) { 418 if (tbp->b_pages[j]->valid) --- 348 unchanged lines hidden (view full) --- 767 while (len > 0) { 768 s = splbio(); 769 /* 770 * If the buffer is not delayed-write (i.e. dirty), or it 771 * is delayed-write but either locked or inval, it cannot 772 * partake in the clustered write. 773 */ 774 VI_LOCK(vp); |
771 if ((tbp = gbincore(vp, start_lbn)) == NULL) { | 775 if ((tbp = gbincore(vp, start_lbn)) == NULL || 776 (tbp->b_vflags & BV_BKGRDINPROG)) { |
772 VI_UNLOCK(vp); 773 ++start_lbn; 774 --len; 775 splx(s); 776 continue; 777 } 778 if (BUF_LOCK(tbp, 779 LK_EXCLUSIVE | LK_NOWAIT | LK_INTERLOCK, VI_MTX(vp))) { 780 ++start_lbn; 781 --len; 782 splx(s); 783 continue; 784 } | 777 VI_UNLOCK(vp); 778 ++start_lbn; 779 --len; 780 splx(s); 781 continue; 782 } 783 if (BUF_LOCK(tbp, 784 LK_EXCLUSIVE | LK_NOWAIT | LK_INTERLOCK, VI_MTX(vp))) { 785 ++start_lbn; 786 --len; 787 splx(s); 788 continue; 789 } |
785 if ((tbp->b_flags & (B_LOCKED | B_INVAL | B_DELWRI)) != 786 B_DELWRI) { | 790 if ((tbp->b_flags & (B_INVAL | B_DELWRI)) != B_DELWRI) { |
787 BUF_UNLOCK(tbp); 788 ++start_lbn; 789 --len; 790 splx(s); 791 continue; 792 } 793 bremfree(tbp); 794 tbp->b_flags &= ~B_DONE; --- 57 unchanged lines hidden (view full) --- 852 for (i = 0; i < len; ++i, ++start_lbn) { 853 if (i != 0) { /* If not the first buffer */ 854 s = splbio(); 855 /* 856 * If the adjacent data is not even in core it 857 * can't need to be written. 858 */ 859 VI_LOCK(vp); | 791 BUF_UNLOCK(tbp); 792 ++start_lbn; 793 --len; 794 splx(s); 795 continue; 796 } 797 bremfree(tbp); 798 tbp->b_flags &= ~B_DONE; --- 57 unchanged lines hidden (view full) --- 856 for (i = 0; i < len; ++i, ++start_lbn) { 857 if (i != 0) { /* If not the first buffer */ 858 s = splbio(); 859 /* 860 * If the adjacent data is not even in core it 861 * can't need to be written. 862 */ 863 VI_LOCK(vp); |
860 if ((tbp = gbincore(vp, start_lbn)) == NULL) { | 864 if ((tbp = gbincore(vp, start_lbn)) == NULL || 865 (tbp->b_vflags & BV_BKGRDINPROG)) { |
861 VI_UNLOCK(vp); 862 splx(s); 863 break; 864 } 865 866 /* 867 * If it IS in core, but has different 868 * characteristics, or is locked (which --- 7 unchanged lines hidden (view full) --- 876 splx(s); 877 break; 878 } 879 880 if ((tbp->b_flags & (B_VMIO | B_CLUSTEROK | 881 B_INVAL | B_DELWRI | B_NEEDCOMMIT)) 882 != (B_DELWRI | B_CLUSTEROK | 883 (bp->b_flags & (B_VMIO | B_NEEDCOMMIT))) || | 866 VI_UNLOCK(vp); 867 splx(s); 868 break; 869 } 870 871 /* 872 * If it IS in core, but has different 873 * characteristics, or is locked (which --- 7 unchanged lines hidden (view full) --- 881 splx(s); 882 break; 883 } 884 885 if ((tbp->b_flags & (B_VMIO | B_CLUSTEROK | 886 B_INVAL | B_DELWRI | B_NEEDCOMMIT)) 887 != (B_DELWRI | B_CLUSTEROK | 888 (bp->b_flags & (B_VMIO | B_NEEDCOMMIT))) || |
884 (tbp->b_flags & B_LOCKED) || | |
885 tbp->b_wcred != bp->b_wcred) { 886 BUF_UNLOCK(tbp); 887 splx(s); 888 break; 889 } 890 891 /* 892 * Check that the combined cluster --- 132 unchanged lines hidden --- | 889 tbp->b_wcred != bp->b_wcred) { 890 BUF_UNLOCK(tbp); 891 splx(s); 892 break; 893 } 894 895 /* 896 * Check that the combined cluster --- 132 unchanged lines hidden --- |