aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/pseudo/pseudo/895fa7e359e8026a608fba052c2994e42901e45f.patch
blob: d8c229541e940775ed08d2a48176a011e8c9372f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
From 895fa7e359e8026a608fba052c2994e42901e45f Mon Sep 17 00:00:00 2001
From: Mark Hatle <mark.hatle@windriver.com>
Date: Fri, 17 Dec 2010 01:23:47 +0000
Subject: Revert "Add a cache of the last object found in pseudo_op"

This reverts commit 49d4d35918d457b0e9206679ecad3b9c84f11e66.

Conflicts:

	ChangeLog.txt
---
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 1db8c7d..200b32e 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -9,7 +9,6 @@
 	* (mhatle) as a result of profiling, optimize inode search
 	* (mhatle) rearrange the pseudo_op file data operations to reduce
 		   the number of selects.
-	* (mhatle) add the ability to cache the last select result
 	* (mhatle) change the indexing in pseudo_db.c
 
 2010-12-14:
diff --git a/pseudo.c b/pseudo.c
index 3979fd8..6b965be 100644
--- a/pseudo.c
+++ b/pseudo.c
@@ -425,9 +425,6 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag) {
 	int found_path = 0, found_ino = 0;
 	int prefer_ino = 0;
 
-	static pseudo_msg_t cache_msg = { .op = 0 };
-	static char * cache_path = NULL;
-
 	if (!msg)
 		return 1;
 	
@@ -471,59 +468,7 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag) {
 
 	/* Lookup the full path, with inode and dev if available */
 	if (msg->pathlen && msg->dev && msg->ino) {
-		if (cache_msg.pathlen == msg->pathlen &&
-		    cache_msg.dev == msg->dev &&
-		    cache_msg.ino == msg->ino &&
-		    !strcmp(cache_path, msg->path)) {
-			/* Found it in the cache! */
-#ifdef NPROFILE
-			pseudo_diag("cache hit -- by_file_exact\n");
-#endif
-			/* Change the cache to match the msg */
-			cache_msg.type = msg->type;
-			cache_msg.op = msg->op;
-			cache_msg.result = msg->result;
-			cache_msg.access = msg->access;
-			cache_msg.fd = msg->fd;
-#ifdef NVALIDATE
-			if (!pdb_find_file_exact(msg)) {
-				if (cache_msg.pathlen != msg->pathlen ||
-				    cache_msg.dev != msg->dev ||
-				    cache_msg.ino != msg->ino ||
-				    cache_msg.uid != msg->uid ||
-				    cache_msg.gid != msg->gid ||
-				    cache_msg.mode != msg->mode ||
-				    cache_msg.rdev != msg->rdev ||
-				    cache_msg.nlink != msg->nlink ||
-				    cache_msg.deleting != msg->deleting) {
-				pseudo_diag("Cache mismatch [%s]: Database differs from cache\n"
-						"     cache vs result:\n"
-						"     dev (%llu,%llu) ino (%llu,%llu)\n"
-						"     uid (%d,%d) gid (%d,%d) mode (0%o,0%o)\n"
-						"     rdev (%llu,%llu) nlink (%d,%d) deleting (%d,%d)\n",
-						msg->pathlen ? msg->path : "no path",
-						(unsigned long long) cache_msg.dev, (unsigned long long) msg->dev,
-						(unsigned long long) cache_msg.ino, (unsigned long long) msg->ino,
-						(unsigned long long) cache_msg.uid, (unsigned int) msg->uid,
-						(unsigned long long) cache_msg.gid, (unsigned int) msg->gid,
-						cache_msg.mode, msg->mode,
-						(unsigned long long) cache_msg.rdev, (unsigned int) msg->rdev,
-						cache_msg.nlink, msg->nlink,
-						cache_msg.deleting, msg->deleting);
-				}
-			} else {
-				pseudo_diag("Cache mismatch [%s]: Not found in DB\n",
-						msg->pathlen ? msg->path : "no path");
-			}
-#endif
-
-			by_path = cache_msg;
-			by_ino = cache_msg;
-			/* no need to restore msg */
-			found_path = 1;
-			found_ino = 1;
-			path_by_ino = msg->path;
-		} else if (!pdb_find_file_exact(msg)) {
+		if (!pdb_find_file_exact(msg)) {
 			/* restore header contents */
 			by_path = *msg;
 			by_ino = *msg;
@@ -539,51 +484,7 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag) {
 		if (msg->pathlen) {
 			/* for now, don't canonicalize paths anymore */
 			/* used to do it here, but now doing it in client */
-			if (cache_msg.pathlen == msg->pathlen &&
-			    !strcmp(cache_path, msg->path)) {
-#ifdef NPROFILE
-				pseudo_diag("cache hit -- by_path\n");
-#endif
-				/* Change the cache to match the msg */
-				cache_msg.type = msg->type;
-				cache_msg.op = msg->op;
-				cache_msg.result = msg->result;
-				cache_msg.access = msg->access;
-				cache_msg.fd = msg->fd;
-#ifdef NVALIDATE
-				if (!pdb_find_file_exact(msg)) {
-					if (cache_msg.pathlen != msg->pathlen ||
-					    cache_msg.dev != msg->dev ||
-					    cache_msg.ino != msg->ino ||
-					    cache_msg.uid != msg->uid ||
-					    cache_msg.gid != msg->gid ||
-					    cache_msg.mode != msg->mode ||
-					    cache_msg.rdev != msg->rdev ||
-					    cache_msg.nlink != msg->nlink ||
-					    cache_msg.deleting != msg->deleting) {
-					pseudo_diag("Cache mismatch [%s]: Database differs from cache\n"
-						"     cache vs result:\n"
-						"     dev (%llu,%llu) ino (%llu,%llu)\n"
-						"     uid (%d,%d) gid (%d,%d) mode (0%o,0%o)\n"
-						"     rdev (%llu,%llu) nlink (%d,%d) deleting (%d,%d)\n",
-						msg->pathlen ? msg->path : "no path",
-						(unsigned long long) cache_msg.dev, (unsigned long long) msg->dev,
-						(unsigned long long) cache_msg.ino, (unsigned long long) msg->ino,
-						(unsigned long long) cache_msg.uid, (unsigned int) msg->uid,
-						(unsigned long long) cache_msg.gid, (unsigned int) msg->gid,
-						cache_msg.mode, msg->mode,
-						(unsigned long long) cache_msg.rdev, (unsigned int) msg->rdev,
-						cache_msg.nlink, msg->nlink,
-						cache_msg.deleting, msg->deleting);
-					}
-				} else {
-					pseudo_diag("Cache mismatch [%s]: Not found in DB\n",
-							msg->pathlen ? msg->path : "no path");
-				}
-#endif
-				by_path = cache_msg;
-				found_path = 1;
-			} else if (!pdb_find_file_path(msg)) {
+			if (!pdb_find_file_path(msg)) {
 				by_path = *msg;
 				found_path = 1;
 			} else {
@@ -594,51 +495,7 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag) {
 		}
 		/* search on original inode -- in case of mismatch */
 		if (msg->dev && msg->ino) {
-			if (cache_msg.dev == msg->dev &&
-			    cache_msg.ino == msg->ino) {
-#ifdef NPROFILE
-				pseudo_diag("cache hit -- by_ino\n");
-#endif
-				/* Change the cache to match the msg */
-				cache_msg.type = msg->type;
-				cache_msg.op = msg->op;
-				cache_msg.result = msg->result;
-				cache_msg.access = msg->access;
-				cache_msg.fd = msg->fd;
-#ifdef NVALIDATE
-				if (!pdb_find_file_exact(msg)) {
-					if (cache_msg.pathlen != msg->pathlen ||
-					    cache_msg.dev != msg->dev ||
-					    cache_msg.ino != msg->ino ||
-					    cache_msg.uid != msg->uid ||
-					    cache_msg.gid != msg->gid ||
-					    cache_msg.mode != msg->mode ||
-					    cache_msg.rdev != msg->rdev ||
-					    cache_msg.nlink != msg->nlink ||
-					    cache_msg.deleting != msg->deleting) {
-					pseudo_diag("Cache mismatch [%s]: Database differs from cache\n"
-						"     cache vs result:\n"
-						"     dev (%llu,%llu) ino (%llu,%llu)\n"
-						"     uid (%d,%d) gid (%d,%d) mode (0%o,0%o)\n"
-						"     rdev (%llu,%llu) nlink (%d,%d) deleting (%d,%d)\n",
-						msg->pathlen ? msg->path : "no path",
-						(unsigned long long) cache_msg.dev, (unsigned long long) msg->dev,
-						(unsigned long long) cache_msg.ino, (unsigned long long) msg->ino,
-						(unsigned long long) cache_msg.uid, (unsigned int) msg->uid,
-						(unsigned long long) cache_msg.gid, (unsigned int) msg->gid,
-						cache_msg.mode, msg->mode,
-						(unsigned long long) cache_msg.rdev, (unsigned int) msg->rdev,
-						cache_msg.nlink, msg->nlink,
-						cache_msg.deleting, msg->deleting);
-					}
-				} else {
-					pseudo_diag("Cache mismatch [%s]: Not found in DB\n",
-							msg->pathlen ? msg->path : "no path");
-				}
-#endif
-				found_ino = 1;
-				path_by_ino = cache_path;
-			} else 	if (!pdb_find_file_dev(&by_ino)) {
+			if (!pdb_find_file_dev(&by_ino)) {
 				found_ino = 1;
 				path_by_ino = pdb_get_file_path(&by_ino);
 			}
@@ -1016,28 +873,6 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag) {
 		break;
 	}
 
-	/* Cache previous values... */
-	if (msg->op != OP_MAY_UNLINK &&
-	    msg->op != OP_DID_UNLINK &&
-	    msg->op != OP_CANCEL_UNLINK &&
-	    msg->op != OP_UNLINK) {
-
-		cache_msg = *msg;
-
-		free(cache_path);
-
-		if (path_by_ino)
-			cache_path = strdup(path_by_ino);
-		else
-			cache_path = strdup(msg->path);
-	} else {
-		cache_msg.pathlen = 0;
-		cache_msg.dev = 0;
-		cache_msg.ino = 0;
-		free(cache_path);
-		cache_path = NULL;
-	}
-
 	/* in the case of an exact match, we just used the pointer
 	 * rather than allocating space
 	 */
--
cgit v0.8.3.3-89-gbf82