xfs
[Top] [All Lists]

[PATCH] xfsrestore: fix multi stream support

To: xfs-oss <xfs@xxxxxxxxxxx>
Subject: [PATCH] xfsrestore: fix multi stream support
From: Rich Johnston <rjohnston@xxxxxxx>
Date: Tue, 1 Oct 2013 11:30:38 -0500
Delivered-to: xfs@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.0
If no extents exist, there is no need to call partial_reg() because
there is no data to split up. Also remove the uneeded check in partial_reg() to detect if this is a multistream restore.

Signed-off-by: Rich Johnston <rjohnston@xxxxxxx>

diff --git a/restore/content.c b/restore/content.c
index 54d933c..ecbcf13 100644
--- a/restore/content.c
+++ b/restore/content.c
@@ -7494,6 +7494,7 @@ restore_extent_group( drive_t *drivep,
        extenthdr_t ehdr;
        off64_t bytesread;
        rv_t rv;
+       uint num_extents = 0; /* number of extents */

        /* copy data extents from media to the file
         */
@@ -7518,6 +7519,7 @@ restore_extent_group( drive_t *drivep,
                if ( ehdr.eh_type == EXTENTHDR_TYPE_LAST ) {
                        break;
                }
+               num_extents++;

                /* if its an ALIGNment extent, discard the extent.
                 */
@@ -7572,7 +7574,7 @@ restore_extent_group( drive_t *drivep,
         * and certain extended inode flags. Register the portion
         * of the file completed here in the persistent state.
         */
-       if (bstatp->bs_size > restoredsz) {
+       if (num_extents && (bstatp->bs_size > restoredsz)) {
                partial_reg(drivep->d_index,
                            bstatp->bs_ino,
                            bstatp->bs_size,
@@ -8959,9 +8961,6 @@ partial_reg( ix_t d_index,

        endoffset = offset + sz;

-       if ( partialmax == 0 )
-               return;
-
        pi_lock();

        /* Search for a matching inode.  Gaps can exist so we must search

<Prev in Thread] Current Thread [Next in Thread>