History log of /fuchsia/zircon/system/utest/fs-vnode/pseudo-dir-tests.cpp
Revision Date Author Comments
# 007799dd 18-Sep-2018 Ankur Mittal <anmittal@google.com>

[fs] Fix PseudoDir readdir

Readdir was returning ZX_ERR_* when there were more entries than supplied
buffer. Change it to ZX_OK as it is not a error to have pagination.

TEST=fs-vnode-test

Change-Id: Ifcb24578b3fccd69f513eb6b90289c1c27117435


# 7f36f25d 23-Aug-2018 Sean Klein <smklein@google.com>

[fdio][fidl] Use unaligned dirents for readdir, add ino

Test: fs-tests
ZX-2502 #done

Change-Id: I93e932a629f25c7da9f9a1a06e022d907ada47ed


# 47c23a87 17-Jul-2018 Christopher R. Johnson <crjohns@google.com>

[fs] Optimize PseudoDir using a WAVL tree.

PseudoDir stores directory entries in a linked list. Insertions to the
list are O(1), but locating an element by name (for opening or removal)
is O(n). Additionally, Readdir may need to checkpoint its progress and
continue, but it must start from the beginning of the list each time. In
the worst case this is O(n^2).

This change replaces the storage for PseudoDir with two WAVL trees, one
sorted by name and the other by ID. Insertions/Lookups/Removals are now
O(lg n). Readdir may still need to restart O(n) times, so Readdir is now
O(n lg n).

This changed the benchmarks as follows:

PseudoDir/Create 33.24%
PseudoDir/RemoveAdd/1 38.44%
PseudoDir/RemoveAdd/8 114.99%
PseudoDir/RemoveAdd/64 11.94%
PseudoDir/RemoveAdd/512 -75.92%
PseudoDir/RemoveAdd/4k -95.53%
PseudoDir/RemoveAdd/16k -98.76%
PseudoDir/Readdir/1/1024 2.87%
PseudoDir/Readdir/8/1024 -4.76%
PseudoDir/Readdir/64/1024 -72.69%
PseudoDir/Readdir/512/1024 -95.63%
PseudoDir/Readdir/4k/1024 -99.66%
PseudoDir/Readdir/16k/1024 -99.87%
PseudoDir/Readdir/1/4k 2.97%
PseudoDir/Readdir/8/4k -5.73%
PseudoDir/Readdir/64/4k -72.71%
PseudoDir/Readdir/512/4k -95.60%
PseudoDir/Readdir/4k/4k -99.67%
PseudoDir/Readdir/16k/4k -99.92%
PseudoDir/Readdir/1/32k 6.65%
PseudoDir/Readdir/8/32k -5.22%
PseudoDir/Readdir/64/32k -72.60%
PseudoDir/Readdir/512/32k -95.56%
PseudoDir/Readdir/4k/32k -99.65%
PseudoDir/Readdir/16k/32k -99.88%
PseudoDir/Readdir/1/64k 2.12%
PseudoDir/Readdir/8/64k -5.35%
PseudoDir/Readdir/64/64k -72.47%
PseudoDir/Readdir/512/64k -95.53%
PseudoDir/Readdir/4k/64k -99.66%
PseudoDir/Readdir/16k/64k -99.87%

The additional overhead outweighs the gains for only tens of entries for
removal and addition. For hundreds or thousands of entries, the
optimized version is far better.

This has a small overhead for small Readdir executions, but it rapidly
outperforms the original implementation on larger directories.

See the bug for detailed benchmark run information.

TEST=zircon$ runtests -t fs-vnode-test; fuchsia$ run zircon_benchmarks \
--benchmark_filter=Pseudo

ZX-2374: #done

Change-Id: I0e41c560e50ac7cf50d6fd9aaddf0d2d20306b04


# 0829806d 01-Mar-2018 Mark Seaborn <mseaborn@google.com>

[unittest] Remove 'length' argument from EXPECT_STR_EQ()/ASSERT_STR_EQ()

The 'length' argument is redundant now that these two functions always
compare the whole strings.

I updated the call sites using an automated tool.

I've removed the now-unneeded EXPECT_STRING_EQ() wrapper in
syslog_socket_tests.cpp.

Change-Id: I80fff5c5ccdc44337125bc2b2d3386fc6606f1dc


# 20460b5f 06-Nov-2017 Sean Klein <smklein@google.com>

[fs] Use the Fuchsia-defined open flags

Re-lands 2aff2cba029cf0f7e98e6d19f6dc7a663c318227

This change uses the Fuchsia-defined flags on the wire
as well as on filesystem servers. Clients interacting
with filesystems through the POSIX compatibility layer
can continue using POSIX open flags; they will be translated
by the RIO layers client-side.

ZX-1359 #comment In Progress

Change-Id: I4972c024547a0daa2146831e49e34d3ef905d4b4


# c830a868 14-Nov-2017 Sean Klein <smklein@google.com>

Revert "[fs] Use the Fuchsia-defined open flags"

This reverts commit 2aff2cba029cf0f7e98e6d19f6dc7a663c318227.

Reason for revert: Fuchsia uses upstream Rust, which doesn't pull these constants from our C library, but their own. I'll need to wait a few days for us to update upstream Rust before we can make progress here.

Original change's description:
> [fs] Use the Fuchsia-defined open flags
>
> This change uses the Fuchsia-defined flags on the wire
> as well as on filesystem servers. Clients interacting
> with filesystems through the POSIX compatibility layer
> can continue using POSIX open flags; they will be translated
> by the RIO layers client-side.
>
> ZX-1359 #comment In Progress
>
> Change-Id: I27dfdea2024183d5d59daa1ed7d8886d89d503d0

TBR=kulakowski@google.com,smklein@google.com,swetland@google.com,mcgrathr@google.com,planders@google.com

Change-Id: If93c2da36f92ea28ed013a61c01c6ec521da26cc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true


# 2aff2cba 06-Nov-2017 Sean Klein <smklein@google.com>

[fs] Use the Fuchsia-defined open flags

This change uses the Fuchsia-defined flags on the wire
as well as on filesystem servers. Clients interacting
with filesystems through the POSIX compatibility layer
can continue using POSIX open flags; they will be translated
by the RIO layers client-side.

ZX-1359 #comment In Progress

Change-Id: I27dfdea2024183d5d59daa1ed7d8886d89d503d0


# ac5047b6 16-Oct-2017 Sean Klein <smklein@google.com>

[fs] Use O_PATH for helper Vnodes that may not be readable

Additionally, convert tests to ValidateFlags (rather than open)
and convert vmo-file to do validation during "ValidateFlags",
rather than Open.

ZX-1151 #done

Change-Id: Ia14bca75df1c5d03ba348133ec15bfbb532c13ea


# c0ffb134 15-Oct-2017 Sean Klein <smklein@google.com>

[fs] Make readdir return actual size as output parameter

One of many commits trying to reduce the overloaded use of
"zx_status_t".

ZX-1189 #done

Change-Id: I8b393b2d5440abfc7646223cab9f9c94115538a4


# 34eacd46 28-Jul-2017 Jeff Brown <jeffbrown@google.com>

[libfs] Define pseudo-dir and pseudo-file vnode types.

Pseudo-dir is appropriate for publishing directories with a small
number of nodes which the client cannot modify.

Pseudo-file is appropriate for publishing dynamic properties.
It is available in buffered and unbuffered flavors.

Change-Id: I11d927c3d7d50ccc725a91377aaacfc1209dce1b