Re: [PATCH 06/16] xfs: remove the buffer allocation size in xfs_dir2_try_block_to_sf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 30, 2024 at 02:49:16PM +0200, Christoph Hellwig wrote:
> We've already calculated the size of the short form directory in the
> size variable when checking if it fits.  Use that for the temporary
> buffer allocation instead of overallocating to the inode size.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>

Makes sense,
Reviewed-by: Darrick J. Wong <djwong@xxxxxxxxxx>

--D

> ---
>  fs/xfs/libxfs/xfs_dir2_sf.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_dir2_sf.c b/fs/xfs/libxfs/xfs_dir2_sf.c
> index fad3fd28175368..d02f1ddb1da92c 100644
> --- a/fs/xfs/libxfs/xfs_dir2_sf.c
> +++ b/fs/xfs/libxfs/xfs_dir2_sf.c
> @@ -281,11 +281,11 @@ xfs_dir2_try_block_to_sf(
>  	trace_xfs_dir2_block_to_sf(args);
>  
>  	/*
> -	 * Allocate a temporary destination buffer the size of the inode to
> -	 * format the data into.  Once we have formatted the data, we can free
> -	 * the block and copy the formatted data into the inode literal area.
> +	 * Allocate a temporary destination buffer to format the data into.
> +	 * Once we have formatted the data, we can free the block and copy the
> +	 * formatted data into the inode literal area.
>  	 */
> -	sfp = kmalloc(mp->m_sb.sb_inodesize, GFP_KERNEL | __GFP_NOFAIL);
> +	sfp = kmalloc(size, GFP_KERNEL | __GFP_NOFAIL);
>  	memcpy(sfp, &sfh, xfs_dir2_sf_hdr_size(sfh.i8count));
>  
>  	/*
> -- 
> 2.39.2
> 
> 




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux