Skip to content

Commit

Permalink
xfs: kill XLOG_SECTOR_ROUND*()
Browse files Browse the repository at this point in the history
XLOG_SECTOR_ROUNDUP_BBCOUNT() and XLOG_SECTOR_ROUNDDOWN_BLKNO()
are now fairly simple macro translations.  Just get rid of them in
favor of the round_up() and round_down() macro calls they represent.

Also, in spots in xlog_get_bp() and xlog_write_log_records(),
round_up() was being called with value 1, which just evaluates
to the macro's second argument; so just use that instead.
In the latter case, make use of that value, as long as it's
already been computed.

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
  • Loading branch information
Alex Elder committed May 19, 2010
1 parent 8511998 commit 5c17f53
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions fs/xfs/xfs_log_recover.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,13 @@ STATIC void xlog_recover_check_summary(xlog_t *);
#define xlog_recover_check_summary(log)
#endif


/*
* Sector aligned buffer routines for buffer create/read/write/access
*/

/* Number of basic blocks in a log sector */
#define xlog_sectbb(log) (1 << (log)->l_sectbb_log)

#define XLOG_SECTOR_ROUNDUP_BBCOUNT(log, bbs) round_up((bbs), xlog_sectbb(log))
#define XLOG_SECTOR_ROUNDDOWN_BLKNO(log, bno) \
round_down((bno), xlog_sectbb(log))

STATIC xfs_buf_t *
xlog_get_bp(
xlog_t *log,
Expand All @@ -82,8 +77,8 @@ xlog_get_bp(

if (log->l_sectbb_log) {
if (nbblks > 1)
nbblks += XLOG_SECTOR_ROUNDUP_BBCOUNT(log, 1);
nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks);
nbblks += xlog_sectbb(log);
nbblks = round_up(nbblks, xlog_sectbb(log));
}
return xfs_buf_get_noaddr(BBTOB(nbblks), log->l_mp->m_logdev_targp);
}
Expand Down Expand Up @@ -134,8 +129,8 @@ xlog_bread_noalign(
}

if (log->l_sectbb_log) {
blk_no = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, blk_no);
nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks);
blk_no = round_down(blk_no, xlog_sectbb(log));
nbblks = round_up(nbblks, xlog_sectbb(log));
}

ASSERT(nbblks > 0);
Expand Down Expand Up @@ -196,8 +191,8 @@ xlog_bwrite(
}

if (log->l_sectbb_log) {
blk_no = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, blk_no);
nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks);
blk_no = round_down(blk_no, xlog_sectbb(log));
nbblks = round_up(nbblks, xlog_sectbb(log));
}

ASSERT(nbblks > 0);
Expand Down Expand Up @@ -1158,7 +1153,7 @@ xlog_write_log_records(
xfs_caddr_t offset;
xfs_buf_t *bp;
int balign, ealign;
int sectbb = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, 1);
int sectbb = xlog_sectbb(log);
int end_block = start_block + blocks;
int bufblks;
int error = 0;
Expand All @@ -1181,7 +1176,7 @@ xlog_write_log_records(
* the buffer in the starting sector not covered by the first
* write below.
*/
balign = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, start_block);
balign = round_down(start_block, sectbb);
if (balign != start_block) {
error = xlog_bread_noalign(log, start_block, 1, bp);
if (error)
Expand All @@ -1200,7 +1195,7 @@ xlog_write_log_records(
* the buffer in the final sector not covered by the write.
* If this is the same sector as the above read, skip it.
*/
ealign = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, end_block);
ealign = round_down(end_block, sectbb);
if (j == 0 && (start_block + endcount > ealign)) {
offset = XFS_BUF_PTR(bp);
balign = BBTOB(ealign - start_block);
Expand Down

0 comments on commit 5c17f53

Please sign in to comment.