LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 08-05-2010, 05:05 AM   #1
joesatch
LQ Newbie
 
Registered: Aug 2010
Posts: 1

Rep: Reputation: 0
how does kernel handle new file creation


how soes kernel handle new file creation
hi,

I wish to understand the way kernel works when a user/app tries to create a file in a directorty.

The background - We have a java applicaiton which consumes messages over JMS, processes it and then writes the XML to an outbound queue+a local directory. Yesterday we obeserved unsual delays in writing to the directory. On 'ls|wc -l' we found >300,000 files in there. Did a quick strace on the process and found it full of mutex calls (More than 3/4 calls in the strace were mutex).

So i thought that new file creation is taking time becasue the system has to every time check certain things (e.g name of files to make sure that the new file with a specific name can be created) amongst 300,000 files and then create a file.

I cleared the directory and the applicaiton resumed to normal service levels.


My questions

1. Was my analysis correct (It seems cuz the app started working fine after a clear down)?
2. More imporatant, how does the kernel work when you try to creat a new file in directory.
3. Can the abnormal number of mutex calls be attributed to the high number of files in the directory?

Many thanks
J
 
Old 08-05-2010, 07:25 AM   #2
archieval
Member
 
Registered: Apr 2007
Location: Philippines
Distribution: Kubuntu, Ubuntu, CentOS
Posts: 289

Rep: Reputation: 41
Quote:
Originally Posted by joesatch View Post
how soes kernel handle new file creation
My questions

1. Was my analysis correct (It seems cuz the app started working fine after a clear down)?
2. More imporatant, how does the kernel work when you try to creat a new file in directory.
3. Can the abnormal number of mutex calls be attributed to the high number of files in the directory?

Many thanks
J
How long is that "taking time" you described?

2. Creating a file is same as opening it and it should be fast. Look at fs/open.c. http://lxr.linux.no/#linux+v2.6.35/fs/open.c#L933

3. I guess no because it is just being created and not being accessed. Maybe your application is already accessing your newly created file? or traversing the directory for your file?
 
  


Reply

Tags
kernel, mutex



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
[SOLVED] dpkg fatal error unable to open files list file Stale NFS file handle cmr26 Linux - Software 5 09-06-2009 04:10 PM
creation of new file in kernel space vishalbutte Programming 3 03-14-2006 02:32 AM
Kernel upgrade: Unable to handle kernel paging request deviantintegral Debian 4 07-14-2004 04:59 PM
RPM Spec file creation: %file section question davidas Linux - Newbie 0 03-16-2004 10:36 PM
Kernel Message:unable to handle kernel NULL pointer dereference at virtual address... dave_d Linux - General 0 02-14-2001 05:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 05:59 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