diff options
author | Kotresh HR <khiremat@redhat.com> | 2016-07-01 15:54:07 +0530 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2016-07-19 06:14:13 -0700 |
commit | 2526f9d3ddc3e7f62828ac4289001b22638ae42a (patch) | |
tree | 7bd7a766098f2ce8d08583647b85c778ccf8505c /xlators/features/bit-rot/src/bitd/bit-rot-tbf.h | |
parent | 74d2aaf51c7ff601e4394cad9f8e23092267af55 (diff) |
features/bitrot: Move throttling code to libglusterfs
Backport of http://review.gluster.org/14846
Since throttling is a separate feature by itself,
move throttling code to libglusterfs.
Change-Id: If9b99885ceb46e5b1865a4af18b2a2caecf59972
BUG: 1357514
Signed-off-by: Kotresh HR <khiremat@redhat.com>
Reviewed-on: http://review.gluster.org/14944
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'xlators/features/bit-rot/src/bitd/bit-rot-tbf.h')
-rw-r--r-- | xlators/features/bit-rot/src/bitd/bit-rot-tbf.h | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-tbf.h b/xlators/features/bit-rot/src/bitd/bit-rot-tbf.h deleted file mode 100644 index 5a41be4fd95..00000000000 --- a/xlators/features/bit-rot/src/bitd/bit-rot-tbf.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - Copyright (c) 2015 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. -*/ - -#include "list.h" -#include "xlator.h" -#include "locking.h" - -#ifndef __BIT_ROT_TBF_H__ -#define __BIT_ROT_TBF_H__ - -typedef enum br_tbf_ops { - BR_TBF_OP_MIN = -1, - BR_TBF_OP_HASH = 0, /* checksum calculation */ - BR_TBF_OP_READ = 1, /* inode read(s) */ - BR_TBF_OP_READDIR = 2, /* dentry read(s) */ - BR_TBF_OP_MAX = 3, -} br_tbf_ops_t; - -/** - * Operation rate specification - */ -typedef struct br_tbf_opspec { - br_tbf_ops_t op; - - unsigned long rate; - - unsigned long maxlimit; -} br_tbf_opspec_t; - -/** - * Token bucket for each operation type - */ -typedef struct br_tbf_bucket { - gf_lock_t lock; - - pthread_t tokener; /* token generator thread */ - - unsigned long tokenrate; /* token generation rate */ - - unsigned long tokens; /* number of current tokens */ - - unsigned long maxtokens; /* maximum token in the bucket */ - - struct list_head queued; /* list of non-conformant requests */ -} br_tbf_bucket_t; - -typedef struct br_tbf { - br_tbf_bucket_t **bucket; -} br_tbf_t; - -br_tbf_t * -br_tbf_init (br_tbf_opspec_t *, unsigned int); - -int -br_tbf_mod (br_tbf_t *, br_tbf_opspec_t *); - -void -br_tbf_throttle (br_tbf_t *, br_tbf_ops_t, unsigned long); - -#define TBF_THROTTLE_BEGIN(tbf, op, tokens) (br_tbf_throttle (tbf, op, tokens)) -#define TBF_THROTTLE_END(tbf, op, tokens) (void) - -#endif /** __BIT_ROT_TBF_H__ */ |