diff options
Diffstat (limited to 'xlators/features/marker/src/marker-quota.h')
| -rw-r--r-- | xlators/features/marker/src/marker-quota.h | 127 |
1 files changed, 44 insertions, 83 deletions
diff --git a/xlators/features/marker/src/marker-quota.h b/xlators/features/marker/src/marker-quota.h index e709bcac2..385760ac4 100644 --- a/xlators/features/marker/src/marker-quota.h +++ b/xlators/features/marker/src/marker-quota.h @@ -1,21 +1,12 @@ -/*Copyright (c) 2008-2010 Gluster, Inc. <http://www.gluster.com> - This file is part of GlusterFS. - - GlusterFS is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. - - GlusterFS is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see - <http://www.gnu.org/licenses/>. +/* + Copyright (c) 2008-2012 Red Hat, Inc. <http://www.redhat.com> + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. */ - #ifndef _MARKER_QUOTA_H #define _MARKER_QUOTA_H @@ -24,7 +15,6 @@ #include "config.h" #endif -#include "marker.h" #include "xlator.h" #include "marker-mem-types.h" @@ -32,11 +22,9 @@ #define QUOTA_DIRTY_KEY "trusted.glusterfs.quota.dirty" #define CONTRIBUTION "contri" -#define VOL_NAME volname #define CONTRI_KEY_MAX 512 #define READDIR_BUF 4096 -char volname [40]; #define QUOTA_STACK_DESTROY(_frame, _this) \ do { \ @@ -44,27 +32,26 @@ char volname [40]; _local = _frame->local; \ _frame->local = NULL; \ STACK_DESTROY (_frame->root); \ - quota_local_unref (_this, _local); \ - GF_FREE (_local); \ + mq_local_unref (_this, _local); \ } while (0) #define QUOTA_ALLOC(var, type, ret) \ do { \ + ret = 0; \ var = GF_CALLOC (sizeof (type), 1, \ - gf_marker_mt_##type); \ + gf_marker_mt_##type); \ if (!var) { \ gf_log ("", GF_LOG_ERROR, \ "out of memory"); \ ret = -1; \ } \ - ret = 0; \ } while (0); #define QUOTA_ALLOC_OR_GOTO(var, type, ret, label) \ do { \ var = GF_CALLOC (sizeof (type), 1, \ - gf_marker_mt_##type); \ + gf_marker_mt_##type); \ if (!var) { \ gf_log ("", GF_LOG_ERROR, \ "out of memory"); \ @@ -74,96 +61,70 @@ char volname [40]; ret = 0; \ } while (0); -#define GET_CONTRI_KEY(var, _gfid, _ret) \ - do { \ - char _gfid_unparsed[40]; \ - uuid_unparse (_gfid, _gfid_unparsed); \ +#define GET_CONTRI_KEY(var, _gfid, _ret) \ + do { \ + char _gfid_unparsed[40]; \ + uuid_unparse (_gfid, _gfid_unparsed); \ _ret = snprintf (var, CONTRI_KEY_MAX, QUOTA_XATTR_PREFIX \ - ".%s.%s." CONTRIBUTION, VOL_NAME, \ - _gfid_unparsed); \ + ".%s.%s." CONTRIBUTION, "quota", \ + _gfid_unparsed); \ } while (0); -#define QUOTA_SAFE_INCREMENT(lock, var) \ - do { \ - LOCK (lock); \ - var ++; \ - UNLOCK (lock); \ - } while (0) - -#define QUOTA_SAFE_DECREMENT(lock, var) \ - do { \ - LOCK (lock); \ - var --; \ - UNLOCK (lock); \ +#define QUOTA_SAFE_INCREMENT(lock, var) \ + do { \ + LOCK (lock); \ + var ++; \ + UNLOCK (lock); \ } while (0) - struct quota_inode_ctx { - int64_t size; - int8_t dirty; - gf_lock_t lock; - struct list_head contribution_head; + int64_t size; + int8_t dirty; + gf_boolean_t updation_status; + gf_lock_t lock; + struct list_head contribution_head; }; typedef struct quota_inode_ctx quota_inode_ctx_t; struct inode_contribution { struct list_head contri_list; - int64_t contribution; - uuid_t gfid; + int64_t contribution; + uuid_t gfid; + gf_lock_t lock; }; typedef struct inode_contribution inode_contribution_t; -struct quota_local { - int64_t delta; - int64_t d_off; - int32_t err; - int32_t ref; - int64_t sum; - int32_t hl_count; - int32_t dentry_child_count; - - fd_t *fd; - call_frame_t *frame; - gf_lock_t lock; - - loc_t loc; - loc_t parent_loc; - - quota_inode_ctx_t *ctx; - inode_contribution_t *contri; -}; -typedef struct quota_local quota_local_t; - -int32_t cn; - int32_t -get_lock_on_parent (call_frame_t *, xlator_t *); +mq_get_lock_on_parent (call_frame_t *, xlator_t *); int32_t -quota_req_xattr (xlator_t *, loc_t *, dict_t *); +mq_req_xattr (xlator_t *, loc_t *, dict_t *); int32_t init_quota_priv (xlator_t *); int32_t -quota_xattr_state (xlator_t *, loc_t *, dict_t *, struct iatt); +mq_xattr_state (xlator_t *, loc_t *, dict_t *, struct iatt); int32_t -quota_set_inode_xattr (xlator_t *, loc_t *); +mq_set_inode_xattr (xlator_t *, loc_t *); int -initiate_quota_txn (xlator_t *, loc_t *); +mq_initiate_quota_txn (xlator_t *, loc_t *); + +int32_t +mq_dirty_inode_readdir (call_frame_t *, void *, xlator_t *, + int32_t, int32_t, fd_t *, dict_t *); int32_t -quota_dirty_inode_readdir (call_frame_t *, void *, xlator_t *, - int32_t, int32_t, fd_t *); +mq_reduce_parent_size (xlator_t *, loc_t *, int64_t); int32_t -reduce_parent_size (xlator_t *, loc_t *); +mq_rename_update_newpath (xlator_t *, loc_t *); int32_t -quota_rename_update_newpath (xlator_t *, loc_t *, inode_t *); +mq_inspect_file_xattr (xlator_t *this, loc_t *loc, dict_t *dict, struct iatt buf); int32_t -quota_forget (xlator_t *, quota_inode_ctx_t *); +mq_forget (xlator_t *, quota_inode_ctx_t *); #endif |
