Page MenuHomeFreeBSD

tmpfs: Implement VOP_DEALLOCATE
ClosedPublic

Authored by khng on Aug 25 2021, 8:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 24, 4:34 PM
Unknown Object (File)
Thu, Oct 24, 4:34 PM
Unknown Object (File)
Thu, Oct 24, 4:34 PM
Unknown Object (File)
Thu, Oct 24, 4:34 PM
Unknown Object (File)
Thu, Oct 24, 4:14 PM
Unknown Object (File)
Oct 7 2024, 2:56 PM
Unknown Object (File)
Oct 3 2024, 6:37 AM
Unknown Object (File)
Sep 30 2024, 7:29 PM
Subscribers

Details

Summary

Implementing VOP_DEALLOCATE to allow hole-punching in the same manner as
POSIX shared memory's fspacectl(SPACECTL_DEALLOC) support.

Sponsored by: The FreeBSD Foundation

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 41216
Build 38105: arc lint + arc unit

Event Timeline

khng requested review of this revision.Aug 25 2021, 8:13 PM
sys/fs/tmpfs/tmpfs_subr.c
1798

I would assert that tn_type == VREG.

1816

There should be a blank line before multi-line comment

1824

error != 0

1834

vm_object_page_remove() leaves wired pages alone. This is fine for truncation, but probably not for deallocation. I think you need to do a pass over the leftover pages and zero them?

BTW, similar issue probably exists with shmfd.

1846

Same

sys/fs/tmpfs/tmpfs_vnops.c
703

These are rather silly asserts from GSoC times, they are a) not useful b) done wrong (ASSERT_VOP_LOCKED should be used if anything)

sys/fs/tmpfs/tmpfs_subr.c
1834

Replying to myself, no need to zero them. The pages are marked as invalid, and I checked that all paths to get the page content (read/mmap) ensure that the page is validated before.

khng marked 5 inline comments as done.
  • Styles
  • KASSERT message changes
  • KASSERT node type be VREG in tmpfs_reg_punch_hole
  • Remove the MPASS(VOP_ISLOCKED(vp)) from tmpfs_deallocate. This is guarded by ASSERT_VOP_LOCKED already.
This revision is now accepted and ready to land.Aug 25 2021, 9:20 PM
This revision was automatically updated to reflect the committed changes.