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

From: Marcelo Tosatti
Date: Fri Aug 20 2004 - 03:35:18 EST


On Thu, Aug 19, 2004 at 11:21:45PM -0700, Andrew Morton wrote:
> Marcelo Tosatti <marcelo.tosatti@xxxxxxxxxxxx> 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. :)

> --- 25/mm/readahead.c~file_ra_state_init-speedup 2004-08-19 23:20:11.695876032 -0700
> +++ 25-akpm/mm/readahead.c 2004-08-19 23:20:42.077257360 -0700
> @@ -28,12 +28,12 @@ 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;
> }
> diff -puN fs/nfsd/vfs.c~file_ra_state_init-speedup fs/nfsd/vfs.c
> --- 25/fs/nfsd/vfs.c~file_ra_state_init-speedup 2004-08-19 23:20:11.713873296 -0700
> +++ 25-akpm/fs/nfsd/vfs.c 2004-08-19 23:21:05.721662864 -0700
> @@ -771,6 +771,7 @@ nfsd_get_raparms(dev_t dev, ino_t ino, s
> ra = *frap;
> ra->p_dev = dev;
> ra->p_ino = ino;
> + memset(&ra->p_ra, 0, sizeof(ra->p_ra));
> file_ra_state_init(&ra->p_ra, mapping);
> found:
> if (rap != &raparm_cache) {
> _
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/