diff options
author | Jeremy Allison <jra@samba.org> | 2000-04-28 01:01:07 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2000-04-28 01:01:07 +0000 |
commit | a2deb91128d59ad04f4ec858ffe4e30f2afb0edd (patch) | |
tree | 1821eec0746f505f6fe28506824cb88dc8aeaae9 | |
parent | 239abd48f049c6a8d2bbc0636eacf347ab77588c (diff) | |
download | samba-a2deb91128d59ad04f4ec858ffe4e30f2afb0edd.tar.gz samba-a2deb91128d59ad04f4ec858ffe4e30f2afb0edd.tar.xz samba-a2deb91128d59ad04f4ec858ffe4e30f2afb0edd.zip |
Added optimization where we are single opener (don't free POSIX locks).
Jeremy.
-rw-r--r-- | source/locking/locking.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/source/locking/locking.c b/source/locking/locking.c index d69ab180067..62304076af2 100644 --- a/source/locking/locking.c +++ b/source/locking/locking.c @@ -772,6 +772,26 @@ void locking_close_file(files_struct *fsp) struct unlock_list *ul = NULL; int eclass; uint32 ecode; + struct pending_closes *pc; + + /* + * Optimization for the common case where we are the only + * opener of a file. If all fd entries are our own, we don't + * need to explicitly release all the locks via the POSIX functions, + * we can just release all the brl locks, as in the no POSIX locking case. + */ + + if ((pc = find_pending_close_entry(fsp->dev, fsp->inode)) != NULL) { + + if (pc->fd_array_size == 1 && pc->fd_array[0] == fsp->fd ) { + /* + * Just release all the brl locks, no need to release individually. + */ + + brl_close(fsp->dev, fsp->inode, pid, fsp->conn->cnum, fsp->fnum); + return; + } + } if ((ul_ctx = talloc_init()) == NULL) { DEBUG(0,("locking_close_file: unable to init talloc context.\n")); @@ -802,7 +822,7 @@ void locking_close_file(files_struct *fsp) } else { /* - * Just release all the tdb locks, no need to release individually. + * Just release all the brl locks, no need to release individually. */ brl_close(fsp->dev, fsp->inode, pid, fsp->conn->cnum, fsp->fnum); |