Unix Technical Forum

Re: memory allocation during vfs_lookup

This is a discussion on Re: memory allocation during vfs_lookup within the mailing.openbsd.tech forums, part of the OpenBSD category; --> On 9/6/07, Scott Francis <darkuncle@gmail.com> wrote: > Here's the question: how does number of objects at various levels in ...


Go Back   Unix Technical Forum > Unix Operating Systems > OpenBSD > mailing.openbsd.tech

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-18-2008, 09:32 AM
Ted Unangst
 
Posts: n/a
Default Re: memory allocation during vfs_lookup

On 9/6/07, Scott Francis <darkuncle@gmail.com> wrote:
> Here's the question: how does number of objects at various levels in a
> directory structure affect memory allocation during object lookups?
> Say I'm doing a lookup on /foo/bar/baz/quux/file.jpg and /foo/bar/baz/
> contains 15000 objects (dirs and files). When I get to examining the
> contents of baz to find the quux entry, do I have to allocate memory
> sufficient to temporarily store the entire contents of baz, or do I go
> through the objects in some kind of serial order until I find the one
> I'm looking for? I'm pretty sure it's the former, since going through
> in any kind of serial order would be tremendously slow for large
> numbers of objects. Knowing the relationship between number of objects
> in the CWD and amount of memory required to hash those object names
> would be very useful.


lookup proceeds in various stages:
first, element by element, from the root, look up each directory. if
it's in the cache, bing done, move on to the next part. if it's not,
we go to the filesystem and do the lookup, then cache the result.

everything that gets looked up is cached, but we only cache the things
we look for (not the the things that get looked "at" (during the
filesystem lookup part).

for ufs, the filesystem code reads the inode, finds the datablocks,
and starts trawling through in a linear order until it finds what we
want and return it (to be cached). linear lookup can be slow, so for
very large directories, ufs keeps its own hash of all directory
entries. this was added later.

but this is only for ufs, which stores directory contents unsorted.
netapps could easily store directories in a tree structure, making
lookup fast without excessive caching.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:35 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com