mbox series

[0/3] use compounding to speed up readdir()

Message ID 20191204225410.17514-1-lsahlber@redhat.com
Headers show
Series use compounding to speed up readdir() | expand

Message

Ronnie Sahlberg Dec. 4, 2019, 10:54 p.m. UTC
Steve, List

This three patches are the first step in using compounding to speed up
readdir() which currently takes a minimum of 4 roundtrips for any non-empty
directory.
With these patches we reduce one roundtrip and we can list a directory
in just 3, instead of 4, roundtrips which will benefit use-cases where
latency to the server is high.

I.e. this changes the sequence of operations for a small directory from
1, Open
2, Query and get data
3, Query loop until we get STATUS_NO_MORE_FILES
4, Close

To be the slightly better
1, Open + Query and get data
2, Query and get STATUS_NO_MORE_FILES
3, Close


In later patches we can do even better and drive this down to just 2 roundtrips
for a small nonempty directory by using
1, Open + Query + Query
2, Close
for the case where we get STATUS_NO_MORE_FILES for the second Query.
And bring it down to just two roundtrips.

That is probably the best we can do for Windows based servers since without
support for the SMB2_INDEX_SPECIFIED flag in the QueryDirectory request
we can not put the Close() as part of the compound.


IF we had SMB2_INDEX_SPECIFIED support on some server (Azure?) and IF we
had a way to reliably detect if the server supports this flag or not then
we could change the sequence to be
Open + Query + Query + Close
and if the second Query returned STATUS_NO_MORE_FILES we would have finished thereaddir() in a single roundtrip.
If the directory is large and the second query did not return this error then
we could just continue and use this compound instead to loop until we get to the end :
Open() + Query(SMB2_INDEX_SPECIFIED, Index) + Close()


regards
Ronnie Sahlberg