stat of i-node

Conor P. Cahill cpcahil at virtech.UUCP
Sun Sep 3 01:19:37 AEST 1989


In article <179 at bmers58.UUCP>, davem at bmers58.UUCP (Dave Mielke) writes:
> The problem with fstat is that it requires an open which also does a
> name lookup. This proves to be very slow when the directories get
> large. I need a way to get the information that stat would return
> without the expense of a name lookup. The i-node is the obvious key to
> the data, but I am unaware of any primitive that gives an application
> program direct access to the data via its actual key. I would
> appreciate any assistence that anyone can offer.

There is no system call primitive that gives you the capability to access a file
based upon it's inode number.  In fact one of the *true* blessings of UNIX is
it's concept of accessing everyting (including devices) through the same 
namespace. (Of course they broke this with the system V IPC implementations)


If your problem is that it is taking too long to search a really big
directory, you probably should change the software that is maintaining
that directory so that it uses some sub-directories.  I worked on a project
that had the same problem with mail message attachments.  These attachments
were put into a single attachment directory on the system.  Over time,
this directory would grow to have thousands of entries which caused
access time to be outragously high.  The solution was to change the 
software to use a series of sub-directories (100 of them) which resulted
in a significant performace gain.
message attachments 


-- 
+-----------------------------------------------------------------------+
| Conor P. Cahill     uunet!virtech!cpcahil      	703-430-9247	!
| Virtual Technologies Inc.,    P. O. Box 876,   Sterling, VA 22170     |
+-----------------------------------------------------------------------+



More information about the Comp.unix.wizards mailing list