예제 #1
0
void type_ext2_block_bitmap___deallocate (char *command_line)

/* This is the opposite of the above function - We call deallocate_block instead of allocate_block */

{
	long entry_num,num=1;
	char *ptr,buffer [80];
	
	ptr=parse_word (command_line,buffer);
	if (*ptr!=0) {
		ptr=parse_word (ptr,buffer);
		num=atol (buffer);
	}
	
	entry_num=block_bitmap_info.entry_num;
	if (num > file_system_info.super_block.s_blocks_per_group-entry_num) {
		wprintw (command_win,"Error - There aren't that much blocks in the group\n");	
		refresh_command_win ();return;				
	}
	
	while (num) {
		deallocate_block (entry_num);
		num--;entry_num++;
	}
	
	dispatch ("show");
}
예제 #2
0
int mpi_process_group::allocate_block(bool out_of_band_receive)
{
  BOOST_ASSERT(!block_num);
  block_iterator i = impl_->blocks.begin();
  while (i != impl_->blocks.end() && *i) ++i;

  if (i == impl_->blocks.end()) {
    impl_->blocks.push_back(new block_type());
    i = impl_->blocks.end() - 1;
  } else {
    *i = new block_type();
  }

  block_num.reset(new int(i - impl_->blocks.begin()),
                  deallocate_block(&impl_->blocks));

#ifdef DEBUG
  fprintf(stderr,
          "Processor %i allocated block #%i\n", process_id(*this), *block_num);
#endif

  return *block_num;
}
예제 #3
0
파일: file.c 프로젝트: ejrh/ejrh
static int reduce_file_callback(FS *fs, BLOCK *block, KEY *key, EFFECT *effect, void *data)
{
    struct reduce_file_baton *baton = (struct reduce_file_baton *) data;
    char extent_prefix[MAX_INTERNAL_NAME+1];
    unsigned long int start, stop;
    unsigned long int first_to_go;
    unsigned long int i;
    
    sprintf(extent_prefix, "%ld/X", baton->label);

    if (key->type == K_INVALID || strncmp(key->name, extent_prefix, strlen(extent_prefix)) != 0)
        return 0;
    
    sscanf(key->name + strlen(extent_prefix), "%ld-%ld", &start, &stop);
    if (stop < baton->new_num_blocks)
    {
        baton->num_blocks = stop+1;
        return 0;
    }
    
    first_to_go = MAX2(start, baton->new_num_blocks);
    
    for (i = first_to_go; i <= stop; i++)
        deallocate_block(fs, B_DATA, key->pointer + (i - start));
    
    if (first_to_go <= start)
        delete_key(fs, block, key->name, effect);
    else
    {
        sprintf(extent_prefix, "%ld/X%08ld-%08ld", baton->label, start, first_to_go - 1);
        replace_key(fs, block, key->name, extent_prefix, K_ATTRIBUTE, key->pointer, effect);
    }
    
    baton->num_blocks = first_to_go;
    return 1;
}