Navigation Menu

Skip to content

Commit

Permalink
io: reduce scope
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Jan 17, 2015
1 parent ea534dc commit ef83799
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions lib/io.c
Expand Up @@ -1135,23 +1135,25 @@ grn_io_expire(grn_ctx *ctx, grn_io *io, int count_thresh, uint32_t limit)
uint32_t nref, nmaps, *pnref = &io->nref;
GRN_ATOMIC_ADD_EX(pnref, 1, nref);
if (!nref && grn_gtick - io->count > count_thresh) {
grn_io_mapinfo *info = io->maps;
{
uint32_t i = io->header->n_arrays;
grn_io_array_spec *array_specs = (grn_io_array_spec *)io->user_header;
while (i--) {
memset(io->ainfo[i].addrs, 0, sizeof(void *) * array_specs[i].max_n_segments);
}
}
for (m = io->max_map_seg; m; info++, m--) {
if (info->map) {
GRN_MUNMAP(&grn_gctx, io, &info->fmo, NULL,
info->map, io->header->segment_size);
info->map = NULL;
info->nref = 0;
info->count = grn_gtick;
GRN_ATOMIC_ADD_EX(&io->nmaps, -1, nmaps);
n++;
{
grn_io_mapinfo *info = io->maps;
for (m = io->max_map_seg; m; info++, m--) {
if (info->map) {
GRN_MUNMAP(&grn_gctx, io, &info->fmo, NULL,
info->map, io->header->segment_size);
info->map = NULL;
info->nref = 0;
info->count = grn_gtick;
GRN_ATOMIC_ADD_EX(&io->nmaps, -1, nmaps);
n++;
}
}
}
}
Expand Down

0 comments on commit ef83799

Please sign in to comment.