bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] fts: introduce the FTS_NOLEAF flag


From: Kamil Dudka
Subject: Re: [PATCH 1/2] fts: introduce the FTS_NOLEAF flag
Date: Mon, 21 Dec 2015 14:44:32 +0100
User-agent: KMail/4.14.10 (Linux/4.2.7-300.fc23.x86_64; KDE/4.14.14; x86_64; ; )

On Thursday 10 December 2015 01:26:38 Pádraig Brady wrote:
> I also noticed a lot of fcntl calls on XFS
> (basically one per file), which I need to look further into:
>   $ strace -c find/find /usr/share >/dev/null
>   % time     seconds  usecs/call     calls    errors syscall
>   ------ ----------- ----------- --------- --------- ----------------
>    40.03    0.147809           1    151710           fcntl
>    17.62    0.065069           1     63154           close
>    14.52    0.053608           1     40071           newfstatat
>    13.15    0.048547           1     35400           getdents

In my testing, fcntl() was called 8x for each directory traversed.

It was mainly caused by the implementation of opendirat().  It calls 
set_cloexec_flag(), which calls fcntl() two times.  Then it calls
fdopendir(), which also calls fcntl() two times.  fts_build() also
calls set_cloexec_flag().  Then inside_dir() calls dup_cloexec(),
which is fcntl (fd, F_DUPFD_CLOEXEC, 0).

Perhaps some syscalls could be optimized out by using dup_cloexec()
also in fts_build()?

Kamil



reply via email to

[Prev in Thread] Current Thread [Next in Thread]