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: Wed, 13 Apr 2011 08:50:26 +1000 [thread overview]
Message-ID: <20110412225026.GJ31057@dastard> (raw)
In-Reply-To: <20110412162237.GB22506@infradead.org>
On Tue, Apr 12, 2011 at 12:22:37PM -0400, Christoph Hellwig wrote:
> On Tue, Apr 12, 2011 at 11:45:43PM +1000, Dave Chinner wrote:
> > Something like this?
>
> Kinda. A few comments below.
>
> > /*
> > + * Read at an offset into the buffer. Returns with the buffer in it's original
> > + * state regardless of the result of the read.
> > + */
> > +STATIC int
> > +xlog_bread_offset(
> > + xlog_t *log,
> > + int buf_offset, /* offset into buffer */
> > + int buf_blks, /* original buffer size */
> > + xfs_daddr_t blk_no, /* block to read from */
> > + int nbblks, /* blocks to read */
> > + xfs_buf_t *bp,
> > + xfs_caddr_t offset)
> > +{
> > + xfs_caddr_t orig_offset = XFS_BUF_PTR(bp);
> > + int error, error2;
> > +
> > + error = XFS_BUF_SET_PTR(bp, offset + BBTOB(buf_offset), BBTOB(nbblks));
>
> Passing in both offset and the buf_offset seems odd as they are only
> used together. So just passing in one byte offset would make more
> sense to me. Of course it's not actually an offset anyore, but virtual
> address, but we use that offset naming all around xlog_align/xlog_bread
> and callers.
Fair enough. I was struggling with the best way to pass and name
all the parameters. I just posted this before I went to bed to see
if this is what you had in mind....
> Also I don't think there is a need for the buf_blks argument. The
> argument always comes directly from the xlog_get_bp number blocks
> argument, so the
>
> BBTOB(buf_blks)
>
> can be replaced by simply using a copy of b_buffer_length taken at
> the beginning of the function.
Very true. My brain surely was not functioning properly ;)
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
prev parent reply other threads:[~2011-04-12 22:47 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
2011-04-12 13:45 ` Dave Chinner
2011-04-12 16:22 ` Christoph Hellwig
2011-04-12 22:50 ` Dave Chinner [this message]
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=20110412225026.GJ31057@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