Page MenuHomeFreeBSD

tmpfs: Implement VOP_DEALLOCATE
ClosedPublic

Authored by khng on Aug 25 2021, 8:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 13, 6:15 PM
Unknown Object (File)
Dec 21 2023, 4:08 PM
Unknown Object (File)
Dec 8 2023, 1:38 AM
Unknown Object (File)
Nov 27 2023, 7:09 PM
Unknown Object (File)
Nov 23 2023, 12:50 AM
Unknown Object (File)
Nov 22 2023, 10:47 PM
Unknown Object (File)
Nov 22 2023, 9:15 PM
Unknown Object (File)
Nov 22 2023, 6:37 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
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.