diff options
author | Raghavendra G <raghavendra@gluster.com> | 2009-10-07 03:44:00 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-10-07 02:36:27 -0700 |
commit | a9151c7c398f755abca20ec1055909f4ab4f3e0f (patch) | |
tree | dcc94b17e4de234e097462859a72654be5af7bfd /xlators/performance/stat-prefetch/src/stat-prefetch.c | |
parent | fee63b09862e228eb95f5354c533d237e3a462b7 (diff) |
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 <avati@dev.gluster.com>
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
Diffstat (limited to 'xlators/performance/stat-prefetch/src/stat-prefetch.c')
-rw-r--r-- | xlators/performance/stat-prefetch/src/stat-prefetch.c | 13 |
1 files changed, 12 insertions, 1 deletions
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) { |