History log of /freebsd/sys/dev/md/md.c (Results 1 – 25 of 582)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# d1604471 03-Jan-2026 Konstantin Belousov <kib@FreeBSD.org>

vm_object: remove the charge member

State that the object charge is zero if object->cred == NULL, or equal
to the ptoa(object->size) otherwise.

Besides being much simpler, the transition to use obj

vm_object: remove the charge member

State that the object charge is zero if object->cred == NULL, or equal
to the ptoa(object->size) otherwise.

Besides being much simpler, the transition to use object->size corrects
the architectural issue with the use of object->charge. The split
operations effectively carve the holes in the charged regions, but
single counter cannot properly express it. As result, coalescing
anonymous mappings cannot calculate correctly if the extended mapping
already backed by the existing object is already accounted or not [1].

To properly solve the issue, either we need to start tracking exact
charged regions in the anonymous objects, which has the significant
overhead and complications. Or give up on the slight over-accounting
and charge the whole object unconditionally, as it is done in the patch.

Reported by: mmel, pho [1]
Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D54572

show more ...


Revision tags: release/15.0.0-p1, release/13.5.0-p8, release/14.3.0-p7, release/15.0.0, release/14.3.0-p6, release/13.5.0-p7
# c6e12d38 28-Oct-2025 Konstantin Belousov <kib@FreeBSD.org>

sys/dev/md: cleanup includes

Remove twice included but unneeded explicit sys/param.h. Sort.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days


Revision tags: release/13.5.0-p6, release/14.3.0-p5, release/13.5.0-p5, release/14.2.0-p7, release/14.3.0-p4, release/14.3.0-p3, release/14.2.0-p6, release/13.5.0-p4, release/13.5.0-p3, release/14.2.0-p5, release/14.3.0-p2
# 15925062 23-Jul-2025 Richard Russo <russor@ruka.org>

biosboot: Detect memory disks from PXE

Walk through the disk driver entries chained off of INT13.

MEMDISK is part of the Syslinux project; it loads disk images into
memory, sets an int 13h hook and

biosboot: Detect memory disks from PXE

Walk through the disk driver entries chained off of INT13.

MEMDISK is part of the Syslinux project; it loads disk images into
memory, sets an int 13h hook and then does a BIOS boot from the image;
this can be used as part of a PXE boot environment to load installer
disks, however the disks are not accessible from inside the FreeBSD
kernel because it doesn't access disks through BIOS APIs.

This patch detects the disk images in the loader, and passes their
address and length as a driver hint. When the md driver sees the hint,
it maps the image, and presents it to the system.

(rebased and reworked from https://reviews.freebsd.org/D27349)

Feedback from: kib, bapt, olce
Differential Revision: https://reviews.freebsd.org/D45404

show more ...


# 56eb7566 16-Jul-2025 Mateusz Piotrowski <0mp@FreeBSD.org>

md(4): Stop symlinking vn.4 to md.4

We've done the same in the past to the vnconfig.8->mdconfig.8 link in:
eb5f4569819 Remove ancient vnconfig symlink

Reviewed by: bcr, markj, ziaee
Approved by

md(4): Stop symlinking vn.4 to md.4

We've done the same in the past to the vnconfig.8->mdconfig.8 link in:
eb5f4569819 Remove ancient vnconfig symlink

Reviewed by: bcr, markj, ziaee
Approved by: markj (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27122

show more ...


# 5ae9f8e9 03-Jul-2025 Mark Johnston <markj@FreeBSD.org>

md: Restore guards in mddestroy()

mddestroy() may be invoked on a partially constructed md device.
Restore the guards that handled this prior to commit e91022168101.

Reported by: syzbot+a0ff73f664d

md: Restore guards in mddestroy()

mddestroy() may be invoked on a partially constructed md device.
Restore the guards that handled this prior to commit e91022168101.

Reported by: syzbot+a0ff73f664de8757cfaa@syzkaller.appspotmail.com
Reported by: syzbot+7b4a4824bf81548283ab@syzkaller.appspotmail.com
Reviewed by: kib
Fixes: e91022168101 ("md(4): move type-specific data under union")
Differential Revision: https://reviews.freebsd.org/D51145

show more ...


# e9102216 02-Jul-2025 Konstantin Belousov <kib@FreeBSD.org>

md(4): move type-specific data under union

This way it is clear which type uses which members.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https

md(4): move type-specific data under union

This way it is clear which type uses which members.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D51127

show more ...


Revision tags: release/14.3.0-p1, release/14.2.0-p4, release/13.5.0-p2
# 5286b96c 25-Jun-2025 Mark Johnston <markj@FreeBSD.org>

md: Use a larger buffer for the ident string

With the old size, the string could easily be truncated, resulting in
non-unique identifiers.

PR: 287679
Reported by: Phil Krylov <phil@krylov.eu>
Revi

md: Use a larger buffer for the ident string

With the old size, the string could easily be truncated, resulting in
non-unique identifiers.

PR: 287679
Reported by: Phil Krylov <phil@krylov.eu>
Reviewed by: kib
MFC after: 2 weeks

show more ...


Revision tags: release/14.3.0, release/13.4.0-p5, release/13.5.0-p1, release/14.2.0-p3, release/13.5.0, release/14.2.0-p2, release/14.1.0-p8, release/13.4.0-p4, release/14.1.0-p7, release/14.2.0-p1, release/13.4.0-p3, release/14.2.0
# 4bf34c59 13-Oct-2024 Konstantin Belousov <kib@FreeBSD.org>

md(4): always trim the last partial sector

Do it also for the preloaded disk, in addition to the dynamically
configured device. This is needed to avoid geom checking alignment and
panicing on read

md(4): always trim the last partial sector

Do it also for the preloaded disk, in addition to the dynamically
configured device. This is needed to avoid geom checking alignment and
panicing on read of the last sector, e.g. for partition schemes and
label tasting.

PR: 281978
Reported by: bz
Reviewed by: bz, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D47102

show more ...


Revision tags: release/13.4.0
# 9d449cad 01-Jun-2024 Alan Somers <asomers@FreeBSD.org>

md: round-trip the MUSTDEALLOC and RESERVE options

If those options are requested when the device is created, ensure that
they will be reported by MDIOCQUERY.

MFC after: 2 weeks
Reviewed by: imp
Pu

md: round-trip the MUSTDEALLOC and RESERVE options

If those options are requested when the device is created, ensure that
they will be reported by MDIOCQUERY.

MFC after: 2 weeks
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1270

show more ...


Revision tags: release/14.1.0
# f75764fe 10-May-2024 John Baldwin <jhb@FreeBSD.org>

md: Merge two switch statements in mdstart_vnode

While here, use bp->bio_cmd instead of auio.uio_rw to drive read vs
write behavior.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.

md: Merge two switch statements in mdstart_vnode

While here, use bp->bio_cmd instead of auio.uio_rw to drive read vs
write behavior.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D45155

show more ...


# 13a5a46c 30-Apr-2024 Andrew Gallatin <gallatin@FreeBSD.org>

Fix new users of MAXPHYS and hide it from the kernel namespace

In cd8537910406, kib made maxphys a load-time tunable. This made
the #define MAXPHYS in sys/param.h almost entirely obsolete, as
it c

Fix new users of MAXPHYS and hide it from the kernel namespace

In cd8537910406, kib made maxphys a load-time tunable. This made
the #define MAXPHYS in sys/param.h almost entirely obsolete, as
it could now be overridden by kern.maxphys at boot time, or by
opt_maxphys.h.

However, decades of tradition have led to several new, incorrect, uses
of MAXPHYS in other parts of the kernel, mostly by seasoned
developers. I've corrected those uses here in a mechanical fashion,
and verified that it fixes a bug in the md driver that I was
experiencing.

Since using MAXPHYS is such an easy mistake to make, it is best to
hide it from the kernel namespace. So I've moved its definition to
_maxphys.h, which is now included in param.h only for userspace.

That brings up the fact that lots of userspace programs use MAXPHYS
for different reasons, most of them probably wrong. Userspace consumers
that really need to know the value of maxphys should probably be
changed to use the kern.maxphys sysctl. But that's outside the scope
of this change.

Reviewed by: imp, jkim, kib, markj
Fixes: 30038a8b4efc ("md: Get rid of the pbuf zone")
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D44986

show more ...


Revision tags: release/13.3.0
# 29363fb4 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl s

sys: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix

show more ...


Revision tags: release/14.0.0
# 95ee2897 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# 58a46cfd 08-Aug-2023 Mike Karels <karels@FreeBSD.org>

md driver compat32: fix structure padding for arm, powerpc

Because the 32-bit md_ioctl structure contains 64-bit members, arm
and powerpc add padding to a multiple of 8. i386 doesn't do this.
The m

md driver compat32: fix structure padding for arm, powerpc

Because the 32-bit md_ioctl structure contains 64-bit members, arm
and powerpc add padding to a multiple of 8. i386 doesn't do this.
The md_ioctl32 definition was correct for amd64/i386 without padding,
but wrong for arm64 and powerpc64. Make __packed__ conditional on
__amd64__, and test for the expected size on non-amd64. Note that
mdconfig is used in the ATF test suite. Note, I verified the
structure size for powerpc, but was unable to test.

MFC after: 1 week
Reviewed by: jrtc27
Differential Revision: https://reviews.freebsd.org/D41339
Discussed with: jhibbits

show more ...


# 30038a8b 23-May-2023 Mark Johnston <markj@FreeBSD.org>

md: Get rid of the pbuf zone

The zone is used solely to provide KVA for mapping BIOs so that we can
pass mapped buffers to VOP_READ and VOP_WRITE. Currently we preallocate
nswbuf/10 bufs for this p

md: Get rid of the pbuf zone

The zone is used solely to provide KVA for mapping BIOs so that we can
pass mapped buffers to VOP_READ and VOP_WRITE. Currently we preallocate
nswbuf/10 bufs for this purpose during boot.

The intent was to limit KVA usage on 32-bit systems, but the
preallocation means that we in fact consumed more KVA than needed unless
one has more than nswbuf/10 (typically 25) vnode-backed MD devices
in existence, which I would argue is the uncommon case.

Meanwhile, all I/O to an MD is handled by a dedicated thread, so we can
instead simply preallocate the KVA region at MD device creation time.

Event: BSDCan 2023
Reviewed by: kib
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D40215

show more ...


Revision tags: release/13.2.0
# ad8feb1e 20-Jan-2023 Konstantin Belousov <kib@FreeBSD.org>

md.c: another style fix

Noted by: jkim
Sponsored by: The FreeBSD Foundation
MFC after: 3 days


# 6189672e 18-Jan-2023 Konstantin Belousov <kib@FreeBSD.org>

Handle ERELOOKUP from VOP_FSYNC() in several other places

We need to repeat the operation if the vnode was relocked.

Reported and reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundat

Handle ERELOOKUP from VOP_FSYNC() in several other places

We need to repeat the operation if the vnode was relocked.

Reported and reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D38114

show more ...


Revision tags: release/12.4.0, release/13.1.0
# bb92cd7b 24-Mar-2022 Mateusz Guzik <mjg@FreeBSD.org>

vfs: NDFREE(&nd, NDF_ONLY_PNBUF) -> NDFREE_PNBUF(&nd)


# cb28dfb2 17-Feb-2022 Aleksandr Fedorov <afedorov@FreeBSD.org>

md(4): Add dummy support of the BIO_FLUSH command for malloc and swap
backend.

PR: 260200
Reported by: editor@callfortesting.org
Reviewed by: vmaffione (mentor), markj
Approved by: vmaffione (mentor

md(4): Add dummy support of the BIO_FLUSH command for malloc and swap
backend.

PR: 260200
Reported by: editor@callfortesting.org
Reviewed by: vmaffione (mentor), markj
Approved by: vmaffione (mentor), markj
Differential Revision: https://reviews.freebsd.org/D34260

show more ...


# b9c92d63 10-Feb-2022 Kyle Evans <kevans@FreeBSD.org>

Annotate geom_md with MODULE_VERSION

This was missed in 74d6c131cbe2 where other geom modules were annotated
with MODULE_VERSION. Again, the problem is the same: we can't detect
that geom_md is loa

Annotate geom_md with MODULE_VERSION

This was missed in 74d6c131cbe2 where other geom modules were annotated
with MODULE_VERSION. Again, the problem is the same: we can't detect
that geom_md is loaded into the kernel without it.

This was noticed in release builds on the cluster; mdconfig attempts to
load geom_md because it can't detect it in the kernel, but the cluster
config includes md(4) and does not build the kmod. This problem would
have been masked on hosts with the kmod built, as the kmod attempts to
register the g_md module and fails. With this commit, mdconfig would
not even try to load it again.

Reported by: re (cperciva)
MFC after: 3 days

show more ...


Revision tags: release/12.3.0
# 7e1d3eef 25-Nov-2021 Mateusz Guzik <mjg@FreeBSD.org>

vfs: remove the unused thread argument from NDINIT*

See b4a58fbf640409a1 ("vfs: remove cn_thread")

Bump __FreeBSD_version to 1400043.


# 3703c188 11-Sep-2021 Ka Ho Ng <khng@FreeBSD.org>

md: Add MD_MUSTDEALLOC support

This adds an option to detect if hole-punching is implemented by the
underlying file system. If this flag is set, and if the underlying file
system does not support h

md: Add MD_MUSTDEALLOC support

This adds an option to detect if hole-punching is implemented by the
underlying file system. If this flag is set, and if the underlying file
system does not support hole-punching, md(4) fails BIO_DELETE requests
with EOPNOTSUPP.

Sponsored by: The FreeBSD Foundation
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D31883

show more ...


# 47619b60 31-Aug-2021 Mark Johnston <markj@FreeBSD.org>

md: Clamp to a multiple of the sector size when resizing

We do this when creating md(4) devices, in kern_mdattach_locked(), but
not when resizing the provider. Apply the same policy when resizing,

md: Clamp to a multiple of the sector size when resizing

We do this when creating md(4) devices, in kern_mdattach_locked(), but
not when resizing the provider. Apply the same policy when resizing, as
many GEOM classes do not expect to deal with providers for which
pp->mediasize % pp->sectorsize != 0.

Reported by: syzkaller
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

show more ...


# 78267c2e 19-Aug-2021 Ka Ho Ng <khng@FreeBSD.org>

md: Replace BIO_DELETE emulation with vn_deallocate(9)

Both zero-filling and/or deallocation can be done with vn_deallocate(9).

Sponsored by: The FreeBSD Foundation
Reviewed by: markj
Differential

md: Replace BIO_DELETE emulation with vn_deallocate(9)

Both zero-filling and/or deallocation can be done with vn_deallocate(9).

Sponsored by: The FreeBSD Foundation
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D28899

show more ...


Revision tags: release/13.0.0
# 69e18c9b 30-Mar-2021 Alex Richardson <arichardson@FreeBSD.org>

sys/dev/md: Drop unncessary __GLOBL(mfs_root)

LLVM12 complains if you change the symbol binding:
error: mfs_root_end changed binding to STB_WEAK [-Werror,-Winline-asm]
error: mfs_root changed bindin

sys/dev/md: Drop unncessary __GLOBL(mfs_root)

LLVM12 complains if you change the symbol binding:
error: mfs_root_end changed binding to STB_WEAK [-Werror,-Winline-asm]
error: mfs_root changed binding to STB_WEAK [-Werror,-Winline-asm]

show more ...


12345678910>>...24