Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Jun 2019 13:59:46 +0000 (UTC)
From:      Alan Somers <asomers@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r349230 - in head: share/man/man9 sys/kern
Message-ID:  <201906201359.x5KDxkJ1000855@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: asomers
Date: Thu Jun 20 13:59:46 2019
New Revision: 349230
URL: https://svnweb.freebsd.org/changeset/base/349230

Log:
  Add a VOP_BMAP(9) man page
  
  Reviewed by:	mckusick
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D20704

Added:
  head/share/man/man9/VOP_BMAP.9   (contents, props changed)
Modified:
  head/share/man/man9/Makefile
  head/sys/kern/vfs_default.c

Modified: head/share/man/man9/Makefile
==============================================================================
--- head/share/man/man9/Makefile	Thu Jun 20 13:24:58 2019	(r349229)
+++ head/share/man/man9/Makefile	Thu Jun 20 13:59:46 2019	(r349230)
@@ -399,6 +399,7 @@ MAN=	accept_filter.9 \
 	VOP_ADVLOCK.9 \
 	VOP_ALLOCATE.9 \
 	VOP_ATTRIB.9 \
+	VOP_BMAP.9 \
 	VOP_BWRITE.9 \
 	VOP_CREATE.9 \
 	VOP_FSYNC.9 \

Added: head/share/man/man9/VOP_BMAP.9
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/share/man/man9/VOP_BMAP.9	Thu Jun 20 13:59:46 2019	(r349230)
@@ -0,0 +1,86 @@
+.\"-
+.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+.\"
+.\" Copyright (c) 2019 The FreeBSD Foundation
+.\"
+.\" This software was developed by BFF Storage Systems, LLC under sponsorship
+.\" from the FreeBSD Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\".\"2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 19, 2019
+.Dt VOP_BMAP 9
+.Os
+.Sh NAME
+.Nm VOP_BMAP
+.Nd Logical to physical block number conversion
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fn VOP_BMAP "struct vnode *vp" "daddr_t bn" "struct bufobj **bop" "daddr_t *bnp" "int *runp" "int *runb"
+.Sh DESCRIPTION
+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:
+.Bl -tag -width type
+.It Fa vp
+The vnode of the file.
+.It Fa bn
+Logical block number within the file identified by
+.Fa vp .
+.It Fa bop
+Return storage for the buffer object associated with the file system's
+underlying device.
+.It Fa bnp
+Return storage for the physical block number.
+.It Fa 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 see fit.
+.It Fa runb
+Like
+.Fa runp
+but for preceding rather than succeeding blocks.
+.El
+.Pp
+Any of the return arguments may be
+.Dv NULL
+to indicate that the caller does not care about that information.
+.Sh LOCKS
+The vnode will be locked on entry and should remain locked on return.
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an error code is returned.
+.Sh SEE ALSO
+.Xr vnode 9 ,
+.Sh HISTORY
+A
+.Fn bmap
+function first appeared in
+.Bx 4.2 .
+.Sh AUTHORS
+This manual page was written by
+.An Alan Somers .

Modified: head/sys/kern/vfs_default.c
==============================================================================
--- head/sys/kern/vfs_default.c	Thu Jun 20 13:24:58 2019	(r349229)
+++ head/sys/kern/vfs_default.c	Thu Jun 20 13:59:46 2019	(r349230)
@@ -603,7 +603,13 @@ vop_stdgetwritemount(ap)
 	return (0);
 }
 
-/* XXX Needs good comment and VOP_BMAP(9) manpage */
+/*
+ * If the file system doesn't implement VOP_BMAP, then return sensible defaults:
+ * - Return the vnode's bufobj instead of any underlying device's bufobj
+ * - Calculate the physical block number as if there were equal size
+ *   consecutive blocks, but
+ * - Report no contiguous runs of blocks.
+ */
 int
 vop_stdbmap(ap)
 	struct vop_bmap_args /* {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906201359.x5KDxkJ1000855>