Page MenuHomeFreeBSD

md: Replace BIO_DELETE emulation with vn_deallocate(9)
ClosedPublic

Authored by khng on Feb 23 2021, 3:12 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 19, 10:50 AM
Unknown Object (File)
Tue, Nov 19, 10:10 AM
Unknown Object (File)
Mon, Nov 18, 5:06 AM
Unknown Object (File)
Sun, Nov 17, 8:00 AM
Unknown Object (File)
Sun, Nov 17, 7:55 AM
Unknown Object (File)
Sun, Nov 17, 7:52 AM
Unknown Object (File)
Sun, Nov 17, 7:25 AM
Unknown Object (File)
Sun, Nov 17, 7:22 AM

Details

Summary

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

Submitted by: Ka Ho Ng <khng@freebsdfoundation.org>
Sponsored by: The FreeBSD Foundation

Diff Detail

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

Event Timeline

khng requested review of this revision.Feb 23 2021, 3:12 PM

vn_deallocate KPI changes.

vn_deallocate() changed.

sys/dev/md/md.c
918

Looks like there is no way to honour MD_SYNC? For writes it is translated to IO_SYNC, but here it looks like it would not be plumbed through VOP_DEALLOCATE.

sys/dev/md/md.c
886

Harmless, but there's a missing break here.

sys/dev/md/md.c
918

For the fallback part, do you think it is reasonable if we add a ioflg in VOP_DEALLOCATE that can accept IO_SYNC? Or do we just make it a vn_deallocate + VOP_FSYNC? On the other hand, posix_fallocate is another call that currently bypass IO_SYNC.

sys/dev/md/md.c
918

I think that adding an additional parameter would be reasonable. Calling VOP_FSYNC() should also work but that seems like a hack, and it can in principle result in unnecessary I/O. I do not insist on fixing this for this review, but I would note it with an XXX comment or so.

So posix_fallocate() does not respect O_SYNC, effectively, which is a bug IMO.

  • Gotchas on the current behavior
  • missing break
khng marked 3 inline comments as done.Aug 10 2021, 4:22 PM
sys/dev/md/md.c
920

I believe we need to update bio->bp_resid as well.

khng marked an inline comment as done.Aug 10 2021, 4:40 PM

A test case in sbin/mdconfig/tests would be nice. I believe trim(8) can be used to easily submit DIOCGDELETE requests against a md device.

This revision is now accepted and ready to land.Aug 10 2021, 5:24 PM

A test case in sbin/mdconfig/tests would be nice. I believe trim(8) can be used to easily submit DIOCGDELETE requests against a md device.

I will make that a separate differential for review.

  • Use IO_SYNC for non-MD_ASYNC case.
This revision now requires review to proceed.Aug 12 2021, 3:21 PM
This revision is now accepted and ready to land.Aug 12 2021, 3:52 PM