[Devel] [PATCH RHEL7 COMMIT] fuse kio: Do not zero already zeroed fields in pcs_find_get_map()

Konstantin Khorenko khorenko at virtuozzo.com
Wed Sep 26 18:06:58 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-862.11.6.vz7.71.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.11.6.vz7.71.14
------>
commit 2052843124c0d5124c8e013bb5466e12699f6e58
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Wed Sep 26 18:06:58 2018 +0300

    fuse kio: Do not zero already zeroed fields in pcs_find_get_map()
    
    kmem_cache_zalloc() already zeroes all the memory,
    so we don't have to do this manually.
    
    Since pcs_find_get_map() is certainly a hot path,
    we mustn't do excess actions here.
    
    Before:
       text    data     bss     dec     hex filename
      92955     367    4172   97494   17cd6 fs/fuse/fuse_kio_pcs.o
    After:
       text    data     bss     dec     hex filename
      92875     367    4172   97414   17c86 fs/fuse/fuse_kio_pcs.o
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_map.c        | 9 ---------
 fs/fuse/kio/pcs/pcs_prot_types.h | 5 -----
 2 files changed, 14 deletions(-)

diff --git a/fs/fuse/kio/pcs/pcs_map.c b/fs/fuse/kio/pcs/pcs_map.c
index 5565eac8ee50..4b5462aafe92 100644
--- a/fs/fuse/kio/pcs/pcs_map.c
+++ b/fs/fuse/kio/pcs/pcs_map.c
@@ -568,20 +568,11 @@ struct pcs_map_entry * pcs_find_get_map(struct pcs_dentry_info *di, u64 offset)
 		return NULL;
 	}
 
-	m->mapping = NULL;
-	m->maps = NULL;
 	m->res_offset = offset;
-	m->chunk_psize = 0;
 	m->index = idx;
 
-	map_version_init(&m->version);
-	m->id = 0;		/* For logging only, it is not used before map is completed */
 	m->state = PCS_MAP_NEW;
-	m->flags = 0;
 	atomic_set(&m->__refcnt, 1);
-	m->mds_flags = 0;
-	m->cs_list = NULL;
-	m->error_tstamp = 0;
 	m->mapping = &di->mapping;
 	INIT_DELAYED_WORK(&m->sync_work, sync_timer_work);
 	INIT_LIST_HEAD(&m->queue);
diff --git a/fs/fuse/kio/pcs/pcs_prot_types.h b/fs/fuse/kio/pcs/pcs_prot_types.h
index 39a1d674cc96..9db4516824aa 100644
--- a/fs/fuse/kio/pcs/pcs_prot_types.h
+++ b/fs/fuse/kio/pcs/pcs_prot_types.h
@@ -202,11 +202,6 @@ typedef struct __pre_aligned(8) _PCS_MAP_VERSION_T {
 	PCS_CHUNK_GENID_T	chunk;
 } PCS_MAP_VERSION_T;
 
-static inline void map_version_init(PCS_MAP_VERSION_T * v)
-{
-	memset(v, 0, sizeof(*v));
-}
-
 /* Returns negative value if v1 is older than v2, positive if v1 is newer than v2, 0 if they are equal */
 static inline int map_version_compare(PCS_MAP_VERSION_T const* v1, PCS_MAP_VERSION_T const* v2)
 {


More information about the Devel mailing list