diff mbox series

[13/16] xfs: move common code into xfs_dir2_sf_addname

Message ID 20240430124926.1775355-14-hch@lst.de (mailing list archive)
State Accepted, archived
Headers show
Series [01/16] xfs: allow non-empty forks in xfs_bmap_local_to_extents_empty | expand

Commit Message

Christoph Hellwig April 30, 2024, 12:49 p.m. UTC
Move updating the inode size and the call to xfs_dir2_sf_check from
xfs_dir2_sf_addname_easy and xfs_dir2_sf_addname_hard into
xfs_dir2_sf_addname.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/libxfs/xfs_dir2_sf.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Darrick J. Wong May 1, 2024, 9:32 p.m. UTC | #1
On Tue, Apr 30, 2024 at 02:49:23PM +0200, Christoph Hellwig wrote:
> Move updating the inode size and the call to xfs_dir2_sf_check from
> xfs_dir2_sf_addname_easy and xfs_dir2_sf_addname_hard into
> xfs_dir2_sf_addname.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

This seems simple enough,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/xfs/libxfs/xfs_dir2_sf.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_dir2_sf.c b/fs/xfs/libxfs/xfs_dir2_sf.c
> index 43e1090082b45d..a9d614dfb9e43b 100644
> --- a/fs/xfs/libxfs/xfs_dir2_sf.c
> +++ b/fs/xfs/libxfs/xfs_dir2_sf.c
> @@ -465,6 +465,9 @@ xfs_dir2_sf_addname(
>  			xfs_dir2_sf_toino8(args);
>  		xfs_dir2_sf_addname_hard(args, objchange, new_isize);
>  	}
> +
> +	dp->i_disk_size = new_isize;
> +	xfs_dir2_sf_check(args);
>  	xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_DDATA);
>  	return 0;
>  }
> @@ -498,8 +501,6 @@ xfs_dir2_sf_addname_easy(
>  	 */
>  	sfep = (xfs_dir2_sf_entry_t *)((char *)sfp + byteoff);
>  	xfs_dir2_sf_addname_common(args, sfep, offset, false);
> -	dp->i_disk_size = new_isize;
> -	xfs_dir2_sf_check(args);
>  }
>  
>  /*
> @@ -583,8 +584,6 @@ xfs_dir2_sf_addname_hard(
>  		memcpy(sfep, oldsfep, old_isize - nbytes);
>  	}
>  	kfree(buf);
> -	dp->i_disk_size = new_isize;
> -	xfs_dir2_sf_check(args);
>  }
>  
>  /*
> -- 
> 2.39.2
> 
>
diff mbox series

Patch

diff --git a/fs/xfs/libxfs/xfs_dir2_sf.c b/fs/xfs/libxfs/xfs_dir2_sf.c
index 43e1090082b45d..a9d614dfb9e43b 100644
--- a/fs/xfs/libxfs/xfs_dir2_sf.c
+++ b/fs/xfs/libxfs/xfs_dir2_sf.c
@@ -465,6 +465,9 @@  xfs_dir2_sf_addname(
 			xfs_dir2_sf_toino8(args);
 		xfs_dir2_sf_addname_hard(args, objchange, new_isize);
 	}
+
+	dp->i_disk_size = new_isize;
+	xfs_dir2_sf_check(args);
 	xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_DDATA);
 	return 0;
 }
@@ -498,8 +501,6 @@  xfs_dir2_sf_addname_easy(
 	 */
 	sfep = (xfs_dir2_sf_entry_t *)((char *)sfp + byteoff);
 	xfs_dir2_sf_addname_common(args, sfep, offset, false);
-	dp->i_disk_size = new_isize;
-	xfs_dir2_sf_check(args);
 }
 
 /*
@@ -583,8 +584,6 @@  xfs_dir2_sf_addname_hard(
 		memcpy(sfep, oldsfep, old_isize - nbytes);
 	}
 	kfree(buf);
-	dp->i_disk_size = new_isize;
-	xfs_dir2_sf_check(args);
 }
 
 /*