diff options
author | Amar Tumballi <amar@gluster.com> | 2011-10-20 12:20:34 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2011-10-23 23:00:48 -0700 |
commit | 333bd9b59c4298a7cb7796f3bd4ee444376c68c6 (patch) | |
tree | a12c57623b3b52fe3df18e8d282ff2fadc4eaeff /xlators | |
parent | 8404b568345b64e14b1a98ae68a5d0b1f3b568ac (diff) |
storage/posix: fill 'ia_ino' from 'ia_gfid' to preserve same ino number
take the least significant 64bit from gfid and assign it to 'ia_ino',
hence for a given file (or directory), the 'ia_ino' number is always
same.
Change-Id: I9bc01576f24a3767999bbe612d047b6849ae1215
BUG: 3042
Reviewed-on: http://review.gluster.com/624
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/storage/posix/src/posix.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 7b206390fb8..98bd2927a37 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -278,6 +278,21 @@ posix_fill_gfid_fd (xlator_t *this, int fd, struct iatt *iatt) return ret; } +void +posix_fill_ino_from_gfid (xlator_t *this, struct iatt *buf) +{ + uint64_t temp_ino = 0; + int j = 0; + int i = 0; + + /* consider least significant 8 bytes of value out of gfid */ + for (i = 15; i > (15 - 8); i--) { + temp_ino += buf->ia_gfid[i] << j; + j += 8; + } + + buf->ia_ino = temp_ino; +} int posix_lstat_with_gfid (xlator_t *this, const char *path, struct iatt *stbuf_p) @@ -299,6 +314,8 @@ posix_lstat_with_gfid (xlator_t *this, const char *path, struct iatt *stbuf_p) if (ret) gf_log_callingfn (this->name, GF_LOG_DEBUG, "failed to get gfid"); + posix_fill_ino_from_gfid (this, &stbuf); + if (stbuf_p) *stbuf_p = stbuf; out: @@ -326,6 +343,8 @@ posix_fstat_with_gfid (xlator_t *this, int fd, struct iatt *stbuf_p) if (ret) gf_log_callingfn (this->name, GF_LOG_DEBUG, "failed to get gfid"); + posix_fill_ino_from_gfid (this, &stbuf); + if (stbuf_p) *stbuf_p = stbuf; @@ -4436,6 +4455,7 @@ posix_do_readdir (call_frame_t *frame, xlator_t *this, strcpy (entry_path + real_path_len + 1, tmp_entry->d_name); posix_lstat_with_gfid (this, entry_path, &stbuf); + tmp_entry->d_ino = stbuf.ia_ino; tmp_entry->d_stat = stbuf; } } |