summaryrefslogtreecommitdiff
path: root/source4/ntvfs
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-03-30 04:55:03 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:59:20 -0500
commit24bacd111334b34d4c52135eea9b466e3a28a8f9 (patch)
treeb5dc40f7a0d3b746d26354e3b6d07797cdb4c765 /source4/ntvfs
parent3387746c4517d6766146080980ac467b72b62316 (diff)
downloadsamba-24bacd111334b34d4c52135eea9b466e3a28a8f9.tar.gz
samba-24bacd111334b34d4c52135eea9b466e3a28a8f9.tar.bz2
samba-24bacd111334b34d4c52135eea9b466e3a28a8f9.zip
r14800: use tdb_get_seqnum() in the change notify code to avoid reloading the
notify record if the tdb has not changed. This makes the notify_trigger() call much faster, which is important as it is called on just about every file operation (This used to be commit d09b8761bfda7dfbb4c7a5c4a4f4359ba01923a3)
Diffstat (limited to 'source4/ntvfs')
-rw-r--r--source4/ntvfs/common/notify.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/source4/ntvfs/common/notify.c b/source4/ntvfs/common/notify.c
index c5acf9decb..b71c2906ae 100644
--- a/source4/ntvfs/common/notify.c
+++ b/source4/ntvfs/common/notify.c
@@ -40,6 +40,7 @@ struct notify_context {
struct messaging_context *messaging_ctx;
struct notify_list *list;
struct notify_array *array;
+ int seqnum;
};
@@ -84,8 +85,8 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx, uint32_t server,
path = smbd_tmp_path(notify, "notify.tdb");
notify->w = tdb_wrap_open(notify, path, 0,
- TDB_DEFAULT,
- O_RDWR|O_CREAT, 0600);
+ TDB_SEQNUM,
+ O_RDWR|O_CREAT, 0600);
talloc_free(path);
if (notify->w == NULL) {
talloc_free(notify);
@@ -96,6 +97,7 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx, uint32_t server,
notify->messaging_ctx = messaging_ctx;
notify->list = NULL;
notify->array = NULL;
+ notify->seqnum = tdb_get_seqnum(notify->w->tdb);
talloc_set_destructor(notify, notify_destructor);
@@ -115,6 +117,15 @@ static NTSTATUS notify_load(struct notify_context *notify)
TDB_DATA dbuf;
DATA_BLOB blob;
NTSTATUS status;
+ int seqnum;
+
+ seqnum = tdb_get_seqnum(notify->w->tdb);
+
+ if (seqnum == notify->seqnum && notify->array != NULL) {
+ return NT_STATUS_OK;
+ }
+
+ notify->seqnum = seqnum;
talloc_free(notify->array);
notify->array = talloc_zero(notify, struct notify_array);