From a9151c7c398f755abca20ec1055909f4ab4f3e0f Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Wed, 7 Oct 2009 03:44:00 +0000 Subject: performance/stat-prefetch: optimizations to sp_lookup. - if stat cache cannot be found for a path in its parent inode and the path is a directory, we can get the cache from the inode corresponding to path and look for "." in that cache. Signed-off-by: Anand V. Avati BUG: 284 (performance actually decreases for 'ls -l' on a directory containing large number of files with stat-prefetch loaded) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=284 --- xlators/performance/stat-prefetch/src/stat-prefetch.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'xlators/performance/stat-prefetch') diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c index 1b19a58d1..c5d05c4ae 100644 --- a/xlators/performance/stat-prefetch/src/stat-prefetch.c +++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c @@ -543,7 +543,18 @@ sp_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xattr_req) op_errno = 0; lookup_behind = 1; } - } + } else if (S_ISDIR (loc->inode->st_mode)) { + cache = sp_get_cache_inode (this, loc->inode, frame->root->pid); + if (cache) { + ret = sp_cache_get_entry (cache, ".", &dirent); + if (ret == 0) { + buf = &dirent.d_stat; + op_ret = 0; + op_errno = 0; + lookup_behind = 1; + } + } + } wind: if (lookup_behind) { -- cgit