VOP_BMAP(9)

VOP_BMAP9

Logical to physical block number conversion

Usage

#include <sys/param.h>

#include <sys/vnode.h>

int

VOP_BMAP(struct vnode *vp, daddr_t bn, struct bufobj **bop, daddr_t *bnp, int *runp, int *runb);

Overview

This vnode call is used to lookup the physical block number of the file system's underlying device where a given logical block of a file is stored. Its arguments are:

vp

The vnode of the file.

bn

Logical block number within the file identified by vp.

bop

Return storage for the buffer object associated with the file system's underlying device.

bnp

Return storage for the physical block number.

runp

Return storage for the number of succeeding logical blocks that may be efficiently read at the same time as the requested block. This will usually be the number of logical blocks whose physical blocks are contiguously allocated. However a file system is free to define "efficient" as it sees fit.

runb

Like runp but for preceding rather than succeeding blocks.

Any of the return arguments may be NULL to indicate that the caller does not care about that information.

Locks

The vnode will be locked on entry and should remain locked on return.

Return values

Zero is returned on success, otherwise an error code is returned.

Releases

20 releases since FreeBSD 11.4-RELEASE; the text changed 8 times.

  1. 11.4
  2. 12.1
  3. 12.2
  4. 12.3
  5. 12.4
  6. 13.0
  7. 13.1–13.2
  8. 13.3–14.0
  9. 14.1–16.0

History

A bmap() function first appeared in 4.2BSD.

Authors

This manual page was written by Alan Somers.

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.