Commit e48264e
btrfs: avoid unnecessary memory allocation and copy at overwrite_item()
There's no need to allocate memory and copy from both the destination and
source extent buffers to compare if the items are equal, we can instead
use memcmp_extent_buffer() which allows to do only one memory allocation
and copy instead of two.
So use memcmp_extent_buffer() instead of memcmp(), allowing us to avoid
one memory allocation, which can fail or be slow while under memory heavy
pressure, avoid the memory copying and reducing code.
Signed-off-by: Filipe Manana <[email protected]>
Reviewed-by: David Sterba <[email protected]>
Signed-off-by: David Sterba <[email protected]>1 parent 9db9c7d commit e48264e
1 file changed
+2
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
422 | 422 | | |
423 | 423 | | |
424 | 424 | | |
425 | | - | |
426 | 425 | | |
427 | 426 | | |
428 | 427 | | |
| |||
432 | 431 | | |
433 | 432 | | |
434 | 433 | | |
435 | | - | |
436 | 434 | | |
437 | | - | |
| 435 | + | |
438 | 436 | | |
439 | | - | |
440 | | - | |
441 | 437 | | |
442 | 438 | | |
443 | 439 | | |
444 | 440 | | |
445 | | - | |
446 | 441 | | |
447 | | - | |
448 | | - | |
449 | | - | |
| 442 | + | |
450 | 443 | | |
451 | | - | |
452 | 444 | | |
453 | 445 | | |
454 | 446 | | |
| |||
0 commit comments