Commit 9e82d3e
btrfs: use a regular rb_root instead of cached rb_root for extent_map_tree
We are currently using a cached rb_root (struct rb_root_cached) for the
rb root of struct extent_map_tree. This doesn't offer much of an advantage
here because:
1) It's only advantage over the regular rb_root is that it caches a
pointer to the left most node (first node), so a call to
rb_first_cached() doesn't have to chase pointers until it reaches
the left most node;
2) We only have two scenarios that access left most node with
rb_first_cached():
When dropping all extent maps from an inode, during inode eviction;
When iterating over extent maps during the extent map shrinker;
3) In both cases we keep removing extent maps, which causes deletion of
the left most node so rb_erase_cached() has to call rb_next() to find
out what's the next left most node and assign it to
struct rb_root_cached::rb_leftmost;
4) We can do that ourselves in those two uses cases and stop using a
rb_root_cached rb tree and use instead a regular rb_root rb tree.
This reduces the size of struct extent_map_tree by 8 bytes and, since
this structure is embedded in struct btrfs_inode, it also reduces the
size of that structure by 8 bytes.
So on a 64 bits platform the size of btrfs_inode is reduced from 1032
bytes down to 1024 bytes.
This means we will be able to have 4 inodes per 4K page instead of 3.
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>1 parent 6a2996c commit 9e82d3e
3 files changed
+30
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
96 | 95 | | |
97 | 96 | | |
98 | 97 | | |
99 | 98 | | |
100 | 99 | | |
101 | | - | |
| 100 | + | |
102 | 101 | | |
103 | | - | |
| 102 | + | |
104 | 103 | | |
105 | | - | |
106 | | - | |
| 104 | + | |
107 | 105 | | |
108 | | - | |
109 | 106 | | |
110 | 107 | | |
111 | 108 | | |
| |||
128 | 125 | | |
129 | 126 | | |
130 | 127 | | |
131 | | - | |
| 128 | + | |
132 | 129 | | |
133 | 130 | | |
134 | 131 | | |
| |||
265 | 262 | | |
266 | 263 | | |
267 | 264 | | |
268 | | - | |
| 265 | + | |
269 | 266 | | |
270 | 267 | | |
271 | 268 | | |
| |||
278 | 275 | | |
279 | 276 | | |
280 | 277 | | |
281 | | - | |
| 278 | + | |
282 | 279 | | |
283 | 280 | | |
284 | 281 | | |
| |||
410 | 407 | | |
411 | 408 | | |
412 | 409 | | |
413 | | - | |
| 410 | + | |
414 | 411 | | |
415 | 412 | | |
416 | 413 | | |
| |||
479 | 476 | | |
480 | 477 | | |
481 | 478 | | |
482 | | - | |
| 479 | + | |
483 | 480 | | |
484 | 481 | | |
485 | 482 | | |
| |||
500 | 497 | | |
501 | 498 | | |
502 | 499 | | |
503 | | - | |
| 500 | + | |
504 | 501 | | |
505 | 502 | | |
506 | 503 | | |
| |||
657 | 654 | | |
658 | 655 | | |
659 | 656 | | |
| 657 | + | |
660 | 658 | | |
661 | 659 | | |
662 | | - | |
| 660 | + | |
| 661 | + | |
663 | 662 | | |
664 | | - | |
| 663 | + | |
665 | 664 | | |
666 | | - | |
667 | 665 | | |
668 | 666 | | |
669 | 667 | | |
670 | 668 | | |
671 | | - | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
672 | 674 | | |
673 | 675 | | |
674 | 676 | | |
| |||
1058 | 1060 | | |
1059 | 1061 | | |
1060 | 1062 | | |
1061 | | - | |
| 1063 | + | |
1062 | 1064 | | |
| 1065 | + | |
1063 | 1066 | | |
1064 | 1067 | | |
1065 | 1068 | | |
1066 | | - | |
1067 | 1069 | | |
1068 | 1070 | | |
1069 | 1071 | | |
| |||
1094 | 1096 | | |
1095 | 1097 | | |
1096 | 1098 | | |
1097 | | - | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
1098 | 1102 | | |
1099 | 1103 | | |
1100 | 1104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
| 22 | + | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
551 | 551 | | |
552 | 552 | | |
553 | 553 | | |
554 | | - | |
| 554 | + | |
555 | 555 | | |
556 | 556 | | |
557 | 557 | | |
| |||
0 commit comments