From: Michael Vrable Date: Wed, 7 Apr 2010 22:36:58 +0000 (-0700) Subject: Cleanups while workign on Samba code. X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=ebdb5ef23b8e152a4793d5927b5d92d7e7b2cc4f;p=bluesky.git Cleanups while workign on Samba code. --- diff --git a/bluesky/bluesky.h b/bluesky/bluesky.h index ff2bf23..29d9a62 100644 --- a/bluesky/bluesky.h +++ b/bluesky/bluesky.h @@ -264,6 +264,8 @@ typedef struct { BlueSkyFS *bluesky_init_fs(gchar *name, BlueSkyStore *store); void bluesky_superblock_flush(BlueSkyFS *fs); +gboolean bluesky_inode_is_ready(BlueSkyInode *inode); + int64_t bluesky_get_current_time(); void bluesky_inode_update_ctime(BlueSkyInode *inode, gboolean update_mtime); uint64_t bluesky_fs_alloc_inode(BlueSkyFS *fs); @@ -298,6 +300,7 @@ gint bluesky_dirent_compare(gconstpointer a, gconstpointer b, void bluesky_flushd_invoke(BlueSkyFS *fs); void bluesky_flushd_invoke_conditional(BlueSkyFS *fs); void bluesky_inode_do_sync(BlueSkyInode *inode); +void bluesky_flushd_thread_launch(BlueSkyFS *fs); void bluesky_debug_dump(BlueSkyFS *fs); diff --git a/bluesky/cache.c b/bluesky/cache.c index 72c181a..00d0fec 100644 --- a/bluesky/cache.c +++ b/bluesky/cache.c @@ -295,3 +295,22 @@ void bluesky_flushd_invoke_conditional(BlueSkyFS *fs) bluesky_flushd_invoke(fs); } + +/* Start a perpetually-running thread that flushes the cache occasionally. */ +static gpointer flushd_thread(BlueSkyFS *fs) +{ + while (TRUE) { + bluesky_flushd_invoke(fs); + struct timespec delay; + delay.tv_sec = 2; + delay.tv_nsec = 0; + nanosleep(&delay, NULL); + } + + return NULL; +} + +void bluesky_flushd_thread_launch(BlueSkyFS *fs) +{ + g_thread_create((GThreadFunc)flushd_thread, fs, FALSE, NULL); +} diff --git a/bluesky/util.c b/bluesky/util.c index bd5ddd3..3ac6596 100644 --- a/bluesky/util.c +++ b/bluesky/util.c @@ -36,6 +36,20 @@ gchar *bluesky_lowercase(const gchar *s) return g_ascii_strdown(s, -1); } +gboolean bluesky_inode_is_ready(BlueSkyInode *inode) +{ + if (inode == NULL) + return FALSE; + + g_mutex_lock(inode->lock); + gboolean valid = (inode->type != BLUESKY_PENDING + && inode->type != BLUESKY_INVALID); + + g_mutex_unlock(inode->lock); + + return valid; +} + /**** Reference-counted strings. ****/ /* Create and return a new reference-counted string. The reference count is diff --git a/s3bench/results/readlatency/repeated-reads.cdf b/s3bench/results/readlatency/repeated-reads.cdf new file mode 100644 index 0000000..258bee5 --- /dev/null +++ b/s3bench/results/readlatency/repeated-reads.cdf @@ -0,0 +1,184 @@ +45678659 1 +46355122 2 +47379259 3 +48709097 4 +49379532 5 +49786543 6 +49943146 7 +50046170 8 +51659455 9 +51717652 10 +51823365 11 +52401446 12 +53426212 13 +53711226 14 +53891235 15 +55629281 16 +55692538 17 +55739985 18 +55778654 19 +55976902 20 +56042769 21 +56063876 22 +56123205 23 +56144665 24 +56767363 25 +56864942 26 +57598879 27 +57916772 28 +58025692 29 +58700836 30 +59591718 31 +61605609 32 +62491770 33 +62541999 34 +62779260 35 +63166558 36 +63667866 37 +63689960 38 +64454483 39 +67419091 40 +68709460 41 +68808792 42 +69978132 43 +70277041 44 +71193653 45 +71825696 46 +71911672 47 +72666593 48 +74021744 49 +74842877 50 +75844197 51 +76982676 52 +77190901 53 +77353293 54 +77680295 55 +77891262 56 +78049688 57 +78489857 58 +78532052 59 +79051713 60 +79491182 61 +79771237 62 +80079032 63 +80362801 64 +80603670 65 +80655724 66 +80845778 67 +81059415 68 +81722925 69 +81929828 70 +82287821 71 +82425517 72 +82861304 73 +83038709 74 +83197398 75 +83316453 76 +84215983 77 +84216369 78 +84463818 79 +85272538 80 +85601647 81 +86400526 82 +86675230 83 +87044190 84 +87447493 85 +87611098 86 +87648187 87 +87904243 88 +88260362 89 +88323579 90 +89737288 91 +90317426 92 +90474320 93 +90599847 94 +91456617 95 +91636635 96 +92358926 97 +92679948 98 +92933857 99 +93124662 100 +93379095 101 +94474014 102 +94860040 103 +95435003 104 +95698334 105 +95958039 106 +96502010 107 +97322533 108 +98049406 109 +98720366 110 +99587678 111 +99783297 112 +103877728 113 +104364702 114 +106653944 115 +108536689 116 +110325180 117 +110557421 118 +110704103 119 +110791858 120 +112152449 121 +115036318 122 +115817475 123 +117678434 124 +119845589 125 +120259390 126 +120499701 127 +120816882 128 +122307081 129 +122553750 130 +123210783 131 +127147837 132 +128164568 133 +129148784 134 +129883413 135 +130181664 136 +132358068 137 +134013949 138 +136220018 139 +139438085 140 +139542969 141 +144310730 142 +146216931 143 +150812266 144 +152529469 145 +152599713 146 +153621949 147 +159331419 148 +164128549 149 +165127327 150 +168455185 151 +169846950 152 +176717574 153 +176945507 154 +182308635 155 +185582169 156 +191689623 157 +192978066 158 +216794455 159 +230299896 160 +244265055 161 +266801657 162 +288406029 163 +290924719 164 +290944322 165 +293194442 166 +296806702 167 +297125397 168 +301451332 169 +306961533 170 +319780909 171 +327596215 172 +336857597 173 +337213725 174 +338926846 175 +339953783 176 +344483199 177 +351730443 178 +373036522 179 +407110566 180 +417600026 181 +602331718 182 +1079106474 183 +5648448221 184