[Pvfs2-cvs] commit by vilayann in pvfs2-1/src/apps/admin:
pvfs2-cp.c pvfs2-fs-dump.c pvfs2-fsck.c pvfs2-genconfig
pvfs2-ln.c pvfs2-ls.c pvfs2-migrate-collection.c
pvfs2-mkdir.c pvfs2-showcoll.c pvfs2-stat.c pvfs2-touch.c
pvfs2-viewdist.c
CVS commit program
cvs at parl.clemson.edu
Wed Aug 9 16:17:30 EDT 2006
Update of /projects/cvsroot/pvfs2-1/src/apps/admin
In directory parlweb1:/tmp/cvs-serv7687/src/apps/admin
Modified Files:
Tag: posix-extensions-branch
pvfs2-cp.c pvfs2-fs-dump.c pvfs2-fsck.c pvfs2-genconfig
pvfs2-ln.c pvfs2-ls.c pvfs2-migrate-collection.c pvfs2-mkdir.c
pvfs2-showcoll.c pvfs2-stat.c pvfs2-touch.c pvfs2-viewdist.c
Log Message:
Reverse merge changes from HEAD to posix-extensions-branch.
Index: pvfs2-cp.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/apps/admin/pvfs2-cp.c,v
diff -p -u -r1.16.8.1 -r1.16.8.2
--- pvfs2-cp.c 7 Jun 2006 03:20:33 -0000 1.16.8.1
+++ pvfs2-cp.c 9 Aug 2006 20:17:29 -0000 1.16.8.2
@@ -558,7 +558,7 @@ static int generic_open(file_object *obj
if ((ret == 0) && (open_type == OPEN_SRC))
{
memset(&resp_getattr, 0, sizeof(PVFS_sysresp_getattr));
- ret = PVFS_sys_getattr(resp_lookup.ref, PVFS_ATTR_SYS_ALL,
+ ret = PVFS_sys_getattr(resp_lookup.ref, PVFS_ATTR_SYS_ALL_NOHINT,
credentials, &resp_getattr);
if (ret)
{
@@ -683,9 +683,6 @@ void make_attribs(PVFS_sys_attr *attr, P
attr->owner = credentials->uid;
attr->group = credentials->gid;
attr->perms = PVFS2_translate_mode(mode);
- attr->atime = time(NULL);
- attr->mtime = attr->atime;
- attr->ctime = attr->atime;
attr->mask = (PVFS_ATTR_SYS_ALL_SETABLE);
attr->dfile_count = nr_datafiles;
Index: pvfs2-fs-dump.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/apps/admin/pvfs2-fs-dump.c,v
diff -p -u -r1.39.8.1 -r1.39.8.2
--- pvfs2-fs-dump.c 7 Jun 2006 03:20:33 -0000 1.39.8.1
+++ pvfs2-fs-dump.c 9 Aug 2006 20:17:29 -0000 1.39.8.2
@@ -439,7 +439,7 @@ int traverse_directory_tree(PVFS_fs_id c
pref = lookup_resp.ref;
PVFS_sys_getattr(pref,
- PVFS_ATTR_SYS_ALL,
+ PVFS_ATTR_SYS_ALL_NOHINT,
creds,
&getattr_resp);
@@ -505,7 +505,7 @@ int descend(PVFS_fs_id cur_fs,
entry_ref.fs_id = cur_fs;
if ((ret = PVFS_sys_getattr(entry_ref,
- PVFS_ATTR_SYS_ALL,
+ PVFS_ATTR_SYS_ALL_NOHINT,
creds,
&getattr_resp)) != 0)
{
Index: pvfs2-fsck.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/apps/admin/pvfs2-fsck.c,v
diff -p -u -r1.13.8.1 -r1.13.8.2
--- pvfs2-fsck.c 7 Jun 2006 03:20:34 -0000 1.13.8.1
+++ pvfs2-fsck.c 9 Aug 2006 20:17:29 -0000 1.13.8.2
@@ -449,7 +449,7 @@ int traverse_directory_tree(PVFS_fs_id c
pref = lookup_resp.ref;
PVFS_sys_getattr(pref,
- PVFS_ATTR_SYS_ALL,
+ PVFS_ATTR_SYS_ALL_NOHINT,
creds,
&getattr_resp);
@@ -565,7 +565,7 @@ int descend(PVFS_fs_id cur_fs,
}
ret = PVFS_sys_getattr(entry_ref,
- PVFS_ATTR_SYS_ALL,
+ PVFS_ATTR_SYS_ALL_NOHINT,
creds,
&getattr_resp);
if (ret != 0) {
@@ -795,7 +795,7 @@ struct handlelist *find_sub_trees(PVFS_f
handle_ref.fs_id = cur_fs;
ret = PVFS_sys_getattr(handle_ref,
- PVFS_ATTR_SYS_ALL,
+ PVFS_ATTR_SYS_ALL_NOHINT,
creds,
&getattr_resp);
if (ret) {
@@ -876,7 +876,7 @@ struct handlelist *fill_lost_and_found(P
handle_ref.fs_id = cur_fs;
ret = PVFS_sys_getattr(handle_ref,
- PVFS_ATTR_SYS_ALL,
+ PVFS_ATTR_SYS_ALL_NOHINT,
creds,
&getattr_resp);
if (ret) {
@@ -987,7 +987,7 @@ void cull_leftovers(PVFS_fs_id cur_fs,
handle_ref.fs_id = cur_fs;
ret = PVFS_sys_getattr(handle_ref,
- PVFS_ATTR_SYS_ALL,
+ PVFS_ATTR_SYS_ALL_NOHINT,
creds,
&getattr_resp);
if (ret) {
@@ -1035,10 +1035,7 @@ int create_lost_and_found(PVFS_fs_id cur
attr.owner = creds->uid;
attr.group = creds->gid;
attr.perms = PVFS2_translate_mode(0755);
- attr.atime = time(NULL);
- attr.mtime = attr.atime;
- attr.ctime = attr.atime;
- attr.mask = (PVFS_ATTR_SYS_ALL_SETABLE);
+ attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
ret = PVFS_sys_lookup(cur_fs,
"/",
Index: pvfs2-genconfig
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/apps/admin/pvfs2-genconfig,v
diff -p -u -r1.53.2.2 -r1.53.2.3
--- pvfs2-genconfig 7 Jun 2006 03:20:34 -0000 1.53.2.2
+++ pvfs2-genconfig 9 Aug 2006 20:17:29 -0000 1.53.2.3
@@ -288,10 +288,6 @@ sub emit_filesystem
print $target "\t\tCoalescingLowWatermark 1\n";
}
- print $target "\t\tAttrCacheKeywords datafile_handles,metafile_dist\n";
- print $target "\t\tAttrCacheKeywords dir_ent, symlink_target\n";
- print $target "\t\tAttrCacheSize 4093\n";
- print $target "\t\tAttrCacheMaxNumElems 32768\n";
print $target "\t</StorageHints>\n";
if($opt_gen_key ne "0")
Index: pvfs2-ln.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/apps/admin/pvfs2-ln.c,v
diff -p -u -r1.3 -r1.3.8.1
--- pvfs2-ln.c 11 Nov 2005 21:30:57 -0000 1.3
+++ pvfs2-ln.c 9 Aug 2006 20:17:29 -0000 1.3.8.1
@@ -126,9 +126,6 @@ static int make_link(PVFS_credentials
attr.owner = pCredentials->uid;
attr.group = pCredentials->gid;
attr.perms = 0777;
- attr.atime = time(NULL);
- attr.mtime = attr.atime;
- attr.ctime = attr.atime;
attr.mask = (PVFS_ATTR_SYS_ALL_SETABLE);
/* We need to change the PINT_remove_base_dir to an API call (pvfs_util),
Index: pvfs2-ls.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/apps/admin/pvfs2-ls.c,v
diff -p -u -r1.63.8.1 -r1.63.8.2
--- pvfs2-ls.c 7 Jun 2006 03:20:34 -0000 1.63.8.1
+++ pvfs2-ls.c 9 Aug 2006 20:17:29 -0000 1.63.8.2
@@ -367,7 +367,7 @@ void print_entry(
memset(&getattr_response,0, sizeof(PVFS_sysresp_getattr));
PVFS_util_gen_credentials(&credentials);
- ret = PVFS_sys_getattr(ref, PVFS_ATTR_SYS_ALL,
+ ret = PVFS_sys_getattr(ref, PVFS_ATTR_SYS_ALL_NOHINT,
&credentials, &getattr_response);
if (ret)
{
@@ -415,7 +415,7 @@ int do_list(
pvfs_dirent_incount = MAX_NUM_DIRENTS;
memset(&getattr_response,0,sizeof(PVFS_sysresp_getattr));
- if (PVFS_sys_getattr(ref, PVFS_ATTR_SYS_ALL,
+ if (PVFS_sys_getattr(ref, PVFS_ATTR_SYS_ALL_NOHINT,
&credentials, &getattr_response) == 0)
{
if ((getattr_response.attr.objtype == PVFS_TYPE_METAFILE) ||
Index: pvfs2-migrate-collection.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/apps/admin/pvfs2-migrate-collection.c,v
diff -p -u -r1.12.2.1 -r1.12.2.2
--- pvfs2-migrate-collection.c 7 Jun 2006 03:20:34 -0000 1.12.2.1
+++ pvfs2-migrate-collection.c 9 Aug 2006 20:17:30 -0000 1.12.2.2
@@ -41,12 +41,12 @@
typedef struct
{
- char coll[100];
- int coll_set;
- char storage_space[PATH_MAX];
- int storage_space_set;
- char new_collection_name[256];
- int new_collname_set;
+ char fs[100];
+ int fs_set;
+ int all_set;
+ int cleanup_set;
+ char fs_conf[PATH_MAX];
+ char server_conf[PATH_MAX];
} options_t;
/** default size of buffers to use for reading old db keys */
@@ -60,39 +60,41 @@ int verbose = 0;
static void print_help(char *progname);
static int parse_args(int argc, char **argv, options_t *opts);
static int src_get_version(
- char* storage_space, char* coll_id, char* ver_string, int ver_string_max);
-static int remove_migration_id_mapping(
- char* storage_space, char* coll_name);
-static int confirm_coll_name_not_used(char* storage_space, char* coll_name);
-static int confirm_subdir_not_used(char* storage_space, char* subdir);
-static int get_migration_id(char* storage_space, TROVE_coll_id* out_id);
+ char* storage_space, TROVE_coll_id coll_id, char* coll_name,
+ char* ver_string, int ver_string_max);
+static int remove_collection_entry(char* storage_space, char* collname);
+
+int migrate_collection(void * config, void * sconfig);
+void fs_config_dummy_free(void *);
+int recursive_rmdir(char* dir);
/* functions specific to reading 0.0.1 collections */
static int src_get_version_0_0_1(
- char* storage_space, char* coll_id, char* ver_string, int ver_string_max);
+ char* storage_space, TROVE_coll_id coll_id,
+ char* ver_string, int ver_string_max);
static int translate_0_0_1(
- char* storage_space, char* coll_id, char* new_name, TROVE_coll_id new_id);
+ char* storage_space, char* old_coll_path,
+ char* coll_name, TROVE_coll_id coll_id);
static int translate_coll_eattr_0_0_1(
- char* storage_space, char* coll_id, char* new_name, TROVE_coll_id new_id,
+ char* old_coll_path, TROVE_coll_id coll_id, char* coll_name,
TROVE_context_id trove_context);
static int translate_dspace_attr_0_0_1(
- char* storage_space, char* coll_id, char* new_name, TROVE_coll_id new_id,
+ char* old_coll_path, TROVE_coll_id coll_id, char* coll_name,
TROVE_context_id trove_context);
static int translate_keyvals_0_0_1(
- char* storage_space, char* coll_id, char* new_name, TROVE_coll_id new_id,
- TROVE_context_id trove_context);
-static int translate_dirdata_sizes_0_0_1(
- char* storage_space, char* coll_id, char* new_name, TROVE_coll_id new_id,
+ char* old_coll_path, TROVE_coll_id coll_id, char* coll_name,
TROVE_context_id trove_context);
static int translate_bstreams_0_0_1(
- char* storage_space, char* coll_id, char* new_name, TROVE_coll_id new_id,
+ char* storage_space, char* old_coll_path,
+ TROVE_coll_id coll_id, char* coll_name,
TROVE_context_id trove_context);
static int translate_keyval_db_0_0_1(
- char* storage_space, char* coll_id,
- char* full_db_path, TROVE_handle handle, char* new_name, TROVE_coll_id
- new_id, TROVE_context_id trove_context);
+ TROVE_coll_id coll_id, char* full_db_path,
+ TROVE_handle handle, char* coll_name,
+ TROVE_context_id trove_context);
static int translate_dist_0_0_1(
PINT_dist * dist);
+static int translate_keyval_key_0_0_1(TROVE_keyval_s * keyval, DBT * db_key);
/** number of keyval buckets used in DBPF 0.0.1 */
#define KEYVAL_MAX_NUM_BUCKETS_0_0_1 32
@@ -105,11 +107,11 @@ static int translate_dist_0_0_1(
KEYVAL_MAX_NUM_BUCKETS_0_0_1)
#define KEYVAL_DIRNAME_0_0_1 "keyvals"
/* arguments are: buf, path_max, stoname, collid, handle */
-#define DBPF_GET_KEYVAL_DBNAME_0_0_1(__b, __pm, __stoname, __cid, __handle) \
-do { \
- snprintf(__b, __pm, "/%s/%08x/%s/%.8llu/%08llx.keyval", __stoname, \
- __cid, KEYVAL_DIRNAME_0_0_1, \
- llu(DBPF_KEYVAL_GET_BUCKET_0_0_1(__handle, __cid)), llu(__handle)); \
+#define DBPF_GET_KEYVAL_DBNAME_0_0_1(__b, __pm, __collpath, __cid, __handle) \
+do { \
+ snprintf(__b, __pm, "/%s/%s/%.8llu/%08llx.keyval", __collpath, \
+ KEYVAL_DIRNAME_0_0_1, \
+ llu(DBPF_KEYVAL_GET_BUCKET_0_0_1(__handle, __cid)), llu(__handle)); \
} while (0)
struct PVFS_ds_storedattr_s_0_0_1
@@ -128,15 +130,17 @@ struct PVFS_ds_storedattr_s_0_0_1
};
typedef struct PVFS_ds_storedattr_s_0_0_1 PVFS_ds_storedattr_0_0_1;
+static options_t opts;
+
+
int main(int argc, char **argv)
{
int ret = -1;
- options_t opts;
- char version[256];
- char *new_name = NULL;
- TROVE_coll_id new_id;
- char subdir[PATH_MAX];
+ /* all parameters read in from fs.conf and server.conf */
+ struct server_configuration_s server_config;
+ PINT_llist_p fs_configs;
+
/* make sure that the buffers we intend to use for reading keys and
* values is at least large enough to hold the maximum size of xattr keys
* and values
@@ -156,61 +160,217 @@ int main(int argc, char **argv)
argv[0]);
return -1;
}
- new_name = opts.new_collection_name;
- /* make sure that there will not be any collisions in the collection name
- * space
- */
- ret = confirm_coll_name_not_used(opts.storage_space, new_name);
+ ret = PINT_parse_config(&server_config, opts.fs_conf, opts.server_conf);
if(ret < 0)
{
- fprintf(stderr, "Error: unable to confirm availability of collection names for migration.\n");
- return(-1);
+ gossip_err("Error: Please check your config files.\n");
+ return -1;
}
- sprintf(subdir, "%s.old", opts.coll);
- ret = confirm_subdir_not_used(opts.storage_space, subdir);
- if(ret < 0)
+
+ if(opts.all_set)
{
- fprintf(stderr, "Error: unable to confirm availability of backup subdirectory for migration: %s.\n", subdir);
- fprintf(stderr, "Error: please make sure that the migration has not already been performed.\n");
- return(-1);
+ /* get all the collection ids from the fs config */
+ fs_configs = PINT_config_get_filesystems(&server_config);
+
+ }
+ else
+ {
+ /* get the collection id from the specified fs name */
+ PVFS_fs_id fs_id = PINT_config_get_fs_id_by_fs_name(
+ &server_config, opts.fs);
+ fs_configs = PINT_llist_new();
+ PINT_llist_add_to_head(
+ fs_configs,
+ (void *)PINT_config_find_fs_id(&server_config, fs_id));
}
- /* pick an unused collection id to use for migration */
- ret = get_migration_id(opts.storage_space, &new_id);
+ ret = PINT_llist_doall_arg(fs_configs, migrate_collection, &server_config);
if(ret < 0)
{
- fprintf(stderr, "Error: unable to get a collection id to use for migration.\n");
+ PINT_config_release(&server_config);
+ if(!opts.all_set)
+ {
+ PINT_llist_free(fs_configs, fs_config_dummy_free);
+ }
+
return(-1);
}
+
+ return 0;
+}
+
+int migrate_collection(void * config, void * sconfig)
+{
+ char old_coll_path[PATH_MAX];
+ char version[256];
+ int ret;
+ struct filesystem_configuration_s * fs_config =
+ (struct filesystem_configuration_s *) config;
+ struct server_configuration_s * server_config =
+ (struct server_configuration_s *) sconfig;
+
+ memset(version, 0, 256);
/* find version of source storage space */
- ret = src_get_version(opts.storage_space, opts.coll, version, 254);
+ ret = src_get_version(
+ server_config->storage_path,
+ fs_config->coll_id,
+ fs_config->file_system_name,
+ version, 254);
if(ret < 0)
{
- fprintf(stderr, "Error: failed to read version of src storage space.\n");
- return(-1);
+ fprintf(stderr,
+ "Error: failed to read version of src storage space\n"
+ " for filesystem: %s (%08x)\n",
+ fs_config->file_system_name, fs_config->coll_id);
+ return ret;
}
/* call the appropriate translation routine based on the version */
- if(strcmp(version, "0.0.1") == 0)
+ if(strncmp(version, "0.0.1", 5) == 0)
{
+ sprintf(old_coll_path, "%s/%08x-old-%s",
+ server_config->storage_path,
+ fs_config->coll_id, version);
+
+ ret = access(old_coll_path, F_OK);
+ if(ret == 0)
+ {
+ if(opts.cleanup_set)
+ {
+ /* user asked to remove this old collection instead
+ * of creating it
+ */
+ if(verbose) printf("VERBOSE Removing old collection at: %s\n",
+ old_coll_path);
+ ret = recursive_rmdir(old_coll_path);
+ if(ret < 0)
+ {
+ fprintf(stderr,
+ "Error: failed to remove %s\n",
+ old_coll_path);
+ return -1;
+ }
+ return 0;
+ }
+
+ if(verbose) printf("VERBOSE %s already exists.\n",
+ old_coll_path);
+ fprintf(stderr,
+ "Error: unable to confirm availability of backup subdirectory (%s)\n"
+ " for migration of fs: %s (%08x).\n",
+ old_coll_path,
+ fs_config->file_system_name,
+ fs_config->coll_id);
+ fprintf(stderr,
+ "Error: please make sure that the migration "
+ "has not already been performed.\n");
+ return -1;
+ }
+
ret = translate_0_0_1(
- opts.storage_space, opts.coll, new_name, new_id);
+ server_config->storage_path, old_coll_path,
+ fs_config->file_system_name,
+ fs_config->coll_id);
if(ret < 0)
{
- fprintf(stderr, "Error: failed to translate from 0.0.1 collection.\n");
- return(-1);
+ fprintf(stderr,
+ "Error: failed to translate from %s collection\n"
+ " for fs: %s (%08x).\n",
+ version, fs_config->file_system_name, fs_config->coll_id);
+ return -1;
+ }
+
+ if(opts.cleanup_set)
+ {
+ /* user asked to remove this old collection instead
+ * of creating it
+ */
+ if(verbose) printf("VERBOSE Removing old collection at: %s\n",
+ old_coll_path);
+ ret = unlink(old_coll_path);
+ if(ret < 0)
+ {
+ perror("unlink");
+ return -1;
+ }
}
}
else
{
- /* complain if we don't recognize the version */
- fprintf(stderr, "Error: unknown collection version: %s\n", version);
- return(-1);
+ if(opts.cleanup_set)
+ {
+ /* user asked to remove this old collection instead
+ * of creating it, but we don't know what the version
+ * is anymore
+ */
+ DIR * storage_dir;
+ struct dirent * next_dirent;
+ char collname[PATH_MAX];
+ int collname_length;
+ int removed_olddirs = 0;
+
+ collname_length = sprintf(collname, "%08x-old", fs_config->coll_id);
+
+ storage_dir = opendir(server_config->storage_path);
+ if(!storage_dir)
+ {
+ fprintf(stderr, "Error: failed to open directory: %s\n",
+ server_config->storage_path);
+ return -1;
+ }
+
+ while((next_dirent = readdir(storage_dir)) != NULL)
+ {
+ int d_namelen = strlen(next_dirent->d_name);
+ if(collname_length < d_namelen &&
+ strncmp(next_dirent->d_name, collname, collname_length) == 0)
+ {
+ char old_coll_path[PATH_MAX];
+
+ sprintf(old_coll_path, "%s/%s",
+ server_config->storage_path, next_dirent->d_name);
+
+ /* found an old version, delete it */
+ if(verbose)
+ printf("VERBOSE Removing old collection at: %s\n",
+ old_coll_path);
+ ret = recursive_rmdir(old_coll_path);
+ if(ret < 0)
+ {
+ fprintf(
+ stderr,
+ "Error: failed to remove old collection at: %s\n",
+ old_coll_path);
+ closedir(storage_dir);
+ return -1;
+ }
+ removed_olddirs = 1;
+ }
+ }
+
+ if(removed_olddirs == 0)
+ {
+ printf("\nWARNING: No old collections with name \"%s\" "
+ "were found to cleanup.\n",
+ fs_config->file_system_name);
+ }
+
+ closedir(storage_dir);
+ }
+ else
+ {
+ /* complain if we don't recognize the version */
+ fprintf(stderr,
+ "Error: unknown collection version: %s\n"
+ " for fs: %s (%08x).\n",
+ version, fs_config->file_system_name, fs_config->coll_id);
+ return -1;
+ }
}
- return(0);
+ return 0;
}
/**
@@ -223,15 +383,14 @@ static int parse_args(
options_t *opts) /** < parsed command line options */
{
int ret = 0, option_index = 0;
- char *cur_option = NULL;
static struct option long_opts[] =
{
{"help",0,0,0},
{"verbose",0,0,0},
{"version",0,0,0},
- {"collection",1,0,0},
- {"new-collection-name",1,0,0},
- {"storage-space",1,0,0},
+ {"fs",1,0,0},
+ {"all",0,0,0},
+ {"cleanup",0,0,0},
{0,0,0,0}
};
@@ -240,55 +399,69 @@ static int parse_args(
while ((ret = getopt_long(argc, argv, "",
long_opts, &option_index)) != -1)
{
- switch (ret)
+ switch (option_index)
{
- case 0:
- cur_option = (char *)long_opts[option_index].name;
- if (strcmp("collection", cur_option) == 0)
- {
- strncpy(opts->coll, optarg, 99);
- opts->coll_set = 1;
- break;
- }
- if (strcmp("new-collection-name", cur_option) == 0)
- {
- strncpy(opts->new_collection_name, optarg, 255);
- opts->new_collname_set = 1;
+ case 0: /* help */
+ print_help(argv[0]);
+ exit(0);
+
+ case 1: /* verbose */
+ verbose = 1;
+ break;
+
+ case 2: /* version */
+ fprintf(stderr,"%s\n",PVFS2_VERSION);
+ exit(0);
+
+ case 3: /* fs */
+ strncpy(opts->fs, optarg, 99);
+ opts->fs_set = 1;
break;
- }
- if (strcmp("storage-space", cur_option) == 0)
- {
- strncpy(opts->storage_space, optarg, PATH_MAX);
- opts->storage_space_set = 1;
+
+ case 4: /* all */
+ opts->all_set = 1;
break;
- }
- if (strcmp("verbose", cur_option) == 0)
- {
- verbose = 1;
+
+ case 5: /* cleanup */
+ opts->cleanup_set = 1;
break;
- }
- if (strcmp("help", cur_option) == 0)
- {
- print_help(argv[0]);
- exit(0);
- }
- else if (strcmp("version", cur_option) == 0)
- {
- fprintf(stderr,"%s\n",PVFS2_VERSION);
- exit(0);
- }
default:
print_help(argv[0]);
return(-1);
}
+ option_index = 0;
+ }
+
+ /* one of the two options -fs or -all must be set. */
+ if (!opts->fs_set && !opts->all_set)
+ {
+ print_help(argv[0]);
+ return(-1);
}
- if (!opts->coll_set || !opts->storage_space_set || !opts->new_collname_set)
+ /* only one of the two options -fs or -all can be set. */
+ if (opts->fs_set && opts->all_set)
{
print_help(argv[0]);
return(-1);
}
+ if(argc < optind)
+ {
+ /* missing fs.conf */
+ print_help(argv[0]);
+ return(-1);
+ }
+ strcpy(opts->fs_conf, argv[optind++]);
+
+ if(argc < optind)
+ {
+ /* missing server.conf */
+ print_help(argv[0]);
+ return(-1);
+ }
+ strcpy(opts->server_conf, argv[optind]);
+
return 0;
}
@@ -298,25 +471,25 @@ static int parse_args(
static void print_help(
char *progname) /**< executable name */
{
- fprintf(stderr,"usage: %s [OPTION]...\n", progname);
- fprintf(stderr,"This utility will migrate a PVFS2 collection from an old version\n"
+ fprintf(stderr,"\nusage: %s \\\n\t\t[OPTIONS] <global_config_file> <server_config_file>\n", progname);
+ fprintf(stderr,"\nThis utility will migrate a PVFS2 collection from an old version\n"
"to the most recent version.\n\n");
- fprintf(stderr,"The following arguments are required:\n");
+ fprintf(stderr,"One of the following arguments is required:\n");
fprintf(stderr,"--------------\n");
- fprintf(stderr," --storage-space=<path>: "
- "location of storage space\n");
- fprintf(stderr," --collection=<hex number>: "
- "collection id to be migrated\n");
- fprintf(stderr, " --new-collection-name=<new collection name>: "
- " collection name of the migrated collection\n");
+ fprintf(stderr," --fs=<fs name> "
+ "name of the file system to migrate\n");
+ fprintf(stderr," --all "
+ "migrate all collections in the filesystem config\n");
fprintf(stderr, "\n");
fprintf(stderr,"The following arguments are optional:\n");
fprintf(stderr,"--------------\n");
- fprintf(stderr," --verbose: "
+ fprintf(stderr," --cleanup "
+ "remove the old collection\n");
+ fprintf(stderr," --verbose "
"print verbose messages during execution\n");
- fprintf(stderr," --help: "
+ fprintf(stderr," --help "
"show this help listing\n");
- fprintf(stderr," --version: "
+ fprintf(stderr," --version "
"print version information and exit\n");
fprintf(stderr, "\n");
return;
@@ -329,21 +502,24 @@ static void print_help(
* \return 0 on succes, -1 on failure
*/
static int src_get_version(
- char* storage_space, /**< path to trove storage space */
- char* coll_id, /**< collection id in string format */
- char* ver_string, /**< version in string format */
- int ver_string_max) /**< maximum size of version string */
+ char* storage_space, /**< path to storage space */
+ TROVE_coll_id coll_id, /**< collection id */
+ char* coll_name, /**< collection name */
+ char* ver_string, /**< version in string format */
+ int ver_string_max) /**< maximum size of version string */
{
int ret = -1;
- ret = src_get_version_0_0_1(storage_space, coll_id, ver_string,
- ver_string_max);
+ ret = src_get_version_0_0_1(
+ storage_space, coll_id, ver_string, ver_string_max);
if(ret != 0)
{
- fprintf(stderr, "Error: all known collection version checks failed for \n"
- "collection %s in storage space %s\n", storage_space, coll_id);
+ fprintf(stderr,
+ "Error: all known collection version checks "
+ "failed for \ncollection %s (%08x) in storage space %s\n",
+ coll_name, coll_id, storage_space);
}
return(ret);
@@ -355,17 +531,18 @@ static int src_get_version(
* \return 0 on succes, -1 on failure
*/
static int src_get_version_0_0_1(
- char* storage_space, /**< path to trove storage space */
- char* coll_id, /**< collection id in string format */
- char* ver_string, /**< version in string format */
- int ver_string_max) /**< maximum size of version string */
+ char* storage_space, /**< path to storage space */
+ TROVE_coll_id coll_id, /**< collection id */
+ char* ver_string, /**< version in string format */
+ int ver_string_max) /**< maximum size of version string */
{
char coll_db[PATH_MAX];
int ret;
DB *dbp;
DBT key, data;
- sprintf(coll_db, "%s/%s/collection_attributes.db", storage_space, coll_id);
+ sprintf(coll_db, "%s/%08x/collection_attributes.db",
+ storage_space, coll_id);
/* try to find a collections db */
ret = access(coll_db, F_OK);
@@ -428,10 +605,10 @@ static int src_get_version_0_0_1(
* \return 0 on succes, -1 on failure
*/
static int translate_0_0_1(
- char* storage_space, /**< path to trove storage space */
- char* coll_id, /**< collection id in string format */
- char* new_name, /**< name of new (temporary) collection */
- TROVE_coll_id new_id) /**< id of new (temporary) collection */
+ char* storage_space, /**< path to storage space */
+ char* old_coll_path, /**< path to old collection */
+ char* coll_name, /**< collection name */
+ TROVE_coll_id coll_id) /**< collection id in string format */
{
int ret = -1;
/* choose a handle range big enough to encompass anything pvfs2-genconfig
@@ -441,18 +618,46 @@ static int translate_0_0_1(
char* method_name = NULL;
TROVE_op_id op_id;
TROVE_context_id trove_context = -1;
- char old_path[PATH_MAX];
- char new_path[PATH_MAX];
+ char current_path[PATH_MAX];
+
+ /* rename old collection */
+ snprintf(current_path, PATH_MAX, "%s/%08x", storage_space, coll_id);
+
+ if(access(current_path, F_OK) != 0)
+ {
+ fprintf(stderr,
+ "Error: could not find old collection: %s\n"
+ " fs: %s (%08x)\n",
+ old_coll_path, coll_name, coll_id);
+ return -1;
+ }
+
+ if(verbose) printf("VERBOSE Renaming old collection.\n");
+ ret = rename(current_path, old_coll_path);
+ if(ret < 0)
+ {
+ perror("rename");
+ return(-1);
+ }
+ ret = remove_collection_entry(storage_space, coll_name);
+ if(ret < 0)
+ {
+ fprintf(stderr, "Error: failed to remove collection entry: %s\n",
+ coll_name);
+ return(-1);
+ }
+
/* create new collection */
/* NOTE: deliberately not specifying root handle; it will get translated
* later as a normal directory if applicable
*/
- if(verbose) printf("VERBOSE Creating temporary collection to migrate to.\n");
+ if(verbose)
+ printf("VERBOSE Creating temporary collection to migrate to.\n");
ret = pvfs2_mkspace(
storage_space,
- new_name,
- new_id,
+ coll_name,
+ coll_id,
TROVE_HANDLE_NULL,
handle_range,
NULL,
@@ -471,7 +676,7 @@ static int translate_0_0_1(
{
PVFS_perror("PINT_dist_initialize", ret);
if(verbose) printf("VERBOSE Destroying temporary collection.\n");
- pvfs2_rmspace(storage_space, new_name, new_id, 1, 0);
+ pvfs2_rmspace(storage_space, coll_name, coll_id, 1, 0);
return(-1);
}
@@ -481,19 +686,19 @@ static int translate_0_0_1(
{
PVFS_perror("trove_initialize", ret);
if(verbose) printf("VERBOSE Destroying temporary collection.\n");
- pvfs2_rmspace(storage_space, new_name, new_id, 1, 0);
+ pvfs2_rmspace(storage_space, coll_name, coll_id, 1, 0);
return(-1);
}
- ret = trove_collection_lookup(new_name, &new_id, NULL, &op_id);
+ ret = trove_collection_lookup(coll_name, &coll_id, NULL, &op_id);
if (ret != 1)
{
fprintf(stderr, "Error: failed to lookup new collection.\n");
if(verbose) printf("VERBOSE Destroying temporary collection.\n");
- pvfs2_rmspace(storage_space, new_name, new_id, 1, 0);
+ pvfs2_rmspace(storage_space, coll_name, coll_id, 1, 0);
return -1;
}
- ret = trove_open_context(new_id, &trove_context);
+ ret = trove_open_context(coll_id, &trove_context);
if (ret < 0)
{
PVFS_perror("trove_open_context", ret);
@@ -501,109 +706,146 @@ static int translate_0_0_1(
}
/* convert collection xattrs */
- ret = translate_coll_eattr_0_0_1(storage_space, coll_id, new_name,
- new_id, trove_context);
+ ret = translate_coll_eattr_0_0_1(
+ old_coll_path, coll_id, coll_name, trove_context);
if(ret < 0)
{
fprintf(stderr, "Error: failed to migrate collection extended attributes.\n");
if(verbose) printf("VERBOSE Destroying temporary collection.\n");
- pvfs2_rmspace(storage_space, new_name, new_id, 1, 0);
+ pvfs2_rmspace(storage_space, coll_name, coll_id, 1, 0);
return(-1);
}
/* convert dspace attrs */
- ret = translate_dspace_attr_0_0_1(storage_space, coll_id, new_name,
- new_id, trove_context);
+ ret = translate_dspace_attr_0_0_1(
+ old_coll_path, coll_id, coll_name, trove_context);
if(ret < 0)
{
fprintf(stderr, "Error: failed to migrate dspace attributes.\n");
if(verbose) printf("VERBOSE Destroying temporary collection.\n");
- pvfs2_rmspace(storage_space, new_name, new_id, 1, 0);
+ pvfs2_rmspace(storage_space, coll_name, coll_id, 1, 0);
return(-1);
}
/* convert dspace keyvals */
- ret = translate_keyvals_0_0_1(storage_space, coll_id, new_name,
- new_id, trove_context);
+ ret = translate_keyvals_0_0_1(
+ old_coll_path, coll_id, coll_name, trove_context);
if(ret < 0)
{
fprintf(stderr, "Error: failed to migrate keyvals.\n");
if(verbose) printf("VERBOSE Destroying temporary collection.\n");
- pvfs2_rmspace(storage_space, new_name, new_id, 1, 0);
- return(-1);
- }
-
- /* convert dirent_count for each directory */
- ret = translate_dirdata_sizes_0_0_1(storage_space, coll_id, new_name,
- new_id, trove_context);
- if(ret < 0)
- {
- fprintf(stderr, "Error: failed to migrate dirdata sizes.\n");
- if(verbose) printf("VERBOSE Destroying temporary collection.\n");
- pvfs2_rmspace(storage_space, new_name, new_id, 1, 0);
+ pvfs2_rmspace(storage_space, coll_name, coll_id, 1, 0);
return(-1);
}
/* at this point, we are done with the Trove API */
- trove_close_context(new_id, trove_context);
+ trove_close_context(coll_id, trove_context);
trove_finalize();
PINT_dist_finalize();
/* convert bstreams */
- ret = translate_bstreams_0_0_1(storage_space, coll_id, new_name,
- new_id, trove_context);
+ ret = translate_bstreams_0_0_1(
+ storage_space, old_coll_path, coll_id, coll_name, trove_context);
if(ret < 0)
{
fprintf(stderr, "Error: failed to migrate bstreams.\n");
if(verbose) printf("VERBOSE Destroying temporary collection.\n");
- pvfs2_rmspace(storage_space, new_name, new_id, 1, 0);
+ pvfs2_rmspace(storage_space, coll_name, coll_id, 1, 0);
return(-1);
}
- /* rename old collection */
- snprintf(old_path, PATH_MAX, "%s/%s", storage_space, coll_id);
- snprintf(new_path, PATH_MAX, "%s/%s.old", storage_space, coll_id);
- if(verbose) printf("VERBOSE Renaming old collection.\n");
- ret = rename(old_path, new_path);
- if(ret < 0)
+ printf("Migration successful.\n");
+
+ if(!opts.cleanup_set)
{
- perror("rename");
- if(verbose) printf("VERBOSE Destroying temporary collection.\n");
- pvfs2_rmspace(storage_space, new_name, new_id, 1, 0);
- return(-1);
+ printf("===================================================================\n");
+ printf("IMPORTANT!!! IMPORTANT!!! IMPORTANT!!! IMPORTANT!!!\n");
+ printf("Please delete the old collection once you have tested and confirmed\n");
+ printf("the results of the migration.\n");
+ printf("Command: \"pvfs2-migrate-collection -cleanup <fs config> <server config>\"\n");
+ printf("===================================================================\n");
}
- /* rename new collection */
- if(verbose) printf("VERBOSE Renaming migrated collection.\n");
- snprintf(old_path, PATH_MAX, "%s/%.8x", storage_space, new_id);
- snprintf(new_path, PATH_MAX, "%s/%s", storage_space, coll_id);
- ret = rename(old_path, new_path);
- if(ret < 0)
+ return(0);
+}
+
+static int remove_collection_entry(char* storage_space, char* collname)
+{
+ char collections_db[PATH_MAX];
+ DB * dbp;
+ DBT key, data;
+ int ret = 0;
+ TROVE_coll_id coll_id;
+
+ sprintf(collections_db, "%s/collections.db", storage_space);
+
+ ret = access(collections_db, F_OK);
+ if(ret == -1 && errno == ENOENT)
{
- perror("rename");
- fprintf(stderr, "Error: non recoverable failure while renaming migrated collection.\n");
+ fprintf(stderr, "Error: could not find %s.\n", collections_db);
+ fprintf(stderr, "Error: src directory is not a known format.\n");
+ return ret;
+ }
+ else if(ret == -1)
+ {
+ fprintf(stderr, "access(%s): %s\n", collections_db, strerror(errno));
+ return -1;
+ }
+
+ ret = db_create(&dbp, NULL, 0);
+ if(ret != 0)
+ {
+ fprintf(stderr, "Error: db_create: %s.\n", db_strerror(ret));
+ return -1;
+ }
+
+ ret = dbp->open(dbp,
+#ifdef HAVE_TXNID_PARAMETER_TO_DB_OPEN
+ NULL,
+#endif
+ collections_db,
+ NULL,
+ DB_UNKNOWN,
+ 0,
+ 0);
+ if(ret != 0)
+ {
+ fprintf(stderr, "Error: dbp->open: %s.\n", db_strerror(ret));
return(-1);
}
- /* remove db entry for temporary collection */
- if(verbose) printf("VERBOSE Removing old reference to migrated collection.\n");
- ret = remove_migration_id_mapping(
- storage_space, new_name);
- if(ret < 0)
+ memset(&key, 0, sizeof(key));
+ memset(&data, 0, sizeof(data));
+
+ key.data = collname;
+ key.size = strlen(collname) + 1;
+ data.data = &coll_id;
+ data.ulen = sizeof(coll_id);
+ data.flags = DB_DBT_USERMEM;
+
+ ret = dbp->get(dbp, NULL, &key, &data, 0);
+ if (ret != 0)
{
- fprintf(stderr, "Warning: non-critical error: failed to remove db entry for temporary collection \"%s\".\n",
- new_name);
+ fprintf(stderr, "Error: dbp->get: %s\n", db_strerror(ret));
+ return -1;
}
- printf("Migration successful.\n");
- printf("===================================================================\n");
- printf("IMPORTANT!!! IMPORTANT!!! IMPORTANT!!! IMPORTANT!!!\n");
- printf("Please delete the old collection once you have tested and confirmed\n");
- printf("the results of the migration.\n");
- printf("Command: \"rm -rf %s/%s.old\"\n", storage_space, coll_id);
- printf("===================================================================\n");
+ ret = dbp->del(dbp, NULL, &key, 0);
+ if (ret != 0)
+ {
+ fprintf(stderr, "Error: dbp->del: %s\n", db_strerror(ret));
+ return -1;
+ }
- return(0);
+ ret = dbp->sync(dbp, 0);
+ if (ret != 0)
+ {
+ fprintf(stderr, "Error: dbp->sync: %s\n", db_strerror(ret));
+ return -1;
+ }
+
+ dbp->close(dbp, 0);
+ return 0;
}
/**
@@ -611,10 +853,9 @@ static int translate_0_0_1(
* \return 0 on succes, -1 on failure
*/
static int translate_coll_eattr_0_0_1(
- char* storage_space, /**< path to trove storage space */
- char* coll_id, /**< collection id in string format */
- char* new_name, /**< name of new (temporary) collection */
- TROVE_coll_id new_id, /**< id of new (temporary) collection */
+ char* old_coll_path, /**< path to old trove collection */
+ TROVE_coll_id coll_id, /**< collection id in string format */
+ char* coll_name, /**< name of collection */
TROVE_context_id trove_context) /**< open trove context */
{
int ret = -1;
@@ -628,7 +869,7 @@ static int translate_coll_eattr_0_0_1(
int count = 0;
TROVE_ds_state state;
- sprintf(coll_db, "%s/%s/collection_attributes.db", storage_space, coll_id);
+ sprintf(coll_db, "%s/collection_attributes.db", old_coll_path);
ret = db_create(&dbp, NULL, 0);
if(ret != 0)
{
@@ -639,13 +880,13 @@ static int translate_coll_eattr_0_0_1(
/* open collection_attributes.db from old collection */
ret = dbp->open(dbp,
#ifdef HAVE_TXNID_PARAMETER_TO_DB_OPEN
- NULL,
+ NULL,
#endif
- coll_db,
- NULL,
- DB_UNKNOWN,
- 0,
- 0);
+ coll_db,
+ NULL,
+ DB_UNKNOWN,
+ 0,
+ 0);
if(ret != 0)
{
fprintf(stderr, "Error: dbp->open: %s.\n", db_strerror(ret));
@@ -699,7 +940,8 @@ static int translate_coll_eattr_0_0_1(
return(-1);
}
/* skip the version attribute- we don't want to copy that one */
- if(ret == 0 && strcmp(key.data, "trove-dbpf-version") != 0)
+ if(ret == 0 && strncmp(key.data, "trove-dbpf-version",
+ strlen("trove-dbpf-version")) != 0)
{
if(verbose) printf("VERBOSE Migrating collection eattr: %s\n", (char*)key.data);
@@ -713,7 +955,7 @@ static int translate_coll_eattr_0_0_1(
/* write out new eattr's */
state = 0;
ret = trove_collection_seteattr(
- new_id,
+ coll_id,
&t_key,
&t_val,
0,
@@ -723,7 +965,7 @@ static int translate_coll_eattr_0_0_1(
while (ret == 0)
{
ret = trove_dspace_test(
- new_id, op_id, trove_context, &count, NULL, NULL,
+ coll_id, op_id, trove_context, &count, NULL, NULL,
&state, 10);
}
if ((ret < 0) || (ret == 1 && state != 0))
@@ -751,10 +993,9 @@ static int translate_coll_eattr_0_0_1(
* \return 0 on succes, -1 on failure
*/
static int translate_dspace_attr_0_0_1(
- char* storage_space, /**< path to trove storage space */
- char* coll_id, /**< collection id in string format */
- char* new_name, /**< name of new (temporary) collection */
- TROVE_coll_id new_id, /**< id of new (temporary) collection */
+ char* old_coll_path, /**< path to old collection */
+ TROVE_coll_id coll_id, /**< collection id */
+ char* coll_name, /**< name of collection */
TROVE_context_id trove_context) /**< open trove context */
{
int ret = -1;
@@ -772,7 +1013,7 @@ static int translate_dspace_attr_0_0_1(
PVFS_ds_storedattr_0_0_1* tmp_attr;
TROVE_ds_attributes new_attr;
- sprintf(attr_db, "%s/%s/dataspace_attributes.db", storage_space, coll_id);
+ sprintf(attr_db, "%s/dataspace_attributes.db", old_coll_path);
ret = db_create(&dbp, NULL, 0);
if(ret != 0)
{
@@ -783,13 +1024,13 @@ static int translate_dspace_attr_0_0_1(
/* open dataspace_attributes.db from old collection */
ret = dbp->open(dbp,
#ifdef HAVE_TXNID_PARAMETER_TO_DB_OPEN
- NULL,
+ NULL,
#endif
- attr_db,
- NULL,
- DB_UNKNOWN,
- 0,
- 0);
+ attr_db,
+ NULL,
+ DB_UNKNOWN,
+ 0,
+ 0);
if(ret != 0)
{
fprintf(stderr, "Error: dbp->open: %s.\n", db_strerror(ret));
@@ -856,14 +1097,14 @@ static int translate_dspace_attr_0_0_1(
state = 0;
ret = trove_dspace_create(
- new_id, &extent_array, &new_handle,
+ coll_id, &extent_array, &new_handle,
tmp_attr->type, NULL,
(TROVE_SYNC | TROVE_FORCE_REQUESTED_HANDLE),
NULL, trove_context, &op_id);
while (ret == 0)
{
- ret = trove_dspace_test(new_id, op_id, trove_context,
+ ret = trove_dspace_test(coll_id, op_id, trove_context,
&count, NULL, NULL, &state,
10);
}
@@ -897,17 +1138,17 @@ static int translate_dspace_attr_0_0_1(
/* write the attributes into the new collection */
state = 0;
- ret = trove_dspace_setattr(new_id,
- *tmp_handle,
- &new_attr,
- TROVE_SYNC,
- NULL,
- trove_context,
- &op_id);
+ ret = trove_dspace_setattr(coll_id,
+ *tmp_handle,
+ &new_attr,
+ TROVE_SYNC,
+ NULL,
+ trove_context,
+ &op_id);
while (ret == 0)
{
ret = trove_dspace_test(
- new_id, op_id, trove_context, &count, NULL, NULL,
+ coll_id, op_id, trove_context, &count, NULL, NULL,
&state, 10);
}
if ((ret < 0) || (ret == 1 && state != 0))
@@ -935,10 +1176,9 @@ static int translate_dspace_attr_0_0_1(
* \return 0 on succes, -1 on failure
*/
static int translate_keyvals_0_0_1(
- char* storage_space, /**< path to trove storage space */
- char* coll_id, /**< collection id in string format */
- char* new_name, /**< name of new (temporary) collection */
- TROVE_coll_id new_id, /**< id of new (temporary) collection */
+ char* old_coll_path, /**< path to old collection */
+ TROVE_coll_id coll_id, /**< collection id */
+ char* coll_name, /**< name of collection */
TROVE_context_id trove_context) /**< open trove context */
{
char bucket_dir[PATH_MAX];
@@ -952,8 +1192,7 @@ static int translate_keyvals_0_0_1(
/* iterate through bucket dirs */
for(i = 0; i < KEYVAL_MAX_NUM_BUCKETS_0_0_1; i++)
{
- snprintf(bucket_dir, PATH_MAX, "%s/%s/keyvals/%.8d", storage_space,
- coll_id, i);
+ snprintf(bucket_dir, PATH_MAX, "%s/keyvals/%.8d", old_coll_path, i);
/* printf("VERBOSE Checking %s for keyval files.\n", bucket_dir); */
tmp_dir = opendir(bucket_dir);
@@ -984,13 +1223,12 @@ static int translate_keyvals_0_0_1(
closedir(tmp_dir);
return(-1);
}
- snprintf(keyval_db, PATH_MAX, "%s/%s/keyvals/%.8d/%s",
- storage_space, coll_id, i, tmp_ent->d_name);
+ snprintf(keyval_db, PATH_MAX, "%s/keyvals/%.8d/%s",
+ old_coll_path, i, tmp_ent->d_name);
/* translate each keyval db to new format */
ret = translate_keyval_db_0_0_1(
- storage_space, coll_id,
- keyval_db, tmp_handle,
- new_name, new_id, trove_context);
+ coll_id, keyval_db, tmp_handle,
+ coll_name, trove_context);
if(ret < 0)
{
fprintf(stderr, "Error: failed to migrate %s\n",
@@ -1006,17 +1244,51 @@ static int translate_keyvals_0_0_1(
return(0);
}
+static int translate_keyval_key_0_0_1(TROVE_keyval_s * keyval, DBT * db_key)
+{
+ if(!strncmp(db_key->data, "root_handle", strlen("root_handle")))
+ {
+ keyval->buffer = ROOT_HANDLE_KEYSTR;
+ keyval->buffer_sz = strlen(ROOT_HANDLE_KEYSTR);
+ }
+ else if(!strncmp(db_key->data, "dir_ent", strlen("dir_ent")))
+ {
+ keyval->buffer = DIRECTORY_ENTRY_KEYSTR;
+ keyval->buffer_sz = strlen(DIRECTORY_ENTRY_KEYSTR);
+ }
+ else if(!strncmp(db_key->data,
+ "datafile_handles", strlen("datafile_handles")))
+ {
+ keyval->buffer = DATAFILE_HANDLES_KEYSTR;
+ keyval->buffer_sz = strlen(DATAFILE_HANDLES_KEYSTR);
+ }
+ else if(!strncmp(db_key->data, "metafile_dist", strlen("metafile_dist")))
+ {
+ keyval->buffer = METAFILE_DIST_KEYSTR;
+ keyval->buffer_sz = strlen(METAFILE_DIST_KEYSTR);
+ }
+ else if(!strncmp(db_key->data, "symlink_target", strlen("symlink_target")))
+ {
+ keyval->buffer = SYMLINK_TARGET_KEYSTR;
+ keyval->buffer_sz = strlen(SYMLINK_TARGET_KEYSTR);
+ }
+ else
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
/**
* Migrates a single keyval db from a 0.0.1 DBPF collection
* \return 0 on succes, -1 on failure
*/
static int translate_keyval_db_0_0_1(
- char* storage_space, /**< path to trove storage space */
- char* coll_id, /**< collection id in string format */
+ TROVE_coll_id coll_id, /**< collection id */
char* full_db_path, /**< fully resolved path to db file */
TROVE_handle handle, /**< handle of the object */
- char* new_name, /**< name of new (temporary) collection */
- TROVE_coll_id new_id, /**< id of new (temporary) collection */
+ char* coll_name, /**< name of collection */
TROVE_context_id trove_context) /**< open trove context */
{
int ret = -1;
@@ -1029,7 +1301,8 @@ static int translate_keyval_db_0_0_1(
TROVE_keyval_s t_key;
TROVE_keyval_s t_val;
- if(verbose) printf("VERBOSE Migrating keyvals for handle: %llu\n", llu(handle));
+ if(verbose)
+ printf("VERBOSE Migrating keyvals for handle: %llu\n", llu(handle));
ret = db_create(&dbp, NULL, 0);
if(ret != 0)
@@ -1040,13 +1313,13 @@ static int translate_keyval_db_0_0_1(
ret = dbp->open(dbp,
#ifdef HAVE_TXNID_PARAMETER_TO_DB_OPEN
- NULL,
+ NULL,
#endif
- full_db_path,
- NULL,
- DB_UNKNOWN,
- 0,
- 0);
+ full_db_path,
+ NULL,
+ DB_UNKNOWN,
+ 0,
+ 0);
if(ret != 0)
{
fprintf(stderr, "Error: dbp->open: %s.\n", db_strerror(ret));
@@ -1102,12 +1375,19 @@ static int translate_keyval_db_0_0_1(
if(ret == 0)
{
int tvalbuf_free = 0;
+ PVFS_ds_flags trove_flags = TROVE_SYNC;
memset(&t_key, 0, sizeof(t_key));
memset(&t_val, 0, sizeof(t_val));
- t_key.buffer = key.data;
- t_key.buffer_sz = key.size;
+ if(translate_keyval_key_0_0_1(&t_key, &key) < 0)
+ {
+ /* assume its a component name of a directory entry */
+ t_key.buffer = key.data;
+ t_key.buffer_sz = key.size;
+ trove_flags |= TROVE_KEYVAL_HANDLE_COUNT;
+ trove_flags |= TROVE_NOOVERWRITE;
+ }
- if(!strcmp(t_key.buffer, "metafile_dist"))
+ if(!strncmp(t_key.buffer, "md", 2)) /* metafile_dist */
{
PINT_dist *newdist;
newdist = data.data;
@@ -1146,13 +1426,13 @@ static int translate_keyval_db_0_0_1(
/* write out new keyval pair */
state = 0;
ret = trove_keyval_write(
- new_id, handle, &t_key, &t_val, TROVE_SYNC, 0, NULL,
+ coll_id, handle, &t_key, &t_val, trove_flags, 0, NULL,
trove_context, &op_id);
while (ret == 0)
{
ret = trove_dspace_test(
- new_id, op_id, trove_context, &count, NULL, NULL,
+ coll_id, op_id, trove_context, &count, NULL, NULL,
&state, 10);
}
@@ -1188,9 +1468,9 @@ static int translate_keyval_db_0_0_1(
*/
static int translate_bstreams_0_0_1(
char* storage_space, /**< path to trove storage space */
- char* coll_id, /**< collection id in string format */
- char* new_name, /**< name of new (temporary) collection */
- TROVE_coll_id new_id, /**< id of new (temporary) collection */
+ char* old_coll_path, /**< path to old collection */
+ TROVE_coll_id coll_id, /**< collection id */
+ char* new_name, /**< name of collection */
TROVE_context_id trove_context) /**< open trove context */
{
char bucket_dir[PATH_MAX];
@@ -1204,9 +1484,9 @@ static int translate_bstreams_0_0_1(
/* iterate through bucket dirs */
for(i = 0; i < BSTREAM_MAX_NUM_BUCKETS_0_0_1; i++)
{
- snprintf(bucket_dir, PATH_MAX, "%s/%s/bstreams/%.8d", storage_space,
- coll_id, i);
-
+ snprintf(bucket_dir, PATH_MAX, "%s/bstreams/%.8d",
+ old_coll_path, i);
+
/* printf("VERBOSE Checking %s for bstream files.\n", bucket_dir); */
tmp_dir = opendir(bucket_dir);
if(!tmp_dir)
@@ -1221,10 +1501,10 @@ static int translate_bstreams_0_0_1(
{
if(verbose) printf("VERBOSE Migrating bstream: %s.\n", tmp_ent->d_name);
- snprintf(bstream_file, PATH_MAX, "%s/%s/bstreams/%.8d/%s",
+ snprintf(bstream_file, PATH_MAX, "%s/bstreams/%.8d/%s",
+ old_coll_path, i, tmp_ent->d_name);
+ snprintf(new_bstream_file, PATH_MAX, "%s/%08x/bstreams/%.8d/%s",
storage_space, coll_id, i, tmp_ent->d_name);
- snprintf(new_bstream_file, PATH_MAX, "%s/%.8x/bstreams/%.8d/%s",
- storage_space, new_id, i, tmp_ent->d_name);
/* hard link to new location */
ret = link(bstream_file, new_bstream_file);
if(ret != 0)
@@ -1241,490 +1521,89 @@ static int translate_bstreams_0_0_1(
return(0);
}
-/**
- * Removes the entry for a particular collection from the trove collection db
- * \return 0 on succes, -1 on failure
+/*
+ * convert integers to pointers in dist
+ * with no copy - dist is modified
*/
-static int remove_migration_id_mapping(
- char* storage_space, /**< path to trove storage space */
- char* coll_name) /**< name of collection to remove mapping to */
+int translate_dist_0_0_1(PINT_dist *dist)
{
- char coll_db[PATH_MAX];
- int ret;
- DB *dbp;
- DBT key;
+ if(!dist)
+ {
+ return 0;
+ }
+ /* convert ints in dist to pointers */
+ dist->dist_name = (char *) dist + (intptr_t) dist->dist_name;
+ dist->params = (void *) ((char *) dist + (intptr_t) dist->params);
+ /* set methods */
+ dist->methods = NULL;
+ if (PINT_dist_lookup(dist)) {
+ fprintf(stderr, "Error: %s: lookup dist failed\n", __func__);
+ return -1;
+ }
+ return 0;
+}
- sprintf(coll_db, "%s/collections.db", storage_space);
+void fs_config_dummy_free(void * dummy) { }
- ret = db_create(&dbp, NULL, 0);
- if(ret != 0)
- {
- fprintf(stderr, "Error: db_create: %s.\n", db_strerror(ret));
- return(-1);
- }
-
- ret = dbp->open(dbp,
-#ifdef HAVE_TXNID_PARAMETER_TO_DB_OPEN
- NULL,
-#endif
- coll_db,
- NULL,
- DB_UNKNOWN,
- 0,
- 0);
- if(ret != 0)
- {
- fprintf(stderr, "Error: dbp->open: %s.\n", db_strerror(ret));
- return(-1);
- }
-
- memset(&key, 0, sizeof(key));
- key.data = coll_name;
- key.size = strlen(coll_name) + 1;
-
- ret = dbp->del(dbp, NULL, &key, 0);
- if (ret != 0)
- {
- fprintf(stderr, "Error: dbp->del: %s\n", db_strerror(ret));
- return(-1);
- }
-
- ret = dbp->sync(dbp, 0);
- if (ret != 0)
- {
- fprintf(stderr, "Error: dbp->sync: %s\n", db_strerror(ret));
- return(-1);
- }
-
- dbp->close(dbp, 0);
- return(0);
-}
-
-/**
- * Checks to confirm that a collection name is not in use
- * \return 0 on succes, -1 on failure
- */
-static int confirm_coll_name_not_used(
- char* storage_space, /**< path to trove storage space */
- char* coll_name) /**< name of collection to check */
+int recursive_rmdir(char* dir)
{
- char coll_db[PATH_MAX];
+ DIR * dirh;
+ struct dirent * dire;
+ struct stat statbuf;
+ char fname[PATH_MAX];
int ret;
- DB *dbp;
- DBT key;
- DBT data;
-
- sprintf(coll_db, "%s/collections.db", storage_space);
-
- ret = db_create(&dbp, NULL, 0);
- if(ret != 0)
- {
- fprintf(stderr, "Error: db_create: %s.\n", db_strerror(ret));
- return(-1);
- }
- ret = dbp->open(dbp,
-#ifdef HAVE_TXNID_PARAMETER_TO_DB_OPEN
- NULL,
-#endif
- coll_db,
- NULL,
- DB_UNKNOWN,
- 0,
- 0);
- if(ret != 0)
+ dirh = opendir(dir);
+ if(!dirh)
{
- fprintf(stderr, "Error: dbp->open: %s.\n", db_strerror(ret));
- return(-1);
+ fprintf(stderr, "Error: failed to open dir: %s\n", dir);
+ return -1;
}
- memset(&key, 0, sizeof(key));
- key.data = coll_name;
- key.size = strlen(coll_name) + 1;
-
- memset(&data, 0, sizeof(data));
- data.data = malloc(DEF_DATA_SIZE);
- if(!data.data)
+ while((dire = readdir(dirh)) != NULL)
{
- perror("malloc");
- dbp->close(dbp, 0);
- return(-1);
- }
- data.size = data.ulen = DEF_DATA_SIZE;
- data.flags |= DB_DBT_USERMEM;
-
- ret = dbp->get(dbp, NULL, &key, &data, 0);
- if(ret == 0)
- {
- free(data.data);
- dbp->close(dbp, 0);
- if(verbose) printf("VERBOSE removing old temporary collection mapping: %s.\n", coll_name);
- ret = remove_migration_id_mapping(
- storage_space, coll_name);
- return(ret);
- }
-
- free(data.data);
- dbp->close(dbp, 0);
- return(0);
-}
-
-/**
- * Checks to confirm that a subdirectory does not exist within the storage
- * space
- * \return 0 on succes, -1 on failure
- */
-static int confirm_subdir_not_used(
- char* storage_space, /**< path to trove storage space */
- char* subdir) /**< name of subdirectory to check */
-{
- char full_path[PATH_MAX];
- int ret = -1;
-
- sprintf(full_path, "%s/%s", storage_space, subdir);
-
- ret = access(full_path, F_OK);
- if(ret == 0)
- {
- if(verbose) printf("VERBOSE %s already exists.\n", full_path);
- return(-1);
- }
-
- return(0);
-}
-
-/**
- * Finds an unused collection id to use as a temporary collection for
- * migration
- * \return 0 on succes, -1 on failure
- */
-static int get_migration_id(
- char* storage_space, /**< path to trove storage space */
- TROVE_coll_id* out_id) /**< collection id */
-{
- int ret = -1;
- char subdir[PATH_MAX];
-
- for(*out_id = 0x1337; (*out_id) < INT_MAX; (*out_id)++)
- {
- sprintf(subdir, "%.8x", *out_id);
- ret = confirm_subdir_not_used(storage_space, subdir);
- if(ret == 0)
+ if(strcmp(dire->d_name, ".") == 0 ||
+ strcmp(dire->d_name, "..") == 0)
{
- if(verbose) printf("VERBOSE Using collection id %.8x for migration.\n",
- *out_id);
- return(0);
+ continue;
}
- }
-
- fprintf(stderr, "Error: could not find an available collection id.\n");
- return(-1);
-}
-/**
- * iterate through all of the directories in the old collection and find out
- * how many entries they had in the dirdata object. Write that value into
- * the new collection (new versions of trove store this explicitly in a db
- * key)
- * \return 0 on success -1 on failure
- */
-static int translate_dirdata_sizes_0_0_1(
- char* storage_space, char* coll_id, char* new_name, TROVE_coll_id new_id,
- TROVE_context_id trove_context)
-{
- int ret = -1;
- char attr_db[PATH_MAX];
- char dir_db[PATH_MAX];
- char dirdata_db[PATH_MAX];
- DB *dbp;
- DB *dir_dbp;
- DB *dirdata_dbp;
- DBT key, data;
- DBT keyB, dataB;
- DBC *dbc_p = NULL;
- TROVE_op_id op_id;
- TROVE_handle tmp_handle;
- TROVE_handle tmp_dirdata_handle;
- PVFS_ds_storedattr_0_0_1* tmp_attr;
- DB_BTREE_STAT *k_stat_p = NULL;
- PVFS_size dirent_count;
- unsigned int coll_id_value;
- TROVE_ds_state state;
- TROVE_keyval_s t_key;
- TROVE_keyval_s t_val;
- int count = 0;
-
- /* scan the coll_id value out of the string name */
- ret = sscanf(coll_id, "%x", &coll_id_value);
- if(ret != 1)
- {
- fprintf(stderr, "Error: malformed collection name %s\n",
- coll_id);
- return(-1);
- }
+ sprintf(fname, "%s/%s", dir, dire->d_name);
+ ret = stat(fname, &statbuf);
+ if(ret == -1)
+ {
+ perror("stat");
+ return -1;
+ }
- sprintf(attr_db, "%s/%s/dataspace_attributes.db", storage_space, coll_id);
- ret = db_create(&dbp, NULL, 0);
- if(ret != 0)
- {
- fprintf(stderr, "Error: db_create: %s.\n", db_strerror(ret));
- return(-1);
+ if(S_ISDIR(statbuf.st_mode))
+ {
+ ret = recursive_rmdir(fname);
+ if(ret < 0)
+ {
+ return ret;
+ }
+ }
+ else if(S_ISREG(statbuf.st_mode))
+ {
+ unlink(fname);
+ }
}
- /* open dataspace_attributes.db from old collection */
- ret = dbp->open(dbp,
-#ifdef HAVE_TXNID_PARAMETER_TO_DB_OPEN
- NULL,
-#endif
- attr_db,
- NULL,
- DB_UNKNOWN,
- 0,
- 0);
- if(ret != 0)
- {
- fprintf(stderr, "Error: dbp->open: %s.\n", db_strerror(ret));
- return(-1);
- }
-
- ret = dbp->cursor(dbp, NULL, &dbc_p, 0);
- if (ret != 0)
+ ret = closedir(dirh);
+ if(ret < 0)
{
- fprintf(stderr, "Error: dbp->cursor: %s.\n", db_strerror(ret));
- dbp->close(dbp, 0);
- return(-1);
+ perror("closedir");
+ return -1;
}
- memset(&key, 0, sizeof(key));
- key.data = malloc(DEF_KEY_SIZE);
- if(!key.data)
+ ret = rmdir(dir);
+ if(ret < 0)
{
- perror("malloc");
- dbc_p->c_close(dbc_p);
- dbp->close(dbp, 0);
- return(-1);
+ perror("rmdir");
}
- key.size = key.ulen = DEF_KEY_SIZE;
- key.flags |= DB_DBT_USERMEM;
- memset(&data, 0, sizeof(data));
- data.data = malloc(DEF_DATA_SIZE);
- if(!data.data)
- {
- perror("malloc");
- free(key.data);
- dbc_p->c_close(dbc_p);
- dbp->close(dbp, 0);
- return(-1);
- }
- data.size = data.ulen = DEF_DATA_SIZE;
- data.flags |= DB_DBT_USERMEM;
-
- memset(&keyB, 0, sizeof(keyB));
- keyB.size = keyB.ulen = 0;
- keyB.flags |= DB_DBT_USERMEM;
-
- memset(&dataB, 0, sizeof(dataB));
- dataB.size = dataB.ulen = 0;
- dataB.flags |= DB_DBT_USERMEM;
-
- do
- {
- /* iterate through handles in the old collection */
- key.size = key.ulen = DEF_KEY_SIZE;
- ret = dbc_p->c_get(dbc_p, &key, &data, DB_NEXT);
- if (ret != DB_NOTFOUND && ret != 0)
- {
- fprintf(stderr, "Error: dbc_p->c_get: %s.\n", db_strerror(ret));
- free(data.data);
- free(key.data);
- dbc_p->c_close(dbc_p);
- dbp->close(dbp, 0);
- return(-1);
- }
- if(ret == 0)
- {
- tmp_handle = *((PVFS_handle*)key.data);
- tmp_attr = ((PVFS_ds_storedattr_0_0_1*)data.data);
-
- if(tmp_attr->type == PVFS_TYPE_DIRECTORY)
- {
- if(verbose) printf("VERBOSE Migrating dirdata_size for handle: %llu\n",
- llu(tmp_handle));
-
- /* find the keyval db for the directory */
- DBPF_GET_KEYVAL_DBNAME_0_0_1(dir_db, (PATH_MAX-1),
- storage_space, coll_id_value, tmp_handle);
-
- ret = db_create(&dir_dbp, NULL, 0);
- if(ret != 0)
- {
- fprintf(stderr, "Error: db_create: %s.\n", db_strerror(ret));
- free(data.data);
- free(key.data);
- dbc_p->c_close(dbc_p);
- dbp->close(dbp, 0);
- return(-1);
- }
-
- ret = dir_dbp->open(dir_dbp,
- #ifdef HAVE_TXNID_PARAMETER_TO_DB_OPEN
- NULL,
- #endif
- dir_db,
- NULL,
- DB_UNKNOWN,
- 0,
- 0);
- if(ret != 0)
- {
- fprintf(stderr, "Error: dir_dbp->open: %s.\n", db_strerror(ret));
- free(data.data);
- free(key.data);
- dbc_p->c_close(dbc_p);
- dbp->close(dbp, 0);
- return(-1);
- }
-
- /* read out the dirdata handle */
- keyB.data = "dir_ent";
- keyB.size = strlen("dir_ent") + 1;
- dataB.data = &tmp_dirdata_handle;
- dataB.size = dataB.ulen = sizeof(PVFS_handle);
- ret = dir_dbp->get(dir_dbp, NULL, &keyB, &dataB, 0);
- if(ret != 0)
- {
- fprintf(stderr, "Error: dir_dbp->get: %s\n", db_strerror(ret));
- free(data.data);
- free(key.data);
- dbc_p->c_close(dbc_p);
- dbp->close(dbp, 0);
- dir_dbp->close(dbp, 0);
- return(-1);
- }
-
- dir_dbp->close(dir_dbp, 0);
-
- /* find the dirdata db for the directory */
- DBPF_GET_KEYVAL_DBNAME_0_0_1(dirdata_db, (PATH_MAX-1),
- storage_space, coll_id_value, tmp_dirdata_handle);
-
- ret = db_create(&dirdata_dbp, NULL, 0);
- if(ret != 0)
- {
- fprintf(stderr, "Error: db_create: %s.\n", db_strerror(ret));
- free(data.data);
- free(key.data);
- dbc_p->c_close(dbc_p);
- dbp->close(dbp, 0);
- return(-1);
- }
-
- dirent_count = 0;
- ret = dirdata_dbp->open(dirdata_dbp,
- #ifdef HAVE_TXNID_PARAMETER_TO_DB_OPEN
- NULL,
- #endif
- dirdata_db,
- NULL,
- DB_UNKNOWN,
- 0,
- 0);
- if(ret == 0)
- {
- /* found out how many keys were in the dirdata db */
- ret = dirdata_dbp->stat(dirdata_dbp,
- #ifdef HAVE_TXNID_PARAMETER_TO_DB_STAT
- (DB_TXN *) NULL,
- #endif
- &k_stat_p,
- #ifdef HAVE_UNKNOWN_PARAMETER_TO_DB_STAT
- NULL,
- #endif
- 0);
- if(ret != 0)
- {
- fprintf(stderr, "Error: dirdata_dbp->stat: %s.\n", db_strerror(ret));
- free(data.data);
- free(key.data);
- dbc_p->c_close(dbc_p);
- dbp->close(dbp, 0);
- dirdata_dbp->close(dbp, 0);
- return(-1);
- }
- dirent_count = (PVFS_size) k_stat_p->bt_ndata;
- free(k_stat_p);
-
- dirdata_dbp->close(dirdata_dbp, 0);
- }
- else
- {
- fprintf(stderr, "WARNING: could not find dirdata object: %s\n", dirdata_db);
- }
-
- if(verbose) printf("VERBOSE size: %lld\n", lld(dirent_count));
-
- /* write the dirent_count out into new collection */
- memset(&t_key, 0, sizeof(t_key));
- memset(&t_val, 0, sizeof(t_val));
- t_key.buffer = "dirdata_size";
- t_key.buffer_sz = 13;
- t_val.buffer = &dirent_count;
- t_val.buffer_sz = sizeof(PVFS_size);
-
- state = 0;
- ret = trove_keyval_write(
- new_id, tmp_handle, &t_key, &t_val,
- TROVE_SYNC, 0, NULL,
- trove_context, &op_id);
-
- while (ret == 0)
- {
- ret = trove_dspace_test(
- new_id, op_id, trove_context, &count, NULL, NULL,
- &state, 10);
- }
- if ((ret < 0) || (ret == 1 && state != 0))
- {
- fprintf(stderr, "Error: trove_keyval_write failure.\n");
- free(data.data);
- free(key.data);
- dbc_p->c_close(dbc_p);
- dbp->close(dbp, 0);
- return -1;
- }
- }
- }
- }while(ret != DB_NOTFOUND);
-
- free(data.data);
- free(key.data);
- dbc_p->c_close(dbc_p);
- dbp->close(dbp, 0);
-
- return(0);
-}
-
-/*
- * convert integers to pointers in dist
- * with no copy - dist is modified
- */
-int translate_dist_0_0_1(PINT_dist *dist)
-{
- if(!dist)
- {
- return 0;
- }
- /* convert ints in dist to pointers */
- dist->dist_name = (char *) dist + (intptr_t) dist->dist_name;
- dist->params = (void *) ((char *) dist + (intptr_t) dist->params);
- /* set methods */
- dist->methods = NULL;
- if (PINT_dist_lookup(dist)) {
- fprintf(stderr, "Error: %s: lookup dist failed\n", __func__);
- return -1;
- }
- return 0;
+ return 0;
}
/* @} */
Index: pvfs2-mkdir.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/apps/admin/pvfs2-mkdir.c,v
diff -p -u -r1.8 -r1.8.8.1
--- pvfs2-mkdir.c 11 Nov 2005 21:30:57 -0000 1.8
+++ pvfs2-mkdir.c 9 Aug 2006 20:17:30 -0000 1.8.8.1
@@ -228,9 +228,6 @@ static int make_directory(PVFS_credentia
attr.owner = credentials->uid;
attr.group = credentials->gid;
attr.perms = mode;
- attr.atime = time(NULL);
- attr.mtime = attr.atime;
- attr.ctime = attr.atime;
attr.mask = (PVFS_ATTR_SYS_ALL_SETABLE);
/* Clear out any info from previous calls */
@@ -311,9 +308,6 @@ static int make_directory(PVFS_credentia
fprintf(stdout, "\t owner [%d]\n", attr.owner);
fprintf(stdout, "\t group [%d]\n", attr.group);
fprintf(stdout, "\t perms [%o]\n", attr.perms);
- fprintf(stdout, "\t atime [%llu]\n", llu(attr.atime));
- fprintf(stdout, "\t mtime [%llu]\n", llu(attr.mtime));
- fprintf(stdout, "\t ctime [%llu]\n", llu(attr.ctime));
}
ret = PVFS_sys_mkdir(basename_ptr,
Index: pvfs2-showcoll.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/apps/admin/pvfs2-showcoll.c,v
diff -p -u -r1.19.8.1 -r1.19.8.2
--- pvfs2-showcoll.c 7 Jun 2006 03:20:34 -0000 1.19.8.1
+++ pvfs2-showcoll.c 9 Aug 2006 20:17:30 -0000 1.19.8.2
@@ -61,7 +61,7 @@ int main(int argc, char **argv)
TROVE_keyval_s key, val;
TROVE_context_id trove_context = -1;
char *method_name;
- char root_handle_string[] = "root_handle"; /* TODO: DEFINE ELSEWHERE? */
+ char root_handle_string[] = ROOT_HANDLE_KEYSTR;
ret = parse_args(argc, argv);
if (ret < 0) {
@@ -429,7 +429,7 @@ static int print_keyval_pair(TROVE_keyva
val_p->read_sz);
print_object_attributes((struct PVFS_object_attr *) val_p->buffer);
}
- else if (!strncmp(key_p->buffer, "datafile_handles", 17) && val_p->read_sz % sizeof(PVFS_handle) == 0) {
+ else if (!strncmp(key_p->buffer, "dh", 17) && val_p->read_sz % sizeof(PVFS_handle) == 0) {
fprintf(stdout,
"\t\t'%s' (%d): '%s' (%d) as handles = ",
(char *) key_p->buffer,
@@ -438,7 +438,7 @@ static int print_keyval_pair(TROVE_keyva
val_p->read_sz);
print_datafile_handles((PVFS_handle *) val_p->buffer, val_p->read_sz / sizeof(PVFS_handle));
}
- else if (type == PVFS_TYPE_DIRECTORY && !strncmp(key_p->buffer, "dir_ent", 8)) {
+ else if (type == PVFS_TYPE_DIRECTORY && !strncmp(key_p->buffer, "de", 3)) {
fprintf(stdout,
"\t\t'%s' (%d): '%s' (%d) as a handle = 0x%08llx\n",
(char *) key_p->buffer,
Index: pvfs2-stat.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/apps/admin/pvfs2-stat.c,v
diff -p -u -r1.5 -r1.5.2.1
--- pvfs2-stat.c 9 Mar 2006 21:17:48 -0000 1.5
+++ pvfs2-stat.c 9 Aug 2006 20:17:30 -0000 1.5.2.1
@@ -225,7 +225,7 @@ static int do_stat(const char
ref.fs_id = fs_id;
ret = PVFS_sys_getattr(ref,
- PVFS_ATTR_SYS_ALL,
+ PVFS_ATTR_SYS_ALL_NOHINT,
(PVFS_credentials *) credentials,
&getattr_response);
Index: pvfs2-touch.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/apps/admin/pvfs2-touch.c,v
diff -p -u -r1.2 -r1.2.12.1
--- pvfs2-touch.c 28 Sep 2005 22:59:17 -0000 1.2
+++ pvfs2-touch.c 9 Aug 2006 20:17:30 -0000 1.2.12.1
@@ -112,8 +112,7 @@ int main(int argc, char **argv)
attr.perms = 0;
attr.atime = time(NULL);
attr.mtime = attr.atime;
- attr.ctime = attr.atime;
- attr.mask = (PVFS_ATTR_SYS_ALL_SETABLE);
+ attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
attr.dfile_count = 0;
parent_ref = resp_lookup.ref;
Index: pvfs2-viewdist.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/apps/admin/pvfs2-viewdist.c,v
diff -p -u -r1.12.2.1 -r1.12.2.2
--- pvfs2-viewdist.c 7 Jun 2006 03:20:34 -0000 1.12.2.1
+++ pvfs2-viewdist.c 9 Aug 2006 20:17:30 -0000 1.12.2.2
@@ -81,8 +81,10 @@ static int generic_open(file_object *obj
static int generic_server_location(file_object *obj, PVFS_credentials *creds,
char **servers, PVFS_handle *handles, int *nservers);
-#define DIST_KEY "system.pvfs2.metafile_dist"
-#define DFILE_KEY "system.pvfs2.datafile_handles"
+/* metafile distribution */
+#define DIST_KEY "system.pvfs2." METAFILE_DIST_KEYSTR
+/* datafile handles */
+#define DFILE_KEY "system.pvfs2." DATAFILE_HANDLES_KEYSTR
static int generic_dist(file_object *obj, PVFS_credentials *creds,
char **dist, int *size)
@@ -404,7 +406,7 @@ static int generic_open(file_object *obj
ref.fs_id = resp_lookup.ref.fs_id;
memset(&resp_getattr, 0, sizeof(PVFS_sysresp_getattr));
- ret = PVFS_sys_getattr(ref, PVFS_ATTR_SYS_ALL,
+ ret = PVFS_sys_getattr(ref, PVFS_ATTR_SYS_ALL_NOHINT,
credentials, &resp_getattr);
if (ret)
{
More information about the Pvfs2-cvs
mailing list