1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-02 00:22:11 +03:00

r21724: Optimization pointed out by Volker. If we don't

have any outstanding locks or blocking locks then
we don't need to read the lock db. on close.
Jeremy.
(This used to be commit 1b063496f9)
This commit is contained in:
Jeremy Allison
2007-03-06 21:59:51 +00:00
committed by Gerald (Jerry) Carter
parent 94a1b230f3
commit 640ab28d78
2 changed files with 21 additions and 0 deletions

View File

@ -222,6 +222,12 @@ struct byte_range_lock *do_lock(files_struct *fsp,
lock_flav,
blocking_lock);
/* blocking ie. pending, locks also count here,
* as this is an efficiency counter to avoid checking
* the lock db. on close. JRA. */
fsp->current_lock_count++;
return br_lck;
}
@ -268,6 +274,9 @@ NTSTATUS do_unlock(files_struct *fsp,
return NT_STATUS_RANGE_NOT_LOCKED;
}
SMB_ASSERT(fsp->current_lock_count > 0);
fsp->current_lock_count--;
return NT_STATUS_OK;
}
@ -315,6 +324,9 @@ NTSTATUS do_lock_cancel(files_struct *fsp,
return NT_STATUS_DOS(ERRDOS, ERRcancelviolation);
}
SMB_ASSERT(fsp->current_lock_count > 0);
fsp->current_lock_count++;
return NT_STATUS_OK;
}
@ -330,6 +342,14 @@ void locking_close_file(files_struct *fsp)
return;
}
/* If we have not outstanding locks or pending
* locks then we don't need to look in the lock db.
*/
if (fsp->current_lock_count == 0) {
return;
}
br_lck = brl_get_locks(NULL,fsp);
if (br_lck) {