1
0
Fork 0

xfs: kill XLOG_SECTOR_ROUND*()

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>
hifive-unleashed-5.1
Alex Elder 2010-04-13 15:22:48 +10:00
parent 8511998baa
commit 5c17f5339f
1 changed files with 9 additions and 14 deletions

View File

@ -56,7 +56,6 @@ 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
*/
@ -64,10 +63,6 @@ STATIC void xlog_recover_check_summary(xlog_t *);
/* 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,
@ -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);
}
@ -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);
@ -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);
@ -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;
@ -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)
@ -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);