From c58f9ce4eefa62ab0ae78d318e443486c4f80a54 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Fri, 18 Dec 2015 20:35:02 +0100 Subject: upcall: add seek() FOP Change-Id: Ic86919d28cf639b561114dc1440c6ea4bc6f7307 BUG: 1220173 Signed-off-by: Niels de Vos Reviewed-on: http://review.gluster.org/13005 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Kaleb KEITHLEY Reviewed-by: Jeff Darcy --- xlators/features/upcall/src/upcall.c | 57 ++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'xlators/features') diff --git a/xlators/features/upcall/src/upcall.c b/xlators/features/upcall/src/upcall.c index 9b724928010..3d0669b305e 100644 --- a/xlators/features/upcall/src/upcall.c +++ b/xlators/features/upcall/src/upcall.c @@ -1522,6 +1522,62 @@ err: return 0; } + +int32_t +up_seek_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, + int op_errno, off_t offset, dict_t *xdata) +{ + client_t *client = NULL; + uint32_t flags = 0; + upcall_local_t *local = NULL; + + EXIT_IF_UPCALL_OFF (this, out); + + client = frame->root->client; + local = frame->local; + + if ((op_ret < 0) || !local) { + goto out; + } + flags = UP_UPDATE_CLIENT; + upcall_cache_invalidate (frame, this, client, local->inode, flags, + NULL, NULL, NULL); + +out: + UPCALL_STACK_UNWIND (seek, frame, op_ret, op_errno, offset, xdata); + + return 0; +} + + +int32_t +up_seek (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, + gf_seek_what_t what, dict_t *xdata) +{ + int32_t op_errno = -1; + upcall_local_t *local = NULL; + + EXIT_IF_UPCALL_OFF (this, out); + + local = upcall_local_init (frame, this, fd->inode); + if (!local) { + op_errno = ENOMEM; + goto err; + } + +out: + STACK_WIND (frame, up_seek_cbk, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->seek, fd, offset, what, xdata); + + return 0; + +err: + UPCALL_STACK_UNWIND (seek, frame, -1, op_errno, 0, NULL); + + return 0; +} + + int32_t mem_acct_init (xlator_t *this) { @@ -1758,6 +1814,7 @@ struct xlator_fops fops = { .readlink = up_readlink, .readv = up_readv, .lk = up_lk, + .seek = up_seek, /* fops doing write */ .truncate = up_truncate, -- cgit