xfs
[Top] [All Lists]

Re: [PATCH 3/9] repair: ensure prefetched buffers have CRCs validated

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH 3/9] repair: ensure prefetched buffers have CRCs validated
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Thu, 24 Apr 2014 22:47:05 -0700
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1398315722-20870-4-git-send-email-david@xxxxxxxxxxxxx>
References: <1398315722-20870-1-git-send-email-david@xxxxxxxxxxxxx> <1398315722-20870-4-git-send-email-david@xxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Thu, Apr 24, 2014 at 03:01:56PM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@xxxxxxxxxx>
> 
> Prefetch currently does not do CRC validation when the IO completes
> due to the optimisation it performs and the fact that it does not
> know what the type of metadata into the buffer is supposed to be.
> Hence, mark all prefetched buffers as "suspect" so that when the
> end user tries to read it with a supplied validation function the
> validation is run even though the buffer was already in the cache.
> 
> Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>

Looks good, but a few minor nitpicks below:

> +             if (ops && (bp->b_flags & LIBXFS_B_UNCHECKED)) {
> +                     bp->b_error = 0;
> +                     bp->b_ops = ops;
> +                     bp->b_ops->verify_read(bp);
> +                     bp->b_flags &= ~LIBXFS_B_UNCHECKED;
> +             }

There's three copies of code in the previous and this patch, it probably
should go into a helper function.

> +     else if (bp->b_ops) {
>               bp->b_ops->verify_read(bp);
> +             bp->b_flags &= ~LIBXFS_B_UNCHECKED;
> +     }

Same with this.

>               bp->b_flags |= LIBXFS_B_UPTODATE;
>               bp->b_flags &= ~(LIBXFS_B_DIRTY | LIBXFS_B_EXIT);
> +             bp->b_flags &= ~LIBXFS_B_UNCHECKED;

Any reason not to clear all three flags in a single line?

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