summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/syncop.c
diff options
context:
space:
mode:
authorKinglong Mee <kinglongmee@gmail.com>2018-02-12 15:13:49 +0800
committerAmar Tumballi <amarts@redhat.com>2018-02-12 21:34:46 +0000
commitd01f7244e9d9f7e3ef84e0ba7b48ef1b1b09d809 (patch)
tree1a95023e8a4097e9a07ded99642228894876d8b5 /libglusterfs/src/syncop.c
parentbfb66cc535ce473afa7e330800d2d2c38afe42c9 (diff)
gfapi: return pre/post attributes from glfs_pread/pwrite
As nfs-ganesha, a wcc data contains pre/post attributes is return in read/write rpc reply. nfs-ganesha get those attributes by two getattr between the real read/write right now. But, gluster has return pre/post attributes from glusterfsd, those attributes are skipped in syncop/gfapi, if gfapi return them, the upper user (nfs-ganesha) can use them directly without any duplicate getattr. Updates: #389 Change-Id: I7b643ae4241cfe2aeb17063de00192d81674024a Signed-off-by: Kinglong Mee <mijinlong@open-fs.com>
Diffstat (limited to 'libglusterfs/src/syncop.c')
-rw-r--r--libglusterfs/src/syncop.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c
index 58c606b238f..01036f59f8a 100644
--- a/libglusterfs/src/syncop.c
+++ b/libglusterfs/src/syncop.c
@@ -1914,6 +1914,7 @@ syncop_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
args->iobref = iobref_ref (iobref);
args->vector = iov_dup (vector, count);
args->count = count;
+ args->iatt1 = *stbuf;
}
__wake (args);
@@ -1925,7 +1926,8 @@ syncop_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
syncop_readv (xlator_t *subvol, fd_t *fd, size_t size, off_t off,
uint32_t flags, struct iovec **vector, int *count,
- struct iobref **iobref, dict_t *xdata_in, dict_t **xdata_out)
+ struct iobref **iobref, struct iatt *iatt,
+ dict_t *xdata_in, dict_t **xdata_out)
{
struct syncargs args = {0, };
@@ -1937,6 +1939,9 @@ syncop_readv (xlator_t *subvol, fd_t *fd, size_t size, off_t off,
else if (args.xdata)
dict_unref (args.xdata);
+ if (iatt)
+ *iatt = args.iatt1;
+
if (args.op_ret < 0)
goto out;
@@ -1958,7 +1963,6 @@ out:
if (args.op_ret < 0)
return -args.op_errno;
return args.op_ret;
-
}
int
@@ -1975,6 +1979,11 @@ syncop_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (xdata)
args->xdata = dict_ref (xdata);
+ if (op_ret >= 0) {
+ args->iatt1 = *prebuf;
+ args->iatt2 = *postbuf;
+ }
+
__wake (args);
return 0;
@@ -1983,7 +1992,8 @@ syncop_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
syncop_writev (xlator_t *subvol, fd_t *fd, const struct iovec *vector,
int32_t count, off_t offset, struct iobref *iobref,
- uint32_t flags, dict_t *xdata_in, dict_t **xdata_out)
+ uint32_t flags, struct iatt *preiatt, struct iatt *postiatt,
+ dict_t *xdata_in, dict_t **xdata_out)
{
struct syncargs args = {0, };
@@ -1991,6 +2001,11 @@ syncop_writev (xlator_t *subvol, fd_t *fd, const struct iovec *vector,
fd, (struct iovec *) vector, count, offset, flags, iobref,
xdata_in);
+ if (preiatt)
+ *preiatt = args.iatt1;
+ if (postiatt)
+ *postiatt = args.iatt2;
+
if (xdata_out)
*xdata_out = args.xdata;
else if (args.xdata)