Re: fstat vs. lseek

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: fstat vs. lseek
Date: 2011-08-08 14:49:01
Message-ID: 16623238.t9h9Udve74@alap2
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2011-08-08 15:02:26 Re: WIP fix proposal for bug #6123
Previous Message Tom Lane 2011-08-08 14:45:22 Re: fstat vs. lseek