Browse Source

* 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.

Paul Eggert 19 years ago
parent
commit
18486cf8d7
2 changed files with 11 additions and 3 deletions
  1. 6 0
      ChangeLog
  2. 5 3
      src/buffer.c

+ 6 - 0
ChangeLog

@@ -1,5 +1,11 @@
 2006-03-07  Paul Eggert  <eggert@cs.ucla.edu>
 2006-03-07  Paul Eggert  <eggert@cs.ucla.edu>
 
 
+	* 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.
+
 	* lib/.cvsignore: Add unistd_.h.  Sort.
 	* lib/.cvsignore: Add unistd_.h.  Sort.
 
 
 2006-03-04  Sergey Poznyakoff  <gray@gnu.org.ua>
 2006-03-04  Sergey Poznyakoff  <gray@gnu.org.ua>

+ 5 - 3
src/buffer.c

@@ -44,6 +44,7 @@
 static tarlong prev_written;	/* bytes written on previous volumes */
 static tarlong prev_written;	/* bytes written on previous volumes */
 static tarlong bytes_written;	/* bytes written on this volume */
 static tarlong bytes_written;	/* bytes written on this volume */
 static void *record_buffer[2];	/* allocated memory */
 static void *record_buffer[2];	/* allocated memory */
+union block *record_buffer_aligned[2];
 static int record_index;
 static int record_index;
 
 
 /* FIXME: The following variables should ideally be static to this
 /* FIXME: The following variables should ideally be static to this
@@ -369,10 +370,11 @@ xclose (int fd)
 static void
 static void
 init_buffer ()
 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;
   current_block = record_start;
   record_end = record_start + blocking_factor;
   record_end = record_start + blocking_factor;
 }
 }