diff options
Diffstat (limited to 'xlators/features')
-rw-r--r-- | xlators/features/filter/src/filter.c | 69 | ||||
-rw-r--r-- | xlators/features/locks/src/posix.c | 19 | ||||
-rw-r--r-- | xlators/features/path-convertor/src/path.c | 81 | ||||
-rw-r--r-- | xlators/features/quota/src/quota.c | 45 | ||||
-rw-r--r-- | xlators/features/trash/src/trash.c | 78 |
5 files changed, 218 insertions, 74 deletions
diff --git a/xlators/features/filter/src/filter.c b/xlators/features/filter/src/filter.c index 67395655771..ce31753a432 100644 --- a/xlators/features/filter/src/filter.c +++ b/xlators/features/filter/src/filter.c @@ -202,7 +202,8 @@ filter_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { int ret = 0; if (op_ret >= 0) { @@ -360,12 +361,13 @@ filter_truncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { if (op_ret >= 0) { - update_stat (buf, this->private); + update_stat (postbuf, this->private); } - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -410,12 +412,13 @@ filter_ftruncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { if (op_ret >= 0) { - update_stat (buf, this->private); + update_stat (postbuf, this->private); } - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -441,9 +444,10 @@ filter_readlink_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *path) + const char *path, + struct stat *sbuf) { - STACK_UNWIND (frame, op_ret, op_errno, path); + STACK_UNWIND (frame, op_ret, op_errno, path, sbuf); return 0; } @@ -483,7 +487,9 @@ filter_mknod_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { int ret = 0; @@ -541,7 +547,9 @@ filter_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { int ret = 0; if (op_ret >= 0) { @@ -595,7 +603,9 @@ filter_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno); return 0; @@ -644,7 +654,9 @@ filter_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno); return 0; @@ -695,7 +707,9 @@ filter_symlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { int ret = 0; if (op_ret >= 0) { @@ -751,7 +765,11 @@ filter_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { if (op_ret >= 0) { update_stat (buf, this->private); @@ -809,7 +827,9 @@ filter_link_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { int ret = 0; if (op_ret >= 0) { @@ -856,7 +876,9 @@ filter_create_cbk (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { int ret = 0; if (op_ret >= 0) { @@ -922,7 +944,8 @@ filter_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, + int32_t wbflags) { int32_t ret = 0; ret = update_frame (frame, loc->inode, this->private); @@ -960,7 +983,7 @@ filter_open (call_frame_t *frame, filter_open_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->open, - loc, flags, fd); + loc, flags, fd, wbflags); return 0; } @@ -1012,15 +1035,17 @@ filter_writev_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *stbuf) + struct stat *prebuf, + struct stat *postbuf) { if (op_ret >= 0) { - update_stat (stbuf, this->private); + update_stat (postbuf, this->private); } STACK_UNWIND (frame, op_ret, op_errno, - stbuf); + prebuf, + postbuf); return 0; } diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c index 605902641d4..379c2d9158c 100644 --- a/xlators/features/locks/src/posix.c +++ b/xlators/features/locks/src/posix.c @@ -58,7 +58,8 @@ struct _truncate_ops { int pl_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { struct _truncate_ops *local = NULL; @@ -67,7 +68,7 @@ pl_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (local->op == TRUNCATE) loc_wipe (&local->loc); - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -307,13 +308,13 @@ pl_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int -pl_open (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t flags, fd_t *fd) +pl_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, + fd_t *fd, int32_t wbflags) { /* why isn't O_TRUNC being handled ? */ STACK_WIND (frame, pl_open_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->open, - loc, flags & ~O_TRUNC, fd); + loc, flags & ~O_TRUNC, fd, wbflags); return 0; } @@ -322,7 +323,8 @@ pl_open (call_frame_t *frame, xlator_t *this, int pl_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - fd_t *fd, inode_t *inode, struct stat *buf) + fd_t *fd, inode_t *inode, struct stat *buf, + struct stat *preparent, struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, fd, inode, buf); @@ -354,9 +356,10 @@ pl_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int pl_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno, stbuf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } diff --git a/xlators/features/path-convertor/src/path.c b/xlators/features/path-convertor/src/path.c index b53286104aa..9657def90c4 100644 --- a/xlators/features/path-convertor/src/path.c +++ b/xlators/features/path-convertor/src/path.c @@ -134,7 +134,9 @@ path_create_cbk (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, fd, inode, buf); return 0; @@ -184,9 +186,10 @@ path_readlink_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *buf) + const char *buf, + struct stat *sbuf) { - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, buf, sbuf); return 0; } @@ -198,7 +201,8 @@ path_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *xattr) + dict_t *xattr, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf, xattr); return 0; @@ -212,7 +216,9 @@ path_symlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -225,7 +231,9 @@ path_mknod_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -239,7 +247,9 @@ path_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -252,7 +262,9 @@ path_link_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -271,7 +283,25 @@ path_opendir_cbk (call_frame_t *frame, } -int32_t +int32_t +path_rename_buf_cbk (call_frame_t *frame, + void *cookie, + xlator_t *this, + int32_t op_ret, + int32_t op_errno, + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) +{ + STACK_UNWIND (frame, op_ret, op_errno, buf); + return 0; +} + + + +int32_t path_common_buf_cbk (call_frame_t *frame, void *cookie, xlator_t *this, @@ -296,6 +326,25 @@ path_common_dict_cbk (call_frame_t *frame, } int32_t +path_common_remove_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno,struct stat *preparent, + struct stat *postparent) +{ + STACK_UNWIND (frame, op_ret, op_errno); + return 0; +} + +int32_t +path_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno,struct stat *prebuf, + struct stat *postbuf) +{ + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); + return 0; +} + + +int32_t path_common_cbk (call_frame_t *frame, void *cookie, xlator_t *this, @@ -465,7 +514,7 @@ path_unlink (call_frame_t *frame, loc->path = tmp_path; STACK_WIND (frame, - path_common_cbk, + path_common_remove_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->unlink, loc); @@ -492,7 +541,7 @@ path_rmdir (call_frame_t *frame, loc->path = tmp_path; STACK_WIND (frame, - path_common_cbk, + path_common_remove_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->rmdir, loc); @@ -558,7 +607,7 @@ path_rename (call_frame_t *frame, newloc->path = tmp_newloc_path; STACK_WIND (frame, - path_common_buf_cbk, + path_rename_buf_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->rename, oldloc, @@ -677,7 +726,7 @@ path_truncate (call_frame_t *frame, loc->path = tmp_path; STACK_WIND (frame, - path_common_buf_cbk, + path_truncate_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->truncate, loc, @@ -696,7 +745,8 @@ path_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, + int32_t wbflags) { char *loc_path = (char *)loc->path; char *tmp_path = NULL; @@ -713,7 +763,8 @@ path_open (call_frame_t *frame, FIRST_CHILD(this)->fops->open, loc, flags, - fd); + fd, + wbflags); loc->path = loc_path; if (tmp_path != loc_path) diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index 94a7ec83b25..e6c5b5dbfb3 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -154,7 +154,8 @@ gf_quota_check_free_disk (xlator_t *this) int quota_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { struct quota_priv *priv = this->private; struct quota_local *local = NULL; @@ -163,11 +164,11 @@ quota_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if ((op_ret >= 0) && priv->disk_usage_limit) { gf_quota_usage_subtract (this, (local->stbuf.st_blocks - - buf->st_blocks) * 512); + postbuf->st_blocks) * 512); loc_wipe (&local->loc); } - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -225,7 +226,8 @@ quota_truncate (call_frame_t *frame, xlator_t *this, int quota_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { struct quota_priv *priv = NULL; struct quota_local *local = NULL; @@ -235,11 +237,11 @@ quota_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if ((op_ret >= 0) && priv->disk_usage_limit) { gf_quota_usage_subtract (this, (local->stbuf.st_blocks - - buf->st_blocks) * 512); + postbuf->st_blocks) * 512); fd_unref (local->fd); } - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -299,7 +301,8 @@ quota_ftruncate (call_frame_t *frame, xlator_t *this, int quota_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf) + inode_t *inode, struct stat *buf, struct stat *preparent, + struct stat *postparent) { struct quota_priv *priv = NULL; @@ -349,7 +352,8 @@ quota_mknod (call_frame_t *frame, xlator_t *this, int quota_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { struct quota_priv *priv = NULL; @@ -399,7 +403,8 @@ quota_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode) int quota_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, struct stat *preparent, + struct stat *postparent) { struct quota_local *local = NULL; @@ -473,7 +478,8 @@ quota_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc) int quota_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, struct stat *preparent, + struct stat *postparent) { struct quota_local *local = NULL; @@ -543,7 +549,8 @@ quota_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc) int quota_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { struct quota_priv *priv = NULL; @@ -593,7 +600,8 @@ quota_symlink (call_frame_t *frame, xlator_t *this, int quota_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - fd_t *fd, inode_t *inode, struct stat *buf) + fd_t *fd, inode_t *inode, struct stat *buf, + struct stat *preparent, struct stat *postparent) { struct quota_priv *priv = this->private; int ret = 0; @@ -656,20 +664,21 @@ quota_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int -quota_open (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t flags, fd_t *fd) +quota_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, + fd_t *fd, int32_t wbflags) { STACK_WIND (frame, quota_open_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->open, - loc, flags, fd); + loc, flags, fd, wbflags); return 0; } int quota_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { struct quota_priv *priv = NULL; struct quota_local *local = NULL; @@ -680,14 +689,14 @@ quota_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (priv->disk_usage_limit) { if (op_ret >= 0) { - gf_quota_usage_add (this, (stbuf->st_blocks - + gf_quota_usage_add (this, (postbuf->st_blocks - local->stbuf.st_blocks) * 512); } fd_unref (local->fd); iobref_unref (local->iobref); } - STACK_UNWIND (frame, op_ret, op_errno, stbuf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } diff --git a/xlators/features/trash/src/trash.c b/xlators/features/trash/src/trash.c index fa5d752eab7..cc5a691521b 100644 --- a/xlators/features/trash/src/trash.c +++ b/xlators/features/trash/src/trash.c @@ -56,14 +56,22 @@ trash_unlink_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf); + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent); int32_t trash_rename_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf); + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent); /** * trash_common_unwind_cbk - @@ -73,7 +81,9 @@ trash_common_unwind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { trash_local_t *local = frame->local; @@ -91,6 +101,39 @@ trash_common_unwind_cbk (call_frame_t *frame, return 0; } + +/** + * trash_rename_unwind_buf_cbk - + */ +int32_t +trash_rename_unwind_buf_cbk (call_frame_t *frame, + void *cookie, + xlator_t *this, + int32_t op_ret, + int32_t op_errno, + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) +{ + trash_local_t *local = frame->local; + + if (!local) + goto out; + + if (local->loc1.path) + loc_wipe (&local->loc1); + + if (local->loc2.path) + loc_wipe (&local->loc2); + + out: + STACK_UNWIND (frame, op_ret, op_errno, buf); + return 0; +} + + /** * trash_common_unwind_buf_cbk - */ @@ -125,7 +168,9 @@ trash_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *stbuf) + struct stat *stbuf, + struct stat *preparent, + struct stat *postparent) { trash_local_t *local = frame->local; char *tmp_str = strdup (local->newpath); @@ -189,7 +234,11 @@ trash_unlink_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { trash_local_t *local = frame->local; if (op_ret == -1 && op_errno == ENOENT) { @@ -302,7 +351,9 @@ trash_rename_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *stbuf) + struct stat *stbuf, + struct stat *preparent, + struct stat *postparent) { trash_local_t *local = frame->local; char *tmp_str = strdup (local->newpath); @@ -367,7 +418,11 @@ trash_rename_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { trash_local_t *local = frame->local; if (op_ret == -1 && op_errno == ENOENT) { @@ -407,7 +462,7 @@ trash_rename_rename_cbk (call_frame_t *frame, .path = local->loc2.path, }; STACK_WIND (frame, - trash_common_unwind_buf_cbk, + trash_rename_unwind_buf_cbk, this->children->xlator, this->children->xlator->fops->rename, &local->loc1, @@ -427,13 +482,14 @@ trash_rename_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *xattr) + dict_t *xattr, + struct stat *postparent) { trash_local_t *local = frame->local; if (op_ret == -1) { STACK_WIND (frame, - trash_common_unwind_buf_cbk, + trash_rename_unwind_buf_cbk, this->children->xlator, this->children->xlator->fops->rename, &local->loc1, @@ -481,7 +537,7 @@ trash_rename (call_frame_t *frame, /* Trying to rename from the trash can dir, do the actual rename */ STACK_WIND (frame, - trash_common_unwind_buf_cbk, + trash_rename_unwind_buf_cbk, this->children->xlator, this->children->xlator->fops->rename, oldloc, |