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