pgsql: Expand the use of get_dirent_type(), shaving a few calls to stat
От | Michael Paquier |
---|---|
Тема | pgsql: Expand the use of get_dirent_type(), shaving a few calls to stat |
Дата | |
Msg-id | E1oU1ZP-0013Vp-VV@gemulon.postgresql.org обсуждение исходный текст |
Список | pgsql-committers |
Expand the use of get_dirent_type(), shaving a few calls to stat()/lstat() Several backend-side loops scanning one or more directories with ReadDir() (WAL segment recycle/removal in xlog.c, backend-side directory copy, temporary file removal, configuration file parsing, some logical decoding logic and some pgtz stuff) already know the type of the entry being scanned thanks to the dirent structure associated to the entry, on platforms where we know about DT_REG, DT_DIR and DT_LNK to make the difference between a regular file, a directory and a symbolic link. Relying on the direct structure of an entry saves a few system calls to stat() and lstat() in the loops updated here, shaving some code while on it. 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 Rupireddy Reviewed-by: Andres Freund, Thomas Munro, Michael Paquier Discussion: https://postgr.es/m/CALj2ACV8n-J-f=yiLUOx2=HrQGPSOZM3nWzyQQvLPcccPXxEdg@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/bfb9dfd93720098cf8f3e7d802df9b02ebe3dc20 Modified Files -------------- src/backend/access/heap/rewriteheap.c | 7 +++-- src/backend/access/transam/xlog.c | 26 +++++++++--------- src/backend/replication/logical/snapbuild.c | 6 +++-- src/backend/replication/slot.c | 6 +++-- src/backend/storage/file/copydir.c | 21 +++++---------- src/backend/storage/file/fd.c | 12 +++------ src/backend/utils/misc/guc-file.l | 42 +++++++++++------------------ src/timezone/pgtz.c | 8 ++---- 8 files changed, 53 insertions(+), 75 deletions(-)
В списке pgsql-committers по дате отправления: