diff options
author | Raghavendra G <rgowdapp@redhat.com> | 2013-08-02 11:08:15 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2013-08-08 11:42:53 +0530 |
commit | d7b3ab5b5d17427bef5012ab72086e2b44ba1364 (patch) | |
tree | 64581bc7e7ca8c8c28ac6ae20a85eb5aa84e0925 /xlators/features/quota/src/quota.h | |
parent | 171996ae57677f97546476094c866e868b7cebca (diff) |
features/quota: design changes
* hard and soft limits are persisted in xattrs of the
inode. Associating limits with inode instead of maintaining as a
global list helps us to scale better.
* quotad-aggregator acts as a special client to provide cluster view
through an rpc program. Quota enforcer loaded on brick uses this to get
aggregated directory sizes. Aggregated sizes are cached for a
timeout period in in-memory inode contexts.
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
Change-Id: I2ab508d9d4fe224bc1d8cf01cf2b7969dd4200bb
BUG: 969461
Diffstat (limited to 'xlators/features/quota/src/quota.h')
-rw-r--r-- | xlators/features/quota/src/quota.h | 118 |
1 files changed, 61 insertions, 57 deletions
diff --git a/xlators/features/quota/src/quota.h b/xlators/features/quota/src/quota.h index de9f6f16..84e7f917 100644 --- a/xlators/features/quota/src/quota.h +++ b/xlators/features/quota/src/quota.h @@ -12,12 +12,30 @@ #include "config.h" #endif +#ifndef _QUOTA_H +#define _QUOTA_H + #include "xlator.h" #include "call-stub.h" #include "defaults.h" -#include "byte-order.h" #include "common-utils.h" #include "quota-mem-types.h" +#include "glusterfs.h" +#include "compat.h" +#include "logging.h" +#include "dict.h" +#include "stack.h" +#include "common-utils.h" +#include "event.h" +#include "globals.h" +#include "rpcsvc.h" +#include "rpc-clnt.h" +#include "byte-order.h" +#include "glusterfs3-xdr.h" +#include "glusterfs3.h" +#include "xdr-generic.h" +#include "compat-errno.h" +#include "protocol-common.h" #define QUOTA_XATTR_PREFIX "trusted." #define DIRTY "dirty" @@ -27,6 +45,10 @@ #define READDIR_BUF 4096 #define QUOTA_UPDATE_USAGE_KEY "quota-update-usage" +#ifndef UUID_CANONICAL_FORM_LEN +#define UUID_CANONICAL_FORM_LEN 36 +#endif + #define WIND_IF_QUOTAOFF(is_quota_on, label) \ if (!is_quota_on) \ goto label; @@ -125,63 +147,45 @@ struct quota_inode_ctx { typedef struct quota_inode_ctx quota_inode_ctx_t; struct quota_local { - gf_lock_t lock; - uint32_t validate_count; - uint32_t link_count; - loc_t loc; - loc_t oldloc; - loc_t newloc; - loc_t validate_loc; - int64_t delta; - int32_t op_ret; - int32_t op_errno; - int64_t size; - int64_t hard_lim; - int64_t soft_lim; - char just_validated; - inode_t *inode; - call_stub_t *stub; + gf_lock_t lock; + uint32_t validate_count; + uint32_t link_count; + loc_t loc; + loc_t oldloc; + loc_t newloc; + loc_t validate_loc; + int64_t delta; + int32_t op_ret; + int32_t op_errno; + int64_t size; + char just_validated; + fop_lookup_cbk_t validate_cbk; + inode_t *inode; + call_stub_t *stub; + struct iobref *iobref; }; -typedef struct quota_local quota_local_t; - - -struct qd_vols_conf { - char *name; - inode_table_t *itable; - uint32_t log_timeout; - gf_boolean_t threads_status; - double default_soft_lim; - gf_lock_t lock; - loc_t root_loc; - uint32_t soft_timeout; - uint32_t hard_timeout; - struct list_head limit_head; - call_frame_t *frame; -}; -typedef struct qd_vols_conf qd_vols_conf_t; - +typedef struct quota_local quota_local_t; struct quota_priv { - int64_t timeout; - double default_soft_lim; - gf_boolean_t is_quota_on; - gf_boolean_t consider_statfs; - struct list_head limit_head; - qd_vols_conf_t **qd_vols_conf; - gf_lock_t lock; -}; -typedef struct quota_priv quota_priv_t; - - -struct limits { - struct list_head limit_list; - char *path; - uuid_t gfid; - int64_t prev_size; - struct timeval prev_log_tv; - int64_t hard_lim; - int64_t soft_lim; - struct timeval expire; - uint32_t timeout; + uint32_t soft_timeout; + uint32_t hard_timeout; + double default_soft_lim; + gf_boolean_t is_quota_on; + gf_boolean_t consider_statfs; + gf_lock_t lock; + rpc_clnt_prog_t *quota_enforcer; + struct rpcsvc_program *quotad_aggregator; + struct rpc_clnt *rpc_clnt; + rpcsvc_t *rpcsvc; + inode_table_t *itable; + char *volume_uuid; }; -typedef struct limits limits_t; +typedef struct quota_priv quota_priv_t; + +int +quota_enforcer_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata, fop_lookup_cbk_t cbk); +struct rpc_clnt * +quota_enforcer_init (xlator_t *this, dict_t *options); + +#endif |