diff options
author | David Sterba <dsterba@suse.com> | 2019-10-10 23:31:19 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2019-11-18 17:51:50 +0100 |
commit | 40d38f53d476238594c24c677593913695e6dec7 (patch) | |
tree | 3042c9176b8e9f2d085e71964b47647053b91da1 /lib | |
parent | btrfs: merge blocking_writers branches in btrfs_tree_read_lock (diff) | |
download | linux-40d38f53d476238594c24c677593913695e6dec7.tar.xz linux-40d38f53d476238594c24c677593913695e6dec7.zip |
btrfs: set blocking_writers directly, no increment or decrement
The increment and decrement was inherited from previous version that
used atomics, switched in commit 06297d8cefca ("btrfs: switch
extent_buffer blocking_writers from atomic to int"). The only possible
values are 0 and 1 so we can set them directly.
The generated assembly (gcc 9.x) did the direct value assignment in
btrfs_set_lock_blocking_write (asm diff after change in 06297d8cefca):
5d: test %eax,%eax
5f: je 62 <btrfs_set_lock_blocking_write+0x22>
61: retq
- 62: lock incl 0x44(%rdi)
- 66: add $0x50,%rdi
- 6a: jmpq 6f <btrfs_set_lock_blocking_write+0x2f>
+ 62: movl $0x1,0x44(%rdi)
+ 69: add $0x50,%rdi
+ 6d: jmpq 72 <btrfs_set_lock_blocking_write+0x32>
The part in btrfs_tree_unlock did a decrement because
BUG_ON(blockers > 1) is probably not a strong hint for the compiler, but
otherwise the output looks safe:
- lock decl 0x44(%rdi)
+ sub $0x1,%eax
+ mov %eax,0x44(%rdi)
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions