From: Christoph Hellwig <hch@infradead.org>
To: Alex Elder <aelder@sgi.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCHv2 5/5] xfs: kill off l_sectbb_mask
Date: Sun, 18 Apr 2010 13:29:35 -0400 [thread overview]
Message-ID: <20100418172935.GA1677@infradead.org> (raw)
In-Reply-To: <201004162054.o3GKs54f025204@stout.americas.sgi.com>
On Fri, Apr 16, 2010 at 03:54:05PM -0500, Alex Elder wrote:
> + * Return the address of the start of the given block number's data
> + * in a log buffer. The buffer covers a log sector-aligned region.
> + */
> STATIC xfs_caddr_t
> xlog_align(
> xlog_t *log,
> @@ -128,14 +132,14 @@ xlog_align(
> int nbblks,
> xfs_buf_t *bp)
> {
> + xfs_daddr_t offset;
> xfs_caddr_t ptr;
>
> - if (log->l_sectBBsize == 1)
> - return XFS_BUF_PTR(bp);
> + offset = blk_no & ((xfs_daddr_t) log->l_sectBBsize - 1);
> + ptr = XFS_BUF_PTR(bp) + BBTOB(offset);
> +
> + ASSERT(ptr + BBTOB(nbblks) <= XFS_BUF_PTR(bp) + XFS_BUF_SIZE(bp));
>
> - ptr = XFS_BUF_PTR(bp) + BBTOB((int)blk_no & log->l_sectbb_mask);
> - ASSERT(XFS_BUF_SIZE(bp) >=
> - BBTOB(nbblks + (blk_no & log->l_sectbb_mask)));
> return ptr;
And btw, now that I think about it we can just remove the
log->l_sectBBsize == 1 case entirely, so the whole thing could become:
STATIC xfs_caddr_t
xlog_align(
struct log *log,
xfs_daddr_t blk_no,
int nbblks,
struct xfs_buf *bp)
{
xfs_daddr_t offset;
offset = blk_no & ((xfs_daddr_t) log->l_sectBBsize - 1);
ASSERT(BBTOB(offset + nbblks) <= XFS_BUF_SIZE(bp));
return XFS_BUF_PTR(bp) + BBTOB(offset);
}
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2010-04-18 17:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-16 20:54 [PATCHv2 5/5] xfs: kill off l_sectbb_mask Alex Elder
2010-04-17 1:34 ` Dave Chinner
2010-04-18 17:21 ` Christoph Hellwig
2010-04-18 17:29 ` Christoph Hellwig [this message]
2010-04-19 13:53 ` Alex Elder
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=20100418172935.GA1677@infradead.org \
--to=hch@infradead.org \
--cc=aelder@sgi.com \
--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