From c7d1aee76d5713d1f337ab1c831c0ed74e4676e1 Mon Sep 17 00:00:00 2001 From: Yaniv Kaul Date: Thu, 27 Dec 2018 18:56:16 +0200 Subject: Multiple files: reduce work while under lock. Mostly, unlock before logging. In some cases, moved different code that was not needed to be under lock (for example, taking time, or malloc'ing) to be executed before taking the lock. Note: logging might be slightly less accurate in order, since it may not be done now under the lock, so order of logs is racy. I think it's a reasonable compromise. Compile-tested only! updates: bz#1193929 Signed-off-by: Yaniv Kaul Change-Id: I2438710016afc9f4f62a176ef1a0d3ed793b4f89 --- libglusterfs/src/fd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libglusterfs/src/fd.c') diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c index 44a9ee69d67..b8aac726093 100644 --- a/libglusterfs/src/fd.c +++ b/libglusterfs/src/fd.c @@ -766,13 +766,13 @@ fd_anonymous_with_flags(inode_t *inode, int32_t flags) { fd_t *fd = NULL; + if (flags & O_DIRECT) + flags = GF_ANON_FD_FLAGS | O_DIRECT; + else + flags = GF_ANON_FD_FLAGS; + LOCK(&inode->lock); { - if (flags & O_DIRECT) - flags = GF_ANON_FD_FLAGS | O_DIRECT; - else - flags = GF_ANON_FD_FLAGS; - fd = __fd_anonymous(inode, flags); } UNLOCK(&inode->lock); -- cgit