MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vnode_pager_input_smlfs

Function vnode_pager_input_smlfs

freebsd/vm/vnode_pager.c:568–656  ·  view source on GitHub ↗

* small block filesystem vnode pager input */

Source from the content-addressed store, hash-verified

566 * small block filesystem vnode pager input
567 */
568static int
569vnode_pager_input_smlfs(vm_object_t object, vm_page_t m)
570{
571 struct vnode *vp;
572 struct bufobj *bo;
573 struct buf *bp;
574 struct sf_buf *sf;
575 daddr_t fileaddr;
576 vm_offset_t bsize;
577 vm_page_bits_t bits;
578 int error, i;
579
580 error = 0;
581 vp = object->handle;
582 if (VN_IS_DOOMED(vp))
583 return VM_PAGER_BAD;
584
585 bsize = vp->v_mount->mnt_stat.f_iosize;
586
587 VOP_BMAP(vp, 0, &bo, 0, NULL, NULL);
588
589 sf = sf_buf_alloc(m, 0);
590
591 for (i = 0; i < PAGE_SIZE / bsize; i++) {
592 vm_ooffset_t address;
593
594 bits = vm_page_bits(i * bsize, bsize);
595 if (m->valid & bits)
596 continue;
597
598 address = IDX_TO_OFF(m->pindex) + i * bsize;
599 if (address >= object->un_pager.vnp.vnp_size) {
600 fileaddr = -1;
601 } else {
602 error = vnode_pager_addr(vp, address, &fileaddr, NULL);
603 if (error)
604 break;
605 }
606 if (fileaddr != -1) {
607 bp = uma_zalloc(vnode_pbuf_zone, M_WAITOK);
608
609 /* build a minimal buffer header */
610 bp->b_iocmd = BIO_READ;
611 bp->b_iodone = bdone;
612 KASSERT(bp->b_rcred == NOCRED, ("leaking read ucred"));
613 KASSERT(bp->b_wcred == NOCRED, ("leaking write ucred"));
614 bp->b_rcred = crhold(curthread->td_ucred);
615 bp->b_wcred = crhold(curthread->td_ucred);
616 bp->b_data = (caddr_t)sf_buf_kva(sf) + i * bsize;
617 bp->b_blkno = fileaddr;
618 pbgetbo(bo, bp);
619 bp->b_vp = vp;
620 bp->b_bcount = bsize;
621 bp->b_bufsize = bsize;
622 bp->b_runningbufspace = bp->b_bufsize;
623 atomic_add_long(&runningbufspace, bp->b_runningbufspace);
624
625 /* do the input */

Callers 1

Calls 15

vm_page_bitsFunction · 0.85
vnode_pager_addrFunction · 0.85
pbgetboFunction · 0.85
atomic_add_longFunction · 0.85
bstrategyFunction · 0.85
bwaitFunction · 0.85
pbrelboFunction · 0.85
bzeroFunction · 0.85
vm_page_bits_setFunction · 0.85
uma_zallocFunction · 0.70
uma_zfreeFunction · 0.70
sf_buf_allocFunction · 0.50

Tested by

no test coverage detected