[PATCH] xfsrestore: fix multi stream support

Rich Johnston rjohnston at sgi.com
Tue Oct 1 11:30:38 CDT 2013


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 at sgi.com>

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



More information about the xfs mailing list