summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2013-09-11 10:17:05 +0000
committerStefan Metzmacher <metze@samba.org>2013-10-06 20:16:00 +0200
commit2b3c5bea1c1512bc250481690b2d968491738629 (patch)
treee49641493d9e4914d6956cee3432e2d33477e8f8
parentf650bb94c8b79bec87c2a1f17b573c27e0ef1b1b (diff)
downloadsamba-2b3c5bea1c1512bc250481690b2d968491738629.tar.gz
samba-2b3c5bea1c1512bc250481690b2d968491738629.tar.bz2
samba-2b3c5bea1c1512bc250481690b2d968491738629.zip
smbd: Avoid an if-statement per read/write in the non-clustered case
Without clustering, fsp->brlock_rec will never be set anyway. In the clustering case we can't use the seqnum trick, so this is slow enough that the additional if-statement does not matter in this case anyway. In the non-clustered case it might. Have not measured it, but every little bit helps I guess. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
-rw-r--r--source3/locking/brlock.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index ee4354c964..a0b94cdadf 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -2062,15 +2062,15 @@ struct byte_range_lock *brl_get_locks_readonly(files_struct *fsp)
{
struct byte_range_lock *br_lock;
- if (lp_clustering()) {
- return brl_get_locks_internal(talloc_tos(), fsp, true);
- }
-
if ((fsp->brlock_rec != NULL)
&& (dbwrap_get_seqnum(brlock_db) == fsp->brlock_seqnum)) {
return fsp->brlock_rec;
}
+ if (lp_clustering()) {
+ return brl_get_locks_internal(talloc_tos(), fsp, true);
+ }
+
TALLOC_FREE(fsp->brlock_rec);
br_lock = brl_get_locks_internal(talloc_tos(), fsp, true);