smbd: Avoid an if-statement per read/write in the non-clustered case
authorVolker Lendecke <vl@samba.org>
Wed, 11 Sep 2013 10:17:05 +0000 (10:17 +0000)
committerStefan Metzmacher <metze@samba.org>
Sun, 6 Oct 2013 18:16:00 +0000 (20:16 +0200)
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>
source3/locking/brlock.c

index ee4354c9647f812f5d62e3ab266ef57be64f426e..a0b94cdadfe83f076c9f12948f327e88adb1ead9 100644 (file)
@@ -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);