* [OFFTOPIC] f_pos ?
@ 2004-07-04 19:18 FabF
2004-07-06 19:58 ` Maneesh Soni
0 siblings, 1 reply; 4+ messages in thread
From: FabF @ 2004-07-04 19:18 UTC (permalink / raw)
To: lkml
Hi,
I try to understand how readdir process works and I can't understand
f_pos management :
Having in mind things work that way :
user : ls
glibc :
open (->sys_open)
getdentries64 (->sys_getdentries64)
kernel:
sys_getdentries64
->vfs_readdir
->ext2_readdir
At that point, I don't understand why ext2_readdir is playing with
filp->f_pos .... It should be 0 ...Why does it care about offset ?
Thanks in advance for your precious help,
FabF
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [OFFTOPIC] f_pos ?
2004-07-04 19:18 [OFFTOPIC] f_pos ? FabF
@ 2004-07-06 19:58 ` Maneesh Soni
2004-07-06 20:38 ` [OFFTOPIC] f_pos ? [PATCH 2.6.7-mm6] ext2_readdir commenting FabF
2004-07-06 20:51 ` [OFFTOPIC] f_pos ? FabF
0 siblings, 2 replies; 4+ messages in thread
From: Maneesh Soni @ 2004-07-06 19:58 UTC (permalink / raw)
To: FabF; +Cc: lkml
On Sun, Jul 04, 2004 at 07:31:29PM +0000, FabF wrote:
> Hi,
>
> I try to understand how readdir process works and I can't understand
> f_pos management :
>
> Having in mind things work that way :
>
> user : ls
> glibc :
> open (->sys_open)
> getdentries64 (->sys_getdentries64)
>
> kernel:
> sys_getdentries64
> ->vfs_readdir
> ->ext2_readdir
>
> At that point, I don't understand why ext2_readdir is playing with
> filp->f_pos .... It should be 0 ...Why does it care about offset ?
>
I think it may not be 0 all the time. A seekdir() could change could change
the offset to non-zero.
Thanks
Maneesh
--
Maneesh Soni
Linux Technology Center,
IBM Austin
email: maneesh@in.ibm.com
Phone: 1-512-838-1896 Fax:
T/L : 6781896
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [OFFTOPIC] f_pos ? [PATCH 2.6.7-mm6] ext2_readdir commenting
2004-07-06 19:58 ` Maneesh Soni
@ 2004-07-06 20:38 ` FabF
2004-07-06 20:51 ` [OFFTOPIC] f_pos ? FabF
1 sibling, 0 replies; 4+ messages in thread
From: FabF @ 2004-07-06 20:38 UTC (permalink / raw)
To: maneesh; +Cc: linux-kernel, Andrew Morton
[-- Attachment #1: Type: text/plain, Size: 1274 bytes --]
On Tue, 2004-07-06 at 21:58, Maneesh Soni wrote:
> On Sun, Jul 04, 2004 at 07:31:29PM +0000, FabF wrote:
> > Hi,
> >
> > I try to understand how readdir process works and I can't understand
> > f_pos management :
> >
> > Having in mind things work that way :
> >
> > user : ls
> > glibc :
> > open (->sys_open)
> > getdentries64 (->sys_getdentries64)
> >
> > kernel:
> > sys_getdentries64
> > ->vfs_readdir
> > ->ext2_readdir
> >
> > At that point, I don't understand why ext2_readdir is playing with
> > filp->f_pos .... It should be 0 ...Why does it care about offset ?
> >
>
> I think it may not be 0 all the time. A seekdir() could change could change
> the offset to non-zero.
Thanks Maneesh :) Anton brightly explained me readdir : it can be called
more than once (buffering ...) so the reason for that offset.Action
taking place in filldir return.'over' in ext2 readdir could bring
confusion though....It's 'over' for kernel duty but the whole path is
not necessarily explored yet.
I think the trivial comment patch attached (against 2.6.7-mm6) could be
interesting for that issue.
Regards,
FabF
>
> Thanks
> Maneesh
[-- Attachment #2: ext2readdir_comment.patch --]
[-- Type: text/x-patch, Size: 619 bytes --]
ext2_readdir commenting
Signed off by FabF
---
diff -puN fs/ext2/dir.c~ext2readdir_comment fs/ext2/dir.c
--- linux-2.6.7/fs/ext2/dir.c~ext2readdir_comment 2004-07-06 22:20:14.514980596 +0200
+++ linux-2.6.7-heatwave/fs/ext2/dir.c 2004-07-06 22:31:52.822458517 +0200
@@ -245,6 +245,12 @@ static inline void ext2_set_de_type(ext2
de->file_type = 0;
}
+/*
+ * ext2_readdir()
+ *
+ * copy directory entries to userland from its current offset (filp->f_pos)
+ * up to the end or when buffer is full (over=-EFAULT | -EINVAL)
+ */
static int
ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
{
_
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [OFFTOPIC] f_pos ?
2004-07-06 19:58 ` Maneesh Soni
2004-07-06 20:38 ` [OFFTOPIC] f_pos ? [PATCH 2.6.7-mm6] ext2_readdir commenting FabF
@ 2004-07-06 20:51 ` FabF
1 sibling, 0 replies; 4+ messages in thread
From: FabF @ 2004-07-06 20:51 UTC (permalink / raw)
To: maneesh; +Cc: lkml
On Tue, 2004-07-06 at 21:58, Maneesh Soni wrote:
> On Sun, Jul 04, 2004 at 07:31:29PM +0000, FabF wrote:
> > Hi,
> >
> > I try to understand how readdir process works and I can't understand
> > f_pos management :
> >
> > Having in mind things work that way :
> >
> > user : ls
> > glibc :
> > open (->sys_open)
> > getdentries64 (->sys_getdentries64)
> >
> > kernel:
> > sys_getdentries64
> > ->vfs_readdir
> > ->ext2_readdir
> >
> > At that point, I don't understand why ext2_readdir is playing with
> > filp->f_pos .... It should be 0 ...Why does it care about offset ?
> >
>
> I think it may not be 0 all the time. A seekdir() could change could change
> the offset to non-zero.
>
btw, someone could tell why old ext2 readdir had "do the readahead"
feature ; current ext3 as well but new ext2 implementation doesn't ???
Regards,
FabF
> Thanks
> Maneesh
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-07-06 20:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-04 19:18 [OFFTOPIC] f_pos ? FabF
2004-07-06 19:58 ` Maneesh Soni
2004-07-06 20:38 ` [OFFTOPIC] f_pos ? [PATCH 2.6.7-mm6] ext2_readdir commenting FabF
2004-07-06 20:51 ` [OFFTOPIC] f_pos ? FabF
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.