public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 22/23] xfs: add pre-write metadata buffer verifier callbacks
Date: Sun, 14 Oct 2012 11:12:19 +1100	[thread overview]
Message-ID: <20121014001219.GR2739@dastard> (raw)
In-Reply-To: <20121013160212.GA24337@infradead.org>

On Sat, Oct 13, 2012 at 12:02:12PM -0400, Christoph Hellwig wrote:
> > +xfs_agfl_write_verify(
> > +	struct xfs_buf	*bp)
> > +{
> > +	xfs_agfl_verify(bp);
> > +}
> > +
> > +void
> > +xfs_agfl_read_verify(
> > +	struct xfs_buf	*bp)
> > +{
> > +	xfs_agfl_verify(bp);
> > +	bp->b_pre_io = xfs_agfl_write_verify;
> >  	bp->b_iodone = NULL;
> >  	xfs_buf_ioend(bp, 0);
> 
> I have to say I hate the way the API works for the buffer callbacks
> even more now that I see the write side.  I know you're a bit annoyed
> about churn from review requests, but I'd really prefer if this
> was redone.

No, I'm not annoyed about churn - I'm not entirely happy myself with
the b_io_done/b_pre_io split that I ended up with, but I needed
something that worked to make any further progress.  I certainly
didn't mean to come across as annoyed by suggestions that
modifications are needed.

It is, however, extremely time consuming to restructure a 50 patch
series that touches a few thousand lines of code from the first
patch (there's a bunch more on top of this set). Hence I'm not about
to do that unless there is good reason for doing it....

> Two ways to do this nicer come to mind:
> 
>  - Have one commone b_verify callback, which gets a bool for_write
>    argument to key of differences.  The xfs_buf_ioend call for reads
>    remains in the caller, b_iodone is not touched at all.  This will
>    remove the boilerplate code a lot in the current version.

I have considered that - it seemed kind of clumsy to have to pass a
bool into the function, because that meant having to determine at IO
completion whether it was a read or write by looking at the flags on
the buffer. Yes, that's a solvable problem but using the iodone
function makes things simple - if it's there just call it.

The other issue I had to handle is that buffers returned from
get_buf calls don't require a read verifier, as they are never read
from disk. And in some places, the actual use of the buffer may not
be known at the time the buffer is obtained (e.g. the extrablk in
the dir/attr code to handle splits), so passing a write verifier
callback to the get_buf call is not necessarily possible in all
cases.

>  - Expecting to have some more difference between the read and the
>    write side when we actually do the crcs from my work on the previous
>    iteration

I haven't seen a need for any specific differences at the CRC
calc/verify layers in any of the patch sets we iterated over in the
past - is there a particular concern that you have that I've missed?

>    of it it might make sense to have two callbacks, but I'd
>    again prefer to not overload b_iodone.  Maybe just pass a:
> 
> struct xfs_buf_ops {
> 	int (*verify_read)(struct xfs_buf *);
> 	int (*verify_write)(struct xfs_buf *);
> };
>
> to all the buffer read/write API calls, and let that deal with it.

This was the other option I considered (and would prefer), but again
had the issue of having to determine the write verifier at the time
of the get_buf call. The write verifiers are much harder to get
right, because we change the format of buffers all the time in the
directory code (e.g. leaf -> block, node -> leaf, etc) and that
means write verifiers have to be changed along with the magic number
of the buffer.

However, now that I have solved that problem, I can go back and
review how much of an issue it really is when it comes to using an
ops structure. It's probably less of a concern than I thought
initially, because now I actually know exactly what is needed in the
dir/attr code.

FWIW, one thing I'll look at doing is adding a patch on top of this
patch set to convert it to an ops structure, rather than rewriting
the patch set from the ground up. It will be much faster to do that
than rewrite the 20-odd patches in this series again....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2012-10-14  0:10 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-12  5:44 [PATCH 00/23] xfs: metadata verifiers V2 Dave Chinner
2012-10-12  5:44 ` [PATCH 01/23] xfs: growfs: don't read garbage for new secondary superblocks Dave Chinner
2012-10-12  5:44 ` [PATCH 02/23] xfs: invalidate allocbt blocks moved to the free list Dave Chinner
2012-10-12  5:44 ` [PATCH 03/23] xfs: make buffer read verication an IO completion function Dave Chinner
2012-10-12  5:44 ` [PATCH 04/23] xfs: uncached buffer reads need to return an error Dave Chinner
2012-10-12  5:44 ` [PATCH 05/23] xfs: verify superblocks as they are read from disk Dave Chinner
2012-10-12  5:44 ` [PATCH 06/23] xfs: verify AGF blocks " Dave Chinner
2012-10-12  5:44 ` [PATCH 07/23] xfs: verify AGI " Dave Chinner
2012-10-12  5:44 ` [PATCH 08/23] xfs: verify AGFL " Dave Chinner
2012-10-12  5:44 ` [PATCH 09/23] xfs: verify inode buffers " Dave Chinner
2012-10-12  5:44 ` [PATCH 10/23] xfs: verify btree blocks " Dave Chinner
2012-10-12  5:44 ` [PATCH 11/23] xfs: verify dquot " Dave Chinner
2012-10-12  5:44 ` [PATCH 12/23] xfs: add verifier callback to directorry read code Dave Chinner
2012-10-12  5:44 ` [PATCH 13/23] xfs: factor dir2 block read operations Dave Chinner
2012-10-12  5:44 ` [PATCH 14/23] xfs: verify dir2 block format buffers Dave Chinner
2012-10-12  5:44 ` [PATCH 15/23] xfs: factor dir2 free block reading Dave Chinner
2012-10-12  5:44 ` [PATCH 16/23] xfs: factor out dir2 data " Dave Chinner
2012-10-12  5:44 ` [PATCH 17/23] xfs: factor dir2 leaf read Dave Chinner
2012-10-12  5:44 ` [PATCH 18/23] xfs: factor and verify attr leaf reads Dave Chinner
2012-10-12  5:44 ` [PATCH 19/23] xfs: add xfs_da_node verification Dave Chinner
2012-10-12  5:44 ` [PATCH 20/23] xfs: Add verifiers to dir2 data readahead Dave Chinner
2012-10-12  5:44 ` [PATCH 21/23] xfs: add buffer pre-write callback Dave Chinner
2012-10-12  5:44 ` [PATCH 22/23] xfs: add pre-write metadata buffer verifier callbacks Dave Chinner
2012-10-13 16:02   ` Christoph Hellwig
2012-10-14  0:12     ` Dave Chinner [this message]
2012-10-18  4:50       ` [PATCH 24/23] xfs: convert buffer verifiers to an ops structure Dave Chinner
2012-10-23 12:36         ` Christoph Hellwig
2012-10-23 21:42           ` Dave Chinner
2012-10-12  5:44 ` [PATCH 23/23] xfs: connect up write verifiers to new buffers Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121014001219.GR2739@dastard \
    --to=david@fromorbit.com \
    --cc=hch@infradead.org \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox