[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Quilt-dev] [PATCH 29/39] backup-files: Try mass link/copy first on rest
From: |
Jean Delvare |
Subject: |
[Quilt-dev] [PATCH 29/39] backup-files: Try mass link/copy first on restore |
Date: |
Sat, 19 Mar 2011 10:52:59 +0100 |
User-agent: |
quilt/0.48-17.1 |
When restoring all files from a backup directory, try a mass link (or
copy) first, as it is much faster. It is however not portable and may
thus fail. If it fails, fallback to per-file processing, which always
works.
This change results in a huge performance boost on systems where
the cp command supports all the required options (which includes
all systems using GNU coreutils.)
Signed-off-by: Jean Delvare <address@hidden>
Reviewed-by: Raphael Hertzog <address@hidden>
---
quilt/scripts/backup-files.in | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
--- a/quilt/scripts/backup-files.in
+++ b/quilt/scripts/backup-files.in
@@ -170,12 +170,28 @@ restore_all()
fi
if [ -s "$NONEMPTY_FILES" ]; then
- xargs -0 rm -f < "$NONEMPTY_FILES"
+ # Try a mass link (or copy) first, as it is much faster.
+ # It is however not portable and may thus fail. If it fails,
+ # fallback to per-file processing, which always works.
+ local target_dir=$PWD opt_l=-l
+ [ -n "$OPT_NOLINKS" ] && opt_l=-p
- while read -d $'\0' -r
- do
- restore_fast "${REPLY#./}"
- done < "$NONEMPTY_FILES"
+ if (cd "$OPT_PREFIX" && \
+ xargs -0 cp $opt_l --parents --remove-destination \
+ --target-directory="$target_dir" \
+ < "$NONEMPTY_FILES" 2> /dev/null); then
+ while read -d $'\0' -r
+ do
+ $ECHO "Restoring ${REPLY#./}"
+ done < "$NONEMPTY_FILES"
+ else
+ xargs -0 rm -f < "$NONEMPTY_FILES"
+
+ while read -d $'\0' -r
+ do
+ restore_fast "${REPLY#./}"
+ done < "$NONEMPTY_FILES"
+ fi
if [ -n "$OPT_TOUCH" ]; then
xargs -0 touch -c < "$NONEMPTY_FILES"
- [Quilt-dev] [PATCH 15/39] backup-files: Optimize restore, (continued)
- [Quilt-dev] [PATCH 15/39] backup-files: Optimize restore, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 23/39] backup-files: Optimize noop, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 27/39] backup-files: Remember the list of files, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 17/39] backup-files: Drop variable filelist, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 09/39] backup-files: Inline copy_file and link_or_copy_file, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 19/39] backup-files: Use internal implementation of dirname, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 33/39] backup-files: Try mass copy first on copy, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 05/39] Clean up legacy C code, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 11/39] backup-files: Prefix must be a directory, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 30/39] backup-files: Skip first mkdir on restore, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 29/39] backup-files: Try mass link/copy first on restore,
Jean Delvare <=
- [Quilt-dev] [PATCH 36/39] backup-files: Drop support for -L on restore, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 16/39] backup-files: Optimize backup, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 06/39] backup-files: Drop suffix option, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 28/39] backup-files: Separate lists for empty and non-empty files, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 10/39] backup-files: Speed up ensure_nolinks, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 35/39] backup-files: Inline restore_fast, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 20/39] backup-files: Batch mass restore, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 31/39] backup-files: New function for copy, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 37/39] backup-files: Drop support for backup removal, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 08/39] backup-files: Drop variable progname, Jean Delvare, 2011/03/19