diff options
author | Alexander <[email protected]> | 2021-06-29 16:26:11 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-29 08:26:11 -0600 |
commit | 6a19dea7f68eaf44003008d284270933ad9d3177 (patch) | |
tree | 6e0b3b32e713d2357eef30c0fd08e1990e0428b8 /module/zfs | |
parent | 5b7053a9a5a624603843a07ac0b360af64839e72 (diff) |
module/zfs: simplify ddt_stat_add() loop
LLVM's Polly (ISL to be precise) is unhappy with the loop from
ddt_stat_add():
CC [M] fs/zfs/zfs/ddt.o
../lib/External/isl/isl_schedule_node.c:2470: cannot insert node
between set or sequence node and its filter children
(building with the custom patch which adds Polly support to Kbuild)
The mentioned loop is rather suboptimal. All that we need is to just
treat ddt_stat_t as an array of u64 and perform 1:1 addition or
substraction. This can be done in simpler for-loop with the
determined index and bounds. Compiler will expand d_end - d into
a number of ddt_stat_t fields at compile time.
This prevents Polly from failing on this file.
Reviewed-by: Matthew Ahrens <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Alexander Lobakin <[email protected]>
Closes #12253
Diffstat (limited to 'module/zfs')
-rw-r--r-- | module/zfs/ddt.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/module/zfs/ddt.c b/module/zfs/ddt.c index b94a9f54e..7b0b1d896 100644 --- a/module/zfs/ddt.c +++ b/module/zfs/ddt.c @@ -423,8 +423,8 @@ ddt_stat_add(ddt_stat_t *dst, const ddt_stat_t *src, uint64_t neg) ASSERT(neg == 0 || neg == -1ULL); /* add or subtract */ - while (d < d_end) - *d++ += (*s++ ^ neg) - neg; + for (int i = 0; i < d_end - d; i++) + d[i] += (s[i] ^ neg) - neg; } static void |