[PATCH] smbd: Simplify find_oplock_types a bit
Volker Lendecke
Volker.Lendecke at SerNet.DE
Mon Oct 14 04:41:00 MDT 2013
Hi!
Please review&push!
Thanks,
Volker
--
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
From 69881d0e7fe0a808dd5f28a42af8688922dfe77c Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Mon, 2 Sep 2013 12:33:40 +0000
Subject: [PATCH] smbd: Simplify find_oplock_types a bit
Define a variable to dereference lck->data just once. Believe it or not,
this saves a few bytes .o with -O3 :-)
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/smbd/open.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index f6df035..b6f3f80 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -1225,6 +1225,7 @@ static void find_oplock_types(files_struct *fsp,
bool *got_level2,
bool *got_no_oplock)
{
+ struct share_mode_data *d = lck->data;
int i;
*pp_batch = NULL;
@@ -1240,8 +1241,8 @@ static void find_oplock_types(files_struct *fsp,
return;
}
- for (i=0; i<lck->data->num_share_modes; i++) {
- struct share_mode_entry *e = &lck->data->share_modes[i];
+ for (i=0; i<d->num_share_modes; i++) {
+ struct share_mode_entry *e = &d->share_modes[i];
if (!is_valid_share_mode_entry(e)) {
continue;
@@ -1256,7 +1257,7 @@ static void find_oplock_types(files_struct *fsp,
if (BATCH_OPLOCK_TYPE(e->op_type)) {
/* batch - can only be one. */
- if (share_mode_stale_pid(lck->data, i)) {
+ if (share_mode_stale_pid(d, i)) {
DEBUG(10, ("Found stale batch oplock\n"));
continue;
}
@@ -1267,7 +1268,7 @@ static void find_oplock_types(files_struct *fsp,
}
if (EXCLUSIVE_OPLOCK_TYPE(e->op_type)) {
- if (share_mode_stale_pid(lck->data, i)) {
+ if (share_mode_stale_pid(d, i)) {
DEBUG(10, ("Found stale duplicate oplock\n"));
continue;
}
@@ -1280,7 +1281,7 @@ static void find_oplock_types(files_struct *fsp,
if (LEVEL_II_OPLOCK_TYPE(e->op_type)) {
if (*pp_batch || *pp_ex_or_batch) {
- if (share_mode_stale_pid(lck->data, i)) {
+ if (share_mode_stale_pid(d, i)) {
DEBUG(10, ("Found stale LevelII "
"oplock\n"));
continue;
@@ -1292,7 +1293,7 @@ static void find_oplock_types(files_struct *fsp,
if (e->op_type == NO_OPLOCK) {
if (*pp_batch || *pp_ex_or_batch) {
- if (share_mode_stale_pid(lck->data, i)) {
+ if (share_mode_stale_pid(d, i)) {
DEBUG(10, ("Found stale NO_OPLOCK "
"entry\n"));
continue;
--
1.8.1.2
More information about the samba-technical
mailing list