From 50ae3e67e4f294925fc840d3f83b77f7072af54d Mon Sep 17 00:00:00 2001 From: Kaleb S KEITHLEY Date: Wed, 18 Nov 2015 12:28:42 -0500 Subject: all: reduce "inline" usage There are three kinds of inline functions: plain inline, extern inline, and static inline. All three have been removed from .c files, except those in "contrib" which aren't our problem. Inlines in .h files, which are overwhelmingly "static inline" already, have generally been left alone. Over time we should be able to "lower" these into .c files, but that has to be done in a case-by-case fashion requiring more manual effort. This part was easy to do automatically without (as far as I can tell) any ill effect. In the process, several pieces of dead code were flagged by the compiler, and were removed. backport of Change-Id: I56a5e614735c9e0a6ee420dab949eac22e25c155, http://review.gluster.org/11769, BUG: 1245331 Change-Id: Iba1efb0bc578ea4a5e9bf76b7bd93dc1be9eba44 BUG: 1283302 Signed-off-by: Kaleb S KEITHLEY Reviewed-on: http://review.gluster.org/12646 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Niels de Vos --- xlators/cluster/dht/src/dht-diskusage.c | 2 +- xlators/cluster/dht/src/dht-hashfn.c | 9 +-------- xlators/cluster/dht/src/dht-helper.c | 2 +- xlators/cluster/dht/src/dht-rebalance.c | 8 ++++---- xlators/cluster/dht/src/dht-selfheal.c | 4 ++-- xlators/cluster/dht/src/tier.c | 2 +- 6 files changed, 10 insertions(+), 17 deletions(-) (limited to 'xlators/cluster/dht/src') diff --git a/xlators/cluster/dht/src/dht-diskusage.c b/xlators/cluster/dht/src/dht-diskusage.c index 2a9ad37f452..2abeec077ae 100644 --- a/xlators/cluster/dht/src/dht-diskusage.c +++ b/xlators/cluster/dht/src/dht-diskusage.c @@ -338,7 +338,7 @@ out: return avail_subvol; } -static inline +static int32_t dht_subvol_has_err (dht_conf_t *conf, xlator_t *this, dht_layout_t *layout) { diff --git a/xlators/cluster/dht/src/dht-hashfn.c b/xlators/cluster/dht/src/dht-hashfn.c index 72b3df022da..9bd7c7d8e9e 100644 --- a/xlators/cluster/dht/src/dht-hashfn.c +++ b/xlators/cluster/dht/src/dht-hashfn.c @@ -44,7 +44,7 @@ dht_hash_compute_internal (int type, const char *name, uint32_t *hash_p) } -static inline +static gf_boolean_t dht_munge_name (const char *original, char *modified, size_t len, regex_t *re) { @@ -77,13 +77,6 @@ dht_hash_compute (xlator_t *this, int type, const char *name, uint32_t *hash_p) size_t len = 0; gf_boolean_t munged = _gf_false; - /* - * It wouldn't be safe to use alloca in an inline function that doesn't - * actually get inlined, and it wouldn't be efficient to do a real - * allocation, so we use alloca here (if needed) and pass that to the - * inline. - */ - if (priv->extra_regex_valid) { len = strlen(name) + 1; rsync_friendly_name = alloca(len); diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c index ca427a0625a..9cb56c54c54 100644 --- a/xlators/cluster/dht/src/dht-helper.c +++ b/xlators/cluster/dht/src/dht-helper.c @@ -30,7 +30,7 @@ dht_free_mig_info (void *data) return; } -static inline int +static int dht_inode_ctx_set_mig_info (xlator_t *this, inode_t *inode, xlator_t *src_subvol, xlator_t *dst_subvol) { diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index 94dfaf64f6d..a9fceb366f0 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -389,7 +389,7 @@ out: gf_defrag_handle_hardlink for description of "returning -2") -1 : failure */ -static inline int +static int __is_file_migratable (xlator_t *this, loc_t *loc, struct iatt *stbuf, dict_t *xattrs, int flags, gf_defrag_info_t *defrag) @@ -634,7 +634,7 @@ out: return ret; } -static inline int +static int __dht_check_free_space (xlator_t *to, xlator_t *from, loc_t *loc, struct iatt *stbuf, int flag) { @@ -744,7 +744,7 @@ out: return ret; } -static inline int +static int __dht_rebalance_migrate_data (xlator_t *from, xlator_t *to, fd_t *src, fd_t *dst, uint64_t ia_size, int hole_exists) { @@ -861,7 +861,7 @@ __tier_migrate_data (gf_defrag_info_t *defrag, xlator_t *from, xlator_t *to, fd_ } -static inline int +static int __dht_rebalance_open_src_file (xlator_t *from, xlator_t *to, loc_t *loc, struct iatt *stbuf, fd_t **src_fd, gf_boolean_t *clean_src) diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c index 515069af417..d7d68ab621e 100644 --- a/xlators/cluster/dht/src/dht-selfheal.c +++ b/xlators/cluster/dht/src/dht-selfheal.c @@ -387,7 +387,7 @@ out: return fixit; } -inline int +int dht_layout_span (dht_layout_t *layout) { int i = 0, count = 0; @@ -1284,7 +1284,7 @@ dht_selfheal_layout_alloc_start (xlator_t *this, loc_t *loc, return start; } -static inline int +static int dht_get_layout_count (xlator_t *this, dht_layout_t *layout, int new_layout) { int i = 0; diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c index 944d3af50c3..0aa511f33a8 100644 --- a/xlators/cluster/dht/src/tier.c +++ b/xlators/cluster/dht/src/tier.c @@ -1068,7 +1068,7 @@ out: return ret; } -static inline int +static int tier_migrate_files_using_qfile (demotion_args_t *comp, query_cbk_args_t *query_cbk_args, char *qfile) -- cgit