xfs
[Top] [All Lists]

Re: [PATCH 21/25] xfs: add buffer pre-write callback

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH 21/25] xfs: add buffer pre-write callback
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Wed, 31 Oct 2012 09:30:15 +1100
Cc: xfs@xxxxxxxxxxx
In-reply-to: <20121026085014.GC3035@xxxxxxxxxxxxx>
References: <1351146854-19343-1-git-send-email-david@xxxxxxxxxxxxx> <1351146854-19343-22-git-send-email-david@xxxxxxxxxxxxx> <20121026085014.GC3035@xxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Fri, Oct 26, 2012 at 04:50:14AM -0400, Christoph Hellwig wrote:
> >     /*
> > +    * run the pre-io callback function if it exists. If this function
> > +    * fails it will mark the buffer with an error and the IO should
> > +    * not be dispatched.
> > +    */
> > +   if (bp->b_pre_io) {
> > +           bp->b_pre_io(bp);
> > +           if (bp->b_error) {
> 
> Wouldn't it be a cleaner calling convention to return the erro from the
> callback?

Perhaps. I just wrote it in a manner consistent with the iodone
function where errors are returned in bp->b_error. Other functions
pass buffer errors like this, too - xfs_buf_ioapply_map(),
xfs_buf_read_map(), and _xfs_buf_ioapply() - so it's not unusual,
really..

I can change it, but that involves changing every callback function
as well and I don't see that as really necessary. i.e. they call
xfs_buf_ioerror() already, so do we really need to have them return
bp->b_error as well?

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

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