diff options
Diffstat (limited to 'xlators/features/marker/src/marker-quota.c')
| -rw-r--r-- | xlators/features/marker/src/marker-quota.c | 92 |
1 files changed, 26 insertions, 66 deletions
diff --git a/xlators/features/marker/src/marker-quota.c b/xlators/features/marker/src/marker-quota.c index 0fc7ba66ee0..3de2ea1c92c 100644 --- a/xlators/features/marker/src/marker-quota.c +++ b/xlators/features/marker/src/marker-quota.c @@ -7,16 +7,16 @@ later), or the GNU General Public License, version 2 (GPLv2), in all cases as published by the Free Software Foundation. */ -#include "dict.h" -#include "xlator.h" -#include "defaults.h" +#include <glusterfs/dict.h> +#include <glusterfs/xlator.h> +#include <glusterfs/defaults.h> #include "libxlator.h" -#include "common-utils.h" -#include "byte-order.h" +#include <glusterfs/common-utils.h> +#include <glusterfs/byte-order.h> #include "marker-quota.h" #include "marker-quota-helper.h" -#include "syncop.h" -#include "quota-common-utils.h" +#include <glusterfs/syncop.h> +#include <glusterfs/quota-common-utils.h> int mq_loc_copy(loc_t *dst, loc_t *src) @@ -134,27 +134,14 @@ out: return -1; } -int32_t +static void mq_set_ctx_dirty_status(quota_inode_ctx_t *ctx, gf_boolean_t status) { GF_VALIDATE_OR_GOTO("marker", ctx, out); mq_set_ctx_status(ctx, &ctx->dirty_status, status); - return 0; -out: - return -1; -} - -int32_t -mq_test_and_set_ctx_dirty_status(quota_inode_ctx_t *ctx, gf_boolean_t *status) -{ - GF_VALIDATE_OR_GOTO("marker", ctx, out); - GF_VALIDATE_OR_GOTO("marker", status, out); - - mq_test_and_set_ctx_status(ctx, &ctx->dirty_status, status); - return 0; out: - return -1; + return; } int @@ -866,19 +853,6 @@ out: } int32_t -mq_get_size(xlator_t *this, loc_t *loc, quota_meta_t *size) -{ - 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) -{ - return _mq_get_metadata(this, loc, contri, NULL, contri_gfid); -} - -int32_t mq_get_delta(xlator_t *this, loc_t *loc, quota_meta_t *delta, quota_inode_ctx_t *ctx, inode_contribution_t *contribution) { @@ -1337,19 +1311,6 @@ out: return ret; } -int -mq_create_xattrs_blocking_txn(xlator_t *this, loc_t *loc, struct iatt *buf) -{ - int32_t ret = -1; - - GF_VALIDATE_OR_GOTO("marker", loc, out); - GF_VALIDATE_OR_GOTO("marker", loc->inode, out); - - ret = _mq_create_xattrs_txn(this, loc, buf, _gf_false); -out: - return ret; -} - int32_t mq_reduce_parent_size_task(void *opaque) { @@ -1752,21 +1713,17 @@ mq_initiate_quota_task(void *opaque) } out: - if (dirty) { - if (ret < 0) { - /* On failure clear dirty status flag. - * In the next lookup inspect_directory_xattr - * can set the status flag and fix the - * dirty directory. - * Do the same if the dir was dirty before - * txn - */ - ret = mq_inode_ctx_get(parent_loc.inode, this, &parent_ctx); - if (ret == 0) - mq_set_ctx_dirty_status(parent_ctx, _gf_false); - } else { - ret = mq_mark_dirty(this, &parent_loc, 0); - } + if ((dirty) && (ret < 0)) { + /* On failure clear dirty status flag. + * In the next lookup inspect_directory_xattr + * can set the status flag and fix the + * dirty directory. + * Do the same if the dir was dirty before + * txn + */ + ret = mq_inode_ctx_get(parent_loc.inode, this, &parent_ctx); + if (ret == 0) + mq_set_ctx_dirty_status(parent_ctx, _gf_false); } if (locked) @@ -1977,7 +1934,7 @@ mq_update_dirty_inode_task(void *opaque) /* Inculde for self */ contri_sum.dir_count++; - ret = mq_get_size(this, loc, &size); + ret = _mq_get_metadata(this, loc, NULL, &size, 0); if (ret < 0) goto out; @@ -2046,8 +2003,8 @@ mq_update_dirty_inode_txn(xlator_t *this, loc_t *loc, quota_inode_ctx_t *ctx) GF_VALIDATE_OR_GOTO("marker", loc, out); GF_VALIDATE_OR_GOTO("marker", loc->inode, out); - ret = mq_test_and_set_ctx_dirty_status(ctx, &status); - if (ret < 0 || status == _gf_true) + mq_test_and_set_ctx_status(ctx, &ctx->dirty_status, &status); + if (status == _gf_true) goto out; ret = mq_synctask(this, mq_update_dirty_inode_task, _gf_true, loc); @@ -2102,6 +2059,9 @@ mq_inspect_directory_xattr(xlator_t *this, quota_inode_ctx_t *ctx, if (ret < 0) goto create_xattr; + if (!contribution) + goto create_xattr; + if (!loc_is_root(loc)) { GET_CONTRI_KEY(this, contri_key, contribution->gfid, keylen); if (keylen < 0) { |
