diff options
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/features/marker/src/marker-quota.c | 111 |
1 files changed, 24 insertions, 87 deletions
diff --git a/xlators/features/marker/src/marker-quota.c b/xlators/features/marker/src/marker-quota.c index b11d1d16b13..8caf5b0c071 100644 --- a/xlators/features/marker/src/marker-quota.c +++ b/xlators/features/marker/src/marker-quota.c @@ -133,39 +133,10 @@ release_lock_on_dirty_inode (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret == -1) { local->err = -1; - } - - if (op_ret == 0) - local->ctx->dirty = 0; - - lock.l_type = F_UNLCK; - lock.l_whence = SEEK_SET; - lock.l_start = 0; - lock.l_len = 0; - lock.l_pid = 0; - - STACK_WIND (frame, - dirty_inode_updation_done, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->inodelk, - this->name, &local->loc, F_SETLKW, &lock); - - return 0; -} + dirty_inode_updation_done (frame, NULL, this, 0, 0); -int32_t -release_lock_on_dirty_inode_parent (call_frame_t *frame, void *cookie, - xlator_t *this, int32_t op_ret, - int32_t op_errno) -{ - struct gf_flock lock = {0, }; - quota_local_t *local = NULL; - - local = frame->local; - - if (op_ret == -1) { - local->err = -1; + return 0; } if (op_ret == 0) @@ -178,15 +149,14 @@ release_lock_on_dirty_inode_parent (call_frame_t *frame, void *cookie, lock.l_pid = 0; STACK_WIND (frame, - release_lock_on_dirty_inode, + dirty_inode_updation_done, FIRST_CHILD(this), FIRST_CHILD(this)->fops->inodelk, - this->name, &local->parent_loc, F_SETLKW, &lock); + this->name, &local->loc, F_SETLKW, &lock); return 0; } - int32_t mark_inode_undirty (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, dict_t *dict) @@ -226,7 +196,7 @@ wind: if (ret) goto err; - STACK_WIND (frame, release_lock_on_dirty_inode_parent, + STACK_WIND (frame, release_lock_on_dirty_inode, FIRST_CHILD(this), FIRST_CHILD(this)->fops->setxattr, &local->loc, newdict, 0); @@ -236,7 +206,7 @@ err: if (op_ret == -1 || ret == -1) { local->err = -1; - release_lock_on_dirty_inode_parent (frame, NULL, this, 0, 0); + release_lock_on_dirty_inode (frame, NULL, this, 0, 0); } if (newdict) @@ -305,7 +275,7 @@ err: if (op_ret == -1 || ret == -1) { local->err = -1; - release_lock_on_dirty_inode_parent (frame, NULL, this, 0, 0); + release_lock_on_dirty_inode (frame, NULL, this, 0, 0); } if (new_dict) @@ -314,10 +284,8 @@ err: return 0; } - int32_t -get_dirty_inode_size (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) +get_dirty_inode_size (call_frame_t *frame, xlator_t *this) { int32_t ret = -1; dict_t *dict = NULL; @@ -326,19 +294,6 @@ get_dirty_inode_size (call_frame_t *frame, void *cookie, xlator_t *this, local = (quota_local_t *) frame->local; - if (op_ret < 0) { - gf_log (this->name, GF_LOG_WARNING, - "inodelk on dirty inode parent failed (%s)" - "path = %s, inode.ino = %"PRId64", inode.gfid = %s" - "parent.ino = %"PRId64", parent.gfid = %s", - strerror (errno), local->loc.path, - local->loc.inode->ino, - uuid_utoa (local->loc.inode->gfid), - local->parent_loc.inode->ino, - uuid_utoa (local->parent_loc.inode->gfid)); - goto lock_err; - } - priv = (marker_conf_t *) this->private; dict = dict_new (); @@ -353,13 +308,9 @@ get_dirty_inode_size (call_frame_t *frame, void *cookie, xlator_t *this, STACK_WIND (frame, update_size_xattr, FIRST_CHILD(this), FIRST_CHILD(this)->fops->lookup, &local->loc, dict); - return 0; + ret =0; err: - release_lock_on_dirty_inode_parent (frame, NULL, this, 0, 0); - return 0; - -lock_err: if (ret) { local->err = -1; @@ -435,29 +386,6 @@ out: return 0; } - -int32_t -get_lock_on_dirty_inode_parent (call_frame_t *frame, xlator_t *this) -{ - quota_local_t *local = NULL; - struct gf_flock lock = {0, }; - - local = frame->local; - - lock.l_type = F_WRLCK; - lock.l_whence = SEEK_SET; - lock.l_start = 0; - lock.l_len = 0; - - STACK_WIND (frame, - get_dirty_inode_size, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->inodelk, - this->name, &local->parent_loc, F_SETLKW, &lock); - return 0; -} - - int32_t quota_readdir_cbk (call_frame_t *frame, void *cookie, @@ -487,7 +415,8 @@ quota_readdir_cbk (call_frame_t *frame, return 0; } else if (op_ret == 0) { - get_lock_on_dirty_inode_parent (frame, this); + get_dirty_inode_size (frame, this); + return 0; } @@ -595,7 +524,7 @@ quota_readdir_cbk (call_frame_t *frame, if (ret) { release_lock_on_dirty_inode (frame, NULL, this, 0, 0); } else if (count == 0 ) { - get_lock_on_dirty_inode_parent (frame, this); + get_dirty_inode_size (frame, this); } return 0; @@ -776,10 +705,6 @@ update_dirty_inode (xlator_t *this, if (ret < 0) goto fr_destroy; - ret = quota_inode_loc_fill (NULL, loc->parent, &local->parent_loc); - if (ret < 0) - goto fr_destroy; - local->ctx = ctx; local->contri = contribution; @@ -1737,6 +1662,18 @@ out: } +/* int32_t */ +/* validate_inode_size_contribution (xlator_t *this, loc_t *loc, int64_t size, */ +/* int64_t contribution) */ +/* { */ +/* if (size != contribution) { */ +/* initiate_quota_txn (this, loc); */ +/* } */ + +/* return 0; */ +/* } */ + + int32_t inspect_directory_xattr (xlator_t *this, loc_t *loc, |