From: Michael Vrable Date: Mon, 11 Jan 2010 22:29:00 +0000 (-0800) Subject: Add a new option to make caching writethrough instead of writeback. X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=0e3a9c0defb08f388fea2c2eb393dd39d9e95e45;p=bluesky.git Add a new option to make caching writethrough instead of writeback. --- diff --git a/bluesky/bluesky.h b/bluesky/bluesky.h index f147088..59814b1 100644 --- a/bluesky/bluesky.h +++ b/bluesky/bluesky.h @@ -21,6 +21,9 @@ extern "C" { typedef struct { /* Perform all get/put operations synchronously. */ int synchronous_stores; + + /* Write data in cache immediately after file is modified. */ + int writethrough_cache; } BlueSkyOptions; extern BlueSkyOptions bluesky_options; diff --git a/bluesky/init.c b/bluesky/init.c index 4b7ec93..82cb3aa 100644 --- a/bluesky/init.c +++ b/bluesky/init.c @@ -25,7 +25,8 @@ void bluesky_init(void) g_thread_init(NULL); bluesky_crypt_init(); - //bluesky_options.synchronous_stores = 1; + bluesky_options.synchronous_stores = 1; + bluesky_options.writethrough_cache = 1; bluesky_store_init(); bluesky_store_init_s3(); diff --git a/bluesky/inode.c b/bluesky/inode.c index bdf01a1..377364c 100644 --- a/bluesky/inode.c +++ b/bluesky/inode.c @@ -41,6 +41,9 @@ void bluesky_inode_update_ctime(BlueSkyInode *inode, gboolean update_mtime) if (inode->change_time == 0) inode->change_time = now; + + if (bluesky_options.writethrough_cache) + bluesky_file_flush(inode, NULL); } /* Unfortunately a glib hash table is only guaranteed to be able to store diff --git a/bluesky/s3store.c b/bluesky/s3store.c index 336afc2..b4920dc 100644 --- a/bluesky/s3store.c +++ b/bluesky/s3store.c @@ -75,7 +75,7 @@ static void s3store_response_callback(S3Status status, info->success = 1; } - if (errorDetails != NULL) { + if (errorDetails != NULL && errorDetails->message != NULL) { g_print(" Error message: %s\n", errorDetails->message); } } diff --git a/nfs3/rpc.c b/nfs3/rpc.c index 38a3c22..cfd67ec 100644 --- a/nfs3/rpc.c +++ b/nfs3/rpc.c @@ -22,6 +22,9 @@ #include #include +#include "bluesky.h" +extern BlueSkyFS *fs; + static void mount_program_3(struct svc_req *rqstp, register SVCXPRT *transp) { @@ -270,6 +273,9 @@ nfs_program_3(struct svc_req *rqstp, register SVCXPRT *transp) fprintf (stderr, "%s", "unable to free arguments"); exit (1); } + + bluesky_flushd_invoke(fs); + return; }