LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-17-2008, 06:09 PM   #1
jef_te
LQ Newbie
 
Registered: Apr 2008
Posts: 1

Rep: Reputation: 0
Quickly retrieve a file from its file system / inode


Hi there.

I worked with UNIX and Linux for the last 23 years. So I'm used to work in CHUI mode.
Actually I'm searching a quick way to retrieve and use a file, knowing only its inode and its file system.
I know I can use find, but the mean time is horribly slow. I need something more efficient.
The matter is, I'm working on a multi-dimensional modeling tool, with millions of informations and complex indexing.

I cannot imagine there is no simple way to get a file from its inode.

Thanks.

Jef
 
Old 04-17-2008, 07:50 PM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Why don't you structure your filesystem so that you don't have millions of files in a directory? For example, having each object contained in it's own subdirectory. Filesystems usually employ hashing on the filename to speed up lookups but you are pushing that.

There are some embedded devices that use sqllite in lieu of a filesystem. This might be useful as you would control what you use as an index which could have a relationship to how the data is indexed in your application.

The inode number is given on the filesystem along with the directory entry. The filename is looked up to reveal the inode number, and then the inode structure itself is looked up. The fopen() and lopen() functions use the pathname while the open() function uses the file description (as in 0 for stdin, 1 for stdout, 2 for stderr) which means the the file was already open. So at one point or another the inode number was first located by looking up the pathname.

Also keep in mind that there are different filesystems which can be structured differently. Accessing the inode structures themselves would be performed by the kernel in the filesystem module.

One thing to consider is to have the information contained in a file where you use your "complex" indexing to directly access the structure instead of using a directory lookup.
Another thing to consider is to create a subdirectory structure which reflects your indexing. The indexing could then determine which subdirectory to search in.

Last edited by jschiwal; 04-24-2008 at 03:05 AM. Reason: added info.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Hard drive file system problem, I think...please HELP QUICKLY rivalmist Fedora 7 01-23-2009 08:26 AM
File system inode hardware block PatrickNew Linux - General 2 08-24-2007 07:08 AM
Can you write a script to display file name, Inode, and size of any file? JaxsunApex Linux - Newbie 3 01-30-2007 08:39 AM
Create a script to display file name, Inode, and size of any file. Has to be a script JaxsunApex Linux - Newbie 7 01-29-2007 08:15 PM
How to repair File System Error - unattached inode 37138 ch.keller Linux - Software 1 07-21-2004 07:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration