Commit e0dfaeb
btrfs: skip clearing EXTENT_DEFRAG for NOCOW ordered extents
In btrfs_finish_one_ordered(), clear_bits is unconditionally initialized
with EXTENT_DEFRAG. For NOCOW ordered extents this is always a no-op
because should_nocow() already forces the COW path when EXTENT_DEFRAG is
set, so a NOCOW ordered extent can never have EXTENT_DEFRAG on its range.
Although harmless, the unconditional btrfs_clear_extent_bit() call still
performs a cold rbtree lookup under the io tree spinlock on every NOCOW
write completion. Avoid this by only adding EXTENT_DEFRAG to clear_bits
for non-NOCOW ordered extents, and skip the call entirely when there are
no bits to clear.
Signed-off-by: Dave Chen <davechen@synology.com>
Signed-off-by: Robbie Ko <robbieko@synology.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>1 parent e70e3f8 commit e0dfaeb
1 file changed
Lines changed: 7 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3197 | 3197 | | |
3198 | 3198 | | |
3199 | 3199 | | |
3200 | | - | |
| 3200 | + | |
3201 | 3201 | | |
3202 | 3202 | | |
3203 | 3203 | | |
| |||
3208 | 3208 | | |
3209 | 3209 | | |
3210 | 3210 | | |
| 3211 | + | |
| 3212 | + | |
| 3213 | + | |
3211 | 3214 | | |
3212 | 3215 | | |
3213 | 3216 | | |
| |||
3339 | 3342 | | |
3340 | 3343 | | |
3341 | 3344 | | |
3342 | | - | |
3343 | | - | |
| 3345 | + | |
| 3346 | + | |
| 3347 | + | |
3344 | 3348 | | |
3345 | 3349 | | |
3346 | 3350 | | |
| |||
0 commit comments