forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitbfb9dfd
committed
Expand the use of get_dirent_type(), shaving a few calls to stat()/lstat()
Several backend-side loops scanning one or more directories withReadDir() (WAL segment recycle/removal in xlog.c, backend-side directorycopy, temporary file removal, configuration file parsing, some logicaldecoding logic and some pgtz stuff) already know the type of the entrybeing scanned thanks to the dirent structure associated to the entry, onplatforms where we know about DT_REG, DT_DIR and DT_LNK to make thedifference between a regular file, a directory and a symbolic link.Relying on the direct structure of an entry saves a few system calls tostat() and lstat() in the loops updated here, shaving some code while onit. The logic of the code remains the same, calling stat() or lstat()depending on if it is necessary to look through symlinks.Authors: Nathan Bossart, Bharath RupireddyReviewed-by: Andres Freund, Thomas Munro, Michael PaquierDiscussion:https://postgr.es/m/CALj2ACV8n-J-f=yiLUOx2=HrQGPSOZM3nWzyQQvLPcccPXxEdg@mail.gmail.com1 parent11e5f99 commitbfb9dfd
File tree
8 files changed
+53
-75
lines changed- src
- backend
- access
- heap
- transam
- replication
- logical
- storage/file
- utils/misc
- timezone
8 files changed
+53
-75
lines changedLines changed: 5 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
113 | 113 |
| |
114 | 114 |
| |
115 | 115 |
| |
| 116 | + | |
116 | 117 |
| |
117 | 118 |
| |
118 | 119 |
| |
| |||
1213 | 1214 |
| |
1214 | 1215 |
| |
1215 | 1216 |
| |
1216 |
| - | |
1217 | 1217 |
| |
1218 | 1218 |
| |
1219 | 1219 |
| |
1220 | 1220 |
| |
1221 | 1221 |
| |
1222 | 1222 |
| |
1223 | 1223 |
| |
| 1224 | + | |
1224 | 1225 |
| |
1225 | 1226 |
| |
1226 | 1227 |
| |
1227 | 1228 |
| |
1228 | 1229 |
| |
1229 | 1230 |
| |
1230 |
| - | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
1231 | 1234 |
| |
1232 | 1235 |
| |
1233 | 1236 |
| |
|
Lines changed: 13 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
657 | 657 |
| |
658 | 658 |
| |
659 | 659 |
| |
660 |
| - | |
661 |
| - | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
662 | 663 |
| |
663 | 664 |
| |
664 | 665 |
| |
| |||
3596 | 3597 |
| |
3597 | 3598 |
| |
3598 | 3599 |
| |
3599 |
| - | |
3600 |
| - | |
| 3600 | + | |
3601 | 3601 |
| |
3602 | 3602 |
| |
3603 | 3603 |
| |
| |||
3669 | 3669 |
| |
3670 | 3670 |
| |
3671 | 3671 |
| |
3672 |
| - | |
3673 |
| - | |
| 3672 | + | |
3674 | 3673 |
| |
3675 | 3674 |
| |
3676 | 3675 |
| |
| |||
3680 | 3679 |
| |
3681 | 3680 |
| |
3682 | 3681 |
| |
3683 |
| - | |
3684 |
| - | |
3685 |
| - | |
| 3682 | + | |
| 3683 | + | |
| 3684 | + | |
3686 | 3685 |
| |
3687 | 3686 |
| |
3688 | 3687 |
| |
| |||
3691 | 3690 |
| |
3692 | 3691 |
| |
3693 | 3692 |
| |
3694 |
| - | |
3695 |
| - | |
| 3693 | + | |
| 3694 | + | |
| 3695 | + | |
3696 | 3696 |
| |
3697 | 3697 |
| |
3698 | 3698 |
| |
3699 | 3699 |
| |
3700 | 3700 |
| |
3701 |
| - | |
| 3701 | + | |
3702 | 3702 |
| |
3703 | 3703 |
| |
3704 | 3704 |
| |
| |||
3710 | 3710 |
| |
3711 | 3711 |
| |
3712 | 3712 |
| |
3713 |
| - | |
| 3713 | + | |
3714 | 3714 |
| |
3715 | 3715 |
| |
3716 | 3716 |
| |
|
Lines changed: 4 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
123 | 123 |
| |
124 | 124 |
| |
125 | 125 |
| |
| 126 | + | |
126 | 127 |
| |
127 | 128 |
| |
128 | 129 |
| |
| |||
2061 | 2062 |
| |
2062 | 2063 |
| |
2063 | 2064 |
| |
2064 |
| - | |
| 2065 | + | |
2065 | 2066 |
| |
2066 | 2067 |
| |
2067 | 2068 |
| |
2068 | 2069 |
| |
2069 | 2070 |
| |
2070 | 2071 |
| |
| 2072 | + | |
2071 | 2073 |
| |
2072 |
| - | |
| 2074 | + | |
2073 | 2075 |
| |
2074 | 2076 |
| |
2075 | 2077 |
| |
|
Lines changed: 4 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
41 | 41 |
| |
42 | 42 |
| |
43 | 43 |
| |
| 44 | + | |
44 | 45 |
| |
45 | 46 |
| |
46 | 47 |
| |
| |||
1442 | 1443 |
| |
1443 | 1444 |
| |
1444 | 1445 |
| |
1445 |
| - | |
1446 | 1446 |
| |
| 1447 | + | |
1447 | 1448 |
| |
1448 | 1449 |
| |
1449 | 1450 |
| |
1450 | 1451 |
| |
1451 | 1452 |
| |
1452 | 1453 |
| |
| 1454 | + | |
1453 | 1455 |
| |
1454 | 1456 |
| |
1455 |
| - | |
| 1457 | + | |
1456 | 1458 |
| |
1457 | 1459 |
| |
1458 | 1460 |
| |
|
Lines changed: 6 additions & 15 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
22 | 22 |
| |
23 | 23 |
| |
24 | 24 |
| |
| 25 | + | |
25 | 26 |
| |
26 | 27 |
| |
27 | 28 |
| |
| |||
50 | 51 |
| |
51 | 52 |
| |
52 | 53 |
| |
53 |
| - | |
| 54 | + | |
54 | 55 |
| |
55 | 56 |
| |
56 | 57 |
| |
| |||
62 | 63 |
| |
63 | 64 |
| |
64 | 65 |
| |
65 |
| - | |
66 |
| - | |
67 |
| - | |
68 |
| - | |
| 66 | + | |
69 | 67 |
| |
70 |
| - | |
| 68 | + | |
71 | 69 |
| |
72 | 70 |
| |
73 | 71 |
| |
74 | 72 |
| |
75 | 73 |
| |
76 |
| - | |
| 74 | + | |
77 | 75 |
| |
78 | 76 |
| |
79 | 77 |
| |
| |||
89 | 87 |
| |
90 | 88 |
| |
91 | 89 |
| |
92 |
| - | |
93 |
| - | |
94 | 90 |
| |
95 | 91 |
| |
96 | 92 |
| |
| |||
101 | 97 |
| |
102 | 98 |
| |
103 | 99 |
| |
104 |
| - | |
105 |
| - | |
106 |
| - | |
107 |
| - | |
108 |
| - | |
109 |
| - | |
| 100 | + | |
110 | 101 |
| |
111 | 102 |
| |
112 | 103 |
| |
|
Lines changed: 3 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3156 | 3156 |
| |
3157 | 3157 |
| |
3158 | 3158 |
| |
3159 |
| - | |
| 3159 | + | |
3160 | 3160 |
| |
3161 |
| - | |
3162 |
| - | |
3163 |
| - | |
3164 |
| - | |
3165 |
| - | |
| 3161 | + | |
3166 | 3162 |
| |
3167 |
| - | |
3168 |
| - | |
3169 |
| - | |
| 3163 | + | |
3170 | 3164 |
| |
3171 | 3165 |
| |
3172 | 3166 |
| |
|
Lines changed: 16 additions & 26 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
| 17 | + | |
17 | 18 |
| |
18 | 19 |
| |
19 | 20 |
| |
| |||
1017 | 1018 |
| |
1018 | 1019 |
| |
1019 | 1020 |
| |
1020 |
| - | |
| 1021 | + | |
1021 | 1022 |
| |
1022 | 1023 |
| |
1023 | 1024 |
| |
| |||
1034 | 1035 |
| |
1035 | 1036 |
| |
1036 | 1037 |
| |
1037 |
| - | |
| 1038 | + | |
| 1039 | + | |
1038 | 1040 |
| |
1039 |
| - | |
1040 |
| - | |
1041 |
| - | |
1042 |
| - | |
1043 |
| - | |
1044 |
| - | |
1045 |
| - | |
1046 |
| - | |
1047 |
| - | |
1048 |
| - | |
1049 |
| - | |
1050 |
| - | |
1051 |
| - | |
1052 |
| - | |
1053 |
| - | |
1054 |
| - | |
1055 |
| - | |
1056 |
| - | |
1057 |
| - | |
1058 |
| - | |
1059 |
| - | |
1060 |
| - | |
1061 |
| - | |
1062 |
| - | |
1063 | 1041 |
| |
1064 | 1042 |
| |
1065 | 1043 |
| |
1066 | 1044 |
| |
1067 | 1045 |
| |
1068 | 1046 |
| |
1069 | 1047 |
| |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
1070 | 1060 |
| |
1071 | 1061 |
| |
1072 | 1062 |
| |
|
Lines changed: 2 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
17 | 17 |
| |
18 | 18 |
| |
19 | 19 |
| |
| 20 | + | |
20 | 21 |
| |
21 | 22 |
| |
22 | 23 |
| |
| |||
429 | 430 |
| |
430 | 431 |
| |
431 | 432 |
| |
432 |
| - | |
433 | 433 |
| |
434 | 434 |
| |
435 | 435 |
| |
| |||
447 | 447 |
| |
448 | 448 |
| |
449 | 449 |
| |
450 |
| - | |
451 |
| - | |
452 |
| - | |
453 |
| - | |
454 | 450 |
| |
455 |
| - | |
| 451 | + | |
456 | 452 |
| |
457 | 453 |
| |
458 | 454 |
| |
|
0 commit comments
Comments
(0)