[PATCH 2/9] db: verify buffer on type change

Christoph Hellwig hch at infradead.org
Mon Apr 21 02:02:52 CDT 2014


> +void
> +set_iocur_type(
> +	const typ_t	*t)
> +{
> +	const struct xfs_buf_ops *ops = t ? t->bops : NULL;
> +	struct xfs_buf	*bp = iocur_top->bp;
> +
> +	iocur_top->typ = t;
> +
> +	/* verify the buffer if the type has one. */
> +	if (!bp)
> +		return;
> +	if (!ops) {
> +		bp->b_ops = NULL;
> +		bp->b_flags |= LIBXFS_B_UNCHECKED;
> +		return;
> +	}

The only caller currently makes sure we never pass a NULL t argument,
and I think keeping it that way is sensible.  If we want to allow
clearing the type we should add a separate clear_iocur_type helper for
it.



More information about the xfs mailing list