public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix check for block zero access in xfs_write_iomap_allocate
@ 2008-04-22 11:02 David Chinner
  2008-04-23  4:06 ` Lachlan McIlroy
  0 siblings, 1 reply; 2+ messages in thread
From: David Chinner @ 2008-04-22 11:02 UTC (permalink / raw)
  To: xfs-dev; +Cc: xfs-oss

Fix check for block zero access in xfs_write_iomap_allocate

The check for block zero access should be done on non-realtime
inodes. Fix the logic error in xfs_write_iomap_allocate(), and
simplify the logic on all checks for block zero access.

Signed-off-by: Dave Chinner <dgc@sgi.com>
---
 fs/xfs/xfs_iomap.c |   13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

Index: 2.6.x-xfs-new/fs/xfs/xfs_iomap.c
===================================================================
--- 2.6.x-xfs-new.orig/fs/xfs/xfs_iomap.c	2008-04-22 11:54:54.000000000 +1000
+++ 2.6.x-xfs-new/fs/xfs/xfs_iomap.c	2008-04-22 20:45:53.469961429 +1000
@@ -523,8 +523,7 @@ xfs_iomap_write_direct(
 		goto error_out;
 	}
 
-	if (unlikely(!imap.br_startblock &&
-		     !(XFS_IS_REALTIME_INODE(ip)))) {
+	if (!(imap.br_startblock || XFS_IS_REALTIME_INODE(ip))) {
 		error = xfs_cmn_err_fsblock_zero(ip, &imap);
 		goto error_out;
 	}
@@ -686,8 +685,7 @@ retry:
 		goto retry;
 	}
 
-	if (unlikely(!imap[0].br_startblock &&
-		     !(XFS_IS_REALTIME_INODE(ip))))
+	if (!(imap[0].br_startblock || XFS_IS_REALTIME_INODE(ip)))
 		return xfs_cmn_err_fsblock_zero(ip, &imap[0]);
 
 	*ret_imap = imap[0];
@@ -838,9 +836,9 @@ xfs_iomap_write_allocate(
 		 * See if we were able to allocate an extent that
 		 * covers at least part of the callers request
 		 */
-		if (unlikely(!imap.br_startblock &&
-			     XFS_IS_REALTIME_INODE(ip)))
+		if (!(imap.br_startblock || XFS_IS_REALTIME_INODE(ip)))
 			return xfs_cmn_err_fsblock_zero(ip, &imap);
+
 		if ((offset_fsb >= imap.br_startoff) &&
 		    (offset_fsb < (imap.br_startoff +
 				   imap.br_blockcount))) {
@@ -934,8 +932,7 @@ xfs_iomap_write_unwritten(
 		if (error)
 			return XFS_ERROR(error);
 
-		if (unlikely(!imap.br_startblock &&
-			     !(XFS_IS_REALTIME_INODE(ip))))
+		if (!(imap.br_startblock || XFS_IS_REALTIME_INODE(ip)))
 			return xfs_cmn_err_fsblock_zero(ip, &imap);
 
 		if ((numblks_fsb = imap.br_blockcount) == 0) {

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

* Re: [PATCH] Fix check for block zero access in xfs_write_iomap_allocate
  2008-04-22 11:02 [PATCH] Fix check for block zero access in xfs_write_iomap_allocate David Chinner
@ 2008-04-23  4:06 ` Lachlan McIlroy
  0 siblings, 0 replies; 2+ messages in thread
From: Lachlan McIlroy @ 2008-04-23  4:06 UTC (permalink / raw)
  To: David Chinner; +Cc: xfs-dev, xfs-oss

Looks good.

David Chinner wrote:
> Fix check for block zero access in xfs_write_iomap_allocate
> 
> The check for block zero access should be done on non-realtime
> inodes. Fix the logic error in xfs_write_iomap_allocate(), and
> simplify the logic on all checks for block zero access.
> 
> Signed-off-by: Dave Chinner <dgc@sgi.com>
> ---
>  fs/xfs/xfs_iomap.c |   13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
> Index: 2.6.x-xfs-new/fs/xfs/xfs_iomap.c
> ===================================================================
> --- 2.6.x-xfs-new.orig/fs/xfs/xfs_iomap.c	2008-04-22 11:54:54.000000000 +1000
> +++ 2.6.x-xfs-new/fs/xfs/xfs_iomap.c	2008-04-22 20:45:53.469961429 +1000
> @@ -523,8 +523,7 @@ xfs_iomap_write_direct(
>  		goto error_out;
>  	}
>  
> -	if (unlikely(!imap.br_startblock &&
> -		     !(XFS_IS_REALTIME_INODE(ip)))) {
> +	if (!(imap.br_startblock || XFS_IS_REALTIME_INODE(ip))) {
>  		error = xfs_cmn_err_fsblock_zero(ip, &imap);
>  		goto error_out;
>  	}
> @@ -686,8 +685,7 @@ retry:
>  		goto retry;
>  	}
>  
> -	if (unlikely(!imap[0].br_startblock &&
> -		     !(XFS_IS_REALTIME_INODE(ip))))
> +	if (!(imap[0].br_startblock || XFS_IS_REALTIME_INODE(ip)))
>  		return xfs_cmn_err_fsblock_zero(ip, &imap[0]);
>  
>  	*ret_imap = imap[0];
> @@ -838,9 +836,9 @@ xfs_iomap_write_allocate(
>  		 * See if we were able to allocate an extent that
>  		 * covers at least part of the callers request
>  		 */
> -		if (unlikely(!imap.br_startblock &&
> -			     XFS_IS_REALTIME_INODE(ip)))
> +		if (!(imap.br_startblock || XFS_IS_REALTIME_INODE(ip)))
>  			return xfs_cmn_err_fsblock_zero(ip, &imap);
> +
>  		if ((offset_fsb >= imap.br_startoff) &&
>  		    (offset_fsb < (imap.br_startoff +
>  				   imap.br_blockcount))) {
> @@ -934,8 +932,7 @@ xfs_iomap_write_unwritten(
>  		if (error)
>  			return XFS_ERROR(error);
>  
> -		if (unlikely(!imap.br_startblock &&
> -			     !(XFS_IS_REALTIME_INODE(ip))))
> +		if (!(imap.br_startblock || XFS_IS_REALTIME_INODE(ip)))
>  			return xfs_cmn_err_fsblock_zero(ip, &imap);
>  
>  		if ((numblks_fsb = imap.br_blockcount) == 0) {
> 
> 
> 

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

end of thread, other threads:[~2008-04-23  4:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-22 11:02 [PATCH] Fix check for block zero access in xfs_write_iomap_allocate David Chinner
2008-04-23  4:06 ` Lachlan McIlroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox