diff mbox series

[08/12] xfs: simplify xfs_ioend_can_merge

Message ID 20190624055253.31183-9-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [01/12] list.h: add a list_pop helper | expand

Commit Message

Christoph Hellwig June 24, 2019, 5:52 a.m. UTC
Compare the block layer status directly instead of converting it to
an errno first.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_aops.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

Comments

Darrick J. Wong June 24, 2019, 4 p.m. UTC | #1
On Mon, Jun 24, 2019 at 07:52:49AM +0200, Christoph Hellwig wrote:
> Compare the block layer status directly instead of converting it to
> an errno first.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/xfs_aops.c | 14 ++------------
>  1 file changed, 2 insertions(+), 12 deletions(-)
> 
> diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
> index 017b87b7765f..acbd73976067 100644
> --- a/fs/xfs/xfs_aops.c
> +++ b/fs/xfs/xfs_aops.c
> @@ -226,13 +226,9 @@ xfs_end_ioend(
>  static bool
>  xfs_ioend_can_merge(
>  	struct xfs_ioend	*ioend,
> -	int			ioend_error,
>  	struct xfs_ioend	*next)
>  {
> -	int			next_error;
> -
> -	next_error = blk_status_to_errno(next->io_bio->bi_status);
> -	if (ioend_error != next_error)
> +	if (ioend->io_bio->bi_status != next->io_bio->bi_status)
>  		return false;
>  	if ((ioend->io_fork == XFS_COW_FORK) ^ (next->io_fork == XFS_COW_FORK))
>  		return false;
> @@ -251,17 +247,11 @@ xfs_ioend_try_merge(
>  	struct list_head	*more_ioends)
>  {
>  	struct xfs_ioend	*next_ioend;
> -	int			ioend_error;
> -
> -	if (list_empty(more_ioends))
> -		return;
> -
> -	ioend_error = blk_status_to_errno(ioend->io_bio->bi_status);
>  
>  	while (!list_empty(more_ioends)) {
>  		next_ioend = list_first_entry(more_ioends, struct xfs_ioend,
>  				io_list);
> -		if (!xfs_ioend_can_merge(ioend, ioend_error, next_ioend))
> +		if (!xfs_ioend_can_merge(ioend, next_ioend))
>  			break;
>  		list_move_tail(&next_ioend->io_list, &ioend->io_list);
>  		ioend->io_size += next_ioend->io_size;
> -- 
> 2.20.1
>
diff mbox series

Patch

diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 017b87b7765f..acbd73976067 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -226,13 +226,9 @@  xfs_end_ioend(
 static bool
 xfs_ioend_can_merge(
 	struct xfs_ioend	*ioend,
-	int			ioend_error,
 	struct xfs_ioend	*next)
 {
-	int			next_error;
-
-	next_error = blk_status_to_errno(next->io_bio->bi_status);
-	if (ioend_error != next_error)
+	if (ioend->io_bio->bi_status != next->io_bio->bi_status)
 		return false;
 	if ((ioend->io_fork == XFS_COW_FORK) ^ (next->io_fork == XFS_COW_FORK))
 		return false;
@@ -251,17 +247,11 @@  xfs_ioend_try_merge(
 	struct list_head	*more_ioends)
 {
 	struct xfs_ioend	*next_ioend;
-	int			ioend_error;
-
-	if (list_empty(more_ioends))
-		return;
-
-	ioend_error = blk_status_to_errno(ioend->io_bio->bi_status);
 
 	while (!list_empty(more_ioends)) {
 		next_ioend = list_first_entry(more_ioends, struct xfs_ioend,
 				io_list);
-		if (!xfs_ioend_can_merge(ioend, ioend_error, next_ioend))
+		if (!xfs_ioend_can_merge(ioend, next_ioend))
 			break;
 		list_move_tail(&next_ioend->io_list, &ioend->io_list);
 		ioend->io_size += next_ioend->io_size;