All of lore.kernel.org
 help / color / mirror / Atom feed
* xfsrestore: fix 2GB directory dump limitation for multi-stream
@ 2015-08-27 18:54 Rich Johnston
  2015-09-01 19:37 ` Rich Johnston
  2015-09-02 13:21 ` Brian Foster
  0 siblings, 2 replies; 3+ messages in thread
From: Rich Johnston @ 2015-08-27 18:54 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: fix-2GB-directory-dump-limitation-for-multi-stream.patch --]
[-- Type: text/plain, Size: 1492 bytes --]


The drive_simple restore path has a 2GB directory limit. Instead of
ASSERTing if nreadneeded64 is greater than INTGENMAX (2GB), add a loop
to handle it.

Signed-off-by: Rich Johnston <rjohnston@sgi.com>
---
 common/drive_simple.c |   24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

Index: b/common/drive_simple.c
===================================================================
--- a/common/drive_simple.c
+++ b/common/drive_simple.c
@@ -765,18 +765,20 @@ do_seek_mark( drive_t *drivep, drive_mar
 	/* use read_buf util func to eat up difference
 	 */
 	nreadneeded64 = mark - strmoff;
-	ASSERT( nreadneeded64 <= INTGENMAX );
-	nreadneeded = ( intgen_t )nreadneeded64;
-	nread = read_buf( 0,
-			  ( size_t )nreadneeded,
-			  ( void * )drivep,
-			  ( rfp_t )drivep->d_opsp->do_read,
-			  ( rrbfp_t )drivep->d_opsp->do_return_read_buf,
-			  &rval );
-	if  ( rval ) {
-		return rval;
+	while ( nreadneeded64 > 0 ) {
+		if ( nreadneeded64 > INTGENMAX )
+			nreadneeded = INTGENMAX;
+		else
+			nreadneeded = ( intgen_t )nreadneeded64;
+		nread = read_buf( 0, nreadneeded, drivep,
+				  ( rfp_t )drivep->d_opsp->do_read,
+				( rrbfp_t )drivep->d_opsp->do_return_read_buf,
+				  &rval );
+		if  ( rval ) {
+			return rval;
+		}
+		nreadneeded64 -= nread;
 	}
-	ASSERT( nread == nreadneeded );
 
 	/* verify we are on the mark
 	 */

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: xfsrestore: fix 2GB directory dump limitation for multi-stream
  2015-08-27 18:54 xfsrestore: fix 2GB directory dump limitation for multi-stream Rich Johnston
@ 2015-09-01 19:37 ` Rich Johnston
  2015-09-02 13:21 ` Brian Foster
  1 sibling, 0 replies; 3+ messages in thread
From: Rich Johnston @ 2015-09-01 19:37 UTC (permalink / raw)
  To: xfs

ping, Does anyone have time to review this please?

Thanks
--Rich

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: xfsrestore: fix 2GB directory dump limitation for multi-stream
  2015-08-27 18:54 xfsrestore: fix 2GB directory dump limitation for multi-stream Rich Johnston
  2015-09-01 19:37 ` Rich Johnston
@ 2015-09-02 13:21 ` Brian Foster
  1 sibling, 0 replies; 3+ messages in thread
From: Brian Foster @ 2015-09-02 13:21 UTC (permalink / raw)
  To: Rich Johnston; +Cc: xfs

On Thu, Aug 27, 2015 at 01:54:45PM -0500, Rich Johnston wrote:
> 
> The drive_simple restore path has a 2GB directory limit. Instead of
> ASSERTing if nreadneeded64 is greater than INTGENMAX (2GB), add a loop
> to handle it.
> 
> Signed-off-by: Rich Johnston <rjohnston@sgi.com>
> ---

I'm not a huge fan of all the spaces used in this code (around the
braces and whatnot). It is consistent with the rest of the code but I'd
probably get away from that as code is modified.

That aside, the change seems fine to me:

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  common/drive_simple.c |   24 +++++++++++++-----------
>  1 file changed, 13 insertions(+), 11 deletions(-)
> 
> Index: b/common/drive_simple.c
> ===================================================================
> --- a/common/drive_simple.c
> +++ b/common/drive_simple.c
> @@ -765,18 +765,20 @@ do_seek_mark( drive_t *drivep, drive_mar
>  	/* use read_buf util func to eat up difference
>  	 */
>  	nreadneeded64 = mark - strmoff;
> -	ASSERT( nreadneeded64 <= INTGENMAX );
> -	nreadneeded = ( intgen_t )nreadneeded64;
> -	nread = read_buf( 0,
> -			  ( size_t )nreadneeded,
> -			  ( void * )drivep,
> -			  ( rfp_t )drivep->d_opsp->do_read,
> -			  ( rrbfp_t )drivep->d_opsp->do_return_read_buf,
> -			  &rval );
> -	if  ( rval ) {
> -		return rval;
> +	while ( nreadneeded64 > 0 ) {
> +		if ( nreadneeded64 > INTGENMAX )
> +			nreadneeded = INTGENMAX;
> +		else
> +			nreadneeded = ( intgen_t )nreadneeded64;
> +		nread = read_buf( 0, nreadneeded, drivep,
> +				  ( rfp_t )drivep->d_opsp->do_read,
> +				( rrbfp_t )drivep->d_opsp->do_return_read_buf,
> +				  &rval );
> +		if  ( rval ) {
> +			return rval;
> +		}
> +		nreadneeded64 -= nread;
>  	}
> -	ASSERT( nread == nreadneeded );
>  
>  	/* verify we are on the mark
>  	 */
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-02 13:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-27 18:54 xfsrestore: fix 2GB directory dump limitation for multi-stream Rich Johnston
2015-09-01 19:37 ` Rich Johnston
2015-09-02 13:21 ` Brian Foster

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.