Commit 5c17f533 authored by Alex Elder's avatar Alex Elder

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: default avatarAlex Elder <aelder@sgi.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
parent 8511998b
...@@ -56,7 +56,6 @@ STATIC void xlog_recover_check_summary(xlog_t *); ...@@ -56,7 +56,6 @@ STATIC void xlog_recover_check_summary(xlog_t *);
#define xlog_recover_check_summary(log) #define xlog_recover_check_summary(log)
#endif #endif
/* /*
* Sector aligned buffer routines for buffer create/read/write/access * Sector aligned buffer routines for buffer create/read/write/access
*/ */
...@@ -64,10 +63,6 @@ STATIC void xlog_recover_check_summary(xlog_t *); ...@@ -64,10 +63,6 @@ STATIC void xlog_recover_check_summary(xlog_t *);
/* Number of basic blocks in a log sector */ /* Number of basic blocks in a log sector */
#define xlog_sectbb(log) (1 << (log)->l_sectbb_log) #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 * STATIC xfs_buf_t *
xlog_get_bp( xlog_get_bp(
xlog_t *log, xlog_t *log,
...@@ -82,8 +77,8 @@ xlog_get_bp( ...@@ -82,8 +77,8 @@ xlog_get_bp(
if (log->l_sectbb_log) { if (log->l_sectbb_log) {
if (nbblks > 1) if (nbblks > 1)
nbblks += XLOG_SECTOR_ROUNDUP_BBCOUNT(log, 1); nbblks += xlog_sectbb(log);
nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks); nbblks = round_up(nbblks, xlog_sectbb(log));
} }
return xfs_buf_get_noaddr(BBTOB(nbblks), log->l_mp->m_logdev_targp); return xfs_buf_get_noaddr(BBTOB(nbblks), log->l_mp->m_logdev_targp);
} }
...@@ -134,8 +129,8 @@ xlog_bread_noalign( ...@@ -134,8 +129,8 @@ xlog_bread_noalign(
} }
if (log->l_sectbb_log) { if (log->l_sectbb_log) {
blk_no = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, blk_no); blk_no = round_down(blk_no, xlog_sectbb(log));
nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks); nbblks = round_up(nbblks, xlog_sectbb(log));
} }
ASSERT(nbblks > 0); ASSERT(nbblks > 0);
...@@ -196,8 +191,8 @@ xlog_bwrite( ...@@ -196,8 +191,8 @@ xlog_bwrite(
} }
if (log->l_sectbb_log) { if (log->l_sectbb_log) {
blk_no = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, blk_no); blk_no = round_down(blk_no, xlog_sectbb(log));
nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks); nbblks = round_up(nbblks, xlog_sectbb(log));
} }
ASSERT(nbblks > 0); ASSERT(nbblks > 0);
...@@ -1158,7 +1153,7 @@ xlog_write_log_records( ...@@ -1158,7 +1153,7 @@ xlog_write_log_records(
xfs_caddr_t offset; xfs_caddr_t offset;
xfs_buf_t *bp; xfs_buf_t *bp;
int balign, ealign; int balign, ealign;
int sectbb = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, 1); int sectbb = xlog_sectbb(log);
int end_block = start_block + blocks; int end_block = start_block + blocks;
int bufblks; int bufblks;
int error = 0; int error = 0;
...@@ -1181,7 +1176,7 @@ xlog_write_log_records( ...@@ -1181,7 +1176,7 @@ xlog_write_log_records(
* the buffer in the starting sector not covered by the first * the buffer in the starting sector not covered by the first
* write below. * write below.
*/ */
balign = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, start_block); balign = round_down(start_block, sectbb);
if (balign != start_block) { if (balign != start_block) {
error = xlog_bread_noalign(log, start_block, 1, bp); error = xlog_bread_noalign(log, start_block, 1, bp);
if (error) if (error)
...@@ -1200,7 +1195,7 @@ xlog_write_log_records( ...@@ -1200,7 +1195,7 @@ xlog_write_log_records(
* the buffer in the final sector not covered by the write. * the buffer in the final sector not covered by the write.
* If this is the same sector as the above read, skip it. * 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)) { if (j == 0 && (start_block + endcount > ealign)) {
offset = XFS_BUF_PTR(bp); offset = XFS_BUF_PTR(bp);
balign = BBTOB(ealign - start_block); balign = BBTOB(ealign - start_block);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment