Re: [PATCH 26/46] xfs: remove the data_dotdot_offset field in struct xfs_dir_ops

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

 



On Thu, Nov 07, 2019 at 07:23:50PM +0100, Christoph Hellwig wrote:
> The data_dotdot_offset value is always equal to data_entry_offset plus
> the fixed size of the "." entry.  Right now calculating that fixed size
> requires an indirect call, but by the end of this series it will be
> an inline function that can be constant folded.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>

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

--D

> ---
>  fs/xfs/libxfs/xfs_da_format.c | 6 ------
>  fs/xfs/libxfs/xfs_dir2.h      | 1 -
>  fs/xfs/xfs_dir2_readdir.c     | 3 ++-
>  3 files changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_da_format.c b/fs/xfs/libxfs/xfs_da_format.c
> index 54754eef2437..7b783b11790d 100644
> --- a/fs/xfs/libxfs/xfs_da_format.c
> +++ b/fs/xfs/libxfs/xfs_da_format.c
> @@ -204,8 +204,6 @@ static const struct xfs_dir_ops xfs_dir2_ops = {
>  	.data_entry_tag_p = xfs_dir2_data_entry_tag_p,
>  	.data_bestfree_p = xfs_dir2_data_bestfree_p,
>  
> -	.data_dotdot_offset = sizeof(struct xfs_dir2_data_hdr) +
> -				XFS_DIR2_DATA_ENTSIZE(1),
>  	.data_first_offset =  sizeof(struct xfs_dir2_data_hdr) +
>  				XFS_DIR2_DATA_ENTSIZE(1) +
>  				XFS_DIR2_DATA_ENTSIZE(2),
> @@ -224,8 +222,6 @@ static const struct xfs_dir_ops xfs_dir2_ftype_ops = {
>  	.data_entry_tag_p = xfs_dir3_data_entry_tag_p,
>  	.data_bestfree_p = xfs_dir2_data_bestfree_p,
>  
> -	.data_dotdot_offset = sizeof(struct xfs_dir2_data_hdr) +
> -				XFS_DIR3_DATA_ENTSIZE(1),
>  	.data_first_offset =  sizeof(struct xfs_dir2_data_hdr) +
>  				XFS_DIR3_DATA_ENTSIZE(1) +
>  				XFS_DIR3_DATA_ENTSIZE(2),
> @@ -244,8 +240,6 @@ static const struct xfs_dir_ops xfs_dir3_ops = {
>  	.data_entry_tag_p = xfs_dir3_data_entry_tag_p,
>  	.data_bestfree_p = xfs_dir3_data_bestfree_p,
>  
> -	.data_dotdot_offset = sizeof(struct xfs_dir3_data_hdr) +
> -				XFS_DIR3_DATA_ENTSIZE(1),
>  	.data_first_offset =  sizeof(struct xfs_dir3_data_hdr) +
>  				XFS_DIR3_DATA_ENTSIZE(1) +
>  				XFS_DIR3_DATA_ENTSIZE(2),
> diff --git a/fs/xfs/libxfs/xfs_dir2.h b/fs/xfs/libxfs/xfs_dir2.h
> index 94e8c40a7d19..8b937993263d 100644
> --- a/fs/xfs/libxfs/xfs_dir2.h
> +++ b/fs/xfs/libxfs/xfs_dir2.h
> @@ -40,7 +40,6 @@ struct xfs_dir_ops {
>  	struct xfs_dir2_data_free *
>  		(*data_bestfree_p)(struct xfs_dir2_data_hdr *hdr);
>  
> -	xfs_dir2_data_aoff_t data_dotdot_offset;
>  	xfs_dir2_data_aoff_t data_first_offset;
>  	size_t	data_entry_offset;
>  
> diff --git a/fs/xfs/xfs_dir2_readdir.c b/fs/xfs/xfs_dir2_readdir.c
> index 39985ca6ae2d..187bb51875c2 100644
> --- a/fs/xfs/xfs_dir2_readdir.c
> +++ b/fs/xfs/xfs_dir2_readdir.c
> @@ -77,7 +77,8 @@ xfs_dir2_sf_getdents(
>  	dot_offset = xfs_dir2_db_off_to_dataptr(geo, geo->datablk,
>  			dp->d_ops->data_entry_offset);
>  	dotdot_offset = xfs_dir2_db_off_to_dataptr(geo, geo->datablk,
> -						dp->d_ops->data_dotdot_offset);
> +			dp->d_ops->data_entry_offset +
> +			dp->d_ops->data_entsize(sizeof(".") - 1));
>  
>  	/*
>  	 * Put . entry unless we're starting past it.
> -- 
> 2.20.1
> 



[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