[PATCH] Data on demand for intermezzo type fs
Troy Benjegerdes <[email protected]> Sun, 25 May 2003 23:47:39 -0500
| Newsgroups | gmane.comp.file-systems.intermezzo.devel |
|---|---|
| Message-ID | <[email protected]> |
--NzB8fVQJ5HfG6fxh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline > > Probably as a command line option to intersync, and one that was saved > in the config file. I went and hacked up what I *think* is the right way to do this. However, it gets written to the config file, but not read back in. The command line method seems to work every time though. > > > > What are the problems with this idea? > > There is no code to flush old data, and no code yet to flush files > when the cache runs out of space. Of course, vintermezzo has the same > problem, so fixing this would fix both. > So for now.. how can I cause the cache to flush files? I'd prefer something separate from intersync for the moment to be able to work out different flush algorithms. And is there anyone else still developing this? :-/ -- -------------------------------------------------------------------------- Troy Benjegerdes 'da hozer' [email protected] Somone asked my why I work on this free (http://www.fsf.org/philosophy/) software stuff and not get a real job. Charles Shultz had the best answer: "Why do musicians compose symphonies and poets write poems? They do it because life wouldn't have any meaning for them if they didn't. That's why I draw cartoons. It's my life." -- Charles Shultz --NzB8fVQJ5HfG6fxh Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="data_on_demand.diff" Index: intersync/fileset.c =================================================================== RCS file: /cvsroot/intermezzo/is/intersync/fileset.c,v retrieving revision 1.40 diff -u -r1.40 fileset.c --- intersync/fileset.c 23 Sep 2002 22:10:07 -0000 1.40 +++ intersync/fileset.c 26 May 2003 04:39:04 -0000 @@ -540,7 +540,8 @@ static struct is_fileset *is_client_init_fset(struct is_cache *cache, struct is_peer *server, char *izo_dir, - char *fsetname) + char *fsetname, + int data_on_demand) { struct is_fileset * root_fset = NULL; struct intersync *is = cache->cache_intersync; @@ -582,7 +583,11 @@ root_fset->fset_permit_holder = server; rep = is_replicator_lookup(root_fset, server); - if (cache->cache_fstype == FSTYPE_VINTERMEZZO && + if (cache->cache_fstype == FSTYPE_VINTERMEZZO) + data_on_demand = 1; + + printf("is_client_init_fset: data_on_demand: %d\n", data_on_demand); + if (data_on_demand == 1 && izo_ioc_mark_fset(root_fset->fset_mtpt_fd, ~0, FSET_DATA_ON_DEMAND)) g_error("Unable to set FSET_DATA_ON_DEMAND: %s (%d).\n", g_strerror(errno), root_fset->fset_mtpt_fd); @@ -603,7 +608,8 @@ struct is_fileset *is_fileset_initialize(struct is_cache *cache, struct is_peer *server, - char * fsetname) + char * fsetname, + int data_on_demand) { struct is_fileset *root_fset = NULL; char *izo_dir = g_strdup_printf("%s/.intermezzo", @@ -617,7 +623,8 @@ } server->srv_cell->cell_root_fset_name = fsetname; root_fset = is_client_init_fset(cache, server, izo_dir, - server->srv_cell->cell_root_fset_name); + server->srv_cell->cell_root_fset_name, + data_on_demand); } g_free(izo_dir); Index: intersync/intersync.c =================================================================== RCS file: /cvsroot/intermezzo/is/intersync/intersync.c,v retrieving revision 1.51 diff -u -r1.51 intersync.c --- intersync/intersync.c 12 Mar 2003 13:20:31 -0000 1.51 +++ intersync/intersync.c 26 May 2003 04:39:04 -0000 @@ -219,6 +219,7 @@ --debug=FLAGS print debug information\n\ --hoard=FILE hoard the files listed in FILE\n\ --reint quit after reintegration and hoard is done\n\ + --data_on_demand force data on demand even on a ext3 filesystem\n\ --daemon run intersync as daemon process\n\ --version output version information and exit\n\ \n\ @@ -260,6 +261,8 @@ {"fsetname", required_argument, NULL, OPT_FSET}, #define OPT_DAEMON -11 {"daemon", no_argument, NULL, OPT_DAEMON}, +#define OPT_DATA_ON_DEMAND -12 + {"data_on_demand", no_argument, NULL, OPT_DATA_ON_DEMAND}, {0} }; @@ -271,6 +274,7 @@ cfg->cfg_hoard_conf = NULL; cfg->cfg_reint_only = 0; cfg->cfg_daemon = 0; + cfg->cfg_data_on_demand = 0; cfg->cfg_clientid = NULL; cfg->cfg_fsetname = NULL; @@ -312,6 +316,9 @@ case OPT_DAEMON: cfg->cfg_daemon = 1; break; + case OPT_DATA_ON_DEMAND: + cfg->cfg_data_on_demand = 1; + break; case OPT_CLIENTID: cfg->cfg_clientid = g_strdup(optarg); break; @@ -397,6 +404,8 @@ dst->cfg_server_port = src->cfg_server_port; if (dst->cfg_local_port == -1) dst->cfg_local_port = src->cfg_local_port; + if (dst->cfg_data_on_demand == -1) + dst->cfg_data_on_demand = src->cfg_data_on_demand; if (!dst->cfg_local_ip) { dst->cfg_local_ip = src->cfg_local_ip; } @@ -418,6 +427,9 @@ if (!cfg->cfg_local_ip) { cfg->cfg_local_ip = g_strdup(DEFAULT_LOCAL_IP); } + if (cfg->cfg_data_on_demand == -1) { /* is this right???? */ + cfg->cfg_data_on_demand = DEFAULT_DATA_ON_DEMAND; + } if (!cfg->cfg_fsetname && !cfg->cfg_server) cfg->cfg_fsetname = g_strdup("rootfset"); return 0; @@ -600,7 +612,8 @@ if (server == NULL) g_error("Cannot connect to server.\n"); } - fset = is_fileset_initialize(cache, server, cfg.cfg_fsetname); + fset = is_fileset_initialize(cache, server, cfg.cfg_fsetname, + cfg.cfg_data_on_demand); if (!fset) is_die("failed to get root file set"); Index: intersync/intersync.h =================================================================== RCS file: /cvsroot/intermezzo/is/intersync/intersync.h,v retrieving revision 1.40 diff -u -r1.40 intersync.h --- intersync/intersync.h 17 May 2002 00:38:10 -0000 1.40 +++ intersync/intersync.h 26 May 2003 04:39:05 -0000 @@ -23,7 +23,7 @@ #define DEFAULT_SERVER_PORT 370 #define DEFAULT_CLIENT_PORT 2432 #define DEFAULT_LOCAL_IP "*" - +#define DEFAULT_DATA_ON_DEMAND 0 # define INTERSYNC_DEBUG # ifdef INTERSYNC_DEBUG @@ -296,7 +296,7 @@ struct is_peer *); void is_peer_destroy_rep(struct is_peer *peer); struct is_fileset *is_fileset_initialize(struct is_cache *, struct is_peer *, - char *fsetname); + char *fsetname, int data_on_demand); struct is_peer *is_peer_set_uuid(struct is_peer *peer, uuid_t uuid); struct is_fileset *is_release_all_permits(struct intersync *is, struct is_peer *peer); Index: lib/config.c =================================================================== RCS file: /cvsroot/intermezzo/is/lib/config.c,v retrieving revision 1.17 diff -u -r1.17 config.c --- lib/config.c 12 Mar 2003 13:18:08 -0000 1.17 +++ lib/config.c 26 May 2003 04:39:05 -0000 @@ -42,6 +42,7 @@ SERVER_PORT, LOCAL_PORT, LOCAL_IP, + DATA_ON_DEMAND, }; struct state { @@ -69,6 +70,8 @@ s->state = LOCAL_PORT; } else if (strcmp(elem, "local_ip") == 0) { s->state = LOCAL_IP; + } else if (strcmp(elem, "data_on_demand") == 0) { + s->state = DATA_ON_DEMAND; } else { /* XXX handle errors */ } @@ -99,8 +102,11 @@ case LOCAL_IP: s->cfg->cfg_local_ip = g_strdup(text); break; + case DATA_ON_DEMAND: + s->cfg->cfg_data_on_demand = atol(text); + break; default: - /*printf("Invalid response: '%s'\n", text);*/ + printf("Invalid response: '%s'\n", text); } } @@ -203,6 +209,8 @@ fprintf(fp, " <local_ip>%s</local_ip>\n", cfg->cfg_local_ip); if(cfg->cfg_local_port) fprintf(fp, " <local_port>%d</local_port>\n", cfg->cfg_local_port); + if(cfg->cfg_data_on_demand) + fprintf(fp, " <data_on_demand>%d</data_on_demand>\n", cfg->cfg_data_on_demand); fprintf(fp, "</profile>\n"); rc = 0; Index: lib/izolib.h =================================================================== RCS file: /cvsroot/intermezzo/is/lib/izolib.h,v retrieving revision 1.31 diff -u -r1.31 izolib.h --- lib/izolib.h 25 Sep 2002 06:31:38 -0000 1.31 +++ lib/izolib.h 26 May 2003 04:39:05 -0000 @@ -96,6 +96,7 @@ char *cfg_hoard_conf; int cfg_reint_only; int cfg_daemon; + int cfg_data_on_demand; char *cfg_clientid; char *cfg_fsetname; }; --NzB8fVQJ5HfG6fxh-- ------------------------------------------------------- This SF.net email is sponsored by: ObjectStore. If flattening out C++ or Java code to make your application fit in a relational database is painful, don't do it! Check out ObjectStore. Now part of Progress Software. http://www.objectstore.net/sourceforge