Exemple #1
0
/* PINT_handle_in_extent_list()
 *
 * Parameters:
 * PINT_llist *extent_list   - PINT_llist of extent structures
 * PVFS_handle                 - a handle
 *
 * Returns 1 if the specified handle is within any of the
 * extents in the specified list of extents.  Returns 0
 * otherwise.
 *
 */
int PINT_handle_in_extent_list(
    PINT_llist *extent_list,
    PVFS_handle handle)
{
    int ret = 0;
    PINT_llist *cur = NULL;
    PVFS_handle_extent *cur_extent = NULL;

    if (extent_list)
    {
        cur = extent_list;
        while(cur)
        {
            cur_extent = PINT_llist_head(cur);
            if (!cur_extent)
            {
                break;
            }
            if (PINT_handle_in_extent(cur_extent,handle))
            {
                ret = 1;
                break;
            }
            cur = PINT_llist_next(cur);
        }
    }
    return ret;
}
Exemple #2
0
static int trove_map_handle_ranges( PINT_llist *extent_list,
                                   struct handle_ledger *ledger)
{
    int ret = -1;
    PINT_llist *cur = NULL;
    PVFS_handle_extent *cur_extent = NULL;
    int64_t total_handles=0;

    if (extent_list && ledger)
    {
        cur = extent_list;
        while(cur)
        {
            cur_extent = PINT_llist_head(cur);
            if (!cur_extent)
            {
                break;
            }

	    ret = trove_handle_ledger_addextent(ledger, cur_extent);
	    if (ret != 0)
            {
		break;
            }

	    /* if, for example, you had a 'first' of 5 and a 'last' of
	     * 5, the difference is 0, but there is one handle */
	    total_handles += (cur_extent->last - cur_extent->first + 1);
            cur = PINT_llist_next(cur);
        }
	trove_handle_ledger_set_threshold(ledger, total_handles);
    }
    return ret;
}
Exemple #3
0
struct generic_queue_item * dsfq_dequeue(struct dequeue_reason r)
{
	pthread_mutex_lock(&dsfq_queue_mutex);
	PINT_llist_doall(dsfq_llist_queue,list_pmsg_print_all);
	//get the head of the list, remove it from the head


	if (dsfq_new_item_added==1)
	{
		dsfq_llist_queue = PINT_llist_sort(dsfq_llist_queue,list_dsfq_sort_comp);
		dsfq_new_item_added=0;
	}

	struct generic_queue_item * item  = (struct generic_queue_item *)PINT_llist_head(dsfq_llist_queue);
	//fprintf(stderr, "msg index is %i\n",head_message->msg_index);
	struct generic_queue_item * next_item = NULL;

	if (item!=NULL)
	{
		next_item = (struct generic_queue_item *)PINT_llist_rem(dsfq_llist_queue, (void*)item->item_id,  list_req_comp);

	}

	if (next_item!=NULL)
	{
		struct dsfq_queue_item * dsfq_item = (struct dsfq_queue_item *)(next_item->embedded_queue_item);
		dsfq_virtual_time=dsfq_item->start_tag;


		//fprintf(stderr, "releasing start_tag %i finish_tag:%i, weight:%i, app: %i, %s, queue length is %i\n", dsfq_item->start_tag, dsfq_item->finish_tag,
		//		dsfq_item->weight, dsfq_item->app_index+1,s_pool.socket_state_list[i].ip, dsfq_queue_size-1);

		dsfq_stats[dsfq_item->app_index].dsfq_app_dispatch++;
/*		for (i=0;i<dsfq_num_apps;i++)
		{
			fprintf(stderr,"app %i:%i;",i, dsfq_app_dispatch[i]);
		}
		fprintf(stderr,"\n");*/

		dsfq_queue_size--;
		int app_index=next_item->socket_data->app_index;
		app_stats[app_index].dispatched_requests+=1;
	}
	else
	{
		dsfq_current_depth--;
	}

	pthread_mutex_unlock(&dsfq_queue_mutex);

	return next_item;
}
Exemple #4
0
int main(int argc, char **argv)
{
    PINT_llist *cur = NULL;
    struct server_configuration_s serverconfig;
    struct host_alias_s *cur_alias;
    struct filesystem_configuration_s *cur_fs = NULL;
    int alias_count = 1;

    if (argc != 3)
    {
        printf("Usage: %s <fs.conf> <server-alias>\n",argv[0]);
        return 1;
    }

    gossip_enable_stderr();

    memset(&serverconfig,0,sizeof(serverconfig));
    if (PINT_parse_config(&serverconfig, argv[1], argv[2], 1))
    {
        printf("Failed to parse config files\n");
        return 1;
    }

    /* dump all gathered config values */
    fprintf(stderr,"--- Printing filesystem configuration\n\n");

    fprintf(stderr,"Server ID                : %s\n",
            serverconfig.host_id);
    fprintf(stderr,"Data Storage Space            : %s\n",
            serverconfig.data_path);
    fprintf(stderr,"Meta Storage Space            : %s\n",
            serverconfig.meta_path);
    fprintf(stderr,"FS Config File Name      : %s (%d bytes)\n",
            serverconfig.fs_config_filename,
            (int)serverconfig.fs_config_buflen);
    fprintf(stderr,"Initial Unexp Requests   : %d\n",
            serverconfig.initial_unexpected_requests);
    fprintf(stderr,"Configured Log File      : %s\n",
            serverconfig.logfile);
    fprintf(stderr,"Configured FlowModules : %s\n",
            serverconfig.flow_modules);
    fprintf(stderr,"Configured BMIModules : %s\n",
            serverconfig.bmi_modules);
    fprintf(stderr,"Event Logging Mask String: %s\n",
            serverconfig.event_logging);

    fprintf(stderr,"\n--- Host Aliases (alias => address):\n");
    cur = serverconfig.host_aliases;
    while(cur)
    {
        cur_alias = PINT_llist_head(cur);
        if (!cur_alias)
        {
            break;
        }

        fprintf(stderr,"%.2d)  %s => %s\n", alias_count++,
                cur_alias->host_alias, cur_alias->bmi_address);
        cur = PINT_llist_next(cur);
    }

    fprintf(stderr,"\n");
    cur = serverconfig.file_systems;
    while(cur)
    {
        cur_fs = PINT_llist_head(cur);
        if (!cur_fs)
        {
            break;
        }
        print_filesystem_configuration(cur_fs);
        cur = PINT_llist_next(cur);
    }

    fprintf(stderr,"\n--- Analyzing filesystem configuration\n\n");
    if (PINT_config_is_valid_configuration(&serverconfig))
    {
        fprintf(stderr,"\nOK: Configuration file is VALID\n");
    }
    else
    {
        fprintf(stderr,"\nERROR: Configuration file is INVALID\n");
    }

    PINT_config_release(&serverconfig);

    gossip_disable();
    return 0;
}
Exemple #5
0
void print_filesystem_configuration(struct filesystem_configuration_s *fs)
{
    PINT_llist *cur = NULL;
    struct host_handle_mapping_s *cur_h_mapping = NULL;

    if (fs)
    {
        fprintf(stderr,"=========== Reporting FS \"%s\" Information "
                "===========\n",fs->file_system_name);
        fprintf(stderr,"Collection ID         : %d\n",fs->coll_id);
        fprintf(stderr,"Root Handle           : %llu\n",
                llu(fs->root_handle));
        fprintf(stderr,"Handle Recycle Timeout: %d seconds\n",
                (int)fs->handle_recycle_timeout_sec.tv_sec);
        fprintf(stderr,"Trove Sync Meta       : %s\n",
                ((fs->trove_sync_meta == TROVE_SYNC) ?
                 "yes" : "no"));
        fprintf(stderr,"Trove Sync Data       : %s\n",
                ((fs->trove_sync_data == TROVE_SYNC) ?
                 "yes" : "no"));
        fprintf(stderr,"Flow Protocol         : ");
        switch(fs->flowproto)
        {
            case FLOWPROTO_DUMP_OFFSETS:
                fprintf(stderr,"flowproto_dump_offsets\n");
                        break;
            case FLOWPROTO_BMI_CACHE:
                fprintf(stderr,"flowproto_bmi_cache\n");
                        break;
            case FLOWPROTO_MULTIQUEUE:
                fprintf(stderr,"flowproto_multiqueue\n");
                        break;
            default:
                fprintf(stderr,"Unknown (<== ERROR!)\n");
                break;
        }

        fprintf(stderr,"\n  --- Meta Server(s) for %s (%d total):\n",
                fs->file_system_name,PINT_llist_count(fs->meta_handle_ranges));
        cur = fs->meta_handle_ranges;
        while(cur)
        {
            cur_h_mapping = PINT_llist_head(cur);
            if (!cur_h_mapping)
            {
                break;
            }
            fprintf(stderr,"    %s\n",
                    cur_h_mapping->alias_mapping->host_alias);
            cur = PINT_llist_next(cur);
        }

        fprintf(stderr,"\n  --- Data Server(s) for %s (%d total):\n",
                fs->file_system_name,PINT_llist_count(fs->data_handle_ranges));
        cur = fs->data_handle_ranges;
        while(cur)
        {
            cur_h_mapping = PINT_llist_head(cur);
            if (!cur_h_mapping)
            {
                break;
            }
            fprintf(stderr,"    %s\n",
                    cur_h_mapping->alias_mapping->host_alias);
            cur = PINT_llist_next(cur);
        }

        fprintf(stderr,"\n  --- Meta Handle Mappings for %s:\n",
                fs->file_system_name);
        cur = fs->meta_handle_ranges;
        while(cur)
        {
            cur_h_mapping = PINT_llist_head(cur);
            if (!cur_h_mapping)
            {
                break;
            }
            fprintf(stderr,"    %s has handle range %s\n",
                    cur_h_mapping->alias_mapping->host_alias,
                    cur_h_mapping->handle_range);
            cur = PINT_llist_next(cur);
        }

        fprintf(stderr,"\n  --- Data Handle Mappings for %s:\n",
                fs->file_system_name);
        cur = fs->data_handle_ranges;
        while(cur)
        {
            cur_h_mapping = PINT_llist_head(cur);
            if (!cur_h_mapping)
            {
                break;
            }
            fprintf(stderr,"    %s has handle range %s\n",
                    cur_h_mapping->alias_mapping->host_alias,
                    cur_h_mapping->handle_range);
            cur = PINT_llist_next(cur);
        }
    }
}
Exemple #6
0
struct generic_queue_item * sfqdfull_dequeue(struct dequeue_reason r)
{

	//int last_io_type = r.complete_size;
	struct generic_queue_item * next;//for heap and list
	//free up current item
	struct generic_queue_item * next_item = NULL; //for actual list item removal
	struct sfqdfull_queue_item *next_queue_item;

	int found=0;
	next_retry:

	if (SFQD_FULL_USE_HEAP_QUEUE==1 && !heap_empty(sfqdfull_heap_queue))
	{
		struct heap_node * hn  = heap_take(sfqd_packet_cmp, sfqdfull_heap_queue);
		next_item  = heap_node_value(hn);
		next_queue_item = (struct sfqdfull_queue_item *)(next_item->embedded_queue_item);
		found=1;
	}

	char bptr[20];
    struct timeval tv;
    time_t tp;
    gettimeofday(&tv, 0);
    tp = tv.tv_sec;
    strftime(bptr, 10, "[%H:%M:%S", localtime(&tp));
    sprintf(bptr+9, ".%06ld]", (long)tv.tv_usec);

	//fprintf(stderr,"%s %s, finished %i complete recv %i, completefwd %i\n",	bptr, log_prefix, finished[0], completerecv[0], completefwd[0]);
	if (SFQD_FULL_USE_HEAP_QUEUE==0)
	{
		/*if (sfqdfull_sorted==0)
		{
			sfqdfull_llist_queue = PINT_llist_sort(sfqdfull_llist_queue,list_sfqd_sort_comp);
			sfqdfull_sorted=1;
		}*/

		int i;
		fprintf(stderr,"%s %s ",bptr,log_prefix);
		for (i=0;i<num_apps;i++)
		{
			fprintf(stderr,"app%i:%i,", i, sfqdfull_list_queue_count[i]);
		}
		fprintf(stderr,"\n");

		next  = (struct generic_queue_item *)PINT_llist_head(sfqdfull_llist_queue);
		if (next!=NULL)
		{
			next_item = (struct generic_queue_item *)PINT_llist_rem(sfqdfull_llist_queue, (void*)next->item_id,  list_req_comp);

		}
		if (next_item!=NULL)
		{
			next_queue_item = (struct sfqdfull_queue_item *)(next_item->embedded_queue_item);
			sfqdfull_list_queue_count[next_queue_item->app_index]--;
			found=1;
			fprintf(stderr," meta dispatching \n");
			int app_index=next_queue_item->app_index;
			if (next_queue_item->app_index==1 && sfqdfull_list_queue_count[0]==0){
				fprintf(stderr,"%s %s, ********************************************** warning app 0 has no item left in the queue\n", bptr, log_prefix);

			}
		}

	}

	if (found==1)
	{
		//current_node = hn;
		sfqdfull_virtual_time=next_queue_item->start_tag;

		fprintf(depthtrack,"%s %s dispatching tag %i app%i on %s\n", bptr, log_prefix, next_queue_item->socket_tag, next_queue_item->app_index,
				s_pool.socket_state_list[next_queue_item->request_socket_index].ip);

		int app_index=next_item->socket_data->app_index;;
		app_stats[app_index].req_go+=1;

		app_stats[app_index].dispatched_requests+=1;

		struct timeval dispatch_time, diff;
		gettimeofday(&dispatch_time, 0);
		next_queue_item->dispatchtime = dispatch_time;
		double ratio = ((float)(app_stats[0].dispatched_requests))/((float)app_stats[1].dispatched_requests);
		fprintf(stderr,"%s %s $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ instant ratio is %d/%d=%f\n",
				bptr, log_prefix, app_stats[0].dispatched_requests, app_stats[1].dispatched_requests, ratio);
		return next_item;
	}
	else
	{
		sfqdfull_current_depth--;
		return NULL;
	}
}