From 08852d6e984f19911752f78c4de9cbc4bb82ba8d Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Thu, 17 Aug 2017 18:00:27 -0400 Subject: [PATCH] ir: stream.c: do not truncate file at each packet flush MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The whole stream file is truncated in bt_ctf_stream_destroy() anyway so truncating at each packet flush is redundant. Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- lib/ctf-ir/stream.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/lib/ctf-ir/stream.c b/lib/ctf-ir/stream.c index 4ce2fe30..70f08d18 100644 --- a/lib/ctf-ir/stream.c +++ b/lib/ctf-ir/stream.c @@ -1715,17 +1715,6 @@ int bt_ctf_stream_flush(struct bt_ctf_stream *stream) stream->flushed_packet_count++; stream->size += stream->pos.packet_size / CHAR_BIT; - do { - ret = ftruncate(stream->pos.fd, stream->size); - } while (ret == -1 && errno == EINTR); - if (ret == -1) { - BT_LOGE_ERRNO("Cannot truncate stream file to new size", - ": size=%" PRIu64 ", stream-addr=%p, " - "stream-name=\"%s\"", - stream->size, stream, - bt_ctf_stream_get_name(stream)); - } - end: /* Reset automatically-set fields. */ if (stream->packet_context) { -- 2.34.1