coreutils
[Top][All Lists]
Advanced

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

Re: "ls -l": Avoid unnecessary getxattr() overhead


From: Sven Breuner
Subject: Re: "ls -l": Avoid unnecessary getxattr() overhead
Date: Sun, 19 Feb 2012 04:17:39 +0100
User-agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2

Jim Meyering wrote on 02/09/2012 03:17 PM:
> Here's that simpler patch:
> [...]

Jim Meyering wrote on 02/17/2012 01:11 PM:
Here's the updates series, along with this addition to NEWS:
[...]

Thanks for all this optimization work so far!

My "ls -l" test case with >60K files in a single directory is now down from about 50s to about 20s already. (When the problem below is solved, it should be down to about 10s).

Unfortunately, some getxattr selinux calls seem to be back with the current coreutils git version.
Those calls were gone after Jim's initial patch from 02/09/2012.

With only the patch from 02/09/2012 applied, strace showed this output for the first three files:

$ strace ~/tmp/ls_20120209 -l --color=always
[...]
lstat("file9", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
capget(0x20080522, 0, NULL)             = -1 EFAULT (Bad address)
getxattr("file9", "security.capability", 0x7fffffffda30, 20) = -1 EOPNOTSUPP (Operation not supported)
lgetxattr("file9", "security.selinux", "unlabeled", 255) = 10
getxattr("file9", "system.posix_acl_access", 0x0, 0) = -1 EOPNOTSUPP (Operation not supported)

lstat("file2", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
capget(0x20080522, 0, NULL)             = -1 EFAULT (Bad address)
getxattr("file2", "security.capability", 0x7fffffffda30, 20) = -1 EOPNOTSUPP (Operation not supported) getxattr("file2", "system.posix_acl_access", 0x0, 0) = -1 EOPNOTSUPP (Operation not supported)

lstat("file7", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
capget(0x20080522, 0, NULL)             = -1 EFAULT (Bad address)
getxattr("file7", "security.capability", 0x7fffffffda30, 20) = -1 EOPNOTSUPP (Operation not supported) getxattr("file7", "system.posix_acl_access", 0x0, 0) = -1 EOPNOTSUPP (Operation not supported)
[...]

=> selinux.security getxattr call for first file, but not for following files


Now with the current git version, strace shows this output for the first three files:

$ strace ~/git/coreutils/src/ls -l --color=always
[...]
lstat("file9", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
capget(0x20080522, 0, NULL)             = -1 EFAULT (Bad address)
getxattr("file9", "security.capability", 0x7fffffffda40, 20) = -1 EOPNOTSUPP (Operation not supported)
lgetxattr("file9", "security.selinux", "unlabeled", 255) = 10
getxattr("file9", "system.posix_acl_access", 0x0, 0) = -1 EOPNOTSUPP (Operation not supported)

lstat("file2", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
lgetxattr("file2", "security.selinux", "unlabeled", 255) = 10

lstat("file7", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
lgetxattr("file7", "security.selinux", "unlabeled", 255) = 10
[...]

=> selinux.security getxattr call for all files


Best regards,
Sven



reply via email to

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