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/features/bit-rot/src/bitd/bit-rot-scrub.c | 8 +++---- xlators/features/bit-rot/src/bitd/bit-rot.c | 25 +++++++++++--------- xlators/features/locks/src/posix.c | 2 +- xlators/features/marker/src/marker-quota.c | 28 +++++++++++------------ xlators/features/marker/src/marker.c | 5 ++-- xlators/features/qemu-block/src/bdrv-xlator.c | 24 ++++++++++--------- xlators/features/qemu-block/src/qb-coroutines.c | 12 +++++----- 7 files changed, 55 insertions(+), 49 deletions(-) (limited to 'xlators/features') diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c index d2b179027a2..1e9c2035c81 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c +++ b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c @@ -36,7 +36,7 @@ bitd_fetch_signature (xlator_t *this, br_child_t *child, int32_t ret = -1; ret = syncop_fgetxattr (child->xl, fd, xattr, - GLUSTERFS_GET_OBJECT_SIGNATURE, NULL); + GLUSTERFS_GET_OBJECT_SIGNATURE, NULL, NULL); if (ret < 0) { br_log_object (this, "fgetxattr", fd->inode->gfid, -ret); goto out; @@ -224,7 +224,7 @@ bitd_compare_ckum (xlator_t *this, gf_log (this->name, GF_LOG_INFO, "Marking %s [GFID: %s] as corrupted..", entry->d_name, uuid_utoa (linked_inode->gfid)); - ret = syncop_fsetxattr (child->xl, fd, xattr, 0); + ret = syncop_fsetxattr (child->xl, fd, xattr, 0, NULL, NULL); if (ret) gf_log (this->name, GF_LOG_ERROR, "Error marking object %s [GFID: %s] as corrupted", @@ -274,7 +274,7 @@ bitd_start_scrub (xlator_t *subvol, syncopctx_setfspid (&pid); - ret = syncop_lookup (child->xl, &loc, NULL, &iatt, NULL, &parent_buf); + ret = syncop_lookup (child->xl, &loc, &iatt, &parent_buf, NULL, NULL); if (ret) { br_log_object_path (this, "lookup", loc.path, -ret); goto out; @@ -304,7 +304,7 @@ bitd_start_scrub (xlator_t *subvol, goto unref_inode; } - ret = syncop_open (child->xl, &loc, O_RDWR, fd); + ret = syncop_open (child->xl, &loc, O_RDWR, fd, NULL, NULL); if (ret) { br_log_object (this, "open", linked_inode->gfid, -ret); ret = -1; diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.c b/xlators/features/bit-rot/src/bitd/bit-rot.c index 6a4de70bfbb..1202ca260eb 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot.c +++ b/xlators/features/bit-rot/src/bitd/bit-rot.c @@ -167,10 +167,12 @@ bitd_is_bad_file (xlator_t *this, br_child_t *child, loc_t *loc, fd_t *fd) if (fd) ret = syncop_fgetxattr (child->xl, fd, &xattr, - "trusted.glusterfs.bad-file", NULL); + "trusted.glusterfs.bad-file", NULL, + NULL); else if (loc) ret = syncop_getxattr (child->xl, loc, &xattr, - "trusted.glusterfs.bad-file", NULL); + "trusted.glusterfs.bad-file", NULL, + NULL); if (!ret) { gf_log (this->name, GF_LOG_DEBUG, "[GFID: %s] is marked " @@ -213,7 +215,7 @@ br_object_lookup (xlator_t *this, br_object_t *object, gf_uuid_copy (loc.gfid, object->gfid); - ret = syncop_lookup (object->child->xl, &loc, NULL, iatt, NULL, NULL); + ret = syncop_lookup (object->child->xl, &loc, iatt, NULL, NULL, NULL); if (ret < 0) goto out; @@ -259,7 +261,7 @@ br_object_open (xlator_t *this, loc.inode = inode_ref (inode); gf_uuid_copy (loc.gfid, inode->gfid); - ret = syncop_open (object->child->xl, &loc, O_RDONLY, fd); + ret = syncop_open (object->child->xl, &loc, O_RDONLY, fd, NULL, NULL); if (ret) { br_log_object (this, "open", inode->gfid, -ret); fd_unref (fd); @@ -295,7 +297,8 @@ br_object_read_block_and_sign (xlator_t *this, fd_t *fd, br_child_t *child, GF_VALIDATE_OR_GOTO (this->name, child, out); ret = syncop_readv (child->xl, fd, - size, offset, 0, &iovec, &count, &iobref); + size, offset, 0, &iovec, &count, &iobref, NULL, + NULL); if (ret < 0) { gf_log (this->name, GF_LOG_ERROR, "readv on %s failed (%s)", @@ -422,7 +425,7 @@ br_object_read_sign (inode_t *linked_inode, fd_t *fd, br_object_t *object, goto free_isign; } - ret = syncop_fsetxattr (object->child->xl, fd, xattr, 0); + ret = syncop_fsetxattr (object->child->xl, fd, xattr, 0, NULL, NULL); if (ret) { gf_log (this->name, GF_LOG_ERROR, "fsetxattr of signature to " "the object %s failed", uuid_utoa (fd->inode->gfid)); @@ -799,7 +802,7 @@ br_trigger_sign (xlator_t *this, br_child_t *child, inode_t *linked_inode, goto out; } - ret = syncop_open (child->xl, loc, O_RDWR, fd); + ret = syncop_open (child->xl, loc, O_RDWR, fd, NULL, NULL); if (ret) { br_log_object (this, "open", linked_inode->gfid, -ret); fd_unref (fd); @@ -891,7 +894,7 @@ bitd_oneshot_crawl (xlator_t *subvol, if (!ret) goto out; - ret = syncop_lookup (child->xl, &loc, NULL, &iatt, NULL, &parent_buf); + ret = syncop_lookup (child->xl, &loc, &iatt, &parent_buf, NULL, NULL); if (ret) { br_log_object_path (this, "lookup", loc.path, -ret); goto out; @@ -931,7 +934,7 @@ bitd_oneshot_crawl (xlator_t *subvol, } ret = syncop_getxattr (child->xl, &loc, &xattr, - GLUSTERFS_GET_OBJECT_SIGNATURE, NULL); + GLUSTERFS_GET_OBJECT_SIGNATURE, NULL, NULL); if (ret < 0) { op_errno = -ret; br_log_object (this, "getxattr", linked_inode->gfid, op_errno); @@ -1088,7 +1091,7 @@ br_brick_connect (xlator_t *this, br_child_t *child) gf_uuid_copy (loc.gfid, loc.inode->gfid); loc.path = gf_strdup ("/"); - ret = syncop_lookup (child->xl, &loc, NULL, &buf, NULL, &parent); + ret = syncop_lookup (child->xl, &loc, &buf, &parent, NULL, NULL); if (ret) { op_errno = -ret; ret = -1; @@ -1098,7 +1101,7 @@ br_brick_connect (xlator_t *this, br_child_t *child) } ret = syncop_getxattr (child->xl, &loc, &xattr, - GLUSTERFS_GET_BR_STUB_INIT_TIME, NULL); + GLUSTERFS_GET_BR_STUB_INIT_TIME, NULL, NULL); if (ret) { op_errno = -ret; ret = -1; diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c index ae513f3a28e..d17d0bbe108 100644 --- a/xlators/features/locks/src/posix.c +++ b/xlators/features/locks/src/posix.c @@ -550,7 +550,7 @@ fetch_pathinfo (xlator_t *this, inode_t *inode, int32_t *op_errno, loc.inode = inode_ref (inode); ret = syncop_getxattr (FIRST_CHILD(this), &loc, &dict, - GF_XATTR_PATHINFO_KEY, NULL); + GF_XATTR_PATHINFO_KEY, NULL, NULL); if (ret < 0) { *op_errno = -ret; ret = -1; diff --git a/xlators/features/marker/src/marker-quota.c b/xlators/features/marker/src/marker-quota.c index 2975e564fa6..c6cf470e5a4 100644 --- a/xlators/features/marker/src/marker-quota.c +++ b/xlators/features/marker/src/marker-quota.c @@ -2100,8 +2100,8 @@ mq_are_xattrs_set (xlator_t *this, loc_t *loc, gf_boolean_t *result, if (ret < 0) goto out; - ret = syncop_lookup (FIRST_CHILD(this), loc, dict, &stbuf, &rsp_dict, - NULL); + ret = syncop_lookup (FIRST_CHILD(this), loc, &stbuf, NULL, + dict, &rsp_dict); if (ret < 0) { gf_log (this->name, (-ret == ENOENT || -ret == ESTALE) ? GF_LOG_DEBUG:GF_LOG_ERROR, "lookup failed " @@ -2198,7 +2198,7 @@ mq_create_xattrs (xlator_t *this, loc_t *loc, gf_boolean_t objects) } ret = syncop_xattrop(FIRST_CHILD(this), loc, GF_XATTROP_ADD_ARRAY64, - dict, NULL); + dict, NULL, NULL); if (ret < 0) { gf_log (this->name, (-ret == ENOENT || -ret == ESTALE) @@ -2264,8 +2264,8 @@ mq_get_dirty (xlator_t *this, loc_t *loc, int32_t *dirty) goto out; } - ret = syncop_lookup (FIRST_CHILD(this), loc, dict, &stbuf, &rsp_dict, - NULL); + ret = syncop_lookup (FIRST_CHILD(this), loc, &stbuf, NULL, + dict, &rsp_dict); if (ret < 0) { gf_log (this->name, (-ret == ENOENT || -ret == ESTALE) ? GF_LOG_DEBUG:GF_LOG_ERROR, "lookup failed " @@ -2311,7 +2311,7 @@ mq_mark_dirty (xlator_t *this, loc_t *loc, int32_t dirty) goto out; } - ret = syncop_setxattr (FIRST_CHILD(this), loc, dict, 0); + ret = syncop_setxattr (FIRST_CHILD(this), loc, dict, 0, NULL, NULL); if (ret < 0) { gf_log (this->name, (-ret == ENOENT || -ret == ESTALE) ? GF_LOG_DEBUG:GF_LOG_ERROR, "setxattr dirty = %d " @@ -2377,8 +2377,8 @@ _mq_get_metadata (xlator_t *this, loc_t *loc, quota_meta_t *contri, goto out; } - ret = syncop_lookup (FIRST_CHILD(this), loc, dict, &stbuf, &rsp_dict, - NULL); + ret = syncop_lookup (FIRST_CHILD(this), loc, &stbuf, NULL, + dict, &rsp_dict); if (ret < 0) { gf_log (this->name, (-ret == ENOENT || -ret == ESTALE) ? GF_LOG_DEBUG:GF_LOG_ERROR, "lookup failed " @@ -2548,7 +2548,7 @@ mq_remove_contri (xlator_t *this, loc_t *loc, inode_contribution_t *contri) goto out; } - ret = syncop_removexattr (FIRST_CHILD(this), loc, contri_key, 0); + ret = syncop_removexattr (FIRST_CHILD(this), loc, contri_key, 0, NULL); if (ret < 0) { if (-ret == ENOENT || -ret == ESTALE) { /* Remove contri in done when unlink operation is @@ -2615,7 +2615,7 @@ mq_update_contri (xlator_t *this, loc_t *loc, inode_contribution_t *contri, goto out; ret = syncop_xattrop(FIRST_CHILD(this), loc, GF_XATTROP_ADD_ARRAY64, - dict, NULL); + dict, NULL, NULL); if (ret < 0) { gf_log (this->name, (-ret == ENOENT || -ret == ESTALE) ? GF_LOG_DEBUG:GF_LOG_ERROR, "xattrop failed " @@ -2674,7 +2674,7 @@ mq_update_size (xlator_t *this, loc_t *loc, quota_meta_t *delta) goto out; ret = syncop_xattrop(FIRST_CHILD(this), loc, GF_XATTROP_ADD_ARRAY64, - dict, NULL); + dict, NULL, NULL); if (ret < 0) { gf_log (this->name, (-ret == ENOENT || -ret == ESTALE) ? GF_LOG_DEBUG:GF_LOG_ERROR, "xattrop failed " @@ -3256,7 +3256,7 @@ mq_update_dirty_inode_v2 (xlator_t *this, loc_t *loc, quota_inode_ctx_t *ctx, goto out; } - ret = syncop_opendir (this, loc, fd); + ret = syncop_opendir (this, loc, fd, NULL, NULL); if (ret < 0) { gf_log (this->name, (-ret == ENOENT || -ret == ESTALE) ? GF_LOG_DEBUG:GF_LOG_ERROR, "opendir failed " @@ -3265,8 +3265,8 @@ mq_update_dirty_inode_v2 (xlator_t *this, loc_t *loc, quota_inode_ctx_t *ctx, } INIT_LIST_HEAD (&entries.list); - while ((ret = syncop_readdirp (this, fd, 131072, offset, NULL, - &entries)) != 0) { + while ((ret = syncop_readdirp (this, fd, 131072, offset, &entries, + NULL, NULL)) != 0) { if (ret < 0) { gf_log (this->name, (-ret == ENOENT || -ret == ESTALE) ? GF_LOG_DEBUG:GF_LOG_ERROR, "readdirp failed " diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c index b1eb252c5c2..fe7c634e344 100644 --- a/xlators/features/marker/src/marker.c +++ b/xlators/features/marker/src/marker.c @@ -2197,7 +2197,7 @@ remove_quota_keys (dict_t *dict, char *k, data_t *v, void *data) xlator_t *this = frame->this; int ret = -1; - ret = syncop_removexattr (FIRST_CHILD (this), &local->loc, k, 0); + ret = syncop_removexattr (FIRST_CHILD (this), &local->loc, k, 0, NULL); if (ret) { gf_log (this->name, GF_LOG_ERROR, "%s: Failed to remove " "extended attribute: %s", local->loc.path, k); @@ -2243,7 +2243,8 @@ quota_xattr_cleaner (void *args) this = frame->this; local = frame->local; - ret = syncop_listxattr (FIRST_CHILD(this), &local->loc, &xdata); + ret = syncop_listxattr (FIRST_CHILD(this), &local->loc, &xdata, NULL, + NULL); if (ret == -1) { ret = -errno; goto out; diff --git a/xlators/features/qemu-block/src/bdrv-xlator.c b/xlators/features/qemu-block/src/bdrv-xlator.c index 5a14f89e5af..5dbe292d6d7 100644 --- a/xlators/features/qemu-block/src/bdrv-xlator.c +++ b/xlators/features/qemu-block/src/bdrv-xlator.c @@ -105,8 +105,8 @@ qemu_gluster_open (BlockDriverState *bs, QDict *options, int bdrv_flags) } gf_uuid_copy(loc.gfid, loc.inode->gfid); - ret = syncop_lookup(FIRST_CHILD(THIS), &loc, NULL, &buf, NULL, - NULL); + ret = syncop_lookup(FIRST_CHILD(THIS), &loc, &buf, NULL, + NULL, NULL); if (ret) { loc_wipe(&loc); return ret; @@ -150,7 +150,7 @@ qemu_gluster_create (const char *filename, QEMUOptionParameter *options) if (!fd) return -ENOMEM; - ret = syncop_fstat (FIRST_CHILD(THIS), fd, &stat); + ret = syncop_fstat (FIRST_CHILD(THIS), fd, &stat, NULL, NULL); if (ret) { fd_unref (fd); return ret; @@ -163,7 +163,8 @@ qemu_gluster_create (const char *filename, QEMUOptionParameter *options) } if (total_size) { - ret = syncop_ftruncate (FIRST_CHILD(THIS), fd, total_size); + ret = syncop_ftruncate (FIRST_CHILD(THIS), fd, total_size, + NULL, NULL); if (ret) { fd_unref (fd); return ret; @@ -195,7 +196,7 @@ qemu_gluster_co_readv (BlockDriverState *bs, int64_t sector_num, int nb_sectors, size = nb_sectors * BDRV_SECTOR_SIZE; ret = syncop_readv (FIRST_CHILD(THIS), fd, size, offset, 0, - &iov, &count, &iobref); + &iov, &count, &iobref, NULL, NULL); if (ret < 0) goto out; @@ -245,7 +246,8 @@ qemu_gluster_co_writev (BlockDriverState *bs, int64_t sector_num, int nb_sectors iov.iov_base = iobuf_ptr (iobuf); iov.iov_len = size; - ret = syncop_writev (FIRST_CHILD(THIS), fd, &iov, 1, offset, iobref, 0); + ret = syncop_writev (FIRST_CHILD(THIS), fd, &iov, 1, offset, iobref, 0, + NULL, NULL); out: if (iobuf) @@ -265,7 +267,7 @@ qemu_gluster_co_flush (BlockDriverState *bs) fd = fd_from_bs (bs); - ret = syncop_flush (FIRST_CHILD(THIS), fd); + ret = syncop_flush (FIRST_CHILD(THIS), fd, NULL, NULL); fd_unref (fd); @@ -281,7 +283,7 @@ qemu_gluster_co_fsync (BlockDriverState *bs) fd = fd_from_bs (bs); - ret = syncop_fsync (FIRST_CHILD(THIS), fd, 0); + ret = syncop_fsync (FIRST_CHILD(THIS), fd, 0, NULL, NULL); fd_unref (fd); @@ -297,7 +299,7 @@ qemu_gluster_truncate (BlockDriverState *bs, int64_t offset) fd = fd_from_bs (bs); - ret = syncop_ftruncate (FIRST_CHILD(THIS), fd, offset); + ret = syncop_ftruncate (FIRST_CHILD(THIS), fd, offset, NULL, NULL); fd_unref (fd); @@ -314,7 +316,7 @@ qemu_gluster_getlength (BlockDriverState *bs) fd = fd_from_bs (bs); - ret = syncop_fstat (FIRST_CHILD(THIS), fd, &iatt); + ret = syncop_fstat (FIRST_CHILD(THIS), fd, &iatt, NULL, NULL); if (ret < 0) return -1; @@ -331,7 +333,7 @@ qemu_gluster_allocated_file_size (BlockDriverState *bs) fd = fd_from_bs (bs); - ret = syncop_fstat (FIRST_CHILD(THIS), fd, &iatt); + ret = syncop_fstat (FIRST_CHILD(THIS), fd, &iatt, NULL, NULL); if (ret < 0) return -1; diff --git a/xlators/features/qemu-block/src/qb-coroutines.c b/xlators/features/qemu-block/src/qb-coroutines.c index 7dee80d1d00..4457576314e 100644 --- a/xlators/features/qemu-block/src/qb-coroutines.c +++ b/xlators/features/qemu-block/src/qb-coroutines.c @@ -81,8 +81,8 @@ qb_format_and_resume (void *opaque) * Lookup the backing image. Verify existence and/or get the * gfid if we don't already have it. */ - ret = syncop_lookup(FIRST_CHILD(frame->this), &loc, NULL, &buf, - NULL, NULL); + ret = syncop_lookup(FIRST_CHILD(frame->this), &loc, &buf, NULL, + NULL, NULL); GF_FREE(qb_inode->backing_fname); if (ret) { loc_wipe(&loc); @@ -148,7 +148,7 @@ qb_format_and_resume (void *opaque) return 0; } - ret = syncop_fsetxattr (FIRST_CHILD(THIS), fd, xattr, 0); + ret = syncop_fsetxattr (FIRST_CHILD(THIS), fd, xattr, 0, NULL, NULL); if (ret) { gf_log (frame->this->name, GF_LOG_ERROR, "failed to setxattr for %s", @@ -437,7 +437,7 @@ qb_update_size_xattr (xlator_t *this, fd_t *fd, const char *fmt, off_t offset) return; } - syncop_fsetxattr (FIRST_CHILD(this), fd, xattr, 0); + syncop_fsetxattr (FIRST_CHILD(this), fd, xattr, 0, NULL, NULL); dict_unref (xattr); } @@ -476,7 +476,7 @@ qb_co_truncate (void *opaque) } ret = syncop_fstat (FIRST_CHILD(this), local->fd, - &stub->args_cbk.prestat); + &stub->args_cbk.prestat, NULL, NULL); if (ret < 0) goto out; stub->args_cbk.prestat.ia_size = qb_inode->size; @@ -490,7 +490,7 @@ qb_co_truncate (void *opaque) qb_inode->size = offset; ret = syncop_fstat (FIRST_CHILD(this), local->fd, - &stub->args_cbk.poststat); + &stub->args_cbk.poststat, NULL, NULL); if (ret < 0) goto out; stub->args_cbk.poststat.ia_size = qb_inode->size; -- cgit