[PATCH 3/9] repair: ensure prefetched buffers have CRCs validated
Christoph Hellwig
hch at infradead.org
Fri Apr 25 00:47:05 CDT 2014
On Thu, Apr 24, 2014 at 03:01:56PM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner at redhat.com>
>
> 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 at redhat.com>
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?
More information about the xfs
mailing list