* file system question @ 2006-02-08 23:39 kapil a 2006-02-09 0:01 ` Avishay Traeger 0 siblings, 1 reply; 6+ messages in thread From: kapil a @ 2006-02-08 23:39 UTC (permalink / raw) To: linux-kernel I am trying to write a file system for 2.6. I have written the required things to mount my file system and now i am trying to get some f_op's and d_op's. I was trying to make the 'ls' command work. So i wrote a myfs_readdir() and linked it to the f_op field. My routine gets called and also filldir gets called and stores the data in the dirent but i dont get the output in stdout. On using strace i find that "ls" does not perform all the calls that a "ls" in a directory mountedf in ext2 performs. To be specific, the strace ouput ends after the getdents64 system call. In the normal "ls" strace, i find there are a couple of more system calls namely a fstat followed by a write to stdout and some more mmap calls. I dont understand the reason behind why the write is not called. My guess is i have not over-ridden some function that i have to write as part of my file system instead of using the default method. Any help regarding this would be appreciated... regards kaps ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: file system question 2006-02-08 23:39 file system question kapil a @ 2006-02-09 0:01 ` Avishay Traeger [not found] ` <ef2d59350602081611h4492bf47ne24e3d591efd29e7@mail.gmail.com> 0 siblings, 1 reply; 6+ messages in thread From: Avishay Traeger @ 2006-02-09 0:01 UTC (permalink / raw) To: kapil a; +Cc: linux-kernel On Wed, 2006-02-08 at 18:39 -0500, kapil a wrote: > I am trying to write a file system for 2.6. I have written the > required things to mount my file system and now i am trying to get > some f_op's and d_op's. I was trying to make the 'ls' command work. So > i wrote a myfs_readdir() and linked it to the f_op field. My routine > gets called and also filldir gets called and stores the data in the > dirent but i dont get the output in stdout. > > On using strace i find that "ls" does not perform all the calls that > a "ls" in a directory mountedf in ext2 performs. To be specific, the > strace ouput ends after the getdents64 system call. In the normal "ls" > strace, i find there are a couple of more system calls namely a fstat > followed by a write to stdout and some more mmap calls. Correct. The getdents system call will call your readdir function. > I dont understand the reason behind why the write is not called. My > guess is i have not over-ridden some function that i have to write as > part of my file system instead of using the default method. Why would your write function get called when 'ls' writes to stdout? Please explain your question more clearly. Avishay Traeger http://www.fsl.cs.sunysb.edu/~avishay/ ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <ef2d59350602081611h4492bf47ne24e3d591efd29e7@mail.gmail.com>]
* Re: file system question [not found] ` <ef2d59350602081611h4492bf47ne24e3d591efd29e7@mail.gmail.com> @ 2006-02-09 0:13 ` kapil a 2006-02-09 1:15 ` Bernd Eckenfels [not found] ` <1139447727.4902.13.camel@rockstar.fsl.cs.sunysb.edu> 1 sibling, 1 reply; 6+ messages in thread From: kapil a @ 2006-02-09 0:13 UTC (permalink / raw) To: linux-kernel ---------- Forwarded message ---------- From: kapil a <kapilann@gmail.com> Date: Feb 8, 2006 7:11 PM Subject: Re: file system question To: Avishay Traeger <atraeger@cs.sunysb.edu> thanks for the reply and sorry for the unclear question. What i meant was when i do an "ls" in a directory that is part of the ext2 filesystem, i can see a "write" call in the strace output at the end and it writes the directory contents to stdout. However when i issue "ls" in the mount point of my file system, i dont have the "write" call. The strace ends with the getdents64 call. When i did some debugging i found that filldir which is suppose to fill the dirent with the directory entries does its job. My filesystem currently has only one inode with one block of data where i have a ".", ".." and "test" written into it. The problem is it does not go further to do some of the other calls as in a mountpoint in ext2 file system. Hope i am clear now. kaps On 2/8/06, Avishay Traeger <atraeger@cs.sunysb.edu> wrote: > On Wed, 2006-02-08 at 18:39 -0500, kapil a wrote: > > I am trying to write a file system for 2.6. I have written the > > required things to mount my file system and now i am trying to get > > some f_op's and d_op's. I was trying to make the 'ls' command work. So > > i wrote a myfs_readdir() and linked it to the f_op field. My routine > > gets called and also filldir gets called and stores the data in the > > dirent but i dont get the output in stdout. > > > > On using strace i find that "ls" does not perform all the calls that > > a "ls" in a directory mountedf in ext2 performs. To be specific, the > > strace ouput ends after the getdents64 system call. In the normal "ls" > > strace, i find there are a couple of more system calls namely a fstat > > followed by a write to stdout and some more mmap calls. > > Correct. The getdents system call will call your readdir function. > > > I dont understand the reason behind why the write is not called. My > > guess is i have not over-ridden some function that i have to write as > > part of my file system instead of using the default method. > > Why would your write function get called when 'ls' writes to stdout? > Please explain your question more clearly. > > > Avishay Traeger > http://www.fsl.cs.sunysb.edu/~avishay/ > > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: file system question 2006-02-09 0:13 ` kapil a @ 2006-02-09 1:15 ` Bernd Eckenfels 0 siblings, 0 replies; 6+ messages in thread From: Bernd Eckenfels @ 2006-02-09 1:15 UTC (permalink / raw) To: linux-kernel kapil a <kapilann@gmail.com> wrote: > When i did some debugging i found that filldir which is suppose to > fill the dirent with the directory entries does its job. My filesystem > currently has only one inode with one block of data where i have a > ".", ".." and "test" written into it. > > The problem is it does not go further to do some of the other calls as > in a mountpoint in ext2 file system. in that case ls is missing something, maybe a count, a size, filetype, permission... why dont you debug ls to see where it is exiting? I mean if you write kernel mode code one could expect that you can step through a user mode tool? Gruss Bernd ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <1139447727.4902.13.camel@rockstar.fsl.cs.sunysb.edu>]
* Re: file system question [not found] ` <1139447727.4902.13.camel@rockstar.fsl.cs.sunysb.edu> @ 2006-02-09 17:57 ` kapil a 2006-02-09 21:54 ` Ram Gupta 0 siblings, 1 reply; 6+ messages in thread From: kapil a @ 2006-02-09 17:57 UTC (permalink / raw) To: Avishay Traeger, lloyd, linux-kernel I am only sending the relevant stuff. My strace output : fstat64(3, {st_mode=S_IFDIR|0755, st_size=48, ...}) = 0 fcntl64(3, F_SETFD, FD_CLOEXEC) = 0 getdents64(3, /* 3 entries */, 4096) = 80 getdents64(3, /* 0 entries */, 4096) = 0 close(3) = 0 exit_group(0) strace output on a partition under ext2 fstat64(3, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 fcntl64(3, F_SETFD, FD_CLOEXEC) = 0 getdents64(3, /* 4 entries */, 4096) = 104 getdents64(3, /* 0 entries */, 4096) = 0 close(3) = 0 fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7ddc000 write(1, "kapil out\n", 11) = 11 munmap(0xb7ddc000, 4096) = 0 exit_group(0) We can see that my strace does not call the fstat, mmap, write and munmap calls. It directly calls the exit_group call. This is what i fail to understand. The getdents seems to be returning data correctly. And filldir() called by the readdir() seems to be working correctly(am not sure). So i fail to understand why the other calls are not performed. I would like to remind you that i have not written all the calls. For example i dont have my file systems implementation of the write call. But atleast i shd be able to call the default. any help would be appreciated. And can anybody think of an other way i can test my filesystem with a smaller call. "ls" seems to be calling way too many system calls. My filesystem is a disk based file system with my superblock in a floppy. kapil On 2/8/06, Avishay Traeger <atraeger@cs.sunysb.edu> wrote: > On Wed, 2006-02-08 at 19:11 -0500, kapil a wrote: > > thanks for the reply and sorry for the unclear question. > > > > What i meant was when i do an "ls" in a directory that is part of the > > ext2 filesystem, i can see a "write" call in the strace output at the > > end and it writes the directory contents to stdout. However when i > > issue "ls" in the mount point of my file system, i dont have the > > "write" call. The strace ends with the getdents64 call. > > > > When i did some debugging i found that filldir which is suppose to > > fill the dirent with the directory entries does its job. My filesystem > > currently has only one inode with one block of data where i have a > > ".", ".." and "test" written into it. > > > > The problem is it does not go further to do some of the other calls as > > in a mountpoint in ext2 file system. > > > > Hope i am clear now. > > > > kaps > > Can you send the strace output? > > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: file system question 2006-02-09 17:57 ` kapil a @ 2006-02-09 21:54 ` Ram Gupta 0 siblings, 0 replies; 6+ messages in thread From: Ram Gupta @ 2006-02-09 21:54 UTC (permalink / raw) To: kapil a; +Cc: Avishay Traeger, lloyd, linux-kernel On 2/9/06, kapil a <kapilann@gmail.com> wrote: > I am only sending the relevant stuff. > > My strace output : > > fstat64(3, {st_mode=S_IFDIR|0755, st_size=48, ...}) = 0 > fcntl64(3, F_SETFD, FD_CLOEXEC) = 0 > getdents64(3, /* 3 entries */, 4096) = 80 > getdents64(3, /* 0 entries */, 4096) = 0 > close(3) = 0 > exit_group(0) > > strace output on a partition under ext2 > > fstat64(3, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 > fcntl64(3, F_SETFD, FD_CLOEXEC) = 0 > getdents64(3, /* 4 entries */, 4096) = 104 > getdents64(3, /* 0 entries */, 4096) = 0 Why dont you write a simple program which makes call to open,read,write & others you want to test. That would not make these unnecessary calls. Regards Ram Gupta ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-02-09 21:54 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-08 23:39 file system question kapil a
2006-02-09 0:01 ` Avishay Traeger
[not found] ` <ef2d59350602081611h4492bf47ne24e3d591efd29e7@mail.gmail.com>
2006-02-09 0:13 ` kapil a
2006-02-09 1:15 ` Bernd Eckenfels
[not found] ` <1139447727.4902.13.camel@rockstar.fsl.cs.sunysb.edu>
2006-02-09 17:57 ` kapil a
2006-02-09 21:54 ` Ram Gupta
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®