Updated: 2022/Sep/29

Please read Privacy Policy. It's for your privacy.

UBC(9)                     Kernel Developer's Manual                    UBC(9)

     ubc - unified buffer cache

     #include <uvm/uvm.h>

     ubc_uiomove(struct uvm_object *uobj, struct uio *uio, vsize_t todo,
         int advice, int flags);

     ubc_zerorange(struct uvm_bject *uobj, off_t off, size_t len, int flags);

     ubc_purge(struct uvm_object *uobj);

     ubc_uiomove() allocates an UBC memory window, performs I/O on it and
     unmaps the window.  The advice parameter is the access pattern hint,
     which must be one of

           UVM_ADV_NORMAL      No hint
           UVM_ADV_RANDOM      Random access hint
           UVM_ADV_SEQUENTIAL  Sequential access hint (from lower offset to
                               higher offset)

     and the flags parameter is

           UBC_READ            Mapping will be accessed for read.
           UBC_WRITE           Mapping will be accessed for write.
           UBC_FAULTBUSY       Fault in window's pages already during mapping
                               operation.  Makes sense only for write.
           UBC_UNMAP           Do not cache mapping.
           UBC_PARTIALOK       Indicate that it is acceptable to return if an
                               error occurs mid-transfer.

     UBC memory window is a kernel mapping of uobj starting at offset offset.

     Once the mapping is created, it must be accessed only by methods that can
     handle faults, such as uiomove(9) or kcopy(9).  Page faults on the
     mapping will result in the object's pager method being called to resolve
     the fault.

     Size of individual UBC memory window is limited to ubc_winsize.
     ubc_uiomove() sequentially creates the UBC memory windows to eventually
     process the whole range according to offset and len parameters.

     The mappings may be cached to speed future accesses to the same region of
     the object, unless UBC_UNMAP was specified in flags parameter.

     ubc_zerorange() sets a range of bytes in a UVM object to zero.  The flags
     parameter takes the same arguments as ubc_uiomove().

     ubc_purge() disassociates all UBC structures from an empty UVM object,
     specified by uobj.

     The ubc subsystem is implemented within the file sys/uvm/uvm_bio.c.

     kcopy(9), pmap(9), uiomove(9), uvm(9), vnode(9), vnodeops(9)

     Chuck Silvers, "UBC: An Efficient Unified I/O and Memory Caching
     Subsystem for NetBSD", Proceedings of the FREENIX Track: 2000 USENIX
     Annual Technical Conference, USENIX Association,
     285-290, June 18-23, 2000.

     UBC first appeared in NetBSD 1.6.

     Chuck Silvers <chuq@chuq.com> designed and implemented the UBC part of
     UVM, which uses UVM pages to cache vnode data rather than the traditional
     buffer cache buffers.

NetBSD 9.99                      May 12, 2018                      NetBSD 9.99