Re: fstat vs. lseek

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: fstat vs. lseek
Дата
Msg-id 16623238.t9h9Udve74@alap2
обсуждение исходный текст
Ответ на fstat vs. lseek  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
On Monday, August 08, 2011 10:30:38 Robert Haas wrote:
> In response to my blog post on lseek contention, someone posted a
> comment wherein they proposed using fstat() rather than lseek() to get
> file sizes.
> 
> Thoughts?
I don't think its a good idea to replace lseek with fstat in the long run. The 
likelihood that the lockless generic_file_llseek will get included seems rather 
high to me. In contrast to that fstat will always be more expensive than that 
as its going through a security check and then the fs' getattr implementation 
(which actually takes a lock on some fs).
On the other hand its currently lockless if the security subsystem is compiled 
out (i.e. no selinux et al) for some common fs (ext3/4, xfs).

Andres


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: fstat vs. lseek
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: WIP fix proposal for bug #6123