summaryrefslogtreecommitdiffstats
path: root/xlators/features/marker/src/marker-quota.c
diff options
context:
space:
mode:
authorVijay Bellur <vbellur@redhat.com>2018-09-24 13:21:58 -0700
committerAmar Tumballi <amarts@redhat.com>2018-09-25 17:01:43 +0000
commit8f207feb260bc6112d5085859b43efc8378a4c5f (patch)
tree2b1ec11256742e8d564de469b5d6476311beb210 /xlators/features/marker/src/marker-quota.c
parentf1b2455b9d01bae8c4652fc3583a60ff7000410e (diff)
features/marker: Avoid passing structures as parameters to functions
Fixes CIDs: 1388779,1390242,1390057 The patch does the following: 1. Changes the prototype of mq_inspect_file_xattr() and mq_xattr_state() to have a parameter of struct iatt * instead of struct iatt. 2. Remove unneeded struct iatt parameter from mq_inspect_directory_xattr() Change-Id: I1f6eabda042f0fe56d8c9bca010302f5e518dbe4 updates: bz#789278 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/features/marker/src/marker-quota.c')
-rw-r--r--xlators/features/marker/src/marker-quota.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/xlators/features/marker/src/marker-quota.c b/xlators/features/marker/src/marker-quota.c
index c680bc9..28da338 100644
--- a/xlators/features/marker/src/marker-quota.c
+++ b/xlators/features/marker/src/marker-quota.c
@@ -2054,7 +2054,7 @@ out:
int32_t
mq_inspect_directory_xattr(xlator_t *this, quota_inode_ctx_t *ctx,
inode_contribution_t *contribution, loc_t *loc,
- dict_t *dict, struct iatt buf)
+ dict_t *dict)
{
int32_t ret = -1;
int8_t dirty = -1;
@@ -2151,7 +2151,7 @@ out:
int32_t
mq_inspect_file_xattr(xlator_t *this, quota_inode_ctx_t *ctx,
inode_contribution_t *contribution, loc_t *loc,
- dict_t *dict, struct iatt buf)
+ dict_t *dict, struct iatt *buf)
{
int32_t ret = -1;
quota_meta_t size = {
@@ -2168,9 +2168,12 @@ mq_inspect_file_xattr(xlator_t *this, quota_inode_ctx_t *ctx,
};
gf_boolean_t status = _gf_false;
+ if (!buf || !contribution || !ctx)
+ goto out;
+
LOCK(&ctx->lock);
{
- ctx->size = 512 * buf.ia_blocks;
+ ctx->size = 512 * buf->ia_blocks;
ctx->file_count = 1;
ctx->dir_count = 0;
@@ -2215,7 +2218,8 @@ out:
}
int32_t
-mq_xattr_state(xlator_t *this, loc_t *origin_loc, dict_t *dict, struct iatt buf)
+mq_xattr_state(xlator_t *this, loc_t *origin_loc, dict_t *dict,
+ struct iatt *buf)
{
int32_t ret = -1;
quota_inode_ctx_t *ctx = NULL;
@@ -2224,7 +2228,7 @@ mq_xattr_state(xlator_t *this, loc_t *origin_loc, dict_t *dict, struct iatt buf)
};
inode_contribution_t *contribution = NULL;
- ret = mq_prevalidate_txn(this, origin_loc, &loc, &ctx, &buf);
+ ret = mq_prevalidate_txn(this, origin_loc, &loc, &ctx, buf);
if (ret < 0 || loc.parent == NULL)
goto out;
@@ -2239,13 +2243,12 @@ mq_xattr_state(xlator_t *this, loc_t *origin_loc, dict_t *dict, struct iatt buf)
ret = -1;
goto out;
}
- if (buf.ia_type == IA_IFDIR)
- mq_inspect_directory_xattr(this, ctx, contribution, &loc, dict,
- buf);
+ if (buf->ia_type == IA_IFDIR)
+ mq_inspect_directory_xattr(this, ctx, contribution, &loc, dict);
else
mq_inspect_file_xattr(this, ctx, contribution, &loc, dict, buf);
} else {
- mq_inspect_directory_xattr(this, ctx, 0, &loc, dict, buf);
+ mq_inspect_directory_xattr(this, ctx, 0, &loc, dict);
}
out: