Kouhei Sutou
null+****@clear*****
Fri Jun 26 12:10:10 JST 2015
Kouhei Sutou 2015-06-26 12:10:10 +0900 (Fri, 26 Jun 2015) New Revision: af76de07e78c0bb008e6bcfa6dc28d8cc18ade4b https://github.com/groonga/groonga/commit/af76de07e78c0bb008e6bcfa6dc28d8cc18ade4b Message: Flush all mapped addresses Modified files: lib/io.c Modified: lib/io.c (+19 -16) =================================================================== --- lib/io.c 2015-06-26 12:05:52 +0900 (7cd701f) +++ lib/io.c 2015-06-26 12:10:10 +0900 (2a3f08e) @@ -1312,10 +1312,7 @@ grn_io_flush(grn_ctx *ctx, grn_io *io) { grn_rc rc = GRN_SUCCESS; struct _grn_io_header *header; - uint32_t i; uint32_t aligned_header_size; - uint32_t max_mapped_segment; - uint32_t segment_size; if (!io->path) { return GRN_SUCCESS; @@ -1323,24 +1320,30 @@ grn_io_flush(grn_ctx *ctx, grn_io *io) header = io->header; aligned_header_size = grn_io_compute_base(header->header_size); - max_mapped_segment = io->max_map_seg; - segment_size = header->segment_size; if (grn_msync(ctx, header, aligned_header_size) != 0) { return ctx->rc; } - for (i = 0; i < max_mapped_segment; i++) { - grn_io_mapinfo *info = &(io->maps[i]); - if (!info) { - continue; - } - if (!info->map) { - continue; - } - if (grn_msync(ctx, info->map, segment_size) != 0) { - rc = ctx->rc; - break; + if (io->maps) { + uint32_t i; + uint32_t max_mapped_segment; + uint32_t segment_size; + + max_mapped_segment = grn_io_max_segment(io); + segment_size = header->segment_size; + for (i = 0; i < max_mapped_segment; i++) { + grn_io_mapinfo *info = &(io->maps[i]); + if (!info) { + continue; + } + if (!info->map) { + continue; + } + if (grn_msync(ctx, info->map, segment_size) != 0) { + rc = ctx->rc; + break; + } } } -------------- next part -------------- HTML����������������������������...Download