X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=bluesky%2Flog.c;h=99b5ae59c528d846bc7ede95d0e3ee37a6a3ac53;hb=4bd76c48487520c2b1c08ff67009f752e0bde941;hp=9dfaa5bfd61437505ca52ed7b339296a8804a6f0;hpb=fb14012672cefd58f8aa7587152f918824ad8ea8;p=bluesky.git diff --git a/bluesky/log.c b/bluesky/log.c index 9dfaa5b..99b5ae5 100644 --- a/bluesky/log.c +++ b/bluesky/log.c @@ -77,8 +77,10 @@ static void log_commit(BlueSkyLog *log) while (log->committed != NULL) { BlueSkyCloudLog *item = (BlueSkyCloudLog *)log->committed->data; g_mutex_lock(item->lock); + bluesky_cloudlog_stats_update(item, -1); item->pending_write &= ~CLOUDLOG_JOURNAL; item->location_flags |= CLOUDLOG_JOURNAL; + bluesky_cloudlog_stats_update(item, 1); g_cond_signal(item->cond); g_mutex_unlock(item->lock); log->committed = g_slist_delete_link(log->committed, log->committed); @@ -158,7 +160,9 @@ static gpointer log_thread(gpointer d) continue; } + bluesky_cloudlog_stats_update(item, -1); item->pending_write |= CLOUDLOG_JOURNAL; + bluesky_cloudlog_stats_update(item, 1); struct log_header header; struct log_footer footer; @@ -200,6 +204,14 @@ static gpointer log_thread(gpointer d) offset += sizeof(header) + sizeof(footer) + item->data->len; + /* Replace the log item's string data with a memory-mapped copy of the + * data, now that it has been written to the log file. (Even if it + * isn't yet on disk, it should at least be in the page cache and so + * available to memory map.) */ + bluesky_string_unref(item->data); + item->data = NULL; + bluesky_cloudlog_fetch(item); + log->committed = g_slist_prepend(log->committed, item); g_atomic_int_add(&item->data_lock_count, -1); g_mutex_unlock(item->lock);