patchGNU tar - Patches: patch #7892, New option to sort directories on...


You are not allowed to post comments on this tracker with your current authentication level.

patch #7892: New option to sort directories on name or inode

Submitted by:  Dick Streefland <dicks>
Submitted on:  Thu 22 Nov 2012 09:55:54 PM UTC  
Category:  None Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  Sergey Poznyakoff <gray> Open/Closed:  Closed

Thu 13 Feb 2014 10:35:40 PM UTC, comment #1:

Applied to the repository (commit 29a6964a). Thank you!

Sergey Poznyakoff <gray>
Project AdministratorIn charge of this item.
Thu 22 Nov 2012 09:55:54 PM UTC, original submission:

Here are patches to tar and gnulib that implement a new --sort option
to sort the entries of directories that will be added to an archive.
The new option is --sort=ORDER, where ORDER is one of none, name or
inode. The actual sorting code has been added to the gnulib module

The motivation for this new option is the observation that reading a
directory on a Linux ext3/ext4 filesystem return the entries in a more
or less random order due to the directory hashing. Creating an archive
from the entries in this order typically results in a lot of disk
seeks. It turns out that when you sort the directory entries on inode
number, the amount of seeking is greatly reduced in most cases.
I typically see a 30-40% reduction in running time, but in some cases
it is even more:

# echo 3 > /proc/sys/vm/drop_caches
# tar cP /usr/bin | dd of=/dev/null
584720+0 records in
584720+0 records out
299376640 bytes (299 MB) copied, 26.4371 s, 11.3 MB/s
# echo 3 > /proc/sys/vm/drop_caches
# tar cP /usr/bin --sort=inode | dd of=/dev/null
584720+0 records in
584720+0 records out
299376640 bytes (299 MB) copied, 12.1403 s, 24.7 MB/s

With --sort=name, the directory entries are sorted on name. This can
be used to make archive creation reproducible. Sorted archives will
also be more suitable for distribution by programs like rsync.

Attached are patches against the current git trees of tar and gnulib.

Dick Streefland <dicks>


Attached Files
file #26959:  tar.diff added by dicks (2KiB - text/x-patch)
file #26960:  gnulib.diff added by dicks (3KiB - text/x-patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by gray (Updated the item)
  • -email is unavailable- added by dicks (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-02-13 gray StatusIn Progress => Done
        Open/ClosedOpen => Closed
    2014-01-09 gray StatusNone => In Progress
        Assigned toNone => gray
    2012-11-22 dicks Attached File- => Added tar.diff, #26959
        Attached File- => Added gnulib.diff, #26960

    Back to the top

    Powered by Savane 3.3