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] xfs: reset buffer pointers before freeing them
Date: Tue, 12 Apr 2011 21:00:28 +1000	[thread overview]
Message-ID: <20110412110028.GA31057@dastard> (raw)
In-Reply-To: <20110412000939.GC29358@infradead.org>

On Mon, Apr 11, 2011 at 08:09:39PM -0400, Christoph Hellwig wrote:
> >  			error = xlog_bread_noalign(log, ealign, sectbb, bp);
> > -			if (error)
> > -				break;
> >  
> > -			error = XFS_BUF_SET_PTR(bp, offset, bufblks);
> > +			/* must reset buffer pointer even on error */
> > +			error2 = XFS_BUF_SET_PTR(bp, offset, bufblks);
> 
> This seems to be incorrect both in the original and your version.
> From all that I can see XFS_BUF_SET_PTR wants a byte count while bufblks
> is a sector count, e.g. this should be:
> 
> 			error2 = XFS_BUF_SET_PTR(bp, offset, BBTOB(bufblks);

Yes, you are right. I missed that.

> While at I think this mess with the buffer virtual mapping, read into it
> and set it back mess needs to go into a single helper instead of beeing
> duplicated three times.  By having named arguments with proper types
> bugs like the existing one above should also be much more obvious to
> spot.

Ok, I'll try to come up with something sane.

> As a follow on patch to that I think we could also get rid of all the
> vmap manipultions entirely, and just specify and I/O offset and length
> manually.  The only thing required for that is a number of pages
> to skip at the beggining of the buffer from the log recovery code to
> _xfs_buf_ioapply, either by passing it down procedurally, or by adding
> a new filed to struct xfs_buf.  In fact just relaxing the b_offset
> semantics to allow offsets larger than a page only in the I/O path would
> do it, but I'm not sure that version helps long-term maintenance.

Passing the offset+len seems like the cleaner solution to me. I
don't like the idea of overloading existing fields just for the IO
path or adding new fields for one off uses, either. That can
probably wait for another day, though, because we've still got the
iclog buffer hackery to deal with.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

  reply	other threads:[~2011-04-12 10:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-11  3:10 [PATCH] xfs: reset buffer pointers before freeing them Dave Chinner
2011-04-12  0:09 ` Christoph Hellwig
2011-04-12 11:00   ` Dave Chinner [this message]
2011-04-12 13:45     ` Dave Chinner
2011-04-12 16:22       ` Christoph Hellwig
2011-04-12 22:50         ` 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=20110412110028.GA31057@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