Re: [PATCH 05/11] xfs: optimise xfs_iext_destroy

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

 



>  /*
> + * Remove all records from the indirection array.
> + */
> +STATIC void
> +xfs_iext_irec_remove_all(
> +	struct xfs_ifork *ifp)
> +{
> +	int		nlists;
> +	int		i;
> +
> +	ASSERT(ifp->if_flags & XFS_IFEXTIREC);
> +	nlists = ifp->if_real_bytes / XFS_IEXT_BUFSZ;
> +	for (i = 0; i < nlists; i++) {
> +		xfs_ext_irec_t *erp = &ifp->if_u1.if_ext_irec[i];

Can we avoid the typedef for new code?

> +		if (erp->er_extbuf)
> +			kmem_free(erp->er_extbuf);

no need to check for NULL before a kmem_free, e.g. this whole loop could
just be:

	for (i = 0; i < nlists; i++)
		kmem_free(ifp->if_u1.if_ext_irec[i].er_extbuf);

>  {
>  	if (ifp->if_flags & XFS_IFEXTIREC) {
> -		int	erp_idx;
> -		int	nlists;
> -
> -		nlists = ifp->if_real_bytes / XFS_IEXT_BUFSZ;
> -		for (erp_idx = nlists - 1; erp_idx >= 0 ; erp_idx--) {
> -			xfs_iext_irec_remove(ifp, erp_idx);
> -		}
> +		xfs_iext_irec_remove_all(ifp);
>  		ifp->if_flags &= ~XFS_IFEXTIREC;

I'd be tempted to just move clearing of the flag into
xfs_iext_irec_remove_all if we change the patch anyway.

Otherwise this looks fine to me.

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs



[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux