svn commit: samba r14800 - in branches/SAMBA_4_0/source/ntvfs/common: .

tridge at samba.org tridge at samba.org
Thu Mar 30 04:55:04 GMT 2006


Author: tridge
Date: 2006-03-30 04:55:03 +0000 (Thu, 30 Mar 2006)
New Revision: 14800

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=14800

Log:

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

Modified:
   branches/SAMBA_4_0/source/ntvfs/common/notify.c


Changeset:
Modified: branches/SAMBA_4_0/source/ntvfs/common/notify.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/common/notify.c	2006-03-30 04:52:39 UTC (rev 14799)
+++ branches/SAMBA_4_0/source/ntvfs/common/notify.c	2006-03-30 04:55:03 UTC (rev 14800)
@@ -40,6 +40,7 @@
 	struct messaging_context *messaging_ctx;
 	struct notify_list *list;
 	struct notify_array *array;
+	int seqnum;
 };
 
 
@@ -84,8 +85,8 @@
 
 	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 @@
 	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,7 +117,16 @@
 	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);
 	NT_STATUS_HAVE_NO_MEMORY(notify->array);



More information about the samba-cvs mailing list