summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShyamsundarR <srangana@redhat.com>2018-05-08 11:02:25 -0400
committerShyamsundarR <srangana@redhat.com>2018-05-08 11:27:48 -0400
commitacaea514b6c31099e657224adb116a96070d51a2 (patch)
tree81ab7ff82c37b7b061bdb237e854a0fe52748147
parentb09db37b4fb17816631b3e837ff08a98376e0c0a (diff)
Revert "gfapi: return pre/post attributes from glfs_ftruncate"
This reverts commit 248152767b0599986bbb6bb35fc27197f6be6964. This is being reverted as the API signatures should adapt to a statx like structure, and also all APIs that need to return pre/post attrs are not complete. As a result, instead of fixing up part of the APIs and then refixing the same in a later release, removing these set of fixes from the branch. Additionally fixed up cloudsync.c code that was using the new syncop signature. Updates: bz#1575386 Change-Id: Idb59d20666c0d7b0c83e7fdc31dd68b8c7db9550
-rw-r--r--api/src/gfapi.aliases3
-rw-r--r--api/src/gfapi.map2
-rw-r--r--api/src/glfs-fops.c36
-rw-r--r--api/src/glfs.h5
-rwxr-xr-xlibglusterfs/src/generator.py2
-rw-r--r--libglusterfs/src/syncop.c15
-rw-r--r--libglusterfs/src/syncop.h1
-rw-r--r--tests/basic/gfapi/mandatory-lock-optimal.c2
-rw-r--r--xlators/cluster/dht/src/dht-rebalance.c11
-rw-r--r--xlators/features/cloudsync/src/cloudsync.c2
10 files changed, 17 insertions, 62 deletions
diff --git a/api/src/gfapi.aliases b/api/src/gfapi.aliases
index 6ddfe623b41..8b774f09754 100644
--- a/api/src/gfapi.aliases
+++ b/api/src/gfapi.aliases
@@ -34,7 +34,7 @@ _pub_glfs_preadv_async _glfs_preadv_async$GFAPI_3.4.0
_pub_glfs_pwritev_async _glfs_pwritev_async$GFAPI_3.4.0
_pub_glfs_lseek _glfs_lseek$GFAPI_3.4.0
_pub_glfs_truncate _glfs_truncate$GFAPI_3.7.15
-_pub_glfs_ftruncate34 _glfs_ftruncate34$GFAPI_3.4.0
+_pub_glfs_ftruncate _glfs_ftruncate$GFAPI_3.4.0
_pub_glfs_ftruncate_async _glfs_ftruncate_async$GFAPI_3.4.0
_pub_glfs_lstat _glfs_lstat$GFAPI_3.4.0
_pub_glfs_stat _glfs_stat$GFAPI_3.4.0
@@ -177,4 +177,3 @@ _pub_glfs_pread _glfs_pread$GFAPI_4.0.0
_pub_glfs_pwrite _glfs_pwrite$GFAPI_4.0.0
_pub_glfs_fsync _glfs_fsync$GFAPI_4.0.0
_pub_glfs_fdatasync _glfs_fdatasync$GFAPI_4.0.0
-_pub_glfs_ftruncate _glfs_ftruncate$GFAPI_4.0.0
diff --git a/api/src/gfapi.map b/api/src/gfapi.map
index 1e5bee17d9f..03ecee811da 100644
--- a/api/src/gfapi.map
+++ b/api/src/gfapi.map
@@ -37,6 +37,7 @@ GFAPI_3.4.0 {
glfs_preadv_async;
glfs_pwritev_async;
glfs_lseek;
+ glfs_ftruncate;
glfs_ftruncate_async;
glfs_lstat;
glfs_stat;
@@ -225,5 +226,4 @@ GFAPI_4.0.0 {
glfs_pwrite;
glfs_fsync;
glfs_fdatasync;
- glfs_ftruncate;
} GFAPI_3.13.0;
diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c
index 8f24b77b0b5..f314c36463d 100644
--- a/api/src/glfs-fops.c
+++ b/api/src/glfs-fops.c
@@ -1774,14 +1774,12 @@ invalid_fs:
GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_fdatasync_async, 3.4.0);
-static int
-glfs_ftruncate_common (struct glfs_fd *glfd, off_t offset,
- struct stat *prestat, struct stat *poststat)
+int
+pub_glfs_ftruncate (struct glfs_fd *glfd, off_t offset)
{
int ret = -1;
xlator_t *subvol = NULL;
fd_t *fd = NULL;
- struct iatt preiatt = {0, }, postiatt = {0, };
dict_t *fop_attr = NULL;
DECLARE_OLD_THIS;
@@ -1807,16 +1805,9 @@ glfs_ftruncate_common (struct glfs_fd *glfd, off_t offset,
if (ret)
gf_msg_debug ("gfapi", 0, "Getting leaseid from thread failed");
- ret = syncop_ftruncate (subvol, fd, offset, &preiatt, &postiatt,
- fop_attr, NULL);
- DECODE_SYNCOP_ERR (ret);
+ ret = syncop_ftruncate (subvol, fd, offset, fop_attr, NULL);
- if (ret >= 0) {
- if (prestat)
- glfs_iatt_to_stat (glfd->fs, &preiatt, prestat);
- if (poststat)
- glfs_iatt_to_stat (glfd->fs, &postiatt, poststat);
- }
+ DECODE_SYNCOP_ERR (ret);
out:
if (fd)
fd_unref (fd);
@@ -1833,24 +1824,7 @@ invalid_fs:
return ret;
}
-int
-pub_glfs_ftruncate34 (struct glfs_fd *glfd, off_t offset)
-{
- return glfs_ftruncate_common (glfd, offset, NULL, NULL);
-}
-
-GFAPI_SYMVER_PUBLIC(glfs_ftruncate34, glfs_ftruncate, 3.4.0);
-
-
-int
-pub_glfs_ftruncate (struct glfs_fd *glfd, off_t offset, struct stat *prestat,
- struct stat *poststat)
-{
- return glfs_ftruncate_common (glfd, offset, prestat, poststat);
-}
-
-GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_ftruncate, 4.0.0);
-
+GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_ftruncate, 3.4.0);
int
pub_glfs_truncate (struct glfs *fs, const char *path, off_t length)
diff --git a/api/src/glfs.h b/api/src/glfs.h
index b20bbf4450d..97331d2398c 100644
--- a/api/src/glfs.h
+++ b/api/src/glfs.h
@@ -571,9 +571,8 @@ off_t glfs_lseek (glfs_fd_t *fd, off_t offset, int whence) __THROW
int glfs_truncate (glfs_t *fs, const char *path, off_t length) __THROW
GFAPI_PUBLIC(glfs_truncate, 3.7.15);
-int glfs_ftruncate (glfs_fd_t *fd, off_t length, struct stat *prestat,
- struct stat *poststat) __THROW
- GFAPI_PUBLIC(glfs_ftruncate, 4.0.0);
+int glfs_ftruncate (glfs_fd_t *fd, off_t length) __THROW
+ GFAPI_PUBLIC(glfs_ftruncate, 3.4.0);
int glfs_ftruncate_async (glfs_fd_t *fd, off_t length, glfs_io_cbk fn,
void *data) __THROW
GFAPI_PUBLIC(glfs_ftruncate_async, 3.4.0);
diff --git a/libglusterfs/src/generator.py b/libglusterfs/src/generator.py
index 29e02782638..d8afd2e11cf 100755
--- a/libglusterfs/src/generator.py
+++ b/libglusterfs/src/generator.py
@@ -303,8 +303,6 @@ ops['access'] = (
ops['ftruncate'] = (
('fop-arg', 'fd', 'fd_t *', 'fd'),
('fop-arg', 'offset', 'off_t', 'offset'),
- ('extra', 'preop', 'struct iatt', '&preop'),
- ('extra', 'postop', 'struct iatt', '&postop'),
('fop-arg', 'xdata', 'dict_t *', 'xdata'),
('cbk-arg', 'prebuf', 'struct iatt *'),
('cbk-arg', 'postbuf', 'struct iatt *'),
diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c
index 3db6fae6b00..4fb55c2b4ab 100644
--- a/libglusterfs/src/syncop.c
+++ b/libglusterfs/src/syncop.c
@@ -2348,31 +2348,20 @@ syncop_ftruncate_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;
}
int
-syncop_ftruncate (xlator_t *subvol, fd_t *fd, off_t offset,
- struct iatt *preiatt, struct iatt *postiatt,
- dict_t *xdata_in, dict_t **xdata_out)
+syncop_ftruncate (xlator_t *subvol, fd_t *fd, off_t offset, dict_t *xdata_in,
+ dict_t **xdata_out)
{
struct syncargs args = {0, };
SYNCOP (subvol, (&args), syncop_ftruncate_cbk, subvol->fops->ftruncate,
fd, offset, xdata_in);
- if (preiatt)
- *preiatt = args.iatt1;
- if (postiatt)
- *postiatt = args.iatt2;
-
if (xdata_out)
*xdata_out = args.xdata;
else if (args.xdata)
diff --git a/libglusterfs/src/syncop.h b/libglusterfs/src/syncop.h
index 3000d2e74c9..e99ca8aa7ae 100644
--- a/libglusterfs/src/syncop.h
+++ b/libglusterfs/src/syncop.h
@@ -472,7 +472,6 @@ int syncop_readv (xlator_t *subvol, fd_t *fd, size_t size, off_t off,
struct iatt *iatt, dict_t *xdata_in, dict_t **xdata_out);
int syncop_ftruncate (xlator_t *subvol, fd_t *fd, off_t offset,
- struct iatt *preiatt, struct iatt *postiatt,
dict_t *xdata_in, dict_t **xdata_out);
int syncop_truncate (xlator_t *subvol, loc_t *loc, off_t offset,
diff --git a/tests/basic/gfapi/mandatory-lock-optimal.c b/tests/basic/gfapi/mandatory-lock-optimal.c
index 9fb5ad657b0..6c62f437a0f 100644
--- a/tests/basic/gfapi/mandatory-lock-optimal.c
+++ b/tests/basic/gfapi/mandatory-lock-optimal.c
@@ -366,7 +366,7 @@ void run_test_7 (int i) {
if (!fd2)
LOG_ERR ("glfs_open", errno);
- ret = glfs_ftruncate (fd2, 4, NULL, NULL);
+ ret = glfs_ftruncate (fd2, 4);
if (ret == 0 || errno != EAGAIN)
LOG_ERR ("glfs_ftruncate", errno);
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
index 91fb94d529c..c5f68f8adf3 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -877,7 +877,6 @@ __dht_rebalance_create_dst_file (xlator_t *this, xlator_t *to, xlator_t *from,
* in some cases
*/
ret2 = syncop_ftruncate (to, fd, 0,
- NULL, NULL,
NULL, NULL);
if (ret2 < 0) {
gf_msg (this->name,
@@ -893,8 +892,7 @@ __dht_rebalance_create_dst_file (xlator_t *this, xlator_t *to, xlator_t *from,
}
if (!conf->use_fallocate) {
- ret = syncop_ftruncate (to, fd, stbuf->ia_size, NULL,
- NULL, NULL, NULL);
+ ret = syncop_ftruncate (to, fd, stbuf->ia_size, NULL, NULL);
if (ret < 0) {
*fop_errno = -ret;
gf_msg (this->name, GF_LOG_WARNING, -ret,
@@ -1770,7 +1768,7 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
}
- ret = syncop_ftruncate (to, dst_fd, 0, NULL, NULL, NULL, NULL);
+ ret = syncop_ftruncate (to, dst_fd, 0, NULL, NULL);
if (ret) {
gf_log (this->name, GF_LOG_WARNING,
"%s: failed to perform truncate on %s (%s)",
@@ -2204,7 +2202,7 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
/* Free up the data blocks on the source node, as the whole
file is migrated */
- ret = syncop_ftruncate (from, src_fd, 0, NULL, NULL, NULL, NULL);
+ ret = syncop_ftruncate (from, src_fd, 0, NULL, NULL);
if (ret) {
gf_log (this->name, GF_LOG_WARNING,
"%s: failed to perform truncate on %s (%s)",
@@ -2337,8 +2335,7 @@ out:
/* reset the destination back to 0 */
if (clean_dst) {
- lk_ret = syncop_ftruncate (to, dst_fd, 0, NULL, NULL,
- NULL, NULL);
+ lk_ret = syncop_ftruncate (to, dst_fd, 0, NULL, NULL);
if (lk_ret) {
gf_msg (this->name, GF_LOG_ERROR, -lk_ret,
DHT_MSG_MIGRATE_FILE_FAILED,
diff --git a/xlators/features/cloudsync/src/cloudsync.c b/xlators/features/cloudsync/src/cloudsync.c
index 48e27c372b6..ce3e41bff63 100644
--- a/xlators/features/cloudsync/src/cloudsync.c
+++ b/xlators/features/cloudsync/src/cloudsync.c
@@ -901,7 +901,7 @@ cs_download_task (void *arg)
/*using dlfd as it is anonymous and have RDWR flag*/
ret = syncop_ftruncate (FIRST_CHILD (this), local->dlfd, 0,
- NULL, NULL, NULL, NULL);
+ NULL, NULL);
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0, -ret,
"ftruncate failed");