Page MenuHomeFreeBSD

Add new cn_flags bits that indicate an Open for Reading and/or Writing
ClosedPublic

Authored by rmacklem on Aug 6 2021, 2:02 AM.
Tags
None
Referenced Files
Unknown Object (File)
May 16 2024, 6:55 PM
Unknown Object (File)
Feb 7 2024, 3:59 PM
Unknown Object (File)
Dec 23 2023, 11:03 AM
Unknown Object (File)
Dec 12 2023, 10:50 PM
Unknown Object (File)
Nov 29 2023, 11:40 PM
Unknown Object (File)
Nov 29 2023, 2:01 AM
Unknown Object (File)
Nov 29 2023, 12:02 AM
Unknown Object (File)
Nov 24 2023, 4:59 PM
Subscribers
None

Details

Summary

VOP_LOOKUP() is called with cn_flags bits ISLASTCN and ISOPEN
to indicate that the lookup is for the last component of a pathname
when doing open.

If the cn_flags also indicates if the open is for Reading, Writing or Both,
the NFSv4 client can do an NFSv4 Open operation in the same compound
RPC as Lookup, often avoiding the additional Open RPC now done when
VOP_OPEN() is called.

This patch defines two new cn_flags bits called OPENREAD and OPENWRITE
and sets these in open2nameif() based on FREAD, FWRITE flag bits.
This will allow a subsequent patch to the NFSv4 client to do the Open
operation in the same RPC as Lookup.

Test Plan

Has been tested along with the NFSv4 client patch that combines
Lookup and Open in the same RPC. Seems to work well against
both the FreeBSD and Linux NFSv4 servers.

For a kernel build over an NFSv4 mount, the number of Open
RPCs is reduced by approximately 15%.
(Most Opens are creating files during the build and cannot
be combined with Lookup, since the Lookup fails with ENOENT.)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

rmacklem created this revision.
kib added inline comments.
sys/sys/namei.h
187

s/reading/writing/

This revision is now accepted and ready to land.Aug 6 2021, 2:14 AM
rmacklem added inline comments.
sys/sys/namei.h
187

Good catch, thanks, rick