summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2011-04-10 10:53:36 +0000
committerAnand Avati <avati@gluster.com>2011-04-11 05:43:47 -0700
commit1992dc12443f376f9b2974f4e830b4b17e3574c0 (patch)
tree736132e56e7ce3ff98d11d66d50614e694058843
parent67d77aa96dccefe68a44473bf45cf6796e741b7d (diff)
features/quota: use signed type to store delta.
Signed-off-by: Raghavendra G <raghavendra@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2604 (Quota: crossing the set limit) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2604
-rw-r--r--xlators/features/quota/src/quota.c16
-rw-r--r--xlators/features/quota/src/quota.h2
2 files changed, 9 insertions, 9 deletions
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c
index 1911d63e364..80b3a2885eb 100644
--- a/xlators/features/quota/src/quota.c
+++ b/xlators/features/quota/src/quota.c
@@ -835,7 +835,8 @@ quota_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
{
int32_t ret = -1, op_errno = EINVAL;
int32_t parents = 0;
- uint64_t size = 0, delta = 0;
+ uint64_t size = 0;
+ int64_t delta = 0;
quota_local_t *local = NULL;
quota_inode_ctx_t *ctx = NULL;
quota_priv_t *priv = NULL;
@@ -876,17 +877,14 @@ quota_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
size = iov_length (vector, count);
LOCK (&ctx->lock);
{
- delta = (off + size - ctx->buf.ia_size);
+ delta = off + size - ctx->buf.ia_size;
+
list_for_each_entry (dentry, &ctx->parents, next) {
parents++;
}
}
UNLOCK (&ctx->lock);
- if (delta < 0) {
- delta = 0;
- }
-
local->delta = delta;
local->stub = stub;
local->link_count = parents;
@@ -1610,8 +1608,10 @@ quota_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc,
if (ctx == NULL) {
gf_log (this->name, GF_LOG_WARNING,
"quota context not set in inode (ino:%"PRId64
- ", gfid:%s)", oldloc->inode?oldloc->inode->ino:0,
- oldloc->inode?uuid_utoa (oldloc->inode->gfid):"0");
+ ", gfid:%s)",
+ oldloc->inode ? oldloc->inode->ino:0,
+ oldloc->inode ? uuid_utoa (oldloc->inode->gfid)
+ :"0");
op_errno = EINVAL;
goto err;
}
diff --git a/xlators/features/quota/src/quota.h b/xlators/features/quota/src/quota.h
index fce2e54bd60..7250a5dc9d3 100644
--- a/xlators/features/quota/src/quota.h
+++ b/xlators/features/quota/src/quota.h
@@ -148,7 +148,7 @@ struct quota_local {
loc_t oldloc;
loc_t newloc;
loc_t validate_loc;
- uint32_t delta;
+ int64_t delta;
int32_t op_ret;
int32_t op_errno;
int64_t size;