Page MenuHomeFreeBSD

Add FIOBMAP2 ioctl
ClosedPublic

Authored by asomers on Jun 20 2019, 12:34 AM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 13 2024, 11:27 AM
Unknown Object (File)
Dec 23 2023, 9:13 AM
Unknown Object (File)
Sep 22 2023, 3:39 PM
Unknown Object (File)
Sep 10 2023, 4:03 PM
Unknown Object (File)
Dec 31 2022, 10:59 PM
Unknown Object (File)
Dec 2 2022, 9:40 AM
Subscribers

Details

Summary

Add FIOBMAP2 ioctl

This ioctl exposes VOP_BMAP information to userland. It can be used by
programs like fragmentation analyzers and optimized cp implementations. But
I'm using it to test fusefs's VOP_BMAP implementation. The "2" in the name
distinguishes it from the similar but incompatible FIOBMAP ioctls in NetBSD
and Linux.

Test Plan

Tested with a dumb command line utility with files on NFS, UFS, devfs, and
fusefs.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

The name, etc, beg the question: what's the motivation to differ from FIOBMAP in Linux (or NetBSD)?

In D20705#447490, @cem wrote:

The name, etc, beg the question: what's the motivation to differ from FIOBMAP in Linux (or NetBSD)?

  1. FIOBMAP stores the block number in an int instead of an int64_t
  2. FIOBMAP does not return runp and runb.

Ah, I was thinking of FIEMAP I think. So the better question might be, why not add FIEMAP instead? https://www.kernel.org/doc/Documentation/filesystems/fiemap.txt

One answer is that it's a less direct way of testing VOP_BMAP, I guess.

In D20705#447498, @cem wrote:

Ah, I was thinking of FIEMAP I think. So the better question might be, why not add FIEMAP instead? https://www.kernel.org/doc/Documentation/filesystems/fiemap.txt

One answer is that it's a less direct way of testing VOP_BMAP, I guess.

Because FIEMAP is far more complicated. It works in terms of extents instead of blocks, and returns a variable sized array. Plus, it hasn't worked out very well on Linux. It was introduced in response to Solaris's SEEK_HOLE, but was too buggy for the purpose. Linux later had to add SEEK_HOLE too.

Changing ufs_bamparray() to return errors rather than panicing is a helpful move forward.

This revision is now accepted and ready to land.Jun 20 2019, 6:08 AM
This revision was automatically updated to reflect the committed changes.
head/sys/kern/vfs_vnops.c
1474–1475

style(9): the second line should be 4-space indented

1504–1505

ditto here