* [PATCH] re-remove xfs custom bitops
@ 2008-04-23 3:57 Eric Sandeen
2008-05-13 16:35 ` Eric Sandeen
0 siblings, 1 reply; 11+ messages in thread
From: Eric Sandeen @ 2008-04-23 3:57 UTC (permalink / raw)
To: xfs-oss
Once more, with feeling!
This re-instates the reverted mod after the ppc panic of
Feb '08. You guys do have ppc boxes in the test farm now right? :)
This keeps xfs_lowbit64 as it was since there aren't good
generic helpers there ...
This should probably keep Dave's signed-off line, there's
a bit of my (userspace) testing here but no original work.
This exact patch isn't tested but it's based on a conglomeration
of prior testing...
Thanks,
-Eric
Index: linux-2.6-xfs/fs/xfs/xfs_bit.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/xfs_bit.c
+++ linux-2.6-xfs/fs/xfs/xfs_bit.c
@@ -25,109 +25,6 @@
* XFS bit manipulation routines, used in non-realtime code.
*/
-#ifndef HAVE_ARCH_HIGHBIT
-/*
- * Index of high bit number in byte, -1 for none set, 0..7 otherwise.
- */
-static const char xfs_highbit[256] = {
- -1, 0, 1, 1, 2, 2, 2, 2, /* 00 .. 07 */
- 3, 3, 3, 3, 3, 3, 3, 3, /* 08 .. 0f */
- 4, 4, 4, 4, 4, 4, 4, 4, /* 10 .. 17 */
- 4, 4, 4, 4, 4, 4, 4, 4, /* 18 .. 1f */
- 5, 5, 5, 5, 5, 5, 5, 5, /* 20 .. 27 */
- 5, 5, 5, 5, 5, 5, 5, 5, /* 28 .. 2f */
- 5, 5, 5, 5, 5, 5, 5, 5, /* 30 .. 37 */
- 5, 5, 5, 5, 5, 5, 5, 5, /* 38 .. 3f */
- 6, 6, 6, 6, 6, 6, 6, 6, /* 40 .. 47 */
- 6, 6, 6, 6, 6, 6, 6, 6, /* 48 .. 4f */
- 6, 6, 6, 6, 6, 6, 6, 6, /* 50 .. 57 */
- 6, 6, 6, 6, 6, 6, 6, 6, /* 58 .. 5f */
- 6, 6, 6, 6, 6, 6, 6, 6, /* 60 .. 67 */
- 6, 6, 6, 6, 6, 6, 6, 6, /* 68 .. 6f */
- 6, 6, 6, 6, 6, 6, 6, 6, /* 70 .. 77 */
- 6, 6, 6, 6, 6, 6, 6, 6, /* 78 .. 7f */
- 7, 7, 7, 7, 7, 7, 7, 7, /* 80 .. 87 */
- 7, 7, 7, 7, 7, 7, 7, 7, /* 88 .. 8f */
- 7, 7, 7, 7, 7, 7, 7, 7, /* 90 .. 97 */
- 7, 7, 7, 7, 7, 7, 7, 7, /* 98 .. 9f */
- 7, 7, 7, 7, 7, 7, 7, 7, /* a0 .. a7 */
- 7, 7, 7, 7, 7, 7, 7, 7, /* a8 .. af */
- 7, 7, 7, 7, 7, 7, 7, 7, /* b0 .. b7 */
- 7, 7, 7, 7, 7, 7, 7, 7, /* b8 .. bf */
- 7, 7, 7, 7, 7, 7, 7, 7, /* c0 .. c7 */
- 7, 7, 7, 7, 7, 7, 7, 7, /* c8 .. cf */
- 7, 7, 7, 7, 7, 7, 7, 7, /* d0 .. d7 */
- 7, 7, 7, 7, 7, 7, 7, 7, /* d8 .. df */
- 7, 7, 7, 7, 7, 7, 7, 7, /* e0 .. e7 */
- 7, 7, 7, 7, 7, 7, 7, 7, /* e8 .. ef */
- 7, 7, 7, 7, 7, 7, 7, 7, /* f0 .. f7 */
- 7, 7, 7, 7, 7, 7, 7, 7, /* f8 .. ff */
-};
-#endif
-
-/*
- * xfs_highbit32: get high bit set out of 32-bit argument, -1 if none set.
- */
-inline int
-xfs_highbit32(
- __uint32_t v)
-{
-#ifdef HAVE_ARCH_HIGHBIT
- return highbit32(v);
-#else
- int i;
-
- if (v & 0xffff0000)
- if (v & 0xff000000)
- i = 24;
- else
- i = 16;
- else if (v & 0x0000ffff)
- if (v & 0x0000ff00)
- i = 8;
- else
- i = 0;
- else
- return -1;
- return i + xfs_highbit[(v >> i) & 0xff];
-#endif
-}
-
-/*
- * xfs_lowbit64: get low bit set out of 64-bit argument, -1 if none set.
- */
-int
-xfs_lowbit64(
- __uint64_t v)
-{
- __uint32_t w = (__uint32_t)v;
- int n = 0;
-
- if (w) { /* lower bits */
- n = ffs(w);
- } else { /* upper bits */
- w = (__uint32_t)(v >> 32);
- if (w && (n = ffs(w)))
- n += 32;
- }
- return n - 1;
-}
-
-/*
- * xfs_highbit64: get high bit set out of 64-bit argument, -1 if none set.
- */
-int
-xfs_highbit64(
- __uint64_t v)
-{
- __uint32_t h = (__uint32_t)(v >> 32);
-
- if (h)
- return xfs_highbit32(h) + 32;
- return xfs_highbit32((__uint32_t)v);
-}
-
-
/*
* Return whether bitmap is empty.
* Size is number of words in the bitmap, which is padded to word boundary
Index: linux-2.6-xfs/fs/xfs/xfs_bit.h
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/xfs_bit.h
+++ linux-2.6-xfs/fs/xfs/xfs_bit.h
@@ -47,13 +47,39 @@ static inline __uint64_t xfs_mask64lo(in
}
/* Get high bit set out of 32-bit argument, -1 if none set */
-extern int xfs_highbit32(__uint32_t v);
-
-/* Get low bit set out of 64-bit argument, -1 if none set */
-extern int xfs_lowbit64(__uint64_t v);
+static inline int xfs_highbit32(__uint32_t v)
+{
+ return fls(v) - 1;
+}
/* Get high bit set out of 64-bit argument, -1 if none set */
-extern int xfs_highbit64(__uint64_t);
+static inline int xfs_highbit64(__uint64_t v)
+{
+ return fls64(v) - 1;
+}
+
+/* Get low bit set out of 32-bit argument, -1 if none set */
+static inline int xfs_lowbit32(__uint32_t v)
+{
+ unsigned long t = v;
+ return (v) ? find_first_bit(&t, 32) : -1;
+}
+
+/* Get low bit set out of 64-bit argument, -1 if none set */
+static inline int xfs_lowbit64(__uint64_t v)
+{
+ __uint32_t w = (__uint32_t)v;
+ int n = 0;
+
+ if (w) { /* lower bits */
+ n = ffs(w);
+ } else { /* upper bits */
+ w = (__uint32_t)(v >> 32);
+ if (w && (n = ffs(w)))
+ n += 32;
+ }
+ return n - 1;
+}
/* Return whether bitmap is empty (1 == empty) */
extern int xfs_bitmap_empty(uint *map, uint size);
Index: linux-2.6-xfs/fs/xfs/xfs_rtalloc.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/xfs_rtalloc.c
+++ linux-2.6-xfs/fs/xfs/xfs_rtalloc.c
@@ -74,18 +74,6 @@ STATIC int xfs_rtmodify_summary(xfs_moun
*/
/*
- * xfs_lowbit32: get low bit set out of 32-bit argument, -1 if none set.
- */
-STATIC int
-xfs_lowbit32(
- __uint32_t v)
-{
- if (v)
- return ffs(v) - 1;
- return -1;
-}
-
-/*
* Allocate space to the bitmap or summary file, and zero it, for growfs.
*/
STATIC int /* error */
@@ -450,6 +438,7 @@ xfs_rtallocate_extent_near(
}
bbno = XFS_BITTOBLOCK(mp, bno);
i = 0;
+ ASSERT(minlen != 0);
log2len = xfs_highbit32(minlen);
/*
* Loop over all bitmap blocks (bbno + i is current block).
@@ -618,6 +607,8 @@ xfs_rtallocate_extent_size(
xfs_suminfo_t sum; /* summary information for extents */
ASSERT(minlen % prod == 0 && maxlen % prod == 0);
+ ASSERT(maxlen != 0);
+
/*
* Loop over all the levels starting with maxlen.
* At each level, look at all the bitmap blocks, to see if there
@@ -675,6 +666,9 @@ xfs_rtallocate_extent_size(
*rtblock = NULLRTBLOCK;
return 0;
}
+ ASSERT(minlen != 0);
+ ASSERT(maxlen != 0);
+
/*
* Loop over sizes, from maxlen down to minlen.
* This time, when we do the allocations, allow smaller ones
@@ -1961,6 +1955,7 @@ xfs_growfs_rt(
nsbp->sb_blocksize * nsbp->sb_rextsize);
nsbp->sb_rextents = nsbp->sb_rblocks;
do_div(nsbp->sb_rextents, nsbp->sb_rextsize);
+ ASSERT(nsbp->sb_rextents != 0);
nsbp->sb_rextslog = xfs_highbit32(nsbp->sb_rextents);
nrsumlevels = nmp->m_rsumlevels = nsbp->sb_rextslog + 1;
nrsumsize =
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH] re-remove xfs custom bitops 2008-04-23 3:57 [PATCH] re-remove xfs custom bitops Eric Sandeen @ 2008-05-13 16:35 ` Eric Sandeen 2008-05-15 8:45 ` Donald Douwsma 0 siblings, 1 reply; 11+ messages in thread From: Eric Sandeen @ 2008-05-13 16:35 UTC (permalink / raw) To: xfs-oss Eric Sandeen wrote: > Once more, with feeling! > > This re-instates the reverted mod after the ppc panic of > Feb '08. You guys do have ppc boxes in the test farm now right? :) > > This keeps xfs_lowbit64 as it was since there aren't good > generic helpers there ... > > This should probably keep Dave's signed-off line, there's > a bit of my (userspace) testing here but no original work. > > This exact patch isn't tested but it's based on a conglomeration > of prior testing... SGI guys, any takers on this one? -Eric > Thanks, > -Eric > > Index: linux-2.6-xfs/fs/xfs/xfs_bit.c > =================================================================== > --- linux-2.6-xfs.orig/fs/xfs/xfs_bit.c > +++ linux-2.6-xfs/fs/xfs/xfs_bit.c > @@ -25,109 +25,6 @@ > * XFS bit manipulation routines, used in non-realtime code. > */ > > -#ifndef HAVE_ARCH_HIGHBIT > -/* > - * Index of high bit number in byte, -1 for none set, 0..7 otherwise. > - */ > -static const char xfs_highbit[256] = { > - -1, 0, 1, 1, 2, 2, 2, 2, /* 00 .. 07 */ > - 3, 3, 3, 3, 3, 3, 3, 3, /* 08 .. 0f */ > - 4, 4, 4, 4, 4, 4, 4, 4, /* 10 .. 17 */ > - 4, 4, 4, 4, 4, 4, 4, 4, /* 18 .. 1f */ > - 5, 5, 5, 5, 5, 5, 5, 5, /* 20 .. 27 */ > - 5, 5, 5, 5, 5, 5, 5, 5, /* 28 .. 2f */ > - 5, 5, 5, 5, 5, 5, 5, 5, /* 30 .. 37 */ > - 5, 5, 5, 5, 5, 5, 5, 5, /* 38 .. 3f */ > - 6, 6, 6, 6, 6, 6, 6, 6, /* 40 .. 47 */ > - 6, 6, 6, 6, 6, 6, 6, 6, /* 48 .. 4f */ > - 6, 6, 6, 6, 6, 6, 6, 6, /* 50 .. 57 */ > - 6, 6, 6, 6, 6, 6, 6, 6, /* 58 .. 5f */ > - 6, 6, 6, 6, 6, 6, 6, 6, /* 60 .. 67 */ > - 6, 6, 6, 6, 6, 6, 6, 6, /* 68 .. 6f */ > - 6, 6, 6, 6, 6, 6, 6, 6, /* 70 .. 77 */ > - 6, 6, 6, 6, 6, 6, 6, 6, /* 78 .. 7f */ > - 7, 7, 7, 7, 7, 7, 7, 7, /* 80 .. 87 */ > - 7, 7, 7, 7, 7, 7, 7, 7, /* 88 .. 8f */ > - 7, 7, 7, 7, 7, 7, 7, 7, /* 90 .. 97 */ > - 7, 7, 7, 7, 7, 7, 7, 7, /* 98 .. 9f */ > - 7, 7, 7, 7, 7, 7, 7, 7, /* a0 .. a7 */ > - 7, 7, 7, 7, 7, 7, 7, 7, /* a8 .. af */ > - 7, 7, 7, 7, 7, 7, 7, 7, /* b0 .. b7 */ > - 7, 7, 7, 7, 7, 7, 7, 7, /* b8 .. bf */ > - 7, 7, 7, 7, 7, 7, 7, 7, /* c0 .. c7 */ > - 7, 7, 7, 7, 7, 7, 7, 7, /* c8 .. cf */ > - 7, 7, 7, 7, 7, 7, 7, 7, /* d0 .. d7 */ > - 7, 7, 7, 7, 7, 7, 7, 7, /* d8 .. df */ > - 7, 7, 7, 7, 7, 7, 7, 7, /* e0 .. e7 */ > - 7, 7, 7, 7, 7, 7, 7, 7, /* e8 .. ef */ > - 7, 7, 7, 7, 7, 7, 7, 7, /* f0 .. f7 */ > - 7, 7, 7, 7, 7, 7, 7, 7, /* f8 .. ff */ > -}; > -#endif > - > -/* > - * xfs_highbit32: get high bit set out of 32-bit argument, -1 if none set. > - */ > -inline int > -xfs_highbit32( > - __uint32_t v) > -{ > -#ifdef HAVE_ARCH_HIGHBIT > - return highbit32(v); > -#else > - int i; > - > - if (v & 0xffff0000) > - if (v & 0xff000000) > - i = 24; > - else > - i = 16; > - else if (v & 0x0000ffff) > - if (v & 0x0000ff00) > - i = 8; > - else > - i = 0; > - else > - return -1; > - return i + xfs_highbit[(v >> i) & 0xff]; > -#endif > -} > - > -/* > - * xfs_lowbit64: get low bit set out of 64-bit argument, -1 if none set. > - */ > -int > -xfs_lowbit64( > - __uint64_t v) > -{ > - __uint32_t w = (__uint32_t)v; > - int n = 0; > - > - if (w) { /* lower bits */ > - n = ffs(w); > - } else { /* upper bits */ > - w = (__uint32_t)(v >> 32); > - if (w && (n = ffs(w))) > - n += 32; > - } > - return n - 1; > -} > - > -/* > - * xfs_highbit64: get high bit set out of 64-bit argument, -1 if none set. > - */ > -int > -xfs_highbit64( > - __uint64_t v) > -{ > - __uint32_t h = (__uint32_t)(v >> 32); > - > - if (h) > - return xfs_highbit32(h) + 32; > - return xfs_highbit32((__uint32_t)v); > -} > - > - > /* > * Return whether bitmap is empty. > * Size is number of words in the bitmap, which is padded to word boundary > Index: linux-2.6-xfs/fs/xfs/xfs_bit.h > =================================================================== > --- linux-2.6-xfs.orig/fs/xfs/xfs_bit.h > +++ linux-2.6-xfs/fs/xfs/xfs_bit.h > @@ -47,13 +47,39 @@ static inline __uint64_t xfs_mask64lo(in > } > > /* Get high bit set out of 32-bit argument, -1 if none set */ > -extern int xfs_highbit32(__uint32_t v); > - > -/* Get low bit set out of 64-bit argument, -1 if none set */ > -extern int xfs_lowbit64(__uint64_t v); > +static inline int xfs_highbit32(__uint32_t v) > +{ > + return fls(v) - 1; > +} > > /* Get high bit set out of 64-bit argument, -1 if none set */ > -extern int xfs_highbit64(__uint64_t); > +static inline int xfs_highbit64(__uint64_t v) > +{ > + return fls64(v) - 1; > +} > + > +/* Get low bit set out of 32-bit argument, -1 if none set */ > +static inline int xfs_lowbit32(__uint32_t v) > +{ > + unsigned long t = v; > + return (v) ? find_first_bit(&t, 32) : -1; > +} > + > +/* Get low bit set out of 64-bit argument, -1 if none set */ > +static inline int xfs_lowbit64(__uint64_t v) > +{ > + __uint32_t w = (__uint32_t)v; > + int n = 0; > + > + if (w) { /* lower bits */ > + n = ffs(w); > + } else { /* upper bits */ > + w = (__uint32_t)(v >> 32); > + if (w && (n = ffs(w))) > + n += 32; > + } > + return n - 1; > +} > > /* Return whether bitmap is empty (1 == empty) */ > extern int xfs_bitmap_empty(uint *map, uint size); > Index: linux-2.6-xfs/fs/xfs/xfs_rtalloc.c > =================================================================== > --- linux-2.6-xfs.orig/fs/xfs/xfs_rtalloc.c > +++ linux-2.6-xfs/fs/xfs/xfs_rtalloc.c > @@ -74,18 +74,6 @@ STATIC int xfs_rtmodify_summary(xfs_moun > */ > > /* > - * xfs_lowbit32: get low bit set out of 32-bit argument, -1 if none set. > - */ > -STATIC int > -xfs_lowbit32( > - __uint32_t v) > -{ > - if (v) > - return ffs(v) - 1; > - return -1; > -} > - > -/* > * Allocate space to the bitmap or summary file, and zero it, for growfs. > */ > STATIC int /* error */ > @@ -450,6 +438,7 @@ xfs_rtallocate_extent_near( > } > bbno = XFS_BITTOBLOCK(mp, bno); > i = 0; > + ASSERT(minlen != 0); > log2len = xfs_highbit32(minlen); > /* > * Loop over all bitmap blocks (bbno + i is current block). > @@ -618,6 +607,8 @@ xfs_rtallocate_extent_size( > xfs_suminfo_t sum; /* summary information for extents */ > > ASSERT(minlen % prod == 0 && maxlen % prod == 0); > + ASSERT(maxlen != 0); > + > /* > * Loop over all the levels starting with maxlen. > * At each level, look at all the bitmap blocks, to see if there > @@ -675,6 +666,9 @@ xfs_rtallocate_extent_size( > *rtblock = NULLRTBLOCK; > return 0; > } > + ASSERT(minlen != 0); > + ASSERT(maxlen != 0); > + > /* > * Loop over sizes, from maxlen down to minlen. > * This time, when we do the allocations, allow smaller ones > @@ -1961,6 +1955,7 @@ xfs_growfs_rt( > nsbp->sb_blocksize * nsbp->sb_rextsize); > nsbp->sb_rextents = nsbp->sb_rblocks; > do_div(nsbp->sb_rextents, nsbp->sb_rextsize); > + ASSERT(nsbp->sb_rextents != 0); > nsbp->sb_rextslog = xfs_highbit32(nsbp->sb_rextents); > nrsumlevels = nmp->m_rsumlevels = nsbp->sb_rextslog + 1; > nrsumsize = > > > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] re-remove xfs custom bitops 2008-05-13 16:35 ` Eric Sandeen @ 2008-05-15 8:45 ` Donald Douwsma 2008-06-28 20:08 ` Eric Sandeen 0 siblings, 1 reply; 11+ messages in thread From: Donald Douwsma @ 2008-05-15 8:45 UTC (permalink / raw) To: Eric Sandeen; +Cc: xfs-oss Eric Sandeen wrote: > Eric Sandeen wrote: >> Once more, with feeling! >> >> This re-instates the reverted mod after the ppc panic of >> Feb '08. You guys do have ppc boxes in the test farm now right? :) >> >> This keeps xfs_lowbit64 as it was since there aren't good >> generic helpers there ... >> >> This should probably keep Dave's signed-off line, there's >> a bit of my (userspace) testing here but no original work. >> >> This exact patch isn't tested but it's based on a conglomeration >> of prior testing... > > SGI guys, any takers on this one? > -Eric Sorry Eric, havent had chance to run this on all platforms yet. I want to test it on ppc as well as the usual x86_64/ia64 combinations, then I'll get it committed. Don > >> Thanks, >> -Eric >> >> Index: linux-2.6-xfs/fs/xfs/xfs_bit.c >> =================================================================== >> --- linux-2.6-xfs.orig/fs/xfs/xfs_bit.c >> +++ linux-2.6-xfs/fs/xfs/xfs_bit.c >> @@ -25,109 +25,6 @@ >> * XFS bit manipulation routines, used in non-realtime code. >> */ >> >> -#ifndef HAVE_ARCH_HIGHBIT >> -/* >> - * Index of high bit number in byte, -1 for none set, 0..7 otherwise. >> - */ >> -static const char xfs_highbit[256] = { >> - -1, 0, 1, 1, 2, 2, 2, 2, /* 00 .. 07 */ >> - 3, 3, 3, 3, 3, 3, 3, 3, /* 08 .. 0f */ >> - 4, 4, 4, 4, 4, 4, 4, 4, /* 10 .. 17 */ >> - 4, 4, 4, 4, 4, 4, 4, 4, /* 18 .. 1f */ >> - 5, 5, 5, 5, 5, 5, 5, 5, /* 20 .. 27 */ >> - 5, 5, 5, 5, 5, 5, 5, 5, /* 28 .. 2f */ >> - 5, 5, 5, 5, 5, 5, 5, 5, /* 30 .. 37 */ >> - 5, 5, 5, 5, 5, 5, 5, 5, /* 38 .. 3f */ >> - 6, 6, 6, 6, 6, 6, 6, 6, /* 40 .. 47 */ >> - 6, 6, 6, 6, 6, 6, 6, 6, /* 48 .. 4f */ >> - 6, 6, 6, 6, 6, 6, 6, 6, /* 50 .. 57 */ >> - 6, 6, 6, 6, 6, 6, 6, 6, /* 58 .. 5f */ >> - 6, 6, 6, 6, 6, 6, 6, 6, /* 60 .. 67 */ >> - 6, 6, 6, 6, 6, 6, 6, 6, /* 68 .. 6f */ >> - 6, 6, 6, 6, 6, 6, 6, 6, /* 70 .. 77 */ >> - 6, 6, 6, 6, 6, 6, 6, 6, /* 78 .. 7f */ >> - 7, 7, 7, 7, 7, 7, 7, 7, /* 80 .. 87 */ >> - 7, 7, 7, 7, 7, 7, 7, 7, /* 88 .. 8f */ >> - 7, 7, 7, 7, 7, 7, 7, 7, /* 90 .. 97 */ >> - 7, 7, 7, 7, 7, 7, 7, 7, /* 98 .. 9f */ >> - 7, 7, 7, 7, 7, 7, 7, 7, /* a0 .. a7 */ >> - 7, 7, 7, 7, 7, 7, 7, 7, /* a8 .. af */ >> - 7, 7, 7, 7, 7, 7, 7, 7, /* b0 .. b7 */ >> - 7, 7, 7, 7, 7, 7, 7, 7, /* b8 .. bf */ >> - 7, 7, 7, 7, 7, 7, 7, 7, /* c0 .. c7 */ >> - 7, 7, 7, 7, 7, 7, 7, 7, /* c8 .. cf */ >> - 7, 7, 7, 7, 7, 7, 7, 7, /* d0 .. d7 */ >> - 7, 7, 7, 7, 7, 7, 7, 7, /* d8 .. df */ >> - 7, 7, 7, 7, 7, 7, 7, 7, /* e0 .. e7 */ >> - 7, 7, 7, 7, 7, 7, 7, 7, /* e8 .. ef */ >> - 7, 7, 7, 7, 7, 7, 7, 7, /* f0 .. f7 */ >> - 7, 7, 7, 7, 7, 7, 7, 7, /* f8 .. ff */ >> -}; >> -#endif >> - >> -/* >> - * xfs_highbit32: get high bit set out of 32-bit argument, -1 if none set. >> - */ >> -inline int >> -xfs_highbit32( >> - __uint32_t v) >> -{ >> -#ifdef HAVE_ARCH_HIGHBIT >> - return highbit32(v); >> -#else >> - int i; >> - >> - if (v & 0xffff0000) >> - if (v & 0xff000000) >> - i = 24; >> - else >> - i = 16; >> - else if (v & 0x0000ffff) >> - if (v & 0x0000ff00) >> - i = 8; >> - else >> - i = 0; >> - else >> - return -1; >> - return i + xfs_highbit[(v >> i) & 0xff]; >> -#endif >> -} >> - >> -/* >> - * xfs_lowbit64: get low bit set out of 64-bit argument, -1 if none set. >> - */ >> -int >> -xfs_lowbit64( >> - __uint64_t v) >> -{ >> - __uint32_t w = (__uint32_t)v; >> - int n = 0; >> - >> - if (w) { /* lower bits */ >> - n = ffs(w); >> - } else { /* upper bits */ >> - w = (__uint32_t)(v >> 32); >> - if (w && (n = ffs(w))) >> - n += 32; >> - } >> - return n - 1; >> -} >> - >> -/* >> - * xfs_highbit64: get high bit set out of 64-bit argument, -1 if none set. >> - */ >> -int >> -xfs_highbit64( >> - __uint64_t v) >> -{ >> - __uint32_t h = (__uint32_t)(v >> 32); >> - >> - if (h) >> - return xfs_highbit32(h) + 32; >> - return xfs_highbit32((__uint32_t)v); >> -} >> - >> - >> /* >> * Return whether bitmap is empty. >> * Size is number of words in the bitmap, which is padded to word boundary >> Index: linux-2.6-xfs/fs/xfs/xfs_bit.h >> =================================================================== >> --- linux-2.6-xfs.orig/fs/xfs/xfs_bit.h >> +++ linux-2.6-xfs/fs/xfs/xfs_bit.h >> @@ -47,13 +47,39 @@ static inline __uint64_t xfs_mask64lo(in >> } >> >> /* Get high bit set out of 32-bit argument, -1 if none set */ >> -extern int xfs_highbit32(__uint32_t v); >> - >> -/* Get low bit set out of 64-bit argument, -1 if none set */ >> -extern int xfs_lowbit64(__uint64_t v); >> +static inline int xfs_highbit32(__uint32_t v) >> +{ >> + return fls(v) - 1; >> +} >> >> /* Get high bit set out of 64-bit argument, -1 if none set */ >> -extern int xfs_highbit64(__uint64_t); >> +static inline int xfs_highbit64(__uint64_t v) >> +{ >> + return fls64(v) - 1; >> +} >> + >> +/* Get low bit set out of 32-bit argument, -1 if none set */ >> +static inline int xfs_lowbit32(__uint32_t v) >> +{ >> + unsigned long t = v; >> + return (v) ? find_first_bit(&t, 32) : -1; >> +} >> + >> +/* Get low bit set out of 64-bit argument, -1 if none set */ >> +static inline int xfs_lowbit64(__uint64_t v) >> +{ >> + __uint32_t w = (__uint32_t)v; >> + int n = 0; >> + >> + if (w) { /* lower bits */ >> + n = ffs(w); >> + } else { /* upper bits */ >> + w = (__uint32_t)(v >> 32); >> + if (w && (n = ffs(w))) >> + n += 32; >> + } >> + return n - 1; >> +} >> >> /* Return whether bitmap is empty (1 == empty) */ >> extern int xfs_bitmap_empty(uint *map, uint size); >> Index: linux-2.6-xfs/fs/xfs/xfs_rtalloc.c >> =================================================================== >> --- linux-2.6-xfs.orig/fs/xfs/xfs_rtalloc.c >> +++ linux-2.6-xfs/fs/xfs/xfs_rtalloc.c >> @@ -74,18 +74,6 @@ STATIC int xfs_rtmodify_summary(xfs_moun >> */ >> >> /* >> - * xfs_lowbit32: get low bit set out of 32-bit argument, -1 if none set. >> - */ >> -STATIC int >> -xfs_lowbit32( >> - __uint32_t v) >> -{ >> - if (v) >> - return ffs(v) - 1; >> - return -1; >> -} >> - >> -/* >> * Allocate space to the bitmap or summary file, and zero it, for growfs. >> */ >> STATIC int /* error */ >> @@ -450,6 +438,7 @@ xfs_rtallocate_extent_near( >> } >> bbno = XFS_BITTOBLOCK(mp, bno); >> i = 0; >> + ASSERT(minlen != 0); >> log2len = xfs_highbit32(minlen); >> /* >> * Loop over all bitmap blocks (bbno + i is current block). >> @@ -618,6 +607,8 @@ xfs_rtallocate_extent_size( >> xfs_suminfo_t sum; /* summary information for extents */ >> >> ASSERT(minlen % prod == 0 && maxlen % prod == 0); >> + ASSERT(maxlen != 0); >> + >> /* >> * Loop over all the levels starting with maxlen. >> * At each level, look at all the bitmap blocks, to see if there >> @@ -675,6 +666,9 @@ xfs_rtallocate_extent_size( >> *rtblock = NULLRTBLOCK; >> return 0; >> } >> + ASSERT(minlen != 0); >> + ASSERT(maxlen != 0); >> + >> /* >> * Loop over sizes, from maxlen down to minlen. >> * This time, when we do the allocations, allow smaller ones >> @@ -1961,6 +1955,7 @@ xfs_growfs_rt( >> nsbp->sb_blocksize * nsbp->sb_rextsize); >> nsbp->sb_rextents = nsbp->sb_rblocks; >> do_div(nsbp->sb_rextents, nsbp->sb_rextsize); >> + ASSERT(nsbp->sb_rextents != 0); >> nsbp->sb_rextslog = xfs_highbit32(nsbp->sb_rextents); >> nrsumlevels = nmp->m_rsumlevels = nsbp->sb_rextslog + 1; >> nrsumsize = >> >> >> > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] re-remove xfs custom bitops 2008-05-15 8:45 ` Donald Douwsma @ 2008-06-28 20:08 ` Eric Sandeen 2008-06-30 9:02 ` Donald Douwsma 0 siblings, 1 reply; 11+ messages in thread From: Eric Sandeen @ 2008-06-28 20:08 UTC (permalink / raw) To: Donald Douwsma; +Cc: xfs-oss Donald Douwsma wrote: > Eric Sandeen wrote: >> Eric Sandeen wrote: >>> Once more, with feeling! >>> >>> This re-instates the reverted mod after the ppc panic of >>> Feb '08. You guys do have ppc boxes in the test farm now right? :) >>> >>> This keeps xfs_lowbit64 as it was since there aren't good >>> generic helpers there ... >>> >>> This should probably keep Dave's signed-off line, there's >>> a bit of my (userspace) testing here but no original work. >>> >>> This exact patch isn't tested but it's based on a conglomeration >>> of prior testing... >> SGI guys, any takers on this one? >> -Eric > > Sorry Eric, havent had chance to run this on all platforms yet. > I want to test it on ppc as well as the usual x86_64/ia64 combinations, > then I'll get it committed. > > Don Don, how's that all going then? :) Thanks, -Eric ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] re-remove xfs custom bitops 2008-06-28 20:08 ` Eric Sandeen @ 2008-06-30 9:02 ` Donald Douwsma 2008-07-03 1:58 ` Eric Sandeen 0 siblings, 1 reply; 11+ messages in thread From: Donald Douwsma @ 2008-06-30 9:02 UTC (permalink / raw) To: Eric Sandeen; +Cc: xfs-oss Eric Sandeen wrote: > Donald Douwsma wrote: >> Eric Sandeen wrote: >>> Eric Sandeen wrote: >>>> Once more, with feeling! >>>> >>>> This re-instates the reverted mod after the ppc panic of >>>> Feb '08. You guys do have ppc boxes in the test farm now right? :) >>>> >>>> This keeps xfs_lowbit64 as it was since there aren't good >>>> generic helpers there ... >>>> >>>> This should probably keep Dave's signed-off line, there's >>>> a bit of my (userspace) testing here but no original work. >>>> >>>> This exact patch isn't tested but it's based on a conglomeration >>>> of prior testing... >>> SGI guys, any takers on this one? >>> -Eric >> Sorry Eric, havent had chance to run this on all platforms yet. >> I want to test it on ppc as well as the usual x86_64/ia64 combinations, >> then I'll get it committed. >> >> Don > > Don, how's that all going then? :) > Good question, got sidetracked with product releases. First time round I hit an Oops on xfstests/177 while running the auto group on ppc32. I dont seem to hit it running the single test, its intermittent. I also hit this oops once back in Feb running x86_64, which was around the time we pulled the last version of this cleanup out, but it may be unrelated. Looping through the auto group overnight, I'll see If I hit it again. XFS mounting filesystem hdb4 Ending clean XFS mount for filesystem: hdb4 Device hdb4 - bad inode magic/vsn daddr 23607192 #0 (magic=0) ------------[ cut here ]------------ kernel BUG at fs/xfs/support/debug.c:54! Oops: Exception in kernel mode, sig: 5 [#1] PowerMac Modules linked in: iptable_filter ip_tables ip6table_filter ip6_tables x_tables ipv6 dm_mod ide_cd_mod cdrom uninorth_agp ohci1394 agpgart sungem sungem_phy natsemi ieee1394 ehci_hcd NIP: c01955c8 LR: c01955bc CTR: c0032cc4 REGS: c3359d10 TRAP: 0700 Not tainted (2.6.25-donaldd) MSR: 00029032 <EE,ME,IR,DR> CR: 24002082 XER: 00000000 TASK = da1a4660[31911] 'xfssyncd' THREAD: c3358000 GPR00: 00000001 c3359dc0 da1a4660 00000041 00000001 00000000 00000000 00000001 GPR08: 0014ff97 c0500d48 d2aea3f2 c0500d48 00190834 00000000 0242db00 0242dc14 GPR16: 0242d860 02464870 0242dc38 c0448f8c c04512c8 00000000 c0160984 c3359e88 GPR24: 00000000 00000020 c3b1d1e0 00000000 c3359e90 00000000 c056cf34 00009032 NIP [c01955c8] cmn_err+0xd4/0xec LR [c01955bc] cmn_err+0xc8/0xec Call Trace: [c3359dc0] [c01955bc] cmn_err+0xc8/0xec (unreliable) [c3359e00] [c0160844] xfs_imap_to_bp+0x1a0/0x200 [c3359e80] [c0160984] xfs_itobp+0xe0/0x18c [c3359ed0] [c0162890] xfs_iflush+0x268/0x3f4 [c3359f10] [c017f98c] xfs_finish_reclaim+0xe8/0x190 [c3359f30] [c017facc] xfs_finish_reclaim_all+0x98/0xf4 [c3359f60] [c017ded0] xfs_syncsub+0x5c/0x290 [c3359f90] [c0192820] xfs_sync_worker+0x30/0x64 [c3359fa0] [c019404c] xfssyncd+0x118/0x16c [c3359fe0] [c004a790] kthread+0x4c/0x88 [c3359ff0] [c0012f9c] kernel_thread+0x44/0x60 Instruction dump: 7c1e19ae 3d20c03a 57a0103a 39291c84 3c60c047 7c89002e 7fc5f378 3863ae70 4bea0c49 7fe00124 7fa00034 5400d97e <0f000000> 80010044 bba10034 38210040 ---[ end trace f4636d0864e8be53 ]--- ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] re-remove xfs custom bitops 2008-06-30 9:02 ` Donald Douwsma @ 2008-07-03 1:58 ` Eric Sandeen 2008-07-03 6:46 ` Donald Douwsma 0 siblings, 1 reply; 11+ messages in thread From: Eric Sandeen @ 2008-07-03 1:58 UTC (permalink / raw) To: Donald Douwsma; +Cc: xfs-oss Donald Douwsma wrote: > First time round I hit an Oops on xfstests/177 while running the auto group > on ppc32. I dont seem to hit it running the single test, its intermittent. Funky. Do you ever hit it w/ the patch reverted? -Eric ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] re-remove xfs custom bitops 2008-07-03 1:58 ` Eric Sandeen @ 2008-07-03 6:46 ` Donald Douwsma 2008-07-03 15:02 ` Eric Sandeen 2008-07-10 5:03 ` Donald Douwsma 0 siblings, 2 replies; 11+ messages in thread From: Donald Douwsma @ 2008-07-03 6:46 UTC (permalink / raw) To: Eric Sandeen; +Cc: xfs-oss Eric Sandeen wrote: > Donald Douwsma wrote: > >> First time round I hit an Oops on xfstests/177 while running the auto group >> on ppc32. I dont seem to hit it running the single test, its intermittent. > > Funky. Do you ever hit it w/ the patch reverted? That's the question. So far no, the QA guys said they hit it a while ago, but the time frame still matches last time. I dont think this is related but I need to get some more ppc32 runs without. I'm probably being over cautious but I'd like to avoid the inagain/outagain/inagain/outagain approach we keep using with some of these cleanups. Don ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] re-remove xfs custom bitops 2008-07-03 6:46 ` Donald Douwsma @ 2008-07-03 15:02 ` Eric Sandeen 2008-07-10 5:03 ` Donald Douwsma 1 sibling, 0 replies; 11+ messages in thread From: Eric Sandeen @ 2008-07-03 15:02 UTC (permalink / raw) To: Donald Douwsma; +Cc: xfs-oss Donald Douwsma wrote: > Eric Sandeen wrote: >> Donald Douwsma wrote: >> >>> First time round I hit an Oops on xfstests/177 while running the auto group >>> on ppc32. I dont seem to hit it running the single test, its intermittent. >> Funky. Do you ever hit it w/ the patch reverted? > > That's the question. So far no, the QA guys said they hit it a while > ago, but the time frame still matches last time. I dont think this > is related but I need to get some more ppc32 runs without. > > I'm probably being over cautious but I'd like to avoid the > inagain/outagain/inagain/outagain approach we keep using with > some of these cleanups. Yep, I totally understand, I'd do just the same. :) -Eric ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] re-remove xfs custom bitops 2008-07-03 6:46 ` Donald Douwsma 2008-07-03 15:02 ` Eric Sandeen @ 2008-07-10 5:03 ` Donald Douwsma 2008-07-10 5:10 ` Eric Sandeen 2008-07-10 6:05 ` Dave Chinner 1 sibling, 2 replies; 11+ messages in thread From: Donald Douwsma @ 2008-07-10 5:03 UTC (permalink / raw) To: Eric Sandeen; +Cc: xfs-oss Donald Douwsma wrote: > Eric Sandeen wrote: >> Donald Douwsma wrote: >> >>> First time round I hit an Oops on xfstests/177 while running the auto >>> group >>> on ppc32. I dont seem to hit it running the single test, its >>> intermittent. >> >> Funky. Do you ever hit it w/ the patch reverted? > > That's the question. So far no, the QA guys said they hit it a while > ago, but the time frame still matches last time. I dont think this > is related but I need to get some more ppc32 runs without. > > I'm probably being over cautious but I'd like to avoid the > inagain/outagain/inagain/outagain approach we keep using with > some of these cleanups. > > Don > Ok I hit the Oops again last weekend without the patch. Which means I have a patch to checkin and another bug to fix Yea! Dave, Eric said this should still be considered signed-off-by you, You ok with that? Eric, am I ok to add yours too since you kept this on the radar? Don ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] re-remove xfs custom bitops 2008-07-10 5:03 ` Donald Douwsma @ 2008-07-10 5:10 ` Eric Sandeen 2008-07-10 6:05 ` Dave Chinner 1 sibling, 0 replies; 11+ messages in thread From: Eric Sandeen @ 2008-07-10 5:10 UTC (permalink / raw) To: Donald Douwsma; +Cc: xfs-oss Donald Douwsma wrote: > Donald Douwsma wrote: >> Eric Sandeen wrote: >>> Donald Douwsma wrote: >>> >>>> First time round I hit an Oops on xfstests/177 while running the auto >>>> group >>>> on ppc32. I dont seem to hit it running the single test, its >>>> intermittent. >>> Funky. Do you ever hit it w/ the patch reverted? >> That's the question. So far no, the QA guys said they hit it a while >> ago, but the time frame still matches last time. I dont think this >> is related but I need to get some more ppc32 runs without. >> >> I'm probably being over cautious but I'd like to avoid the >> inagain/outagain/inagain/outagain approach we keep using with >> some of these cleanups. >> >> Don >> > > Ok I hit the Oops again last weekend without the patch. > Which means I have a patch to checkin and another bug to fix Yea! > > Dave, Eric said this should still be considered signed-off-by you, > You ok with that? > Eric, am I ok to add yours too since you kept this on the radar? That's fine by me, thanks. -Eric ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] re-remove xfs custom bitops 2008-07-10 5:03 ` Donald Douwsma 2008-07-10 5:10 ` Eric Sandeen @ 2008-07-10 6:05 ` Dave Chinner 1 sibling, 0 replies; 11+ messages in thread From: Dave Chinner @ 2008-07-10 6:05 UTC (permalink / raw) To: Donald Douwsma; +Cc: Eric Sandeen, xfs-oss On Thu, Jul 10, 2008 at 03:03:15PM +1000, Donald Douwsma wrote: > Donald Douwsma wrote: >> Eric Sandeen wrote: >>> Donald Douwsma wrote: >>> >>>> First time round I hit an Oops on xfstests/177 while running the >>>> auto group >>>> on ppc32. I dont seem to hit it running the single test, its >>>> intermittent. >>> >>> Funky. Do you ever hit it w/ the patch reverted? >> >> That's the question. So far no, the QA guys said they hit it a while >> ago, but the time frame still matches last time. I dont think this >> is related but I need to get some more ppc32 runs without. >> >> I'm probably being over cautious but I'd like to avoid the >> inagain/outagain/inagain/outagain approach we keep using with >> some of these cleanups. >> >> Don >> > > Ok I hit the Oops again last weekend without the patch. > Which means I have a patch to checkin and another bug to fix Yea! > > Dave, Eric said this should still be considered signed-off-by you, > You ok with that? Yeah, no problems there. Cheers, Dave. -- Dave Chinner david@fromorbit.com ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2008-07-10 6:04 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-04-23 3:57 [PATCH] re-remove xfs custom bitops Eric Sandeen 2008-05-13 16:35 ` Eric Sandeen 2008-05-15 8:45 ` Donald Douwsma 2008-06-28 20:08 ` Eric Sandeen 2008-06-30 9:02 ` Donald Douwsma 2008-07-03 1:58 ` Eric Sandeen 2008-07-03 6:46 ` Donald Douwsma 2008-07-03 15:02 ` Eric Sandeen 2008-07-10 5:03 ` Donald Douwsma 2008-07-10 5:10 ` Eric Sandeen 2008-07-10 6:05 ` Dave Chinner
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox