Page MenuHomeFreeBSD

vfs: Add ioflag to VOP_DEALLOCATE(9)
ClosedPublic

Authored by khng on Aug 11 2021, 7:19 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 10, 10:55 AM
Unknown Object (File)
Sun, Nov 10, 10:53 AM
Unknown Object (File)
Mon, Oct 28, 4:48 PM
Unknown Object (File)
Sun, Oct 20, 6:53 PM
Unknown Object (File)
Sun, Oct 20, 4:41 AM
Unknown Object (File)
Sun, Oct 20, 4:41 AM
Unknown Object (File)
Sun, Oct 20, 4:41 AM
Unknown Object (File)
Sun, Oct 20, 4:40 AM
Subscribers

Details

Summary

The addition of ioflag allows callers passing
IO_SYNC/IO_DATASYNC/IO_DIRECT down to the file system implementation.
The vop_stddeallocate fallback implementation is updated to pass the
ioflag to the file system implementation.
vn_deallocate(9) internally is also changed to pass ioflag to the
VOP_DEALLOCATE call.

Sponsored by: The FreeBSD Foundation

Diff Detail

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

Event Timeline

khng requested review of this revision.Aug 11 2021, 7:19 AM
sys/kern/vfs_vnops.c
3462

I suggest you to commit rename ioflg->ioflag as a preliminary change.

3478

Fix style: there should be spaces around '|'.

3558

!= 0

3559

!= 0

3567

() != 0

khng marked 5 inline comments as done.

Styles.

sys/kern/vfs_vnops.c
3568

This ioflag calculation block was copied/pasted from vn_write(). Put it into a helper used in both places.

khng marked an inline comment as done.
  • IO_SYNC and/or IO_DATASYNC ends up in a helper.
  • Move IO_NODELOCKED | IO_RANGELOCKED style fix to D31505
sys/kern/vfs_vnops.c
1150–1151

Didn't previous version also handled O_DIRECT?

1152

I do not see why making the invocation of the helper more complicated. Move calculation of mp into it, as you see mp is cleared on the next line.

khng marked 2 inline comments as done.
  • Let vn_fspacectl check O_DIRECT as well
  • style

Move mp = into the helper.

get_sync_ioflag -> get_write_ioflag: Move IO_DIRECT checking into the helper.

share/man/man9/vn_deallocate.9
70

Just copy the definition from VOP_DEALLOCATE?

79–80
sys/kern/vfs_vnops.c
1150–1153

Why not handle FNONBLOCK in the helper too?

It is useful to extract get_write_ioflags() into separate commit. For instance, it can be merged to stable branches independently of other fspacectl changes.

sys/kern/vfs_vnops.c
930

() != 0

933

Same.

942

Same

khng marked 5 inline comments as done.

Dedicated commit for:

  • vfs: Add get_write_ioflag handler to calculate ioflag
  • Styles
khng marked an inline comment as done.Aug 11 2021, 3:03 PM

I asked for a commit that _only_ introduces get_write_ioflag() and replaces existing place(s) with it. Addition of flags anywhere is clearly a different change.

  • Separate get_write_ioflag commit (This currently calculates IO_DIRECT/IO_SYNC/IO_DATASYNC). I do not introduce IO_NDELAY calculation because it is clearly not going to be used by vn_fspacectl yet even it is harmless to just let it passthrough for now.
This revision is now accepted and ready to land.Aug 12 2021, 12:44 PM
This revision was automatically updated to reflect the committed changes.