Page MenuHomeFreeBSD

tmpfs: Implement VOP_DEALLOCATE
ClosedPublic

Authored by khng on Aug 25 2021, 8:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Dec 9, 8:54 PM
Unknown Object (File)
Sun, Dec 8, 5:43 AM
Unknown Object (File)
Fri, Nov 29, 2:09 PM
Unknown Object (File)
Nov 18 2024, 3:27 PM
Unknown Object (File)
Nov 18 2024, 3:12 PM
Unknown Object (File)
Oct 24 2024, 4:34 PM
Unknown Object (File)
Oct 24 2024, 4:34 PM
Unknown Object (File)
Oct 24 2024, 4:34 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 41211
Build 38100: 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.