lkml.org 
[lkml]   [2004]   [Aug]   [20]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateThu, 19 Aug 2004 23:21:45 -0700
FromAndrew Morton <>
SubjectRe: remove dentry_open::file_ra_init_state() duplicated memset was Re: kernbench on 512p
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?

--- 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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:05    [from the cache]
©2003-2008