Xueqian Hu has uploaded this change for review. ( https://review.gerrithub.io/c/ffilz/nfs-ganesha/+/1233751?usp=email ) Change subject: mdcache: optimize mdc_get_parent to reduce content_lock contention ...................................................................... mdcache: optimize mdc_get_parent to reduce content_lock contention In mdcache_create_handle (PUTFH path), mdc_get_parent was called unconditionally for every entry, acquiring content_lock in exclusive write mode even for non-directory entries where parent pointers are not applicable. This caused unnecessary serialization on every NFSv4 PUTFH operation. Two optimizations: 1. Skip mdc_get_parent entirely for non-directory entries in mdcache_create_handle, since parent pointers are only meaningful for directories. 2. In mdc_get_parent, use a shared read lock first to check if the parent pointer is already cached and valid (the common case). Only upgrade to an exclusive write lock when the parent pointer actually needs to be refreshed. After acquiring the write lock, re-check to avoid redundant '..' lookups if another thread already refreshed it. Change-Id: Ifefe27bd21561bac21fe8cab9a435f280d3bb316 Signed-off-by: xueqian.hu <xh140312@outlook.com> --- M src/FSAL/Stackable_FSALs/FSAL_MDCACHE/mdcache_handle.c M src/FSAL/Stackable_FSALs/FSAL_MDCACHE/mdcache_helpers.c 2 files changed, 27 insertions(+), 7 deletions(-) git pull ssh://review.gerrithub.io:29418/ffilz/nfs-ganesha refs/changes/51/1233751/1 -- To view, visit https://review.gerrithub.io/c/ffilz/nfs-ganesha/+/1233751?usp=email To unsubscribe, or for help writing mail filters, visit https://review.gerrithub.io/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: ffilz/nfs-ganesha Gerrit-Branch: next Gerrit-Change-Id: Ifefe27bd21561bac21fe8cab9a435f280d3bb316 Gerrit-Change-Number: 1233751 Gerrit-PatchSet: 1 Gerrit-Owner: Xueqian Hu <xh140312@outlook.com>