projects
/
redis.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
redis-benchmark: Initial support for pipelining.
[redis.git]
/
src
/
bio.c
diff --git
a/src/bio.c
b/src/bio.c
index 1657455eb26f460a9945f6b682494d0da1a0585f..eaac8e40d55663caf3fbacf4212a01247ba26972 100644
(file)
--- a/
src/bio.c
+++ b/
src/bio.c
@@
-20,6
+20,10
@@
* Every thread wait for new jobs in its queue, and process every job
* sequentially.
*
* Every thread wait for new jobs in its queue, and process every job
* sequentially.
*
+ * Jobs of the same type are guaranteed to be processed from the least
+ * recently inserted to the most recently inserted (older jobs processed
+ * first).
+ *
* Currently there is no way for the creator of the job to be notified about
* the completion of the operation, this will only be added when/if needed.
*/
* Currently there is no way for the creator of the job to be notified about
* the completion of the operation, this will only be added when/if needed.
*/
@@
-125,6
+129,8
@@
void *bioProcessBackgroundJobs(void *arg) {
/* Process the job accordingly to its type. */
if (type == REDIS_BIO_CLOSE_FILE) {
close((long)job->arg1);
/* Process the job accordingly to its type. */
if (type == REDIS_BIO_CLOSE_FILE) {
close((long)job->arg1);
+ } else if (type == REDIS_BIO_AOF_FSYNC) {
+ aof_fsync((long)job->arg1);
} else {
redisPanic("Wrong job type in bioProcessBackgroundJobs().");
}
} else {
redisPanic("Wrong job type in bioProcessBackgroundJobs().");
}
@@
-147,6
+153,11
@@
unsigned long long bioPendingJobsOfType(int type) {
return val;
}
return val;
}
+#if 0 /* We don't use the following code for now, and bioWaitPendingJobsLE
+ probably needs a rewrite using conditional variables instead of the
+ current implementation. */
+
+
/* Wait until the number of pending jobs of the specified type are
* less or equal to the specified number.
*
/* Wait until the number of pending jobs of the specified type are
* less or equal to the specified number.
*
@@
-184,9
+195,14
@@
time_t bioOlderJobOfType(int type) {
pthread_mutex_lock(&bio_mutex[type]);
ln = listFirst(bio_jobs[type]);
pthread_mutex_lock(&bio_mutex[type]);
ln = listFirst(bio_jobs[type]);
+ if (ln == NULL) {
+ pthread_mutex_unlock(&bio_mutex[type]);
+ return 0;
+ }
job = ln->value;
time = job->time;
pthread_mutex_unlock(&bio_mutex[type]);
return time;
}
job = ln->value;
time = job->time;
pthread_mutex_unlock(&bio_mutex[type]);
return time;
}
+#endif