Page MenuHomeFreeBSD

vfs: Add ioflag to VOP_DEALLOCATE(9)
ClosedPublic

Authored by khng on Aug 11 2021, 7:19 AM.

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
rG FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

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

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

3482

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

3561

!= 0

3562

!= 0

3570

() != 0

khng marked 5 inline comments as done.

Styles.

sys/kern/vfs_vnops.c
3571

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
1154–1155

Didn't previous version also handled O_DIRECT?

1155

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
1154–1157

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
933

() != 0

936

Same.

945

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.