* [PATCH] Use the incore inode size in xfs_file_readdir()
@ 2008-12-04 6:59 Lachlan McIlroy
2008-12-04 7:08 ` Christoph Hellwig
0 siblings, 1 reply; 4+ messages in thread
From: Lachlan McIlroy @ 2008-12-04 6:59 UTC (permalink / raw)
To: xfs-oss
We should be using the incore inode size here not the linux inode
size. The incore inode size is always up to date for directories
whereas the linux inode size is not updated for directories.
We've hit assertions in xfs_bmap() and traced it back to the linux
inode size being zero here but the incore size being correct.
--- xfs-fix.orig/fs/xfs/linux-2.6/xfs_file.c
+++ xfs-fix/fs/xfs/linux-2.6/xfs_file.c
@@ -254,7 +254,7 @@ xfs_file_readdir(
* point we can change the ->readdir prototype to include the
* buffer size.
*/
- bufsize = (size_t)min_t(loff_t, PAGE_SIZE, inode->i_size);
+ bufsize = (size_t)min_t(loff_t, PAGE_SIZE, ip->i_d.di_size);
error = xfs_readdir(ip, dirent, bufsize,
(xfs_off_t *)&filp->f_pos, filldir);
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Use the incore inode size in xfs_file_readdir()
2008-12-04 6:59 [PATCH] Use the incore inode size in xfs_file_readdir() Lachlan McIlroy
@ 2008-12-04 7:08 ` Christoph Hellwig
2008-12-05 3:22 ` Lachlan McIlroy
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2008-12-04 7:08 UTC (permalink / raw)
To: Lachlan McIlroy; +Cc: xfs-oss
On Thu, Dec 04, 2008 at 05:59:08PM +1100, Lachlan McIlroy wrote:
> We should be using the incore inode size here not the linux inode
> size. The incore inode size is always up to date for directories
> whereas the linux inode size is not updated for directories.
>
> We've hit assertions in xfs_bmap() and traced it back to the linux
> inode size being zero here but the incore size being correct.
Heh. Looks good, but you can still call ->readdir with a 0 inode size,
so you might want to check for that (actualyl I think other pathes
are goign to take care of it, but..)
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Use the incore inode size in xfs_file_readdir()
2008-12-04 7:08 ` Christoph Hellwig
@ 2008-12-05 3:22 ` Lachlan McIlroy
2008-12-17 14:20 ` Christoph Hellwig
0 siblings, 1 reply; 4+ messages in thread
From: Lachlan McIlroy @ 2008-12-05 3:22 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: xfs-oss
Christoph Hellwig wrote:
> On Thu, Dec 04, 2008 at 05:59:08PM +1100, Lachlan McIlroy wrote:
>> We should be using the incore inode size here not the linux inode
>> size. The incore inode size is always up to date for directories
>> whereas the linux inode size is not updated for directories.
>>
>> We've hit assertions in xfs_bmap() and traced it back to the linux
>> inode size being zero here but the incore size being correct.
>
> Heh. Looks good, but you can still call ->readdir with a 0 inode size,
> so you might want to check for that (actualyl I think other pathes
> are goign to take care of it, but..)
What if we remove bufsize and pass PAGE_SIZE into xfs_readdir()?
No need to worry about a 0 inode size.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Use the incore inode size in xfs_file_readdir()
2008-12-05 3:22 ` Lachlan McIlroy
@ 2008-12-17 14:20 ` Christoph Hellwig
0 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2008-12-17 14:20 UTC (permalink / raw)
To: Lachlan McIlroy; +Cc: Christoph Hellwig, xfs-oss
On Fri, Dec 05, 2008 at 02:22:55PM +1100, Lachlan McIlroy wrote:
> Christoph Hellwig wrote:
> > On Thu, Dec 04, 2008 at 05:59:08PM +1100, Lachlan McIlroy wrote:
> >> We should be using the incore inode size here not the linux inode
> >> size. The incore inode size is always up to date for directories
> >> whereas the linux inode size is not updated for directories.
> >>
> >> We've hit assertions in xfs_bmap() and traced it back to the linux
> >> inode size being zero here but the incore size being correct.
> >
> > Heh. Looks good, but you can still call ->readdir with a 0 inode size,
> > so you might want to check for that (actualyl I think other pathes
> > are goign to take care of it, but..)
>
> What if we remove bufsize and pass PAGE_SIZE into xfs_readdir()?
> No need to worry about a 0 inode size.
It is used for sizing a memory allocation in xfs_dir2_leaf_getdents, and
avoiding over-allocations for small directories seems like a good idea.
So please go ahead with your original patch.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-12-17 14:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-04 6:59 [PATCH] Use the incore inode size in xfs_file_readdir() Lachlan McIlroy
2008-12-04 7:08 ` Christoph Hellwig
2008-12-05 3:22 ` Lachlan McIlroy
2008-12-17 14:20 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox