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

Dave Chinner david at fromorbit.com
Tue Oct 30 17:30:15 CDT 2012


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 at fromorbit.com



More information about the xfs mailing list