public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Inode question
@ 2004-07-21 18:39 sankarshana rao
  2004-07-21 20:25 ` Dave Kleikamp
  0 siblings, 1 reply; 10+ messages in thread
From: sankarshana rao @ 2004-07-21 18:39 UTC (permalink / raw)
  To: linux-kernel

Hi,
I want to call namei() function in order to derive an
inode from a path name. Can I do this inside a kernel
module???
If yes, what object file should I link to in order to
get namei() definition??

pls advice...

Thx in advance
Sankarshana M

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Inode question
  2004-07-21 18:39 Inode question sankarshana rao
@ 2004-07-21 20:25 ` Dave Kleikamp
  2004-07-21 20:46   ` sankarshana rao
  0 siblings, 1 reply; 10+ messages in thread
From: Dave Kleikamp @ 2004-07-21 20:25 UTC (permalink / raw)
  To: sankarshana rao; +Cc: linux-kernel

On Wed, 2004-07-21 at 13:39, sankarshana rao wrote:
> Hi,
> I want to call namei() function in order to derive an
> inode from a path name. Can I do this inside a kernel
> module???

>From a kernel module, you should probably call path_lookup().

Shaggy
-- 
David Kleikamp
IBM Linux Technology Center


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Inode question
  2004-07-21 20:25 ` Dave Kleikamp
@ 2004-07-21 20:46   ` sankarshana rao
  2004-07-21 20:56     ` Dave Kleikamp
  2004-07-21 21:09     ` Richard B. Johnson
  0 siblings, 2 replies; 10+ messages in thread
From: sankarshana rao @ 2004-07-21 20:46 UTC (permalink / raw)
  To: Dave Kleikamp; +Cc: linux-kernel

Thx for the reply...
When I try to call lookup() from my kernel module, it
gives undefined symbol error during INSMOD..
any clues???

--- Dave Kleikamp <shaggy@austin.ibm.com> wrote:
> On Wed, 2004-07-21 at 13:39, sankarshana rao wrote:
> > Hi,
> > I want to call namei() function in order to derive
> an
> > inode from a path name. Can I do this inside a
> kernel
> > module???
> 
> >From a kernel module, you should probably call
> path_lookup().
> 
> Shaggy
> -- 
> David Kleikamp
> IBM Linux Technology Center
> 
> 



	
		
__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Inode question
  2004-07-21 20:46   ` sankarshana rao
@ 2004-07-21 20:56     ` Dave Kleikamp
  2004-07-21 21:09     ` Richard B. Johnson
  1 sibling, 0 replies; 10+ messages in thread
From: Dave Kleikamp @ 2004-07-21 20:56 UTC (permalink / raw)
  To: sankarshana rao; +Cc: linux-kernel

On Wed, 2004-07-21 at 15:46, sankarshana rao wrote:
> Thx for the reply...
> When I try to call lookup() from my kernel module, it
> gives undefined symbol error during INSMOD..
> any clues???

Not lookup, but path_lookup.

#include <linux/namei.h>
struct nameidata nd;
rc = path_lookup(path, LOOKUP_FOLLOW, &nd);
if (rc)
	file not found
else
	inum = nd.dentry->d_inode->i_ino;
	path_release(&nd);

> --- Dave Kleikamp <shaggy@austin.ibm.com> wrote:
> > On Wed, 2004-07-21 at 13:39, sankarshana rao wrote:
> > > Hi,
> > > I want to call namei() function in order to derive
> > an
> > > inode from a path name. Can I do this inside a
> > kernel
> > > module???
> > 
> > >From a kernel module, you should probably call
> > path_lookup().
> > 
> > Shaggy
-- 
David Kleikamp
IBM Linux Technology Center


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Inode question
  2004-07-21 20:46   ` sankarshana rao
  2004-07-21 20:56     ` Dave Kleikamp
@ 2004-07-21 21:09     ` Richard B. Johnson
  2004-07-21 22:57       ` sankarshana rao
  1 sibling, 1 reply; 10+ messages in thread
From: Richard B. Johnson @ 2004-07-21 21:09 UTC (permalink / raw)
  To: sankarshana rao; +Cc: Dave Kleikamp, linux-kernel

On Wed, 21 Jul 2004, sankarshana rao wrote:

> Thx for the reply...
> When I try to call lookup() from my kernel module, it
> gives undefined symbol error during INSMOD..
> any clues???
>

It's probably not an exported symbol.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.26 on an i686 machine (5570.56 BogoMips).
            Note 96.31% of all statistics are fiction.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Inode question
  2004-07-21 21:09     ` Richard B. Johnson
@ 2004-07-21 22:57       ` sankarshana rao
  2004-07-22 12:36         ` Dave Kleikamp
  2004-07-22 14:23         ` Paulo Marques
  0 siblings, 2 replies; 10+ messages in thread
From: sankarshana rao @ 2004-07-21 22:57 UTC (permalink / raw)
  To: root; +Cc: linux-kernel

Guys,
Thx for the inputs...I got it with path_lookup....

Can I pass the inode pointer back to the user space???
I have a scenario in which I have to create multiple
folders on the harddisk. The number of folders can be
in hundreds. Instead of parsing the path name
everytime I need to create a folder (that's what
sys_mkdir does??? ), I was thinking if I have the
inode* of the parent folder, I can avoid this parsing
and directly create a subfolder under the parent
folder...

Pls advice if this approach makes sense or not and if
it is doable or not??

any input in this regard will be very helpful..


--- "Richard B. Johnson" <root@chaos.analogic.com>
wrote:
> On Wed, 21 Jul 2004, sankarshana rao wrote:
> 
> > Thx for the reply...
> > When I try to call lookup() from my kernel module,
> it
> > gives undefined symbol error during INSMOD..
> > any clues???
> >
> 
> It's probably not an exported symbol.
> 
> Cheers,
> Dick Johnson
> Penguin : Linux version 2.4.26 on an i686 machine
> (5570.56 BogoMips).
>             Note 96.31% of all statistics are
> fiction.
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Inode question
  2004-07-21 22:57       ` sankarshana rao
@ 2004-07-22 12:36         ` Dave Kleikamp
  2004-07-22 14:23         ` Paulo Marques
  1 sibling, 0 replies; 10+ messages in thread
From: Dave Kleikamp @ 2004-07-22 12:36 UTC (permalink / raw)
  To: sankarshana rao; +Cc: root, linux-kernel

On Wed, 2004-07-21 at 17:57, sankarshana rao wrote:
> Guys,
> Thx for the inputs...I got it with path_lookup....
> 
> Can I pass the inode pointer back to the user space???

You shouldn't do that.

> I have a scenario in which I have to create multiple
> folders on the harddisk. The number of folders can be
> in hundreds. Instead of parsing the path name
> everytime I need to create a folder (that's what
> sys_mkdir does??? ), I was thinking if I have the
> inode* of the parent folder, I can avoid this parsing
> and directly create a subfolder under the parent
> folder...

Couldn't the program chdir to the parent directory and create the
folders with a relative pathname?
-- 
David Kleikamp
IBM Linux Technology Center


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Inode question
  2004-07-21 22:57       ` sankarshana rao
  2004-07-22 12:36         ` Dave Kleikamp
@ 2004-07-22 14:23         ` Paulo Marques
  2004-07-27  1:28           ` sankarshana rao
  1 sibling, 1 reply; 10+ messages in thread
From: Paulo Marques @ 2004-07-22 14:23 UTC (permalink / raw)
  To: sankarshana rao; +Cc: root, linux-kernel@vger.kernel.org

On Wed, 2004-07-21 at 23:57, sankarshana rao wrote:
> Guys,
> Thx for the inputs...I got it with path_lookup....
> 
> Can I pass the inode pointer back to the user space???

To get an inode number from user space you can simply use the "stat" or
"fstat" functions. You don't need to create your own module.

> I have a scenario in which I have to create multiple
> folders on the harddisk. The number of folders can be
> in hundreds. Instead of parsing the path name
> everytime I need to create a folder (that's what
> sys_mkdir does??? ), I was thinking if I have the
> inode* of the parent folder, I can avoid this parsing
> and directly create a subfolder under the parent
> folder...

Is this really a problem? The dentry cache should make this quite fast,
leaving the bottleneck to the actual write on disk of the result.

I tried a small program (if it can be called a program) to create a
thousand directories and it takes less than 100 ms on my machine.

Best regards,

-- 
Paulo Marques - www.grupopie.com
"In a world without walls and fences who needs windows and gates?"


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Inode question
  2004-07-22 14:23         ` Paulo Marques
@ 2004-07-27  1:28           ` sankarshana rao
  2004-07-27 11:18             ` Paulo Marques
  0 siblings, 1 reply; 10+ messages in thread
From: sankarshana rao @ 2004-07-27  1:28 UTC (permalink / raw)
  To: pmarques; +Cc: linux-kernel

Thx for the inputs..
I am trying this thing on Mips processor and creating
500 folders itself takes about 1.6 seconds. That's why
I was wondering if using inodes would make it any
faster..
pls guide...



--- Paulo Marques <pmarques@grupopie.com> wrote:
> On Wed, 2004-07-21 at 23:57, sankarshana rao wrote:
> > Guys,
> > Thx for the inputs...I got it with path_lookup....
> > 
> > Can I pass the inode pointer back to the user
> space???
> 
> To get an inode number from user space you can
> simply use the "stat" or
> "fstat" functions. You don't need to create your own
> module.
> 
> > I have a scenario in which I have to create
> multiple
> > folders on the harddisk. The number of folders can
> be
> > in hundreds. Instead of parsing the path name
> > everytime I need to create a folder (that's what
> > sys_mkdir does??? ), I was thinking if I have the
> > inode* of the parent folder, I can avoid this
> parsing
> > and directly create a subfolder under the parent
> > folder...
> 
> Is this really a problem? The dentry cache should
> make this quite fast,
> leaving the bottleneck to the actual write on disk
> of the result.
> 
> I tried a small program (if it can be called a
> program) to create a
> thousand directories and it takes less than 100 ms
> on my machine.
> 
> Best regards,
> 
> -- 
> Paulo Marques - www.grupopie.com
> "In a world without walls and fences who needs
> windows and gates?"
> 
> 



	
		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Inode question
  2004-07-27  1:28           ` sankarshana rao
@ 2004-07-27 11:18             ` Paulo Marques
  0 siblings, 0 replies; 10+ messages in thread
From: Paulo Marques @ 2004-07-27 11:18 UTC (permalink / raw)
  To: sankarshana rao; +Cc: linux-kernel@vger.kernel.org

On Tue, 2004-07-27 at 02:28, sankarshana rao wrote:
> Thx for the inputs..
> I am trying this thing on Mips processor and creating
> 500 folders itself takes about 1.6 seconds. That's why
> I was wondering if using inodes would make it any
> faster..
> pls guide...

I really think the name lookup is not your bottleneck.

I did some more tests to check where the time to create a dir came from
and, as expected, it depends a lot on the filesystem.

Using ext3, creating 1000 dirs on my machine (P4 2.8GHz) takes about 100
ms. Using tmpfs, takes only 6 ms. Even a machine 20 times slower would
take at most 60ms to do the 500 lookups.

Both tests have to do the same lookup on the dentry cache and check for
duplicate names, etc. 

So the real difference is the time *the filesystem* takes to create a
dir.

You're probably using JFFS2 or something like that, which is almost 
synchronous (I don't know for sure if it is really synchronous), and
writes the updates to flash on every dir creation.

I hope this helps,

-- 
Paulo Marques - www.grupopie.com
"In a world without walls and fences who needs windows and gates?"


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-07-27 11:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-21 18:39 Inode question sankarshana rao
2004-07-21 20:25 ` Dave Kleikamp
2004-07-21 20:46   ` sankarshana rao
2004-07-21 20:56     ` Dave Kleikamp
2004-07-21 21:09     ` Richard B. Johnson
2004-07-21 22:57       ` sankarshana rao
2004-07-22 12:36         ` Dave Kleikamp
2004-07-22 14:23         ` Paulo Marques
2004-07-27  1:28           ` sankarshana rao
2004-07-27 11:18             ` Paulo Marques

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox