Re: [PATCH 1/5] xfs: const-ify xfs_owner_info arguments

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

 



On Thu, Nov 08, 2018 at 03:20:07PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> 
> Only certain functions actually change the contents of an
> xfs_owner_info; the rest can accept a const struct pointer.  This will
> enable us to save stack space by hoisting static owner info types to
> be const global variables.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> ---
>  fs/xfs/libxfs/xfs_alloc.c  |    4 -
>  fs/xfs/libxfs/xfs_alloc.h  |    4 -
>  fs/xfs/libxfs/xfs_bmap.c   |    2 
>  fs/xfs/libxfs/xfs_bmap.h   |    4 -
>  fs/xfs/libxfs/xfs_rmap.c   |  212 ++++++++++++++++++++++----------------------
>  fs/xfs/libxfs/xfs_rmap.h   |   12 +-
>  fs/xfs/scrub/btree.c       |   45 +++++----
>  fs/xfs/scrub/btree.h       |   22 ++---
>  fs/xfs/scrub/common.c      |   14 +--
>  fs/xfs/scrub/common.h      |    2 
>  fs/xfs/scrub/refcount.c    |   11 +-
>  fs/xfs/scrub/repair.c      |   50 +++++-----
>  fs/xfs/scrub/repair.h      |    7 +
>  fs/xfs/scrub/rmap.c        |   30 +++---
>  fs/xfs/scrub/scrub.h       |    4 -
>  fs/xfs/xfs_trace.h         |    4 -
>  fs/xfs/xfs_trans.h         |    3 -
>  fs/xfs/xfs_trans_extfree.c |    2 
>  18 files changed, 218 insertions(+), 214 deletions(-)
> 
> 
> diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
> index e1c0c0d2f1b0..bce46fa0ee38 100644
> --- a/fs/xfs/libxfs/xfs_alloc.c
> +++ b/fs/xfs/libxfs/xfs_alloc.c
> @@ -1699,7 +1699,7 @@ xfs_free_ag_extent(
>  	xfs_agnumber_t		agno,
>  	xfs_agblock_t		bno,
>  	xfs_extlen_t		len,
> -	struct xfs_owner_info	*oinfo,
> +	const struct xfs_owner_info	*oinfo,
>  	enum xfs_ag_resv_type	type)
>  {
>  	xfs_btree_cur_t	*bno_cur;	/* cursor for by-block btree */
> @@ -3013,7 +3013,7 @@ __xfs_free_extent(
>  	struct xfs_trans	*tp,	/* transaction pointer */
>  	xfs_fsblock_t		bno,	/* starting block number of extent */
>  	xfs_extlen_t		len,	/* length of extent */
> -	struct xfs_owner_info	*oinfo,	/* extent owner */
> +	const struct xfs_owner_info	*oinfo,	/* extent owner */
>  	enum xfs_ag_resv_type	type,	/* block reservation type */
>  	bool			skip_discard)
>  {

Looks like we missed some function arg alignment fixups here.

...
> diff --git a/fs/xfs/libxfs/xfs_rmap.h b/fs/xfs/libxfs/xfs_rmap.h
> index 157dc722ad35..00e38505037f 100644
> --- a/fs/xfs/libxfs/xfs_rmap.h
> +++ b/fs/xfs/libxfs/xfs_rmap.h
> @@ -52,7 +52,7 @@ xfs_rmap_skip_owner_update(
>  
>  static inline bool
>  xfs_rmap_should_skip_owner_update(
> -	struct xfs_owner_info	*oi)
> +	const struct xfs_owner_info	*oi)
>  {
>  	return oi->oi_owner == XFS_RMAP_OWN_NULL;
>  }
> @@ -103,7 +103,7 @@ xfs_rmap_irec_offset_unpack(
>  
>  static inline void
>  xfs_owner_info_unpack(
> -	struct xfs_owner_info	*oinfo,
> +	const struct xfs_owner_info	*oinfo,
>  	uint64_t		*owner,
>  	uint64_t		*offset,
>  	unsigned int		*flags)

... and here.

...
> diff --git a/fs/xfs/xfs_trans_extfree.c b/fs/xfs/xfs_trans_extfree.c
> index 73b11ed6795e..5210f86a9114 100644
> --- a/fs/xfs/xfs_trans_extfree.c
> +++ b/fs/xfs/xfs_trans_extfree.c
> @@ -57,7 +57,7 @@ xfs_trans_free_extent(
>  	struct xfs_efd_log_item	*efdp,
>  	xfs_fsblock_t		start_block,
>  	xfs_extlen_t		ext_len,
> -	struct xfs_owner_info	*oinfo,
> +	const struct xfs_owner_info	*oinfo,
>  	bool			skip_discard)

... and here.

With those fixed up:

Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx>

>  {
>  	struct xfs_mount	*mp = tp->t_mountp;
> 



[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