performance/stat-prefetch: implement sp_checksum.

Signed-off-by: Anand V. Avati <avati@dev.gluster.com>

BUG: 221 (stat prefetch implementation)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=221
This commit is contained in:
Raghavendra G 2009-08-23 22:36:37 +00:00 committed by Anand V. Avati
parent 251c9d6e83
commit 284b42546e
2 changed files with 41 additions and 2 deletions

View File

@ -124,7 +124,11 @@ fops to be implemented:
2. remove entries corresponding to symbolic links from cache, since readlink
would've changed st_atime.
* checksum/xattrop/fxattrop
* checksum
Delete the entry corresponding to basename from cache stored in context of
fds opened on parent inode, since st_atime is changed during this call.
* xattrop/fxattrop
These calls modify various times of stat structure, hence appropriate entries
have to be removed from the cache. I am leaving these calls unimplemented in
stat-prefetch for timebeing. Once we have a working translator, these five fops

View File

@ -1635,6 +1635,40 @@ unwind:
}
int32_t
sp_checksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, uint8_t *file_checksum,
uint8_t *dir_checksum)
{
SP_STACK_UNWIND (frame, op_ret, op_errno, file_checksum, dir_checksum);
return 0;
}
int32_t
sp_checksum (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flag)
{
sp_cache_t *cache = NULL;
GF_VALIDATE_OR_GOTO (this->name, loc, unwind);
GF_VALIDATE_OR_GOTO (this->name, loc->parent, unwind);
GF_VALIDATE_OR_GOTO (this->name, loc->name, unwind);
cache = sp_get_cache_inode (this, loc->parent, frame->root->pid);
if (cache) {
sp_cache_remove_entry (cache, (char *)loc->name, 0);
}
STACK_WIND (frame, sp_checksum_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->checksum, loc, flag);
return 0;
unwind:
SP_STACK_UNWIND (frame, -1, errno, NULL);
return 0;
}
int32_t
sp_forget (xlator_t *this, inode_t *inode)
{
@ -1703,7 +1737,8 @@ struct xlator_fops fops = {
.setxattr = sp_setxattr,
.removexattr = sp_removexattr,
.setdents = sp_setdents,
.getdents = sp_getdents
.getdents = sp_getdents,
.checksum = sp_checksum,
};
struct xlator_mops mops = {