summaryrefslogtreecommitdiffstats
path: root/xlators/features/shard/src/shard.h
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2015-04-01 16:00:05 +0530
committerVijay Bellur <vbellur@redhat.com>2015-04-08 15:23:29 +0000
commit4be65bb376e2fffd7175f579724aae4c5718d57c (patch)
treeaf258397a2efdd5f5a6c9ae0309c05c11a9f386f /xlators/features/shard/src/shard.h
parent346e64e578573296028efa516cd93cfaf2b17b8f (diff)
features/shard: Introduce file size xattr
With each inode write FOP, the size and block count of the file will be updated within the xattr. There are two 64 byte fields that are intentionally left blank for now for future use when consistency guarantee is introduced later in sharding. Change-Id: I40a2e700150c1f199a6bf87909f063c84ab7bb43 BUG: 1207603 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: http://review.gluster.org/10097 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/features/shard/src/shard.h')
-rw-r--r--xlators/features/shard/src/shard.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/xlators/features/shard/src/shard.h b/xlators/features/shard/src/shard.h
index 879aa030991..0eeabc51f5e 100644
--- a/xlators/features/shard/src/shard.h
+++ b/xlators/features/shard/src/shard.h
@@ -24,6 +24,7 @@
#define SHARD_MIN_BLOCK_SIZE (4 * GF_UNIT_MB)
#define SHARD_MAX_BLOCK_SIZE (4 * GF_UNIT_TB)
#define GF_XATTR_SHARD_BLOCK_SIZE "trusted.glusterfs.shard.block-size"
+#define GF_XATTR_SHARD_FILE_SIZE "trusted.glusterfs.shard.file-size"
#define SHARD_ROOT_GFID "be318638-e8a0-4c6d-977d-7a937aa84806"
#define SHARD_INODE_LRU_LIMIT 4096
@@ -70,6 +71,7 @@
#define SHARD_INODE_CREATE_INIT(this, local, xattr_req, loc, label) do { \
int __ret = -1; \
+ uint64_t *__size_attr = NULL; \
shard_priv_t *__priv = NULL; \
\
__priv = this->private; \
@@ -84,8 +86,34 @@
goto label; \
} \
\
+ __ret = shard_set_size_attrs (0, 0, &__size_attr); \
+ if (__ret) \
+ goto label; \
+ \
+ __ret = dict_set_bin (xattr_req, GF_XATTR_SHARD_FILE_SIZE, \
+ __size_attr, 8 * 4); \
+ if (__ret) { \
+ gf_log (this->name, GF_LOG_WARNING, "Failed to set key: %s " \
+ "on path %s", GF_XATTR_SHARD_FILE_SIZE, loc->path); \
+ GF_FREE (__size_attr); \
+ goto label; \
+ } \
+} while (0)
+
+
+#define SHARD_MD_READ_FOP_INIT_REQ_DICT(this, xattr_req, gfid, label) do { \
+ int __ret = -1; \
+ \
+ __ret = dict_set_uint64 (xattr_req, GF_XATTR_SHARD_FILE_SIZE, 8 * 4); \
+ if (__ret) { \
+ gf_log (this->name, GF_LOG_WARNING, "Failed to set dict" \
+ " value: key:%s for %s.", GF_XATTR_SHARD_FILE_SIZE, \
+ uuid_utoa (gfid)); \
+ goto label; \
+ } \
} while (0)
+
typedef struct shard_priv {
uint64_t block_size;
uuid_t dot_shard_gfid;
@@ -119,6 +147,8 @@ typedef struct shard_local {
dict_t *xattr_req;
dict_t *xattr_rsp;
inode_t **inode_list;
+ struct iatt prebuf;
+ struct iatt postbuf;
struct iovec *vector;
struct iobref *iobref;
struct {