From 346e64e578573296028efa516cd93cfaf2b17b8f Mon Sep 17 00:00:00 2001 From: Raghavendra Talur Date: Wed, 11 Mar 2015 18:36:01 +0530 Subject: libglusterfs/syncop: Add xdata to all syncop calls This patch adds support for xdata in both the request and response path of syncops. Few calls like lookup already had the support; have renamed variables in few places to maintain uniformity. xdata passed downwards is known as xdata_in and xdata passed upwards is known as xdata_out. There is an old patch by Jeff Darcy at http://review.gluster.org/#/c/8769/3 which does the same for some selected calls. It also brings in xdata support at gfapi level. xdata support at gfapi level would be introduced in subsequent patches. Change-Id: I340e94ebaf2a38e160e65bc30732e8fe1c532dcc BUG: 1158621 Signed-off-by: Raghavendra Talur Reviewed-on: http://review.gluster.org/9859 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/cluster/afr/src/afr-self-heal-data.c | 8 +++--- xlators/cluster/afr/src/afr-self-heal-entry.c | 23 +++++++++-------- xlators/cluster/afr/src/afr-self-heal-metadata.c | 11 ++++---- xlators/cluster/afr/src/afr-self-heal-name.c | 6 +++-- xlators/cluster/afr/src/afr-self-heald.c | 8 +++--- xlators/cluster/afr/src/pump.c | 32 +++++++++++++----------- 6 files changed, 49 insertions(+), 39 deletions(-) (limited to 'xlators/cluster/afr') diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c index d20b6945a7e..a8a7326e4ec 100644 --- a/xlators/cluster/afr/src/afr-self-heal-data.c +++ b/xlators/cluster/afr/src/afr-self-heal-data.c @@ -125,7 +125,7 @@ __afr_is_sink_zero_filled (xlator_t *this, fd_t *fd, size_t size, priv = this->private; ret = syncop_readv (priv->children[sink], fd, size, offset, 0, &iovec, - &count, &iobref); + &count, &iobref, NULL, NULL); if (ret < 0) goto out; ret = iov_0filled (iovec, count); @@ -155,7 +155,7 @@ __afr_selfheal_data_read_write (call_frame_t *frame, xlator_t *this, fd_t *fd, priv = this->private; ret = syncop_readv (priv->children[source], fd, size, offset, 0, - &iovec, &count, &iobref); + &iovec, &count, &iobref, NULL, NULL); if (ret <= 0) return ret; @@ -204,7 +204,7 @@ __afr_selfheal_data_read_write (call_frame_t *frame, xlator_t *this, fd_t *fd, } ret = syncop_writev (priv->children[i], fd, iovec, count, - offset, iobref, 0); + offset, iobref, 0, NULL, NULL); if (ret != iov_length (iovec, count)) { /* write() failed on this sink. unset the corresponding member in sinks[] (which is healed_sinks[] in the @@ -750,7 +750,7 @@ afr_selfheal_data_open (xlator_t *this, inode_t *inode) loc.inode = inode_ref (inode); gf_uuid_copy (loc.gfid, inode->gfid); - ret = syncop_open (this, &loc, O_RDWR|O_LARGEFILE, fd); + ret = syncop_open (this, &loc, O_RDWR|O_LARGEFILE, fd, NULL, NULL); if (ret) { fd_unref (fd); fd = NULL; diff --git a/xlators/cluster/afr/src/afr-self-heal-entry.c b/xlators/cluster/afr/src/afr-self-heal-entry.c index 1f3ea38ffd9..ab0d98bd014 100644 --- a/xlators/cluster/afr/src/afr-self-heal-entry.c +++ b/xlators/cluster/afr/src/afr-self-heal-entry.c @@ -56,7 +56,7 @@ afr_selfheal_entry_delete (xlator_t *this, inode_t *dir, const char *name, uuid_utoa (dir->gfid), name, uuid_utoa_r (replies[child].poststat.ia_gfid, g), subvol->name); - ret = syncop_rmdir (subvol, &loc, 1); + ret = syncop_rmdir (subvol, &loc, 1, NULL, NULL); break; default: gf_log (this->name, GF_LOG_WARNING, @@ -64,7 +64,7 @@ afr_selfheal_entry_delete (xlator_t *this, inode_t *dir, const char *name, uuid_utoa (dir->gfid), name, uuid_utoa_r (replies[child].poststat.ia_gfid, g), subvol->name); - ret = syncop_unlink (subvol, &loc); + ret = syncop_unlink (subvol, &loc, NULL, NULL); break; } } @@ -119,21 +119,23 @@ afr_selfheal_recreate_entry (xlator_t *this, int dst, int source, inode_t *dir, switch (iatt->ia_type) { case IA_IFDIR: - ret = syncop_mkdir (priv->children[dst], &loc, mode, xdata, 0); + ret = syncop_mkdir (priv->children[dst], &loc, mode, 0, + xdata, NULL); if (ret == 0) newentry[dst] = 1; break; case IA_IFLNK: ret = syncop_lookup (priv->children[dst], &srcloc, 0, 0, 0, 0); if (ret == 0) { - ret = syncop_link (priv->children[dst], &srcloc, &loc); + ret = syncop_link (priv->children[dst], &srcloc, &loc, + NULL, NULL); } else { ret = syncop_readlink (priv->children[source], &srcloc, - &linkname, 4096); + &linkname, 4096, NULL, NULL); if (ret <= 0) goto out; - ret = syncop_symlink (priv->children[dst], &loc, linkname, - xdata, NULL); + ret = syncop_symlink (priv->children[dst], &loc, + linkname, NULL, xdata, NULL); if (ret == 0) newentry[dst] = 1; } @@ -143,7 +145,7 @@ afr_selfheal_recreate_entry (xlator_t *this, int dst, int source, inode_t *dir, if (ret) goto out; ret = syncop_mknod (priv->children[dst], &loc, mode, - iatt->ia_rdev, xdata, &newent); + iatt->ia_rdev, &newent, xdata, NULL); if (ret == 0 && newent.ia_nlink == 1) { /* New entry created. Mark @dst pending on all sources */ newentry[dst] = 1; @@ -508,7 +510,8 @@ afr_selfheal_entry_do_subvol (call_frame_t *frame, xlator_t *this, if (!iter_frame) return -ENOMEM; - while ((ret = syncop_readdir (subvol, fd, 131072, offset, &entries))) { + while ((ret = syncop_readdir (subvol, fd, 131072, offset, &entries, + NULL, NULL))) { if (ret > 0) ret = 0; list_for_each_entry (entry, &entries.list, list) { @@ -682,7 +685,7 @@ afr_selfheal_data_opendir (xlator_t *this, inode_t *inode) loc.inode = inode_ref (inode); gf_uuid_copy (loc.gfid, inode->gfid); - ret = syncop_opendir (this, &loc, fd); + ret = syncop_opendir (this, &loc, fd, NULL, NULL); if (ret) { fd_unref (fd); fd = NULL; diff --git a/xlators/cluster/afr/src/afr-self-heal-metadata.c b/xlators/cluster/afr/src/afr-self-heal-metadata.c index 3d76647e974..11c0c9c8cd9 100644 --- a/xlators/cluster/afr/src/afr-self-heal-metadata.c +++ b/xlators/cluster/afr/src/afr-self-heal-metadata.c @@ -55,7 +55,7 @@ __afr_selfheal_metadata_do (call_frame_t *frame, xlator_t *this, inode_t *inode, uuid_utoa (inode->gfid)); ret = syncop_getxattr (priv->children[source], &loc, &xattr, NULL, - NULL); + NULL, NULL); if (ret < 0) { ret = -EIO; goto out; @@ -74,19 +74,20 @@ __afr_selfheal_metadata_do (call_frame_t *frame, xlator_t *this, inode_t *inode, ret = syncop_setattr (priv->children[i], &loc, &locked_replies[source].poststat, - AFR_HEAL_ATTR, NULL, NULL); + AFR_HEAL_ATTR, NULL, NULL, NULL, NULL); if (ret) healed_sinks[i] = 0; ret = syncop_getxattr (priv->children[i], &loc, &old_xattr, 0, - NULL); + NULL, NULL); if (old_xattr) { afr_delete_ignorable_xattrs (old_xattr); ret = syncop_removexattr (priv->children[i], &loc, "", - old_xattr); + old_xattr, NULL); } - ret = syncop_setxattr (priv->children[i], &loc, xattr, 0); + ret = syncop_setxattr (priv->children[i], &loc, xattr, 0, NULL, + NULL); if (ret) healed_sinks[i] = 0; } diff --git a/xlators/cluster/afr/src/afr-self-heal-name.c b/xlators/cluster/afr/src/afr-self-heal-name.c index 12163298f7e..ba9c3eeb6ea 100644 --- a/xlators/cluster/afr/src/afr-self-heal-name.c +++ b/xlators/cluster/afr/src/afr-self-heal-name.c @@ -177,7 +177,8 @@ __afr_selfheal_name_expunge (xlator_t *this, inode_t *parent, uuid_t pargfid, uuid_utoa (pargfid), bname, uuid_utoa_r (replies[i].poststat.ia_gfid, g), priv->children[i]->name); - ret |= syncop_rmdir (priv->children[i], &loc, 1); + ret |= syncop_rmdir (priv->children[i], &loc, 1, NULL, + NULL); break; default: gf_log (this->name, GF_LOG_WARNING, @@ -185,7 +186,8 @@ __afr_selfheal_name_expunge (xlator_t *this, inode_t *parent, uuid_t pargfid, uuid_utoa (pargfid), bname, uuid_utoa_r (replies[i].poststat.ia_gfid, g), priv->children[i]->name); - ret |= syncop_unlink (priv->children[i], &loc); + ret |= syncop_unlink (priv->children[i], &loc, NULL, + NULL); break; } } diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c index 0d8d5294f49..fe9367597a2 100644 --- a/xlators/cluster/afr/src/afr-self-heald.c +++ b/xlators/cluster/afr/src/afr-self-heald.c @@ -173,7 +173,7 @@ afr_shd_inode_find (xlator_t *this, xlator_t *subvol, uuid_t gfid) goto out; gf_uuid_copy (loc.gfid, gfid); - ret = syncop_lookup (subvol, &loc, NULL, &iatt, NULL, NULL); + ret = syncop_lookup (subvol, &loc, &iatt, NULL, NULL, NULL); if (ret < 0) goto out; @@ -199,7 +199,7 @@ afr_shd_index_inode (xlator_t *this, xlator_t *subvol) gf_uuid_copy (rootloc.gfid, rootloc.inode->gfid); ret = syncop_getxattr (subvol, &rootloc, &xattr, - GF_XATTROP_INDEX_GFID, NULL); + GF_XATTROP_INDEX_GFID, NULL, NULL); if (ret || !xattr) { errno = -ret; goto out; @@ -232,7 +232,7 @@ afr_shd_index_purge (xlator_t *subvol, inode_t *inode, char *name) loc.parent = inode_ref (inode); loc.name = name; - ret = syncop_unlink (subvol, &loc); + ret = syncop_unlink (subvol, &loc, NULL, NULL); loc_wipe (&loc); return ret; @@ -1038,7 +1038,7 @@ afr_shd_get_index_count (xlator_t *this, int i, uint64_t *count) gf_uuid_copy (rootloc.gfid, rootloc.inode->gfid); ret = syncop_getxattr (subvol, &rootloc, &xattr, - GF_XATTROP_INDEX_COUNT, NULL); + GF_XATTROP_INDEX_COUNT, NULL, NULL); if (ret < 0) goto out; diff --git a/xlators/cluster/afr/src/pump.c b/xlators/cluster/afr/src/pump.c index 139c9b6c447..ff8f5866f10 100644 --- a/xlators/cluster/afr/src/pump.c +++ b/xlators/cluster/afr/src/pump.c @@ -287,7 +287,8 @@ pump_save_path (xlator_t *this, const char *path) gf_log (this->name, GF_LOG_WARNING, "%s: failed to set the key %s", path, PUMP_PATH); - ret = syncop_setxattr (PUMP_SOURCE_CHILD (this), &loc, dict, 0); + ret = syncop_setxattr (PUMP_SOURCE_CHILD (this), &loc, dict, 0, NULL, + NULL); if (ret < 0) { gf_log (this->name, GF_LOG_INFO, @@ -464,7 +465,7 @@ gf_pump_traverse_directory (loc_t *loc) goto out; } - ret = syncop_opendir (this, loc, fd); + ret = syncop_opendir (this, loc, fd, NULL, NULL); if (ret < 0) { gf_log (this->name, GF_LOG_DEBUG, "opendir failed on %s", loc->path); @@ -475,7 +476,8 @@ gf_pump_traverse_directory (loc_t *loc) "pump opendir on %s returned=%d", loc->path, ret); - while (syncop_readdirp (this, fd, 131072, offset, NULL, &entries)) { + while (syncop_readdirp (this, fd, 131072, offset, &entries, NULL, + NULL)) { free_entries = _gf_true; if (list_empty (&entries.list)) { @@ -511,8 +513,8 @@ gf_pump_traverse_directory (loc_t *loc) entry_loc.path, iatt.ia_ino); - ret = syncop_lookup (this, &entry_loc, NULL, &iatt, - &xattr_rsp, &parent); + ret = syncop_lookup (this, &entry_loc, &iatt, &parent, + NULL, &xattr_rsp); if (ret) { gf_log (this->name, GF_LOG_ERROR, @@ -625,14 +627,14 @@ pump_xattr_cleaner (call_frame_t *frame, void *cookie, xlator_t *this, afr_build_root_loc (this, &loc); ret = syncop_removexattr (priv->children[source], &loc, - PUMP_PATH, 0); + PUMP_PATH, 0, NULL); ret = syncop_removexattr (priv->children[sink], &loc, - PUMP_SINK_COMPLETE, 0); + PUMP_SINK_COMPLETE, 0, NULL); for (i = 0; i < priv->child_count; i++) { ret = syncop_removexattr (priv->children[i], &loc, - PUMP_SOURCE_COMPLETE, 0); + PUMP_SOURCE_COMPLETE, 0, NULL); if (ret) { gf_log (this->name, GF_LOG_DEBUG, "removexattr " "failed with %s", strerror (-ret)); @@ -676,7 +678,8 @@ pump_complete_migration (xlator_t *this) "%s: failed to set the key %s", loc.path, PUMP_SOURCE_COMPLETE); - ret = syncop_setxattr (PUMP_SOURCE_CHILD (this), &loc, dict, 0); + ret = syncop_setxattr (PUMP_SOURCE_CHILD (this), &loc, dict, 0, + NULL, NULL); if (ret < 0) { gf_log (this->name, GF_LOG_DEBUG, "setxattr failed - while notifying source complete"); @@ -687,7 +690,8 @@ pump_complete_migration (xlator_t *this) "%s: failed to set the key %s", loc.path, PUMP_SINK_COMPLETE); - ret = syncop_setxattr (PUMP_SINK_CHILD (this), &loc, dict, 0); + ret = syncop_setxattr (PUMP_SINK_CHILD (this), &loc, dict, 0, + NULL, NULL); if (ret < 0) { gf_log (this->name, GF_LOG_DEBUG, "setxattr failed - while notifying sink complete"); @@ -722,8 +726,8 @@ pump_lookup_sink (loc_t *loc) if (ret) goto out; - ret = syncop_lookup (PUMP_SINK_CHILD (this), loc, - xattr_req, &iatt, &xattr_rsp, &parent); + ret = syncop_lookup (PUMP_SINK_CHILD (this), loc, &iatt, &parent, + xattr_req, &xattr_rsp); if (ret) { gf_log (this->name, GF_LOG_DEBUG, @@ -768,8 +772,8 @@ pump_task (void *data) } afr_set_root_gfid (xattr_req); - ret = syncop_lookup (this, &loc, xattr_req, - &iatt, &xattr_rsp, &parent); + ret = syncop_lookup (this, &loc, &iatt, &parent, + xattr_req, &xattr_rsp); gf_log (this->name, GF_LOG_TRACE, "lookup: path=%s gfid=%s", -- cgit