vfs_bio.c (b1951f402864c5ed187dee4bc5fc92a7f548f78a) vfs_bio.c (fd5d1124e25f9996b0bfbf17156d850d106b27b4)
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
9 * notice immediately at the beginning of the file, without modification,
10 * this list of conditions, and the following disclaimer.
11 * 2. Absolutely no warranty of function or purpose is made by the author
12 * John S. Dyson.
13 *
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
9 * notice immediately at the beginning of the file, without modification,
10 * this list of conditions, and the following disclaimer.
11 * 2. Absolutely no warranty of function or purpose is made by the author
12 * John S. Dyson.
13 *
14 * $Id: vfs_bio.c,v 1.163 1998/05/01 15:04:35 peter Exp $
14 * $Id: vfs_bio.c,v 1.164 1998/05/01 15:10:59 peter Exp $
15 */
16
17/*
18 * this file contains a new buffer I/O scheme implementing a coherent
19 * VM object and buffer cache scheme. Pains have been taken to make
20 * sure that the performance degradation associated with schemes such
21 * as this is not realized.
22 *

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

290 bp->b_flags |= B_READ;
291 bp->b_flags &= ~(B_DONE | B_ERROR | B_INVAL);
292 if (bp->b_rcred == NOCRED) {
293 if (cred != NOCRED)
294 crhold(cred);
295 bp->b_rcred = cred;
296 }
297 vfs_busy_pages(bp, 0);
15 */
16
17/*
18 * this file contains a new buffer I/O scheme implementing a coherent
19 * VM object and buffer cache scheme. Pains have been taken to make
20 * sure that the performance degradation associated with schemes such
21 * as this is not realized.
22 *

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

290 bp->b_flags |= B_READ;
291 bp->b_flags &= ~(B_DONE | B_ERROR | B_INVAL);
292 if (bp->b_rcred == NOCRED) {
293 if (cred != NOCRED)
294 crhold(cred);
295 bp->b_rcred = cred;
296 }
297 vfs_busy_pages(bp, 0);
298 VOP_STRATEGY(bp);
298 VOP_STRATEGY(vp, bp);
299 return (biowait(bp));
300 }
301 return (0);
302}
303
304/*
305 * Operates like bread, but also starts asynchronous I/O on
306 * read-ahead blocks.

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

323 bp->b_flags |= B_READ;
324 bp->b_flags &= ~(B_DONE | B_ERROR | B_INVAL);
325 if (bp->b_rcred == NOCRED) {
326 if (cred != NOCRED)
327 crhold(cred);
328 bp->b_rcred = cred;
329 }
330 vfs_busy_pages(bp, 0);
299 return (biowait(bp));
300 }
301 return (0);
302}
303
304/*
305 * Operates like bread, but also starts asynchronous I/O on
306 * read-ahead blocks.

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

323 bp->b_flags |= B_READ;
324 bp->b_flags &= ~(B_DONE | B_ERROR | B_INVAL);
325 if (bp->b_rcred == NOCRED) {
326 if (cred != NOCRED)
327 crhold(cred);
328 bp->b_rcred = cred;
329 }
330 vfs_busy_pages(bp, 0);
331 VOP_STRATEGY(bp);
331 VOP_STRATEGY(vp, bp);
332 ++readwait;
333 }
334 for (i = 0; i < cnt; i++, rablkno++, rabsize++) {
335 if (inmem(vp, *rablkno))
336 continue;
337 rabp = getblk(vp, *rablkno, *rabsize, 0, 0);
338
339 if ((rabp->b_flags & B_CACHE) == 0) {
340 if (curproc != NULL)
341 curproc->p_stats->p_ru.ru_inblock++;
342 rabp->b_flags |= B_READ | B_ASYNC;
343 rabp->b_flags &= ~(B_DONE | B_ERROR | B_INVAL);
344 if (rabp->b_rcred == NOCRED) {
345 if (cred != NOCRED)
346 crhold(cred);
347 rabp->b_rcred = cred;
348 }
349 vfs_busy_pages(rabp, 0);
332 ++readwait;
333 }
334 for (i = 0; i < cnt; i++, rablkno++, rabsize++) {
335 if (inmem(vp, *rablkno))
336 continue;
337 rabp = getblk(vp, *rablkno, *rabsize, 0, 0);
338
339 if ((rabp->b_flags & B_CACHE) == 0) {
340 if (curproc != NULL)
341 curproc->p_stats->p_ru.ru_inblock++;
342 rabp->b_flags |= B_READ | B_ASYNC;
343 rabp->b_flags &= ~(B_DONE | B_ERROR | B_INVAL);
344 if (rabp->b_rcred == NOCRED) {
345 if (cred != NOCRED)
346 crhold(cred);
347 rabp->b_rcred = cred;
348 }
349 vfs_busy_pages(rabp, 0);
350 VOP_STRATEGY(rabp);
350 VOP_STRATEGY(vp, rabp);
351 } else {
352 brelse(rabp);
353 }
354 }
355
356 if (readwait) {
357 rv = biowait(bp);
358 }

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

390 --numdirtybuffers;
391 reassignbuf(bp, bp->b_vp);
392 }
393
394 bp->b_vp->v_numoutput++;
395 vfs_busy_pages(bp, 1);
396 if (curproc != NULL)
397 curproc->p_stats->p_ru.ru_oublock++;
351 } else {
352 brelse(rabp);
353 }
354 }
355
356 if (readwait) {
357 rv = biowait(bp);
358 }

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

390 --numdirtybuffers;
391 reassignbuf(bp, bp->b_vp);
392 }
393
394 bp->b_vp->v_numoutput++;
395 vfs_busy_pages(bp, 1);
396 if (curproc != NULL)
397 curproc->p_stats->p_ru.ru_oublock++;
398 VOP_STRATEGY(bp);
398 VOP_STRATEGY(bp->b_vp, bp);
399
400 /*
401 * Collect statistics on synchronous and asynchronous writes.
402 * Writes to block devices are charged to their associated
403 * filesystem (if any).
404 */
405 if ((vp = bp->b_vp) != NULL) {
406 if (vp->v_type == VBLK)

--- 2037 unchanged lines hidden ---
399
400 /*
401 * Collect statistics on synchronous and asynchronous writes.
402 * Writes to block devices are charged to their associated
403 * filesystem (if any).
404 */
405 if ((vp = bp->b_vp) != NULL) {
406 if (vp->v_type == VBLK)

--- 2037 unchanged lines hidden ---