[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 0/3] ls: convert it to use statx() when available
From: |
Jeff Layton |
Subject: |
[PATCH 0/3] ls: convert it to use statx() when available |
Date: |
Wed, 11 Sep 2019 09:51:42 -0400 |
This patchset converts the ls command to use statx instead of stat when
available. This allows ls to indicate interest in only certain inode
metadata.
This is potentially a win on networked/clustered/distributed
filesystems. In cases where we'd have to do a full, heavyweight stat()
call we can now do a much lighter statx() call.
As a real-world example, consider a filesystem like CephFS where one
client is actively writing to a file and another client does an
ls --color in the same directory. --color means that we need to fetch
the mode of the file.
Doing that with a stat() call means that we have to fetch the size and
mtime in addition to the mode. The MDS in that situation will have to
revoke caps in order to ensure that it has up-to-date values to report,
which disrupts the writer.
This has a measurable affect on performance. I ran a fio sequential
write test on one client and had a second client do "ls --color" in a
tight loop on the directory that held the file:
Baseline -- no activity on the second client:
WRITE: bw=76.7MiB/s (80.4MB/s), 76.7MiB/s-76.7MiB/s (80.4MB/s-80.4MB/s),
io=4600MiB (4824MB), run=60016-60016msec
Without this patch series, we see a noticable performance hit:
WRITE: bw=70.4MiB/s (73.9MB/s), 70.4MiB/s-70.4MiB/s (73.9MB/s-73.9MB/s),
io=4228MiB (4433MB), run=60012-60012msec
With this patch series, we gain most of that ground back:
WRITE: bw=75.9MiB/s (79.6MB/s), 75.9MiB/s-75.9MiB/s (79.6MB/s-79.6MB/s),
io=4555MiB (4776MB), run=60019-60019msec
Jeff Layton (3):
stat: move struct statx to struct stat conversion routines to new
header
ls: use statx for loop detection if it's available
ls: add statx-enabled variants of stat and lstat calls
src/ls.c | 179 ++++++++++++++++++++++++++++++++++++++++++++--------
src/stat.c | 32 +---------
src/statx.h | 54 ++++++++++++++++
3 files changed, 208 insertions(+), 57 deletions(-)
create mode 100644 src/statx.h
--
2.21.0
- [PATCH 0/3] ls: convert it to use statx() when available,
Jeff Layton <=
[PATCH 3/3] ls: add statx-enabled variants of stat and lstat calls, Jeff Layton, 2019/09/11