file_size = item->location.size;
}
- if (map->addr == NULL) {
- int fd = openat(log->dirfd, map->filename, O_RDONLY);
-
- if (fd < 0) {
- fprintf(stderr, "Error opening logfile %s: %m\n", map->filename);
- goto exit2;
- }
-
- off_t length = lseek(fd, 0, SEEK_END);
- map->addr = (const char *)mmap(NULL, length, PROT_READ, MAP_SHARED,
- fd, 0);
- g_atomic_int_add(&log->disk_used, -(map->len / 1024));
- map->len = length;
- g_atomic_int_add(&log->disk_used, map->len / 1024);
-
- g_atomic_int_inc(&map->refcount);
-
- close(fd);
- }
-
/* Log segments fetched from the cloud might only be partially-fetched.
* Check whether the object we are interested in is available. */
if (location == CLOUDLOG_CLOUD) {
}
}
+ if (map->addr == NULL) {
+ int fd = openat(log->dirfd, map->filename, O_RDONLY);
+
+ if (fd < 0) {
+ fprintf(stderr, "Error opening logfile %s: %m\n", map->filename);
+ goto exit2;
+ }
+
+ off_t length = lseek(fd, 0, SEEK_END);
+ map->addr = (const char *)mmap(NULL, length, PROT_READ, MAP_SHARED,
+ fd, 0);
+ g_atomic_int_add(&log->disk_used, -(map->len / 1024));
+ map->len = length;
+ g_atomic_int_add(&log->disk_used, map->len / 1024);
+
+ g_atomic_int_inc(&map->refcount);
+
+ close(fd);
+ }
+
if (map_data) {
if (location == CLOUDLOG_JOURNAL)
file_offset += sizeof(struct log_header);