1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

r4121: Optimisation from Nadav Danieli <nadavd@exanet.com>. If we're oplocked,

short circuit some is_locked() tests.
Jeremy.
(This used to be commit f4feed8f90)
This commit is contained in:
Jeremy Allison 2004-12-09 22:10:40 +00:00 committed by Gerald (Jerry) Carter
parent e53d780628
commit 822fcec39d

View File

@ -77,9 +77,17 @@ BOOL is_locked(files_struct *fsp,connection_struct *conn,
if (!lp_locking(snum) || !lp_strict_locking(snum))
return(False);
ret = !brl_locktest(fsp->dev, fsp->inode, fsp->fnum,
if (EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type) && (lock_type == READ_LOCK || lock_type == WRITE_LOCK)) {
DEBUG(10,("is_locked: optimisation - exclusive oplock on file %s\n", fsp->fsp_name ));
ret = 0;
} else if (LEVEL_II_OPLOCK_TYPE(fsp->oplock_type) && (lock_type == READ_LOCK)) {
DEBUG(10,("is_locked: optimisation - level II oplock on file %s\n", fsp->fsp_name ));
ret = 0;
} else {
ret = !brl_locktest(fsp->dev, fsp->inode, fsp->fnum,
global_smbpid, sys_getpid(), conn->cnum,
offset, count, lock_type);
}
DEBUG(10,("is_locked: brl start=%.0f len=%.0f %s for file %s\n",
(double)offset, (double)count, ret ? "locked" : "unlocked",