bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-tar] tar archive buffer was not page-aligned?


From: Paul Eggert
Subject: [Bug-tar] tar archive buffer was not page-aligned?
Date: Tue, 07 Mar 2006 16:58:19 -0800
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

I noticed that tar's archive buffer is carefully allocated to be aligned,
but then the alignment is forgotten.  So I installed this patch.

2006-03-07  Paul Eggert  <address@hidden>

        * src/buffer.c (record_buffer_aligned): New var.
        (init_buffer): Use it to ensure that the buffer is aligned.
        This doesn't result in any measurable performance improvement
        on my host (Debian GNU/Linux 3.1 stable, with default block size),
        but I assume it does help on some hosts.

--- src/buffer.c        20 Feb 2006 08:15:31 -0000      1.96
+++ src/buffer.c        8 Mar 2006 00:55:56 -0000       1.97
@@ -44,6 +44,7 @@
 static tarlong prev_written;   /* bytes written on previous volumes */
 static tarlong bytes_written;  /* bytes written on this volume */
 static void *record_buffer[2]; /* allocated memory */
+union block *record_buffer_aligned[2];
 static int record_index;
 
 /* FIXME: The following variables should ideally be static to this
@@ -369,10 +370,11 @@ xclose (int fd)
 static void
 init_buffer ()
 {
-  if (!record_buffer[record_index])
-    page_aligned_alloc (&record_buffer[record_index], record_size);
+  if (! record_buffer_aligned[record_index])
+    record_buffer_aligned[record_index] =
+      page_aligned_alloc (&record_buffer[record_index], record_size);
 
-  record_start = record_buffer[record_index];
+  record_start = record_buffer_aligned[record_index];
   current_block = record_start;
   record_end = record_start + blocking_factor;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]