summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/client/src/client-helpers.c
diff options
context:
space:
mode:
authorDan Lambright <dlambrig@redhat.com>2015-02-18 14:49:50 -0500
committerVijay Bellur <vbellur@redhat.com>2015-03-18 04:47:41 -0700
commita216745e5db3fdb4fa8d625c971e70f8d0e34d23 (patch)
treec1165dbc612ec7121bd1734cb9bb006f9ac7c9d3 /xlators/protocol/client/src/client-helpers.c
parent38ccaaf9d1a93c4fc6d733ee3bd5c73e5457bdab (diff)
cluster/dht: Change the subvolume encoding in d_off to be a "global"
position in the graph rather than relative (local) to a particular translator. Encoding the volume in this way allows a single translator to manage which brick is currently being scanned for directory entries. Using a single translator minimizes allocated bits in the d_off. It also allows multiple DHT translators in the same graph to have a common frame of reference (the graph position) for which brick is being read. Multiple DHT translators are needed for the Tiering feature. The fix builds off a previous change (9332) which removed subvolume encoding from AFR. The fix makes an equivalent change to the EC translator. More background can be found in fix 9332 and gluster-dev discussions [1]. DHT and AFR/EC are responsibile (as before) for choosing which brick to enumerate directory entries in over the readdir lifecycle. The client translator receiving the readdir fop encodes the dht_t. It is referred to as the "leaf node" in the graph and corresponds to the brick being scanned. When DHT decodes the d_off, it translates the leaf node to a local subvolume, which represents the next node in the graph leading to the brick. Tracking of leaf nodes is done in common utility functions. Leaf nodes counts and positional information are updated on a graph switch. [1] www.gluster.org/pipermail/gluster-devel/2015-January/043592.html Change-Id: Iaf0ea86d7046b1ceadbad69d88707b243077ebc8 BUG: 1190734 Signed-off-by: Dan Lambright <dlambrig@redhat.com> Reviewed-on: http://review.gluster.org/9688 Reviewed-by: Xavier Hernandez <xhernandez@datalab.es> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com> Tested-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/protocol/client/src/client-helpers.c')
-rw-r--r--xlators/protocol/client/src/client-helpers.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/xlators/protocol/client/src/client-helpers.c b/xlators/protocol/client/src/client-helpers.c
index 5d9f00fdc70..be5e7b57739 100644
--- a/xlators/protocol/client/src/client-helpers.c
+++ b/xlators/protocol/client/src/client-helpers.c
@@ -141,12 +141,16 @@ client_local_wipe (clnt_local_t *local)
}
int
-unserialize_rsp_dirent (struct gfs3_readdir_rsp *rsp, gf_dirent_t *entries)
+unserialize_rsp_dirent (xlator_t *this, struct gfs3_readdir_rsp *rsp,
+ gf_dirent_t *entries)
{
struct gfs3_dirlist *trav = NULL;
gf_dirent_t *entry = NULL;
int entry_len = 0;
int ret = -1;
+ clnt_conf_t *conf = NULL;
+
+ conf = this->private;
trav = rsp->reply;
while (trav) {
@@ -156,7 +160,8 @@ unserialize_rsp_dirent (struct gfs3_readdir_rsp *rsp, gf_dirent_t *entries)
goto out;
entry->d_ino = trav->d_ino;
- entry->d_off = trav->d_off;
+ gf_itransform (this, trav->d_off, &entry->d_off,
+ conf->client_id);
entry->d_len = trav->d_len;
entry->d_type = trav->d_type;
@@ -182,12 +187,17 @@ unserialize_rsp_direntp (xlator_t *this, fd_t *fd,
inode_table_t *itable = NULL;
int entry_len = 0;
int ret = -1;
+ clnt_conf_t *conf = NULL;
trav = rsp->reply;
if (fd)
itable = fd->inode->table;
+ conf = this->private;
+ if (!conf)
+ goto out;
+
while (trav) {
entry_len = gf_dirent_size (trav->name);
entry = GF_CALLOC (1, entry_len, gf_common_mt_gf_dirent_t);
@@ -195,7 +205,8 @@ unserialize_rsp_direntp (xlator_t *this, fd_t *fd,
goto out;
entry->d_ino = trav->d_ino;
- entry->d_off = trav->d_off;
+ gf_itransform (this, trav->d_off, &entry->d_off,
+ conf->client_id);
entry->d_len = trav->d_len;
entry->d_type = trav->d_type;