summaryrefslogtreecommitdiffstats
path: root/xlators/features/shard/src/shard.h
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2015-04-01 15:13:11 +0530
committerVijay Bellur <vbellur@redhat.com>2015-04-06 23:09:28 -0700
commitd1a5c805610115122b8ef61367b61425d7e39db5 (patch)
treedd28c0abe91d8f7af4599b5fb3e330ea3e97c8ae /xlators/features/shard/src/shard.h
parent2ef9ad2dc5822b9b88243cb7f60816fe1c531e91 (diff)
features/shard: Refactor code
* Renamed shard_writev_create_write_shards() to shard_common_resolve_shards() to appropriately reflect its functionality and for reuse in other fops too. * Move code common to MKNOD and CREATE into a macro. * Cut down on if nesting in shard_lookup_cbk() Change-Id: I488255499673accd426390c6d42f2b39bab3d637 BUG: 1205661 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: http://review.gluster.org/10096 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/features/shard/src/shard.h')
-rw-r--r--xlators/features/shard/src/shard.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/xlators/features/shard/src/shard.h b/xlators/features/shard/src/shard.h
index 4c4637567da..879aa030991 100644
--- a/xlators/features/shard/src/shard.h
+++ b/xlators/features/shard/src/shard.h
@@ -65,7 +65,26 @@
shard_local_wipe (__local); \
mem_put (__local); \
} \
-} while (0) \
+} while (0)
+
+
+#define SHARD_INODE_CREATE_INIT(this, local, xattr_req, loc, label) do { \
+ int __ret = -1; \
+ shard_priv_t *__priv = NULL; \
+ \
+ __priv = this->private; \
+ \
+ local->block_size = hton64 (__priv->block_size); \
+ __ret = dict_set_static_bin (xattr_req, GF_XATTR_SHARD_BLOCK_SIZE, \
+ &local->block_size, \
+ sizeof (local->block_size)); \
+ if (__ret) { \
+ gf_log (this->name, GF_LOG_WARNING, "Failed to set key: %s " \
+ "on path %s", GF_XATTR_SHARD_BLOCK_SIZE, loc->path); \
+ goto label; \
+ } \
+ \
+} while (0)
typedef struct shard_priv {
uint64_t block_size;