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

Dave Chinner david at fromorbit.com
Mon Apr 21 18:14:02 CDT 2014


On Mon, Apr 21, 2014 at 12:02:52AM -0700, Christoph Hellwig wrote:
> > +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.

Ok, I'll clear the conditional initialisation of *ops.

-- 
Dave Chinner
david at fromorbit.com



More information about the xfs mailing list