diff options
| author | Raghavendra G <raghavendra@gluster.com> | 2010-04-06 02:11:19 +0000 | 
|---|---|---|
| committer | Anand V. Avati <avati@dev.gluster.com> | 2010-04-08 03:09:01 -0700 | 
| commit | 832fedddd215d8902b8a7fba1e06b4329ea2e651 (patch) | |
| tree | fbfd0c1672fc151060d3f61e1fe0e18afefa04cf | |
| parent | 0f892d517b1907e2bd8cb3ac26699e2027d67fe6 (diff) | |
performance/io-cache: make use of nano second resolution of mtime during cache validation.
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 801 (Direct io-mode support and related changes in caching translators.)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=801
| -rw-r--r-- | libglusterfs/src/protocol.h | 8 | ||||
| -rw-r--r-- | xlators/performance/io-cache/src/io-cache.c | 6 | ||||
| -rw-r--r-- | xlators/performance/io-cache/src/io-cache.h | 9 | ||||
| -rw-r--r-- | xlators/performance/io-cache/src/page.c | 7 | 
4 files changed, 19 insertions, 11 deletions
diff --git a/libglusterfs/src/protocol.h b/libglusterfs/src/protocol.h index 3b5b3087f9f..67595179a91 100644 --- a/libglusterfs/src/protocol.h +++ b/libglusterfs/src/protocol.h @@ -75,9 +75,8 @@ gf_stat_to_stat (struct gf_stat *gf_stat, struct stat *stat)  	stat->st_blksize      = ntoh32 (gf_stat->blksize);  	stat->st_blocks       = ntoh64 (gf_stat->blocks);  	stat->st_atime        = ntoh32 (gf_stat->atime); -	stat->st_mtime        = ntoh32 (gf_stat->mtime); -	stat->st_ctime        = ntoh32 (gf_stat->ctime); -	/* TODO: handle nsec */ +        stat->st_mtime        = ntoh32 (gf_stat->mtime); +        stat->st_ctime        = ntoh32 (gf_stat->ctime);  } @@ -96,8 +95,7 @@ gf_stat_from_stat (struct gf_stat *gf_stat, struct stat *stat)  	gf_stat->blocks      = hton64 (stat->st_blocks);  	gf_stat->atime       = hton32 (stat->st_atime);  	gf_stat->mtime       = hton32 (stat->st_mtime); -	gf_stat->ctime       = hton32 (stat->st_ctime); -	/* TODO: handle nsec */ +        gf_stat->ctime       = hton32 (stat->st_ctime);  } diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c index 0c015caa4cc..1172f91d284 100644 --- a/xlators/performance/io-cache/src/io-cache.c +++ b/xlators/performance/io-cache/src/io-cache.c @@ -194,6 +194,7 @@ ioc_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,  		{                          if (ioc_inode->cache.mtime == 0) {                                  ioc_inode->cache.mtime = stbuf->st_mtime; +                                ioc_inode->cache.mtime_nsec = ST_MTIM_NSEC(stbuf);                          }  		}  		ioc_inode_unlock (ioc_inode); @@ -287,8 +288,10 @@ ioc_cache_validate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,  		ioc_inode_lock (ioc_inode);  		{  			destroy_size = __ioc_inode_flush (ioc_inode); -			if (op_ret >= 0) +			if (op_ret >= 0) {  				ioc_inode->cache.mtime = stbuf->st_mtime; +                                ioc_inode->cache.mtime_nsec = ST_MTIM_NSEC(stbuf); +                        }  		}  		ioc_inode_unlock (ioc_inode);  		local_stbuf = NULL; @@ -567,6 +570,7 @@ ioc_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,                          ioc_inode_lock (ioc_inode);                          {                                  ioc_inode->cache.mtime = buf->st_mtime; +                                ioc_inode->cache.mtime_nsec = ST_MTIM_NSEC(buf);                          }                          ioc_inode_unlock (ioc_inode); diff --git a/xlators/performance/io-cache/src/io-cache.h b/xlators/performance/io-cache/src/io-cache.h index 44f621f8078..63c2609ec7f 100644 --- a/xlators/performance/io-cache/src/io-cache.h +++ b/xlators/performance/io-cache/src/io-cache.h @@ -130,9 +130,12 @@ struct ioc_page {  struct ioc_cache {          rbthash_table_t  *page_table;          struct list_head  page_lru; -	time_t            mtime;       /* -                                        * mtime of the server file when last -                                        * cached +	uint32_t          mtime;       /* +                                        * seconds component of file mtime on +                                        * server +                                        */ +        uint32_t          mtime_nsec;  /* nanosecond component of file mtime +                                        * on server                                          */  	struct timeval    tv;          /*                                          * time-stamp at last re-validate diff --git a/xlators/performance/io-cache/src/page.c b/xlators/performance/io-cache/src/page.c index fc0eba1011b..964f8d01a09 100644 --- a/xlators/performance/io-cache/src/page.c +++ b/xlators/performance/io-cache/src/page.c @@ -292,7 +292,8 @@ ioc_cache_still_valid (ioc_inode_t *ioc_inode, struct stat *stbuf)  		cache_still_valid = 0;  #else -	if (!stbuf || (stbuf->st_mtime != ioc_inode->cache.mtime)) +	if (!stbuf || (stbuf->st_mtime != ioc_inode->cache.mtime) +            || (ST_MTIM_NSEC(stbuf) != ioc_inode->cache.mtime_nsec))  		cache_still_valid = 0;  #endif @@ -366,8 +367,10 @@ ioc_fault_cbk (call_frame_t *frame, void *cookie, xlator_t *this,  			destroy_size = __ioc_inode_flush (ioc_inode);  		} -		if ((op_ret >= 0) && !zero_filled) +		if ((op_ret >= 0) && !zero_filled) {  			ioc_inode->cache.mtime = stbuf->st_mtime; +                        ST_MTIM_NSEC_SET(stbuf, ioc_inode->cache.mtime_nsec); +                }  		gettimeofday (&ioc_inode->cache.tv, NULL);  | 
