vfs_bio.c (21144e3bf1f416a758f6546bfabfa8e4e8cba507) | vfs_bio.c (b99c307a21423935df9af6a532033f28b62e2966) |
---|---|
1/* 2 * Copyright (c) 1994,1997 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 --- 664 unchanged lines hidden (view full) --- 673 674 bp->b_vp->v_numoutput++; 675 vfs_busy_pages(bp, 1); 676 if (curproc != NULL) 677 curproc->p_stats->p_ru.ru_oublock++; 678 splx(s); 679 if (oldflags & B_ASYNC) 680 BUF_KERNPROC(bp); | 1/* 2 * Copyright (c) 1994,1997 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 --- 664 unchanged lines hidden (view full) --- 673 674 bp->b_vp->v_numoutput++; 675 vfs_busy_pages(bp, 1); 676 if (curproc != NULL) 677 curproc->p_stats->p_ru.ru_oublock++; 678 splx(s); 679 if (oldflags & B_ASYNC) 680 BUF_KERNPROC(bp); |
681 VOP_STRATEGY(bp->b_vp, bp); | 681 BUF_STRATEGY(bp); |
682 683 if ((oldflags & B_ASYNC) == 0) { 684 int rtval = biowait(bp); 685 brelse(bp); 686 return (rtval); 687 } 688 689 return (0); --- 191 unchanged lines hidden (view full) --- 881 * 882 * bwrite() ( or the VOP routine anyway ) is responsible for handling 883 * B_INVAL buffers. Not us. 884 */ 885void 886bawrite(struct buf * bp) 887{ 888 bp->b_flags |= B_ASYNC; | 682 683 if ((oldflags & B_ASYNC) == 0) { 684 int rtval = biowait(bp); 685 brelse(bp); 686 return (rtval); 687 } 688 689 return (0); --- 191 unchanged lines hidden (view full) --- 881 * 882 * bwrite() ( or the VOP routine anyway ) is responsible for handling 883 * B_INVAL buffers. Not us. 884 */ 885void 886bawrite(struct buf * bp) 887{ 888 bp->b_flags |= B_ASYNC; |
889 (void) VOP_BWRITE(bp->b_vp, bp); | 889 (void) BUF_WRITE(bp); |
890} 891 892/* 893 * bowrite: 894 * 895 * Ordered write. Start output on a buffer, and flag it so that the 896 * device will write it in the order it was queued. The buffer is 897 * released when the output completes. bwrite() ( or the VOP routine 898 * anyway ) is responsible for handling B_INVAL buffers. 899 */ 900int 901bowrite(struct buf * bp) 902{ 903 bp->b_flags |= B_ORDERED | B_ASYNC; | 890} 891 892/* 893 * bowrite: 894 * 895 * Ordered write. Start output on a buffer, and flag it so that the 896 * device will write it in the order it was queued. The buffer is 897 * released when the output completes. bwrite() ( or the VOP routine 898 * anyway ) is responsible for handling B_INVAL buffers. 899 */ 900int 901bowrite(struct buf * bp) 902{ 903 bp->b_flags |= B_ORDERED | B_ASYNC; |
904 return (VOP_BWRITE(bp->b_vp, bp)); | 904 return (BUF_WRITE(bp)); |
905} 906 907/* 908 * bwillwrite: 909 * 910 * Called prior to the locking of any vnodes when we are expecting to 911 * write. We do not want to starve the buffer cache with too many 912 * dirty buffers so we block here. By blocking prior to the locking --- 508 unchanged lines hidden (view full) --- 1421 1422 splx(s); 1423 /* 1424 * default (old) behavior, writing out only one block 1425 * 1426 * XXX returns b_bufsize instead of b_bcount for nwritten? 1427 */ 1428 nwritten = bp->b_bufsize; | 905} 906 907/* 908 * bwillwrite: 909 * 910 * Called prior to the locking of any vnodes when we are expecting to 911 * write. We do not want to starve the buffer cache with too many 912 * dirty buffers so we block here. By blocking prior to the locking --- 508 unchanged lines hidden (view full) --- 1421 1422 splx(s); 1423 /* 1424 * default (old) behavior, writing out only one block 1425 * 1426 * XXX returns b_bufsize instead of b_bcount for nwritten? 1427 */ 1428 nwritten = bp->b_bufsize; |
1429 (void) VOP_BWRITE(bp->b_vp, bp); | 1429 (void) BUF_WRITE(bp); |
1430 1431 return nwritten; 1432} 1433 1434/* 1435 * getnewbuf: 1436 * 1437 * Find and initialize a new buffer header, freeing up existing buffers --- 721 unchanged lines hidden (view full) --- 2159 * check for size inconsistancies for non-VMIO case. 2160 */ 2161 2162 if (bp->b_bcount != size) { 2163 if ((bp->b_flags & B_VMIO) == 0 || 2164 (size > bp->b_kvasize)) { 2165 if (bp->b_flags & B_DELWRI) { 2166 bp->b_flags |= B_NOCACHE; | 1430 1431 return nwritten; 1432} 1433 1434/* 1435 * getnewbuf: 1436 * 1437 * Find and initialize a new buffer header, freeing up existing buffers --- 721 unchanged lines hidden (view full) --- 2159 * check for size inconsistancies for non-VMIO case. 2160 */ 2161 2162 if (bp->b_bcount != size) { 2163 if ((bp->b_flags & B_VMIO) == 0 || 2164 (size > bp->b_kvasize)) { 2165 if (bp->b_flags & B_DELWRI) { 2166 bp->b_flags |= B_NOCACHE; |
2167 VOP_BWRITE(bp->b_vp, bp); | 2167 BUF_WRITE(bp); |
2168 } else { 2169 if ((bp->b_flags & B_VMIO) && 2170 (LIST_FIRST(&bp->b_dep) == NULL)) { 2171 bp->b_flags |= B_RELBUF; 2172 brelse(bp); 2173 } else { 2174 bp->b_flags |= B_NOCACHE; | 2168 } else { 2169 if ((bp->b_flags & B_VMIO) && 2170 (LIST_FIRST(&bp->b_dep) == NULL)) { 2171 bp->b_flags |= B_RELBUF; 2172 brelse(bp); 2173 } else { 2174 bp->b_flags |= B_NOCACHE; |
2175 VOP_BWRITE(bp->b_vp, bp); | 2175 BUF_WRITE(bp); |
2176 } 2177 } 2178 goto loop; 2179 } 2180 } 2181 2182 /* 2183 * If the size is inconsistant in the VMIO case, we can resize --- 20 unchanged lines hidden (view full) --- 2204 * can issue a read if B_CACHE is not set, or because 2205 * ( for example ) an uncached B_DELWRI might loop due 2206 * to softupdates re-dirtying the buffer. In the latter 2207 * case, B_CACHE is set after the first write completes, 2208 * preventing further loops. 2209 */ 2210 2211 if ((bp->b_flags & (B_CACHE|B_DELWRI)) == B_DELWRI) { | 2176 } 2177 } 2178 goto loop; 2179 } 2180 } 2181 2182 /* 2183 * If the size is inconsistant in the VMIO case, we can resize --- 20 unchanged lines hidden (view full) --- 2204 * can issue a read if B_CACHE is not set, or because 2205 * ( for example ) an uncached B_DELWRI might loop due 2206 * to softupdates re-dirtying the buffer. In the latter 2207 * case, B_CACHE is set after the first write completes, 2208 * preventing further loops. 2209 */ 2210 2211 if ((bp->b_flags & (B_CACHE|B_DELWRI)) == B_DELWRI) { |
2212 VOP_BWRITE(bp->b_vp, bp); | 2212 BUF_WRITE(bp); |
2213 goto loop; 2214 } 2215 2216 splx(s); 2217 bp->b_flags &= ~B_DONE; 2218 } else { 2219 /* 2220 * Buffer is not in-core, create new buffer. The buffer --- 1004 unchanged lines hidden --- | 2213 goto loop; 2214 } 2215 2216 splx(s); 2217 bp->b_flags &= ~B_DONE; 2218 } else { 2219 /* 2220 * Buffer is not in-core, create new buffer. The buffer --- 1004 unchanged lines hidden --- |