diff mbox series

[3/4] xfs: drop unused ioend private merge and setfilesize code

Message ID 20210405145903.629152-4-bfoster@redhat.com (mailing list archive)
State Superseded, archived
Headers show
Series xfs: ioend batching log reservation deadlock | expand

Commit Message

Brian Foster April 5, 2021, 2:59 p.m. UTC
XFS no longer attaches anthing to ioend->io_private. Remove the
unnecessary ->io_private merging code. This removes the only remaining
user of xfs_setfilesize_ioend() so remove that function as well.

Signed-off-by: Brian Foster <bfoster@redhat.com>
---
 fs/xfs/xfs_aops.c | 46 +---------------------------------------------
 1 file changed, 1 insertion(+), 45 deletions(-)

Comments

Christoph Hellwig April 5, 2021, 5:55 p.m. UTC | #1
On Mon, Apr 05, 2021 at 10:59:02AM -0400, Brian Foster wrote:
>  			io_list))) {
>  		list_del_init(&ioend->io_list);
> -		iomap_ioend_try_merge(ioend, &tmp, xfs_ioend_merge_private);
> +		iomap_ioend_try_merge(ioend, &tmp, NULL);

The merge_private argument to iomap_ioend_try_merge and the io_private
field in struct ioend can go way now as well.

Otherwise the whole series looks good to me from a very cursory look.
Brian Foster April 5, 2021, 6:08 p.m. UTC | #2
On Mon, Apr 05, 2021 at 06:55:33PM +0100, Christoph Hellwig wrote:
> On Mon, Apr 05, 2021 at 10:59:02AM -0400, Brian Foster wrote:
> >  			io_list))) {
> >  		list_del_init(&ioend->io_list);
> > -		iomap_ioend_try_merge(ioend, &tmp, xfs_ioend_merge_private);
> > +		iomap_ioend_try_merge(ioend, &tmp, NULL);
> 
> The merge_private argument to iomap_ioend_try_merge and the io_private
> field in struct ioend can go way now as well.
> 

Indeed. I'll tack on another patch to remove all of that.

Brian

> Otherwise the whole series looks good to me from a very cursory look.
>
Christoph Hellwig April 7, 2021, 6:36 a.m. UTC | #3
Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
Darrick J. Wong April 7, 2021, 3:40 p.m. UTC | #4
On Mon, Apr 05, 2021 at 10:59:02AM -0400, Brian Foster wrote:
> XFS no longer attaches anthing to ioend->io_private. Remove the
> unnecessary ->io_private merging code. This removes the only remaining
> user of xfs_setfilesize_ioend() so remove that function as well.
> 
> Signed-off-by: Brian Foster <bfoster@redhat.com>

Hooray for de-warting,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/xfs/xfs_aops.c | 46 +---------------------------------------------
>  1 file changed, 1 insertion(+), 45 deletions(-)
> 
> diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
> index 63ecc04de64f..a7f91f4186bc 100644
> --- a/fs/xfs/xfs_aops.c
> +++ b/fs/xfs/xfs_aops.c
> @@ -85,31 +85,6 @@ xfs_setfilesize(
>  	return __xfs_setfilesize(ip, tp, offset, size);
>  }
>  
> -STATIC int
> -xfs_setfilesize_ioend(
> -	struct iomap_ioend	*ioend,
> -	int			error)
> -{
> -	struct xfs_inode	*ip = XFS_I(ioend->io_inode);
> -	struct xfs_trans	*tp = ioend->io_private;
> -
> -	/*
> -	 * The transaction may have been allocated in the I/O submission thread,
> -	 * thus we need to mark ourselves as being in a transaction manually.
> -	 * Similarly for freeze protection.
> -	 */
> -	xfs_trans_set_context(tp);
> -	__sb_writers_acquired(VFS_I(ip)->i_sb, SB_FREEZE_FS);
> -
> -	/* we abort the update if there was an IO error */
> -	if (error) {
> -		xfs_trans_cancel(tp);
> -		return error;
> -	}
> -
> -	return __xfs_setfilesize(ip, tp, ioend->io_offset, ioend->io_size);
> -}
> -
>  /*
>   * IO write completion.
>   */
> @@ -163,25 +138,6 @@ xfs_end_ioend(
>  	memalloc_nofs_restore(nofs_flag);
>  }
>  
> -/*
> - * If the to be merged ioend has a preallocated transaction for file
> - * size updates we need to ensure the ioend it is merged into also
> - * has one.  If it already has one we can simply cancel the transaction
> - * as it is guaranteed to be clean.
> - */
> -static void
> -xfs_ioend_merge_private(
> -	struct iomap_ioend	*ioend,
> -	struct iomap_ioend	*next)
> -{
> -	if (!ioend->io_private) {
> -		ioend->io_private = next->io_private;
> -		next->io_private = NULL;
> -	} else {
> -		xfs_setfilesize_ioend(next, -ECANCELED);
> -	}
> -}
> -
>  /* Finish all pending io completions. */
>  void
>  xfs_end_io(
> @@ -201,7 +157,7 @@ xfs_end_io(
>  	while ((ioend = list_first_entry_or_null(&tmp, struct iomap_ioend,
>  			io_list))) {
>  		list_del_init(&ioend->io_list);
> -		iomap_ioend_try_merge(ioend, &tmp, xfs_ioend_merge_private);
> +		iomap_ioend_try_merge(ioend, &tmp, NULL);
>  		xfs_end_ioend(ioend);
>  	}
>  }
> -- 
> 2.26.3
>
diff mbox series

Patch

diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 63ecc04de64f..a7f91f4186bc 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -85,31 +85,6 @@  xfs_setfilesize(
 	return __xfs_setfilesize(ip, tp, offset, size);
 }
 
-STATIC int
-xfs_setfilesize_ioend(
-	struct iomap_ioend	*ioend,
-	int			error)
-{
-	struct xfs_inode	*ip = XFS_I(ioend->io_inode);
-	struct xfs_trans	*tp = ioend->io_private;
-
-	/*
-	 * The transaction may have been allocated in the I/O submission thread,
-	 * thus we need to mark ourselves as being in a transaction manually.
-	 * Similarly for freeze protection.
-	 */
-	xfs_trans_set_context(tp);
-	__sb_writers_acquired(VFS_I(ip)->i_sb, SB_FREEZE_FS);
-
-	/* we abort the update if there was an IO error */
-	if (error) {
-		xfs_trans_cancel(tp);
-		return error;
-	}
-
-	return __xfs_setfilesize(ip, tp, ioend->io_offset, ioend->io_size);
-}
-
 /*
  * IO write completion.
  */
@@ -163,25 +138,6 @@  xfs_end_ioend(
 	memalloc_nofs_restore(nofs_flag);
 }
 
-/*
- * If the to be merged ioend has a preallocated transaction for file
- * size updates we need to ensure the ioend it is merged into also
- * has one.  If it already has one we can simply cancel the transaction
- * as it is guaranteed to be clean.
- */
-static void
-xfs_ioend_merge_private(
-	struct iomap_ioend	*ioend,
-	struct iomap_ioend	*next)
-{
-	if (!ioend->io_private) {
-		ioend->io_private = next->io_private;
-		next->io_private = NULL;
-	} else {
-		xfs_setfilesize_ioend(next, -ECANCELED);
-	}
-}
-
 /* Finish all pending io completions. */
 void
 xfs_end_io(
@@ -201,7 +157,7 @@  xfs_end_io(
 	while ((ioend = list_first_entry_or_null(&tmp, struct iomap_ioend,
 			io_list))) {
 		list_del_init(&ioend->io_list);
-		iomap_ioend_try_merge(ioend, &tmp, xfs_ioend_merge_private);
+		iomap_ioend_try_merge(ioend, &tmp, NULL);
 		xfs_end_ioend(ioend);
 	}
 }