Re: remove dentry_open::file_ra_init_state() duplicated memset was Re: kernbench on 512p

Andrew Morton
2004-08-20T08:42:48Z

Marcelo Tosatti <marcelo.tosatti@cyclades.com> wrote:
>
> On Thu, Aug 19, 2004 at 11:21:45PM -0700, Andrew Morton wrote:
> > Marcelo Tosatti <marcelo.tosatti@cyclades.com> wrote:
> > >
> > > So this patch creates a __file_ra_state_init() function, which initializes
> > > the file_ra_state fields, without the memset.
> > >
> > > file_ra_state_init() does the memset + its __ counterpart.
> >
> > Seems unnecessarily fiddly. How about this?
>
> Thats cleaner yep. :)

It got even cleaner - Neil has just nuked the NFS callsite.

--- 25/mm/readahead.c~file_ra_state_init-speedup 2004-08-20 00:03:19.979397128 -0700
+++ 25-akpm/mm/readahead.c 2004-08-20 00:04:25.159488248 -0700
@@ -28,16 +28,15 @@ struct backing_dev_info default_backing_
EXPORT_SYMBOL_GPL(default_backing_dev_info);

/*
- * Initialise a struct file's readahead state
+ * Initialise a struct file's readahead state. Assumes that the caller has
+ * memset *ra to zero.
*/
void
file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping)
{
- memset(ra, 0, sizeof(*ra));
ra->ra_pages = mapping->backing_dev_info->ra_pages;
ra->average = ra->ra_pages / 2;
}
-EXPORT_SYMBOL(file_ra_state_init);

/*
* Return max readahead size for this inode in number-of-pages.
_