Commit 8cba4344 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Tim Shimmin

[XFS] clean up xfs_bmbt_set_all/xfs_bmbt_disk_set_all

xfs_bmbt_set_all/xfs_bmbt_disk_set_all are identical to
xfs_bmbt_set_allf/xfs_bmbt_disk_set_allf except that the former take a
xfs_bmbt_irec_t and the latter take the individual extent fields as scalar
values.

This patch reimplements xfs_bmbt_set_all/xfs_bmbt_disk_set_all as trivial
wrappers around xfs_bmbt_set_allf/xfs_bmbt_disk_set_allf and cleans up the
variable naming in xfs_bmbt_set_allf/xfs_bmbt_disk_set_allf to have some
meaning instead of one char variable names.

SGI-PV: 968563
SGI-Modid: xfs-linux-melb:xfs-kern:29319a
Signed-off-by: default avatarChristoph Hellwig <hch@infradead.org>
Signed-off-by: default avatarDavid Chinner <dgc@sgi.com>
Signed-off-by: default avatarTim Shimmin <tes@sgi.com>
parent a6f64d4a
...@@ -2291,176 +2291,124 @@ xfs_bmbt_newroot( ...@@ -2291,176 +2291,124 @@ xfs_bmbt_newroot(
} }
/* /*
* Set all the fields in a bmap extent record from the uncompressed form. * Set all the fields in a bmap extent record from the arguments.
*/ */
void void
xfs_bmbt_set_all( xfs_bmbt_set_allf(
xfs_bmbt_rec_host_t *r, xfs_bmbt_rec_host_t *r,
xfs_bmbt_irec_t *s) xfs_fileoff_t startoff,
xfs_fsblock_t startblock,
xfs_filblks_t blockcount,
xfs_exntst_t state)
{ {
int extent_flag; int extent_flag = (state == XFS_EXT_NORM) ? 0 : 1;
ASSERT(state == XFS_EXT_NORM || state == XFS_EXT_UNWRITTEN);
ASSERT((startoff & XFS_MASK64HI(64-BMBT_STARTOFF_BITLEN)) == 0);
ASSERT((blockcount & XFS_MASK64HI(64-BMBT_BLOCKCOUNT_BITLEN)) == 0);
ASSERT((s->br_state == XFS_EXT_NORM) ||
(s->br_state == XFS_EXT_UNWRITTEN));
extent_flag = (s->br_state == XFS_EXT_NORM) ? 0 : 1;
ASSERT((s->br_startoff & XFS_MASK64HI(9)) == 0);
ASSERT((s->br_blockcount & XFS_MASK64HI(43)) == 0);
#if XFS_BIG_BLKNOS #if XFS_BIG_BLKNOS
ASSERT((s->br_startblock & XFS_MASK64HI(12)) == 0); ASSERT((startblock & XFS_MASK64HI(64-BMBT_STARTBLOCK_BITLEN)) == 0);
r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) | r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
((xfs_bmbt_rec_base_t)s->br_startoff << 9) | ((xfs_bmbt_rec_base_t)startoff << 9) |
((xfs_bmbt_rec_base_t)s->br_startblock >> 43); ((xfs_bmbt_rec_base_t)startblock >> 43);
r->l1 = ((xfs_bmbt_rec_base_t)s->br_startblock << 21) | r->l1 = ((xfs_bmbt_rec_base_t)startblock << 21) |
((xfs_bmbt_rec_base_t)s->br_blockcount & ((xfs_bmbt_rec_base_t)blockcount &
(xfs_bmbt_rec_base_t)XFS_MASK64LO(21)); (xfs_bmbt_rec_base_t)XFS_MASK64LO(21));
#else /* !XFS_BIG_BLKNOS */ #else /* !XFS_BIG_BLKNOS */
if (ISNULLSTARTBLOCK(s->br_startblock)) { if (ISNULLSTARTBLOCK(b)) {
r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) | r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
((xfs_bmbt_rec_base_t)s->br_startoff << 9) | ((xfs_bmbt_rec_base_t)startoff << 9) |
(xfs_bmbt_rec_base_t)XFS_MASK64LO(9); (xfs_bmbt_rec_base_t)XFS_MASK64LO(9);
r->l1 = XFS_MASK64HI(11) | r->l1 = XFS_MASK64HI(11) |
((xfs_bmbt_rec_base_t)s->br_startblock << 21) | ((xfs_bmbt_rec_base_t)startblock << 21) |
((xfs_bmbt_rec_base_t)s->br_blockcount & ((xfs_bmbt_rec_base_t)blockcount &
(xfs_bmbt_rec_base_t)XFS_MASK64LO(21)); (xfs_bmbt_rec_base_t)XFS_MASK64LO(21));
} else { } else {
r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) | r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
((xfs_bmbt_rec_base_t)s->br_startoff << 9); ((xfs_bmbt_rec_base_t)startoff << 9);
r->l1 = ((xfs_bmbt_rec_base_t)s->br_startblock << 21) | r->l1 = ((xfs_bmbt_rec_base_t)startblock << 21) |
((xfs_bmbt_rec_base_t)s->br_blockcount & ((xfs_bmbt_rec_base_t)blockcount &
(xfs_bmbt_rec_base_t)XFS_MASK64LO(21)); (xfs_bmbt_rec_base_t)XFS_MASK64LO(21));
} }
#endif /* XFS_BIG_BLKNOS */ #endif /* XFS_BIG_BLKNOS */
} }
/* /*
* Set all the fields in a bmap extent record from the arguments. * Set all the fields in a bmap extent record from the uncompressed form.
*/ */
void void
xfs_bmbt_set_allf( xfs_bmbt_set_all(
xfs_bmbt_rec_host_t *r, xfs_bmbt_rec_host_t *r,
xfs_fileoff_t o, xfs_bmbt_irec_t *s)
xfs_fsblock_t b,
xfs_filblks_t c,
xfs_exntst_t v)
{ {
int extent_flag; xfs_bmbt_set_allf(r, s->br_startoff, s->br_startblock,
s->br_blockcount, s->br_state);
ASSERT((v == XFS_EXT_NORM) || (v == XFS_EXT_UNWRITTEN));
extent_flag = (v == XFS_EXT_NORM) ? 0 : 1;
ASSERT((o & XFS_MASK64HI(64-BMBT_STARTOFF_BITLEN)) == 0);
ASSERT((c & XFS_MASK64HI(64-BMBT_BLOCKCOUNT_BITLEN)) == 0);
#if XFS_BIG_BLKNOS
ASSERT((b & XFS_MASK64HI(64-BMBT_STARTBLOCK_BITLEN)) == 0);
r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
((xfs_bmbt_rec_base_t)o << 9) |
((xfs_bmbt_rec_base_t)b >> 43);
r->l1 = ((xfs_bmbt_rec_base_t)b << 21) |
((xfs_bmbt_rec_base_t)c &
(xfs_bmbt_rec_base_t)XFS_MASK64LO(21));
#else /* !XFS_BIG_BLKNOS */
if (ISNULLSTARTBLOCK(b)) {
r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
((xfs_bmbt_rec_base_t)o << 9) |
(xfs_bmbt_rec_base_t)XFS_MASK64LO(9);
r->l1 = XFS_MASK64HI(11) |
((xfs_bmbt_rec_base_t)b << 21) |
((xfs_bmbt_rec_base_t)c &
(xfs_bmbt_rec_base_t)XFS_MASK64LO(21));
} else {
r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
((xfs_bmbt_rec_base_t)o << 9);
r->l1 = ((xfs_bmbt_rec_base_t)b << 21) |
((xfs_bmbt_rec_base_t)c &
(xfs_bmbt_rec_base_t)XFS_MASK64LO(21));
}
#endif /* XFS_BIG_BLKNOS */
} }
#ifndef XFS_NATIVE_HOST #ifndef XFS_NATIVE_HOST
/* /*
* Set all the fields in a bmap extent record from the uncompressed form. * Set all the fields in a disk format bmap extent record from the arguments.
*/ */
void void
xfs_bmbt_disk_set_all( xfs_bmbt_disk_set_allf(
xfs_bmbt_rec_t *r, xfs_bmbt_rec_t *r,
xfs_bmbt_irec_t *s) xfs_fileoff_t startoff,
xfs_fsblock_t startblock,
xfs_filblks_t blockcount,
xfs_exntst_t state)
{ {
int extent_flag; int extent_flag = (state == XFS_EXT_NORM) ? 0 : 1;
ASSERT(state == XFS_EXT_NORM || state == XFS_EXT_UNWRITTEN);
ASSERT((startoff & XFS_MASK64HI(64-BMBT_STARTOFF_BITLEN)) == 0);
ASSERT((blockcount & XFS_MASK64HI(64-BMBT_BLOCKCOUNT_BITLEN)) == 0);
ASSERT((s->br_state == XFS_EXT_NORM) ||
(s->br_state == XFS_EXT_UNWRITTEN));
extent_flag = (s->br_state == XFS_EXT_NORM) ? 0 : 1;
ASSERT((s->br_startoff & XFS_MASK64HI(9)) == 0);
ASSERT((s->br_blockcount & XFS_MASK64HI(43)) == 0);
#if XFS_BIG_BLKNOS #if XFS_BIG_BLKNOS
ASSERT((s->br_startblock & XFS_MASK64HI(12)) == 0); ASSERT((startblock & XFS_MASK64HI(64-BMBT_STARTBLOCK_BITLEN)) == 0);
INT_SET(r->l0, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)extent_flag << 63) |
((xfs_bmbt_rec_base_t)s->br_startoff << 9) | INT_SET(r->l0, ARCH_CONVERT,
((xfs_bmbt_rec_base_t)s->br_startblock >> 43)); ((xfs_bmbt_rec_base_t)extent_flag << 63) |
INT_SET(r->l1, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)s->br_startblock << 21) | ((xfs_bmbt_rec_base_t)startoff << 9) |
((xfs_bmbt_rec_base_t)s->br_blockcount & ((xfs_bmbt_rec_base_t)startblock >> 43));
INT_SET(r->l1, ARCH_CONVERT,
((xfs_bmbt_rec_base_t)startblock << 21) |
((xfs_bmbt_rec_base_t)blockcount &
(xfs_bmbt_rec_base_t)XFS_MASK64LO(21))); (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)));
#else /* !XFS_BIG_BLKNOS */ #else /* !XFS_BIG_BLKNOS */
if (ISNULLSTARTBLOCK(s->br_startblock)) { if (ISNULLSTARTBLOCK(b)) {
INT_SET(r->l0, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)extent_flag << 63) | INT_SET(r->l0, ARCH_CONVERT,
((xfs_bmbt_rec_base_t)s->br_startoff << 9) | ((xfs_bmbt_rec_base_t)extent_flag << 63) |
((xfs_bmbt_rec_base_t)startoff << 9) |
(xfs_bmbt_rec_base_t)XFS_MASK64LO(9)); (xfs_bmbt_rec_base_t)XFS_MASK64LO(9));
INT_SET(r->l1, ARCH_CONVERT, XFS_MASK64HI(11) | INT_SET(r->l1, ARCH_CONVERT, XFS_MASK64HI(11) |
((xfs_bmbt_rec_base_t)s->br_startblock << 21) | ((xfs_bmbt_rec_base_t)startblock << 21) |
((xfs_bmbt_rec_base_t)s->br_blockcount & ((xfs_bmbt_rec_base_t)blockcount &
(xfs_bmbt_rec_base_t)XFS_MASK64LO(21))); (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)));
} else { } else {
INT_SET(r->l0, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)extent_flag << 63) | INT_SET(r->l0, ARCH_CONVERT,
((xfs_bmbt_rec_base_t)s->br_startoff << 9)); ((xfs_bmbt_rec_base_t)extent_flag << 63) |
INT_SET(r->l1, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)s->br_startblock << 21) | ((xfs_bmbt_rec_base_t)startoff << 9));
((xfs_bmbt_rec_base_t)s->br_blockcount & INT_SET(r->l1, ARCH_CONVERT,
((xfs_bmbt_rec_base_t)startblock << 21) |
((xfs_bmbt_rec_base_t)blockcount &
(xfs_bmbt_rec_base_t)XFS_MASK64LO(21))); (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)));
} }
#endif /* XFS_BIG_BLKNOS */ #endif /* XFS_BIG_BLKNOS */
} }
/* /*
* Set all the fields in a disk format bmap extent record from the arguments. * Set all the fields in a bmap extent record from the uncompressed form.
*/ */
void void
xfs_bmbt_disk_set_allf( xfs_bmbt_disk_set_all(
xfs_bmbt_rec_t *r, xfs_bmbt_rec_t *r,
xfs_fileoff_t o, xfs_bmbt_irec_t *s)
xfs_fsblock_t b,
xfs_filblks_t c,
xfs_exntst_t v)
{ {
int extent_flag; xfs_bmbt_disk_set_allf(r, s->br_startoff, s->br_startblock,
s->br_blockcount, s->br_state);
ASSERT((v == XFS_EXT_NORM) || (v == XFS_EXT_UNWRITTEN));
extent_flag = (v == XFS_EXT_NORM) ? 0 : 1;
ASSERT((o & XFS_MASK64HI(64-BMBT_STARTOFF_BITLEN)) == 0);
ASSERT((c & XFS_MASK64HI(64-BMBT_BLOCKCOUNT_BITLEN)) == 0);
#if XFS_BIG_BLKNOS
ASSERT((b & XFS_MASK64HI(64-BMBT_STARTBLOCK_BITLEN)) == 0);
INT_SET(r->l0, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)extent_flag << 63) |
((xfs_bmbt_rec_base_t)o << 9) |
((xfs_bmbt_rec_base_t)b >> 43));
INT_SET(r->l1, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)b << 21) |
((xfs_bmbt_rec_base_t)c &
(xfs_bmbt_rec_base_t)XFS_MASK64LO(21)));
#else /* !XFS_BIG_BLKNOS */
if (ISNULLSTARTBLOCK(b)) {
INT_SET(r->l0, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)extent_flag << 63) |
((xfs_bmbt_rec_base_t)o << 9) |
(xfs_bmbt_rec_base_t)XFS_MASK64LO(9));
INT_SET(r->l1, ARCH_CONVERT, XFS_MASK64HI(11) |
((xfs_bmbt_rec_base_t)b << 21) |
((xfs_bmbt_rec_base_t)c &
(xfs_bmbt_rec_base_t)XFS_MASK64LO(21)));
} else {
INT_SET(r->l0, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)extent_flag << 63) |
((xfs_bmbt_rec_base_t)o << 9));
INT_SET(r->l1, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)b << 21) |
((xfs_bmbt_rec_base_t)c &
(xfs_bmbt_rec_base_t)XFS_MASK64LO(21)));
}
#endif /* XFS_BIG_BLKNOS */
} }
#endif /* XFS_NATIVE_HOST */ #endif /* XFS_NATIVE_HOST */
......
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