diff options
-rw-r--r-- | xlators/features/marker/src/marker-quota.c | 91 |
1 files changed, 33 insertions, 58 deletions
diff --git a/xlators/features/marker/src/marker-quota.c b/xlators/features/marker/src/marker-quota.c index 84798521265..ef3203131ee 100644 --- a/xlators/features/marker/src/marker-quota.c +++ b/xlators/features/marker/src/marker-quota.c @@ -2182,9 +2182,9 @@ mq_are_xattrs_set (xlator_t *this, loc_t *loc, gf_boolean_t *result, ret = syncop_lookup (FIRST_CHILD(this), loc, &stbuf, NULL, dict, &rsp_dict); if (ret < 0) { - gf_log (this->name, (-ret == ENOENT || -ret == ESTALE) - ? GF_LOG_DEBUG:GF_LOG_ERROR, "lookup failed " - "for %s: %s", loc->path, strerror (-ret)); + gf_log_callingfn (this->name, (-ret == ENOENT || -ret == ESTALE) + ? GF_LOG_DEBUG:GF_LOG_ERROR, "lookup failed " + "for %s: %s", loc->path, strerror (-ret)); goto out; } @@ -2271,13 +2271,13 @@ mq_create_xattrs (xlator_t *this, quota_inode_ctx_t *ctx, loc_t *loc, goto out; } - ret = syncop_xattrop(FIRST_CHILD(this), loc, GF_XATTROP_ADD_ARRAY64, - dict, NULL, NULL); + ret = syncop_xattrop (FIRST_CHILD(this), loc, GF_XATTROP_ADD_ARRAY64, + dict, NULL, NULL); if (ret < 0) { - gf_log (this->name, (-ret == ENOENT || -ret == ESTALE) - ? GF_LOG_DEBUG:GF_LOG_ERROR, "xattrop failed " - "for %s: %s", loc->path, strerror (-ret)); + gf_log_callingfn (this->name, (-ret == ENOENT || -ret == ESTALE) + ? GF_LOG_DEBUG:GF_LOG_ERROR, "xattrop failed " + "for %s: %s", loc->path, strerror (-ret)); goto out; } @@ -2311,9 +2311,9 @@ mq_lock (xlator_t *this, loc_t *loc, short l_type) ret = syncop_inodelk (FIRST_CHILD(this), this->name, loc, F_SETLKW, &lock, NULL, NULL); if (ret < 0) - gf_log (this->name, (-ret == ENOENT || -ret == ESTALE) - ? GF_LOG_DEBUG:GF_LOG_ERROR, "inodelk failed " - "for %s: %s", loc->path, strerror (-ret)); + gf_log_callingfn (this->name, (-ret == ENOENT || -ret == ESTALE) + ? GF_LOG_DEBUG:GF_LOG_ERROR, "inodelk failed " + "for %s: %s", loc->path, strerror (-ret)); out: @@ -2344,9 +2344,9 @@ mq_get_dirty (xlator_t *this, loc_t *loc, int32_t *dirty) ret = syncop_lookup (FIRST_CHILD(this), loc, &stbuf, NULL, dict, &rsp_dict); if (ret < 0) { - gf_log (this->name, (-ret == ENOENT || -ret == ESTALE) - ? GF_LOG_DEBUG:GF_LOG_ERROR, "lookup failed " - "for %s: %s", loc->path, strerror (-ret)); + gf_log_callingfn (this->name, (-ret == ENOENT || -ret == ESTALE) + ? GF_LOG_DEBUG:GF_LOG_ERROR, "lookup failed " + "for %s: %s", loc->path, strerror (-ret)); goto out; } @@ -2390,7 +2390,7 @@ mq_mark_dirty (xlator_t *this, loc_t *loc, int32_t dirty) ret = syncop_setxattr (FIRST_CHILD(this), loc, dict, 0, NULL, NULL); if (ret < 0) { - gf_log (this->name, (-ret == ENOENT || -ret == ESTALE) + gf_log_callingfn (this->name, (-ret == ENOENT || -ret == ESTALE) ? GF_LOG_DEBUG:GF_LOG_ERROR, "setxattr dirty = %d " "failed for %s: %s", dirty, loc->path, strerror (-ret)); goto out; @@ -2457,9 +2457,9 @@ _mq_get_metadata (xlator_t *this, loc_t *loc, quota_meta_t *contri, ret = syncop_lookup (FIRST_CHILD(this), loc, &stbuf, NULL, dict, &rsp_dict); if (ret < 0) { - gf_log (this->name, (-ret == ENOENT || -ret == ESTALE) - ? GF_LOG_DEBUG:GF_LOG_ERROR, "lookup failed " - "for %s: %s", loc->path, strerror (-ret)); + gf_log_callingfn (this->name, (-ret == ENOENT || -ret == ESTALE) + ? GF_LOG_DEBUG:GF_LOG_ERROR, "lookup failed " + "for %s: %s", loc->path, strerror (-ret)); goto out; } @@ -2526,11 +2526,8 @@ mq_get_metadata (xlator_t *this, loc_t *loc, quota_meta_t *contri, } ret = _mq_get_metadata (this, loc, contri, size, contribution->gfid); - if (ret < 0) { - gf_log_callingfn (this->name, GF_LOG_ERROR, "Failed to get " - "metadata for %s", loc->path); + if (ret < 0) goto out; - } if (size) { LOCK (&ctx->lock); @@ -2559,34 +2556,14 @@ out: int32_t mq_get_size (xlator_t *this, loc_t *loc, quota_meta_t *size) { - int32_t ret = -1; - - ret = _mq_get_metadata (this, loc, NULL, size, 0); - if (ret < 0) { - gf_log_callingfn (this->name, GF_LOG_ERROR, "Failed to get " - "metadata for %s", loc->path); - goto out; - } - -out: - return ret; + return _mq_get_metadata (this, loc, NULL, size, 0); } int32_t mq_get_contri (xlator_t *this, loc_t *loc, quota_meta_t *contri, uuid_t contri_gfid) { - int32_t ret = -1; - - ret = _mq_get_metadata (this, loc, contri, NULL, contri_gfid); - if (ret < 0) { - gf_log_callingfn (this->name, GF_LOG_ERROR, "Failed to get " - "metadata for %s", loc->path); - goto out; - } - -out: - return ret; + return _mq_get_metadata (this, loc, contri, NULL, contri_gfid); } int32_t @@ -2641,9 +2618,10 @@ mq_remove_contri (xlator_t *this, loc_t *loc, quota_inode_ctx_t *ctx, */ ret = 0; } else { - gf_log (this->name, GF_LOG_ERROR, "removexattr %s " - "failed for %s: %s", contri_key, loc->path, - strerror (-ret)); + gf_log_callingfn (this->name, GF_LOG_ERROR, + "removexattr %s failed for %s: %s", + contri_key, loc->path, + strerror (-ret)); goto out; } } @@ -2705,9 +2683,9 @@ mq_update_contri (xlator_t *this, loc_t *loc, inode_contribution_t *contri, ret = syncop_xattrop(FIRST_CHILD(this), loc, GF_XATTROP_ADD_ARRAY64, dict, NULL, NULL); if (ret < 0) { - gf_log (this->name, (-ret == ENOENT || -ret == ESTALE) - ? GF_LOG_DEBUG:GF_LOG_ERROR, "xattrop failed " - "for %s: %s", loc->path, strerror (-ret)); + gf_log_callingfn (this->name, (-ret == ENOENT || -ret == ESTALE) + ? GF_LOG_DEBUG:GF_LOG_ERROR, "xattrop failed " + "for %s: %s", loc->path, strerror (-ret)); goto out; } @@ -2764,9 +2742,9 @@ mq_update_size (xlator_t *this, loc_t *loc, quota_meta_t *delta) ret = syncop_xattrop(FIRST_CHILD(this), loc, GF_XATTROP_ADD_ARRAY64, dict, NULL, NULL); if (ret < 0) { - gf_log (this->name, (-ret == ENOENT || -ret == ESTALE) - ? GF_LOG_DEBUG:GF_LOG_ERROR, "xattrop failed " - "for %s: %s", loc->path, strerror (-ret)); + gf_log_callingfn (this->name, (-ret == ENOENT || -ret == ESTALE) + ? GF_LOG_DEBUG:GF_LOG_ERROR, "xattrop failed " + "for %s: %s", loc->path, strerror (-ret)); goto out; } @@ -2948,15 +2926,12 @@ mq_start_quota_txn_v2 (xlator_t *this, loc_t *loc, quota_inode_ctx_t *ctx, dirty = _gf_true; ret = mq_update_contri (this, &child_loc, contri, &delta); - if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "contri " - "update failed for %s", child_loc.path); + if (ret < 0) goto out; - } ret = mq_update_size (this, &parent_loc, &delta); if (ret < 0) { - gf_log (this->name, GF_LOG_WARNING, "rollback " + gf_log (this->name, GF_LOG_DEBUG, "rollback " "contri updation"); mq_sub_meta (&delta, NULL); mq_update_contri (this, &child_loc, contri, &delta); |