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)
Sun, Oct 13, 7:13 PM
Unknown Object (File)
Sep 27 2024, 9:43 AM
Unknown Object (File)
Sep 23 2024, 11:37 AM
Unknown Object (File)
Sep 17 2024, 3:12 AM
Unknown Object (File)
Sep 16 2024, 4:18 AM
Unknown Object (File)
Sep 12 2024, 6:56 PM
Unknown Object (File)
Sep 6 2024, 12:30 PM
Unknown Object (File)
Sep 6 2024, 10:38 AM
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 Skipped
Unit
Tests Skipped

Event Timeline

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

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
180

Good catch, thanks, rick