android_kernel_xiaomi_sm8350/fs/ext4
Theodore Ts'o 210ad6aedb ext4: avoid unnecessary spinlock in critical POSIX ACL path
If a filesystem supports POSIX ACL's, the VFS layer expects the filesystem
to do POSIX ACL checks on any files not owned by the caller, and it does
this for every single pathname component that it looks up.

That obviously can be pretty expensive if the filesystem isn't careful
about it, especially with locking. That's doubly sad, since the common
case tends to be that there are no ACL's associated with the files in
question.

ext4 already caches the ACL data so that it doesn't have to look it up
over and over again, but it does so by taking the inode->i_lock spinlock
on every lookup. Which is a noticeable overhead even if it's a private
lock, especially on CPU's where the serialization is expensive (eg Intel
Netburst aka 'P4').

For the special case of not actually having any ACL's, all that locking is
unnecessary. Even if somebody else were to be changing the ACL's on
another CPU, we simply don't care - if we've seen a NULL ACL, we might as
well use it.

So just load the ACL speculatively without any locking, and if it was
NULL, just use it. If it's non-NULL (either because we had a cached
entry, or because the cache hasn't been filled in at all), it means that
we'll need to get the lock and re-load it properly.

(This commit was ported from a patch originally authored by Linus for
ext3.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2009-06-17 00:36:35 -04:00
..
acl.c ext4: avoid unnecessary spinlock in critical POSIX ACL path 2009-06-17 00:36:35 -04:00
acl.h
balloc.c ext4: Convert ext4_lock_group to use sb_bgl_lock 2009-05-02 20:35:09 -04:00
bitmap.c
block_validity.c ext4: Add a comprehensive block validity check to ext4_get_blocks() 2009-05-17 15:38:01 -04:00
dir.c ext4: Define a new set of flags for ext4_get_blocks() 2009-05-14 00:58:52 -04:00
ext4_extents.h ext4: Validate extent details only when read from the disk 2009-03-27 16:39:58 -04:00
ext4_jbd2.c
ext4_jbd2.h
ext4.h ext4: Get rid of EXTEND_DISKSIZE flag of ext4_get_blocks_handle() 2009-06-09 00:17:05 -04:00
extents.c ext4: Avoid corrupting the uninitialized bit in the extent during truncate 2009-06-10 14:22:55 -04:00
file.c ext4: Fix discard of inode prealloc space with delayed allocation. 2009-03-27 22:36:43 -04:00
fsync.c
hash.c
ialloc.c ext4: Clean up calls to ext4_get_group_desc() 2009-05-25 11:50:39 -04:00
inode.c ext4: Don't treat a truncation of a zero-length file as replace-via-truncate 2009-06-09 09:54:40 -04:00
ioctl.c ext4: add EXT4_IOC_ALLOC_DA_BLKS ioctl 2009-02-26 01:04:07 -05:00
Kconfig trivial: fix typos/grammar errors in Kconfig texts 2009-03-30 15:22:01 +02:00
Makefile ext4: Add a comprehensive block validity check to ext4_get_blocks() 2009-05-17 15:38:01 -04:00
mballoc.c ext4: Add a comprehensive block validity check to ext4_get_blocks() 2009-05-17 15:38:01 -04:00
mballoc.h ext4: Move fs/ext4/group.h into ext4.h 2009-05-01 19:44:44 -04:00
migrate.c ext4: Fix NULL dereference in ext4_ext_migrate()'s error handling 2009-02-15 20:02:19 -05:00
namei.c ext4: fix dx_map_entry to support 256k directory blocks 2009-06-08 12:41:35 -04:00
resize.c ext4: Move fs/ext4/group.h into ext4.h 2009-05-01 19:44:44 -04:00
super.c Push BKL down into ->remount_fs() 2009-06-11 21:36:11 -04:00
symlink.c
xattr_security.c
xattr_trusted.c
xattr_user.c
xattr.c ext4: Use lowercase names of quota functions 2009-03-26 02:18:36 +01:00
xattr.h