vfs_cluster.c (63e9755548e4feebf798686ab8bce0cdaaaf7b46) vfs_cluster.c (0012f373e43db2341c20329163ed2d5ad3b0f341)
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1993
5 * The Regents of the University of California. All rights reserved.
6 * Modifications/enhancements:
7 * Copyright (c) 1995 John S. Dyson. All rights reserved.
8 *

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

460 tsize = size;
461 VM_OBJECT_WLOCK(tbp->b_bufobj->bo_object);
462 for (j = 0; tsize > 0; j++) {
463 toff = off & PAGE_MASK;
464 tinc = tsize;
465 if (toff + tinc > PAGE_SIZE)
466 tinc = PAGE_SIZE - toff;
467 VM_OBJECT_ASSERT_WLOCKED(tbp->b_pages[j]->object);
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1993
5 * The Regents of the University of California. All rights reserved.
6 * Modifications/enhancements:
7 * Copyright (c) 1995 John S. Dyson. All rights reserved.
8 *

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

460 tsize = size;
461 VM_OBJECT_WLOCK(tbp->b_bufobj->bo_object);
462 for (j = 0; tsize > 0; j++) {
463 toff = off & PAGE_MASK;
464 tinc = tsize;
465 if (toff + tinc > PAGE_SIZE)
466 tinc = PAGE_SIZE - toff;
467 VM_OBJECT_ASSERT_WLOCKED(tbp->b_pages[j]->object);
468 if ((tbp->b_pages[j]->valid &
469 vm_page_bits(toff, tinc)) != 0)
470 break;
471 if (vm_page_trysbusy(tbp->b_pages[j]) == 0)
472 break;
468 if (vm_page_trysbusy(tbp->b_pages[j]) == 0)
469 break;
470 if ((tbp->b_pages[j]->valid &
471 vm_page_bits(toff, tinc)) != 0) {
472 vm_page_sunbusy(tbp->b_pages[j]);
473 break;
474 }
473 vm_object_pip_add(tbp->b_bufobj->bo_object, 1);
474 off += tinc;
475 tsize -= tinc;
476 }
477 if (tsize > 0) {
478clean_sbusy:
479 vm_object_pip_wakeupn(tbp->b_bufobj->bo_object,
480 j);

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

519 for (j = 0; j < tbp->b_npages; j += 1) {
520 vm_page_t m;
521 m = tbp->b_pages[j];
522 if ((bp->b_npages == 0) ||
523 (bp->b_pages[bp->b_npages-1] != m)) {
524 bp->b_pages[bp->b_npages] = m;
525 bp->b_npages++;
526 }
475 vm_object_pip_add(tbp->b_bufobj->bo_object, 1);
476 off += tinc;
477 tsize -= tinc;
478 }
479 if (tsize > 0) {
480clean_sbusy:
481 vm_object_pip_wakeupn(tbp->b_bufobj->bo_object,
482 j);

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

521 for (j = 0; j < tbp->b_npages; j += 1) {
522 vm_page_t m;
523 m = tbp->b_pages[j];
524 if ((bp->b_npages == 0) ||
525 (bp->b_pages[bp->b_npages-1] != m)) {
526 bp->b_pages[bp->b_npages] = m;
527 bp->b_npages++;
528 }
527 if (m->valid == VM_PAGE_BITS_ALL)
529 if (vm_page_all_valid(m))
528 tbp->b_pages[j] = bogus_page;
529 }
530 VM_OBJECT_WUNLOCK(tbp->b_bufobj->bo_object);
531 /*
532 * Don't inherit tbp->b_bufsize as it may be larger due to
533 * a non-page-aligned size. Instead just aggregate using
534 * 'size'.
535 */

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

543
544 /*
545 * Fully valid pages in the cluster are already good and do not need
546 * to be re-read from disk. Replace the page with bogus_page
547 */
548 VM_OBJECT_WLOCK(bp->b_bufobj->bo_object);
549 for (j = 0; j < bp->b_npages; j++) {
550 VM_OBJECT_ASSERT_WLOCKED(bp->b_pages[j]->object);
530 tbp->b_pages[j] = bogus_page;
531 }
532 VM_OBJECT_WUNLOCK(tbp->b_bufobj->bo_object);
533 /*
534 * Don't inherit tbp->b_bufsize as it may be larger due to
535 * a non-page-aligned size. Instead just aggregate using
536 * 'size'.
537 */

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

545
546 /*
547 * Fully valid pages in the cluster are already good and do not need
548 * to be re-read from disk. Replace the page with bogus_page
549 */
550 VM_OBJECT_WLOCK(bp->b_bufobj->bo_object);
551 for (j = 0; j < bp->b_npages; j++) {
552 VM_OBJECT_ASSERT_WLOCKED(bp->b_pages[j]->object);
551 if (bp->b_pages[j]->valid == VM_PAGE_BITS_ALL)
553 if (vm_page_all_valid(bp->b_pages[j]))
552 bp->b_pages[j] = bogus_page;
553 }
554 VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object);
555 if (bp->b_bufsize > bp->b_kvasize)
556 panic("cluster_rbuild: b_bufsize(%ld) > b_kvasize(%d)\n",
557 bp->b_bufsize, bp->b_kvasize);
558
559 if (buf_mapped(bp)) {

--- 538 unchanged lines hidden ---
554 bp->b_pages[j] = bogus_page;
555 }
556 VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object);
557 if (bp->b_bufsize > bp->b_kvasize)
558 panic("cluster_rbuild: b_bufsize(%ld) > b_kvasize(%d)\n",
559 bp->b_bufsize, bp->b_kvasize);
560
561 if (buf_mapped(bp)) {

--- 538 unchanged lines hidden ---