Re: [PATCH v7 12/19] xfs: Add helper function xfs_attr_rmtval_unmap

Chandan Rajendra
2020-03-02T02:42:13Z

On Sunday, February 23, 2020 7:36 AM Allison Collins wrote:
> This function is similar to xfs_attr_rmtval_remove, but adapted to return EAGAIN for
> new transactions. We will use this later when we introduce delayed attributes
>
I don't see any logical errors.

Reviewed-by: Chandan Rajendra <chandanrlinux@gmail.com>

> Signed-off-by: Allison Collins <allison.henderson@oracle.com>
> ---
> fs/xfs/libxfs/xfs_attr_remote.c | 28 ++++++++++++++++++++++++++++
> fs/xfs/libxfs/xfs_attr_remote.h | 1 +
> 2 files changed, 29 insertions(+)
>
> diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c
> index 3de2eec..da40f85 100644
> --- a/fs/xfs/libxfs/xfs_attr_remote.c
> +++ b/fs/xfs/libxfs/xfs_attr_remote.c
> @@ -711,3 +711,31 @@ xfs_attr_rmtval_remove(
> }
> return 0;
> }
> +
> +/*
> + * Remove the value associated with an attribute by deleting the out-of-line
> + * buffer that it is stored on. Returns EAGAIN for the caller to refresh the
> + * transaction and recall the function
> + */
> +int
> +xfs_attr_rmtval_unmap(
> + struct xfs_da_args *args)
> +{
> + int error, done;
> +
> + /*
> + * Unmap value blocks for this attr. This is similar to
> + * xfs_attr_rmtval_remove, but open coded here to return EAGAIN
> + * for new transactions
> + */
> + error = xfs_bunmapi(args->trans, args->dp,
> + args->rmtblkno, args->rmtblkcnt,
> + XFS_BMAPI_ATTRFORK, 1, &done);
> + if (error)
> + return error;
> +
> + if (!done)
> + return -EAGAIN;
> +
> + return 0;
> +}
> diff --git a/fs/xfs/libxfs/xfs_attr_remote.h b/fs/xfs/libxfs/xfs_attr_remote.h
> index eff5f95..e06299a 100644
> --- a/fs/xfs/libxfs/xfs_attr_remote.h
> +++ b/fs/xfs/libxfs/xfs_attr_remote.h
> @@ -14,4 +14,5 @@ int xfs_attr_rmtval_remove(struct xfs_da_args *args);
> int xfs_attr_rmtval_stale(struct xfs_inode *ip, struct xfs_bmbt_irec *map,
> xfs_buf_flags_t incore_flags);
> int xfs_attr_rmtval_invalidate(struct xfs_da_args *args);
> +int xfs_attr_rmtval_unmap(struct xfs_da_args *args);
> #endif /* __XFS_ATTR_REMOTE_H__ */
>

--
chandan