diff options
| -rw-r--r-- | libglusterfs/src/iatt.h | 59 | ||||
| -rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-common.c | 6 | ||||
| -rw-r--r-- | xlators/cluster/ec/src/ec-combine.c | 4 | ||||
| -rw-r--r-- | xlators/debug/trace/src/trace.c | 6 | ||||
| -rw-r--r-- | xlators/nfs/server/src/nfs3.c | 6 | ||||
| -rw-r--r-- | xlators/storage/posix/src/posix-helpers.c | 4 | 
6 files changed, 64 insertions, 21 deletions
diff --git a/libglusterfs/src/iatt.h b/libglusterfs/src/iatt.h index b8907598b18..8cb2b4a5b27 100644 --- a/libglusterfs/src/iatt.h +++ b/libglusterfs/src/iatt.h @@ -33,7 +33,6 @@ typedef enum {          IA_IFSOCK  } ia_type_t; -  typedef struct {          uint8_t    suid:1;          uint8_t    sgid:1; @@ -45,28 +44,63 @@ typedef struct {          } owner, group, other;  } ia_prot_t; -  struct iatt { +        uint64_t     ia_flags;          uint64_t     ia_ino;        /* inode number */ -        uuid_t       ia_gfid;          uint64_t     ia_dev;        /* backing device ID */ -        ia_type_t    ia_type;       /* type of file */ -        ia_prot_t    ia_prot;       /* protection */ +        uint64_t     ia_rdev;       /* device ID (if special file) */ +        uint64_t     ia_size;       /* file size in bytes */          uint32_t     ia_nlink;      /* Link count */          uint32_t     ia_uid;        /* user ID of owner */          uint32_t     ia_gid;        /* group ID of owner */ -        uint64_t     ia_rdev;       /* device ID (if special file) */ -        uint64_t     ia_size;       /* file size in bytes */          uint32_t     ia_blksize;    /* blocksize for filesystem I/O */          uint64_t     ia_blocks;     /* number of 512B blocks allocated */ -        uint32_t     ia_atime;      /* last access time */ +        int64_t      ia_atime;      /* last access time */ +        int64_t      ia_mtime;      /* last modification time */ +        int64_t      ia_ctime;      /* last status change time */ +        int64_t      ia_btime;      /* creation time. Fill using statx */          uint32_t     ia_atime_nsec; -        uint32_t     ia_mtime;      /* last modification time */          uint32_t     ia_mtime_nsec; -        uint32_t     ia_ctime;      /* last status change time */          uint32_t     ia_ctime_nsec; +        uint32_t     ia_btime_nsec; +        uint64_t     ia_attributes; /* chattr related:compressed, immutable, +                                     * append only, encrypted etc.*/ +        uint64_t     ia_attributes_mask; /* Mask for the attributes */ + +        uuid_t       ia_gfid; +        ia_type_t    ia_type;       /* type of file */ +        ia_prot_t    ia_prot;       /* protection */  }; +/* 64-bit mask for valid members in struct iatt. */ +#define IATT_TYPE             0x0000000000000001U +#define IATT_MODE             0x0000000000000002U +#define IATT_NLINK            0x0000000000000004U +#define IATT_UID              0x0000000000000008U +#define IATT_GID              0x0000000000000010U +#define IATT_ATIME            0x0000000000000020U +#define IATT_MTIME            0x0000000000000040U +#define IATT_CTIME            0x0000000000000080U +#define IATT_INO              0x0000000000000100U +#define IATT_SIZE             0x0000000000000200U +#define IATT_BLOCKS           0x0000000000000400U +#define IATT_BTIME            0x0000000000000800U +#define IATT_GFID             0x0000000000001000U + +/* Macros for checking validity of struct iatt members.*/ +#define IATT_TYPE_VALID(iaflags) (iaflags & IATT_TYPE) +#define IATT_MODE_VALID(iaflags) (iaflags & IATT_MODE) +#define IATT_NLINK_VALID(iaflags) (iaflags & IATT_NLINK) +#define IATT_UID_VALID(iaflags) (iaflags & IATT_UID) +#define IATT_GID_VALID(iaflags) (iaflags & IATT_GID) +#define IATT_ATIME_VALID(iaflags) (iaflags & IATT_ATIME) +#define IATT_MTIME_VALID(iaflags) (iaflags & IATT_MTIME) +#define IATT_CTIME_VALID(iaflags) (iaflags & IATT_CTIME) +#define IATT_INO_VALID(iaflags) (iaflags & IATT_INO) +#define IATT_SIZE_VALID(iaflags) (iaflags & IATT_SIZE) +#define IATT_BLOCKS_VALID(iaflags) (iaflags & IATT_BLOCKS) +#define IATT_BTIME_VALID(iaflags) (iaflags & IATT_BTIME) +#define IATT_GFID_VALID(iaflags) (iaflags & IATT_GFID)  #define IA_ISREG(t) (t == IA_IFREG)  #define IA_ISDIR(t) (t == IA_IFDIR) @@ -302,6 +336,11 @@ iatt_from_stat (struct iatt *iatt, struct stat *stat)          iatt->ia_ctime      = stat->st_ctime;          iatt->ia_ctime_nsec = ST_CTIM_NSEC (stat); +        /* Setting IATT_INO in ia_flags is done in posix_fill_ino_from_gfid. */ +        iatt->ia_flags = iatt->ia_flags | IATT_TYPE | IATT_MODE | IATT_NLINK | +                         IATT_UID | IATT_GID | IATT_SIZE | IATT_BLOCKS | +                         IATT_ATIME | IATT_MTIME | IATT_CTIME; +          return 0;  } 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) {  | 
