xfs
[Top] [All Lists]

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

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH 2/9] db: verify buffer on type change
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Mon, 21 Apr 2014 00:02:52 -0700
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1397550301-31883-3-git-send-email-david@xxxxxxxxxxxxx>
References: <1397550301-31883-1-git-send-email-david@xxxxxxxxxxxxx> <1397550301-31883-3-git-send-email-david@xxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
> +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.

<Prev in Thread] Current Thread [Next in Thread>