* [PATCH 4/7] xfs: kill XLOG_SECTOR_ROUND*()
@ 2010-03-18 22:54 Alex Elder
2010-03-20 16:48 ` Christoph Hellwig
0 siblings, 1 reply; 2+ messages in thread
From: Alex Elder @ 2010-03-18 22:54 UTC (permalink / raw)
To: xfs
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>
---
fs/xfs/xfs_log_recover.c | 23 +++++++++--------------
1 file changed, 9 insertions(+), 14 deletions(-)
Index: b/fs/xfs/xfs_log_recover.c
===================================================================
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -56,7 +56,6 @@ STATIC void xlog_recover_check_summary(x
#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(x
/* 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);
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 4/7] xfs: kill XLOG_SECTOR_ROUND*()
2010-03-18 22:54 [PATCH 4/7] xfs: kill XLOG_SECTOR_ROUND*() Alex Elder
@ 2010-03-20 16:48 ` Christoph Hellwig
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2010-03-20 16:48 UTC (permalink / raw)
To: Alex Elder; +Cc: xfs
> @@ -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));
This arithmetics would benefit greatly from a comment why we're
adding one log block to it and then round it up.
Anyway, patch looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-03-20 16:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-18 22:54 [PATCH 4/7] xfs: kill XLOG_SECTOR_ROUND*() Alex Elder
2010-03-20 16:48 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox