diff options
author | Yaniv Kaul <ykaul@redhat.com> | 2019-10-22 15:41:41 +0300 |
---|---|---|
committer | Susant Palai <spalai@redhat.com> | 2019-12-17 05:45:42 +0000 |
commit | 49f524def676e62e0f0cfb8a674bc28923c28f13 (patch) | |
tree | f4b9eebfa5e7870a64593913cab4f735f5bda209 /xlators/cluster/dht/src/dht-common.h | |
parent | 5ab835004371f2165d1c3f335aa0fd777c9f8c20 (diff) |
dht-common.h/dht-helper.c: exctract the LOCK() from DHT_UPDATE_TIME
Currently, the code (and only place) that is using this macro is
in dht_inode_ctx_time_update() where it is called 3 times in a row,
which is essentially 3 cycles of LOCK/UNLOCK on the same lock.
Instead, extract the LOCK()/UNLOCK() part of the macro
and wrap those calls with it.
Change-Id: I6312b985e3d97517857b55f342440accc4063db6
updates: bz#1193929
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src/dht-common.h')
-rw-r--r-- | xlators/cluster/dht/src/dht-common.h | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h index 3c992297f0f..32f7fcbd9d7 100644 --- a/xlators/cluster/dht/src/dht-common.h +++ b/xlators/cluster/dht/src/dht-common.h @@ -823,22 +823,18 @@ typedef struct dht_fd_ctx { dht_local_wipe(__xl, __local); \ } while (0) -#define DHT_UPDATE_TIME(ctx_sec, ctx_nsec, new_sec, new_nsec, inode, post) \ +#define DHT_UPDATE_TIME(ctx_sec, ctx_nsec, new_sec, new_nsec, post) \ do { \ - LOCK(&inode->lock); \ - { \ - if (ctx_sec == new_sec) \ - new_nsec = max(new_nsec, ctx_nsec); \ - else if (ctx_sec > new_sec) { \ - new_sec = ctx_sec; \ - new_nsec = ctx_nsec; \ - } \ - if (post) { \ - ctx_sec = new_sec; \ - ctx_nsec = new_nsec; \ - } \ + if (ctx_sec == new_sec) \ + new_nsec = max(new_nsec, ctx_nsec); \ + else if (ctx_sec > new_sec) { \ + new_sec = ctx_sec; \ + new_nsec = ctx_nsec; \ + } \ + if (post) { \ + ctx_sec = new_sec; \ + ctx_nsec = new_nsec; \ } \ - UNLOCK(&inode->lock); \ } while (0) #define is_greater_time(a, an, b, bn) \ |