From 9fd17c1c3c44944ea280c4c15bad0d49b298b8a9 Mon Sep 17 00:00:00 2001 From: Ravishankar N Date: Mon, 25 Dec 2017 19:19:53 +0530 Subject: posix: Introduce flags for validity of iatt members v1 of the patch started off as adding new fields to iatt that can be filled up using statx but the discussions were more around introducing masks to check the validity of different fields from a RIO perspective. To that extent, I have dropped the statx call in this version and introduced a 64 bit mask for existing fields. The masks I have defined are similar with the statx() flags' masks. I have *not* changed iatt_to_stat() to use the macros IATT_TYPE_VALID, IATT_GFID_VALID etc before blindly copying from struct iatt to struct. Also fixed warnings in xlators because of atime/mtime/ctime seconds field change from uint32_t to int64_t. Change-Id: I4ac614f1e8d5c8246fc99d5bc2d2a23e7941512b Signed-off-by: Ravishankar N --- xlators/cluster/afr/src/afr-self-heal-common.c | 6 +++--- xlators/cluster/ec/src/ec-combine.c | 4 ++-- xlators/debug/trace/src/trace.c | 6 +++--- xlators/nfs/server/src/nfs3.c | 6 +++--- xlators/storage/posix/src/posix-helpers.c | 4 ++++ 5 files changed, 15 insertions(+), 11 deletions(-) (limited to 'xlators') diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c index 7e020bb6bee..88a3d9618e3 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.c +++ b/xlators/cluster/afr/src/afr-self-heal-common.c @@ -1015,7 +1015,7 @@ afr_sh_fav_by_majority (xlator_t *this, struct afr_reply *replies, for (i = 0; i < priv->child_count; i++) { if (replies[i].valid == 1) { gf_msg_debug (this->name, 0, "Child:%s " - "mtime_sec = %d, size = %lu for gfid %s", + "mtime_sec = %ld, size = %lu for gfid %s", priv->children[i]->name, replies[i].poststat.ia_mtime, replies[i].poststat.ia_size, @@ -1056,7 +1056,7 @@ afr_sh_fav_by_mtime (xlator_t *this, struct afr_reply *replies, inode_t *inode) for (i = 0; i < priv->child_count; i++) { if (replies[i].valid == 1) { gf_msg_debug (this->name, 0, "Child:%s " - "mtime = %d, mtime_nsec = %d for gfid %s", + "mtime = %ld, mtime_nsec = %d for gfid %s", priv->children[i]->name, replies[i].poststat.ia_mtime, replies[i].poststat.ia_mtime_nsec, @@ -1096,7 +1096,7 @@ afr_sh_fav_by_ctime (xlator_t *this, struct afr_reply *replies, inode_t *inode) for (i = 0; i < priv->child_count; i++) { if (replies[i].valid == 1) { gf_msg_debug (this->name, 0, "Child:%s " - "ctime = %d, ctime_nsec = %d for gfid %s", + "ctime = %ld, ctime_nsec = %d for gfid %s", priv->children[i]->name, replies[i].poststat.ia_ctime, replies[i].poststat.ia_ctime_nsec, diff --git a/xlators/cluster/ec/src/ec-combine.c b/xlators/cluster/ec/src/ec-combine.c index 01a865628f9..b51ec87a934 100644 --- a/xlators/cluster/ec/src/ec-combine.c +++ b/xlators/cluster/ec/src/ec-combine.c @@ -98,8 +98,8 @@ ec_combine_write (ec_fop_data_t *fop, ec_cbk_data_t *dst, return 1; } -void ec_iatt_time_merge(uint32_t * dst_sec, uint32_t * dst_nsec, - uint32_t src_sec, uint32_t src_nsec) +void ec_iatt_time_merge(int64_t *dst_sec, uint32_t *dst_nsec, + int64_t src_sec, uint32_t src_nsec) { if ((*dst_sec < src_sec) || ((*dst_sec == src_sec) && (*dst_nsec < src_nsec))) diff --git a/xlators/debug/trace/src/trace.c b/xlators/debug/trace/src/trace.c index c85f2a7a994..be2f84d936f 100644 --- a/xlators/debug/trace/src/trace.c +++ b/xlators/debug/trace/src/trace.c @@ -41,9 +41,9 @@ trace_stat_to_str(struct iatt *buf, char *str, size_t len) snprintf (str, len, "gfid=%s ino=%"PRIu64", mode=%o, " "nlink=%"GF_PRI_NLINK", uid=%u, gid=%u, size=%"PRIu64", " "blocks=%"PRIu64", atime=%s mtime=%s ctime=%s " - "atime_sec=%"PRIu32", atime_nsec=%"PRIu32"," - " mtime_sec=%"PRIu32", mtime_nsec=%"PRIu32", " - "ctime_sec=%"PRIu32", ctime_nsec=%"PRIu32"", + "atime_sec=%"PRId64", atime_nsec=%"PRIu32"," + " mtime_sec=%"PRId64", mtime_nsec=%"PRIu32", " + "ctime_sec=%"PRId64", ctime_nsec=%"PRIu32"", uuid_utoa (buf->ia_gfid), buf->ia_ino, st_mode_from_ia (buf->ia_prot, buf->ia_type), buf->ia_nlink, buf->ia_uid, buf->ia_gid, buf->ia_size, buf->ia_blocks, diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c index 6428a77442e..93f5124acf4 100644 --- a/xlators/nfs/server/src/nfs3.c +++ b/xlators/nfs/server/src/nfs3.c @@ -2661,14 +2661,14 @@ nfs3svc_create_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if ((cs->stbuf.ia_mtime == buf->ia_mtime) && (cs->stbuf.ia_atime == buf->ia_atime)) { gf_msg_debug (GF_NFS3, 0, - "Create req retransmitted verf %x %x", + "Create req retransmitted verf %ld %ld", cs->stbuf.ia_mtime, cs->stbuf.ia_atime); stat = NFS3_OK; nfs3_fh_build_child_fh (&cs->parent, buf, &cs->fh); } else { gf_msg_debug (GF_NFS3, 0, - "File already exist new_verf %x %x" - "old_verf %x %x", cs->stbuf.ia_mtime, + "File already exist new_verf %ld %ld" + "old_verf %ld %ld", cs->stbuf.ia_mtime, cs->stbuf.ia_atime, buf->ia_mtime, buf->ia_atime); stat = NFS3ERR_EXIST; diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index 39d29f413a8..e299dcb837c 100644 --- a/xlators/storage/posix/src/posix-helpers.c +++ b/xlators/storage/posix/src/posix-helpers.c @@ -597,6 +597,7 @@ posix_fill_ino_from_gfid (xlator_t *this, struct iatt *buf) goto out; } buf->ia_ino = gfid_to_ino (buf->ia_gfid); + buf->ia_flags |= IATT_INO; out: return; } @@ -618,6 +619,7 @@ posix_fdstat (xlator_t *this, int fd, struct iatt *stbuf_p) iatt_from_stat (&stbuf, &fstatbuf); ret = posix_fill_gfid_fd (this, fd, &stbuf); + stbuf.ia_flags |= IATT_GFID; posix_fill_ino_from_gfid (this, &stbuf); @@ -688,6 +690,7 @@ posix_istat (xlator_t *this, uuid_t gfid, const char *basename, posix_fill_gfid_path (this, real_path, &stbuf); else gf_uuid_copy (stbuf.ia_gfid, gfid); + stbuf.ia_flags |= IATT_GFID; posix_fill_ino_from_gfid (this, &stbuf); @@ -716,6 +719,7 @@ posix_pstat (xlator_t *this, uuid_t gfid, const char *path, gf_uuid_copy (stbuf.ia_gfid, gfid); else posix_fill_gfid_path (this, path, &stbuf); + stbuf.ia_flags |= IATT_GFID; ret = sys_lstat (path, &lstatbuf); if (ret == -1) { -- cgit