cluster: RHEL56 - gfs2_edit restoremeta should not return 0 on failure
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 6468ae5d37c4571c13cadda3d4f4be2b439d6f35
Parent: 4e3322cb8fcb1109fc5f16131b467127c229fa5d
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Wed Jun 23 14:25:31 2010 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Tue Jun 29 09:12:40 2010 -0500
gfs2_edit restoremeta should not return 0 on failure
The gfs2_edit "restoremeta" function was always returning zero,
even when the restore was not successful. This made it difficult
to automate some gfs2 testing. This patch makes gfs2_edit return
the correct result from restoremeta.
rhbz#607229
---
gfs2/edit/savemeta.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index d47b283..5cec3a0 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -882,5 +882,5 @@ void restoremeta(const char *in_fn, const char *out_device,
if (!printblocksonly)
close(sbd.device_fd);
- exit(0);
+ exit(error);
}
13 years, 11 months
cluster: STABLE3 - fsck.gfs2: unaligned access on ia64
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: d76d382f7452d8a6c6e2585d7f4bfe4f446c115c
Parent: 34e25eaec43373a8438b0985d8d98aaaa5edc3f5
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Mon Jun 28 17:23:25 2010 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Mon Jun 28 17:23:25 2010 -0500
fsck.gfs2: unaligned access on ia64
This patch ports the kernel version of the latest gfs2_bitfit function
back to user space. This is more efficient and avoids the unaligned
access errors on ia64.
rhbz#608154
---
gfs2/fsck/fs_bits.h | 11 -----
gfs2/fsck/pass5.c | 1 -
gfs2/libgfs2/fs_bits.c | 115 ++++++++++++++++++++++++++---------------------
gfs2/libgfs2/libgfs2.h | 5 +-
4 files changed, 67 insertions(+), 65 deletions(-)
diff --git a/gfs2/fsck/fs_bits.h b/gfs2/fsck/fs_bits.h
index 371c6c6..d4f262e 100644
--- a/gfs2/fsck/fs_bits.h
+++ b/gfs2/fsck/fs_bits.h
@@ -14,15 +14,4 @@ struct fs_bitmap
};
typedef struct fs_bitmap fs_bitmap_t;
-/* functions with blk #'s that are buffer relative */
-uint32_t gfs2_bitcount(unsigned char *buffer, unsigned int buflen,
- unsigned char state);
-uint32_t gfs2_bitfit(unsigned char *buffer, unsigned int buflen,
- uint32_t goal, unsigned char old_state);
-
-/* functions with blk #'s that are rgrp relative */
-uint32_t gfs2_blkalloc_internal(struct rgrp_list *rgd, uint32_t goal,
- unsigned char old_state,
- unsigned char new_state, int do_it);
-
#endif /* __FS_BITS_H__ */
diff --git a/gfs2/fsck/pass5.c b/gfs2/fsck/pass5.c
index 645d81c..79493e1 100644
--- a/gfs2/fsck/pass5.c
+++ b/gfs2/fsck/pass5.c
@@ -7,7 +7,6 @@
#include "libgfs2.h"
#include "fsck.h"
-#include "fs_bits.h"
#include "util.h"
static int convert_mark(uint8_t q, uint32_t *count)
diff --git a/gfs2/libgfs2/fs_bits.c b/gfs2/libgfs2/fs_bits.c
index c420dfc..380dd81 100644
--- a/gfs2/libgfs2/fs_bits.c
+++ b/gfs2/libgfs2/fs_bits.c
@@ -18,6 +18,41 @@
#define ALIGN(x,a) (((x)+(a)-1)&~((a)-1))
/**
+ * gfs2_bit_search
+ * @ptr: Pointer to bitmap data
+ * @mask: Mask to use (normally 0x55555.... but adjusted for search start)
+ * @state: The state we are searching for
+ *
+ * We xor the bitmap data with a patter which is the bitwise opposite
+ * of what we are looking for, this gives rise to a pattern of ones
+ * wherever there is a match. Since we have two bits per entry, we
+ * take this pattern, shift it down by one place and then and it with
+ * the original. All the even bit positions (0,2,4, etc) then represent
+ * successful matches, so we mask with 0x55555..... to remove the unwanted
+ * odd bit positions.
+ *
+ * This allows searching of a whole u64 at once (32 blocks) with a
+ * single test (on 64 bit arches).
+ */
+
+static inline uint64_t gfs2_bit_search(const unsigned long long *ptr,
+ unsigned long long mask,
+ uint8_t state)
+{
+ unsigned long long tmp;
+ static const unsigned long long search[] = {
+ [0] = 0xffffffffffffffffULL,
+ [1] = 0xaaaaaaaaaaaaaaaaULL,
+ [2] = 0x5555555555555555ULL,
+ [3] = 0x0000000000000000ULL,
+ };
+ tmp = le64_to_cpu(*ptr) ^ search[state];
+ tmp &= (tmp >> 1);
+ tmp &= mask;
+ return tmp;
+}
+
+/**
* gfs2_bitfit - Find a free block in the bitmaps
* @buffer: the buffer that holds the bitmaps
* @buflen: the length (in bytes) of the buffer
@@ -26,61 +61,39 @@
*
* Return: the block number that was allocated
*/
-
-uint32_t gfs2_bitfit(unsigned char *buffer, unsigned int buflen,
- uint32_t goal, unsigned char old_state)
+unsigned long gfs2_bitfit(const unsigned char *buf, const unsigned int len,
+ unsigned long goal, unsigned char state)
{
- const uint8_t *byte, *start, *end;
- int bit, startbit;
- uint32_t g1, g2, misaligned;
- unsigned long *plong;
- unsigned long lskipval;
-
- lskipval = (old_state & GFS2_BLKST_USED) ? LBITSKIP00 : LBITSKIP55;
- g1 = (goal / GFS2_NBBY);
- start = buffer + g1;
- byte = start;
- end = buffer + buflen;
- g2 = ALIGN(g1, sizeof(unsigned long));
- plong = (unsigned long *)(buffer + g2);
- startbit = bit = (goal % GFS2_NBBY) * GFS2_BIT_SIZE;
- misaligned = g2 - g1;
- if (!misaligned)
- goto ulong_aligned;
-/* parse the bitmap a byte at a time */
-misaligned:
- while (byte < end) {
- if (((*byte >> bit) & GFS2_BIT_MASK) == old_state) {
- return goal +
- (((byte - start) * GFS2_NBBY) +
- ((bit - startbit) >> 1));
- }
- bit += GFS2_BIT_SIZE;
- if (bit >= GFS2_NBBY * GFS2_BIT_SIZE) {
- bit = 0;
- byte++;
- misaligned--;
- if (!misaligned) {
- plong = (unsigned long *)byte;
- goto ulong_aligned;
- }
- }
- }
- return BFITNOENT;
-
-/* parse the bitmap a unsigned long at a time */
-ulong_aligned:
- while ((unsigned char *)plong < end) {
- if (((*plong) & LBITMASK) != lskipval)
- break;
- plong++;
- }
- if ((unsigned char *)plong < end) {
- byte = (const uint8_t *)plong;
- misaligned += sizeof(unsigned long) - 1;
- goto misaligned;
+ unsigned long spoint = (goal << 1) & ((8 * sizeof(unsigned long)) - 1);
+ const unsigned long long *ptr = ((unsigned long long *)buf) + (goal >> 5);
+ const unsigned long long *end = (unsigned long long *)
+ (buf + ALIGN(len, sizeof(unsigned long long)));
+ unsigned long long tmp;
+ unsigned long long mask = 0x5555555555555555ULL;
+ unsigned long bit;
+
+ if (state > 3)
+ return 0;
+
+ /* Mask off bits we don't care about at the start of the search */
+ mask <<= spoint;
+ tmp = gfs2_bit_search(ptr, mask, state);
+ ptr++;
+ while(tmp == 0 && ptr < end) {
+ tmp = gfs2_bit_search(ptr, 0x5555555555555555ULL, state);
+ ptr++;
}
- return BFITNOENT;
+ /* Mask off any bits which are more than len bytes from the start */
+ if (ptr == end && (len & (sizeof(unsigned long long) - 1)))
+ tmp &= (((unsigned long long)~0) >>
+ (64 - 8 * (len & (sizeof(unsigned long long) - 1))));
+ /* Didn't find anything, so return */
+ if (tmp == 0)
+ return BFITNOENT;
+ ptr--;
+ bit = ffsll(tmp);
+ bit /= 2; /* two bits per entry in the bitmap */
+ return (((const unsigned char *)ptr - buf) * GFS2_NBBY) + bit;
}
/**
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 0c4bc8a..8835a4f 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -395,8 +395,9 @@ extern int fix_device_geometry(struct gfs2_sbd *sdp);
/* functions with blk #'s that are buffer relative */
extern uint32_t gfs2_bitcount(unsigned char *buffer, unsigned int buflen,
unsigned char state);
-extern uint32_t gfs2_bitfit(unsigned char *buffer, unsigned int buflen,
- uint32_t goal, unsigned char old_state);
+extern unsigned long gfs2_bitfit(const unsigned char *buffer,
+ const unsigned int buflen,
+ unsigned long goal, unsigned char old_state);
/* functions with blk #'s that are rgrp relative */
extern uint32_t gfs2_blkalloc_internal(struct rgrp_list *rgd, uint32_t goal,
13 years, 11 months
cluster: RHEL6 - fsck.gfs2: unaligned access on ia64
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 4d6b610339b27a30deac7d9e29dc4236824b58ad
Parent: 6571b0c8747f33ec244917bad1720ddab967c185
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Mon Jun 28 17:23:25 2010 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Mon Jun 28 17:26:15 2010 -0500
fsck.gfs2: unaligned access on ia64
This patch ports the kernel version of the latest gfs2_bitfit function
back to user space. This is more efficient and avoids the unaligned
access errors on ia64.
rhbz#608154
---
gfs2/fsck/fs_bits.h | 11 -----
gfs2/fsck/pass5.c | 1 -
gfs2/libgfs2/fs_bits.c | 115 ++++++++++++++++++++++++++---------------------
gfs2/libgfs2/libgfs2.h | 5 +-
4 files changed, 67 insertions(+), 65 deletions(-)
diff --git a/gfs2/fsck/fs_bits.h b/gfs2/fsck/fs_bits.h
index 371c6c6..d4f262e 100644
--- a/gfs2/fsck/fs_bits.h
+++ b/gfs2/fsck/fs_bits.h
@@ -14,15 +14,4 @@ struct fs_bitmap
};
typedef struct fs_bitmap fs_bitmap_t;
-/* functions with blk #'s that are buffer relative */
-uint32_t gfs2_bitcount(unsigned char *buffer, unsigned int buflen,
- unsigned char state);
-uint32_t gfs2_bitfit(unsigned char *buffer, unsigned int buflen,
- uint32_t goal, unsigned char old_state);
-
-/* functions with blk #'s that are rgrp relative */
-uint32_t gfs2_blkalloc_internal(struct rgrp_list *rgd, uint32_t goal,
- unsigned char old_state,
- unsigned char new_state, int do_it);
-
#endif /* __FS_BITS_H__ */
diff --git a/gfs2/fsck/pass5.c b/gfs2/fsck/pass5.c
index 645d81c..79493e1 100644
--- a/gfs2/fsck/pass5.c
+++ b/gfs2/fsck/pass5.c
@@ -7,7 +7,6 @@
#include "libgfs2.h"
#include "fsck.h"
-#include "fs_bits.h"
#include "util.h"
static int convert_mark(uint8_t q, uint32_t *count)
diff --git a/gfs2/libgfs2/fs_bits.c b/gfs2/libgfs2/fs_bits.c
index c420dfc..380dd81 100644
--- a/gfs2/libgfs2/fs_bits.c
+++ b/gfs2/libgfs2/fs_bits.c
@@ -18,6 +18,41 @@
#define ALIGN(x,a) (((x)+(a)-1)&~((a)-1))
/**
+ * gfs2_bit_search
+ * @ptr: Pointer to bitmap data
+ * @mask: Mask to use (normally 0x55555.... but adjusted for search start)
+ * @state: The state we are searching for
+ *
+ * We xor the bitmap data with a patter which is the bitwise opposite
+ * of what we are looking for, this gives rise to a pattern of ones
+ * wherever there is a match. Since we have two bits per entry, we
+ * take this pattern, shift it down by one place and then and it with
+ * the original. All the even bit positions (0,2,4, etc) then represent
+ * successful matches, so we mask with 0x55555..... to remove the unwanted
+ * odd bit positions.
+ *
+ * This allows searching of a whole u64 at once (32 blocks) with a
+ * single test (on 64 bit arches).
+ */
+
+static inline uint64_t gfs2_bit_search(const unsigned long long *ptr,
+ unsigned long long mask,
+ uint8_t state)
+{
+ unsigned long long tmp;
+ static const unsigned long long search[] = {
+ [0] = 0xffffffffffffffffULL,
+ [1] = 0xaaaaaaaaaaaaaaaaULL,
+ [2] = 0x5555555555555555ULL,
+ [3] = 0x0000000000000000ULL,
+ };
+ tmp = le64_to_cpu(*ptr) ^ search[state];
+ tmp &= (tmp >> 1);
+ tmp &= mask;
+ return tmp;
+}
+
+/**
* gfs2_bitfit - Find a free block in the bitmaps
* @buffer: the buffer that holds the bitmaps
* @buflen: the length (in bytes) of the buffer
@@ -26,61 +61,39 @@
*
* Return: the block number that was allocated
*/
-
-uint32_t gfs2_bitfit(unsigned char *buffer, unsigned int buflen,
- uint32_t goal, unsigned char old_state)
+unsigned long gfs2_bitfit(const unsigned char *buf, const unsigned int len,
+ unsigned long goal, unsigned char state)
{
- const uint8_t *byte, *start, *end;
- int bit, startbit;
- uint32_t g1, g2, misaligned;
- unsigned long *plong;
- unsigned long lskipval;
-
- lskipval = (old_state & GFS2_BLKST_USED) ? LBITSKIP00 : LBITSKIP55;
- g1 = (goal / GFS2_NBBY);
- start = buffer + g1;
- byte = start;
- end = buffer + buflen;
- g2 = ALIGN(g1, sizeof(unsigned long));
- plong = (unsigned long *)(buffer + g2);
- startbit = bit = (goal % GFS2_NBBY) * GFS2_BIT_SIZE;
- misaligned = g2 - g1;
- if (!misaligned)
- goto ulong_aligned;
-/* parse the bitmap a byte at a time */
-misaligned:
- while (byte < end) {
- if (((*byte >> bit) & GFS2_BIT_MASK) == old_state) {
- return goal +
- (((byte - start) * GFS2_NBBY) +
- ((bit - startbit) >> 1));
- }
- bit += GFS2_BIT_SIZE;
- if (bit >= GFS2_NBBY * GFS2_BIT_SIZE) {
- bit = 0;
- byte++;
- misaligned--;
- if (!misaligned) {
- plong = (unsigned long *)byte;
- goto ulong_aligned;
- }
- }
- }
- return BFITNOENT;
-
-/* parse the bitmap a unsigned long at a time */
-ulong_aligned:
- while ((unsigned char *)plong < end) {
- if (((*plong) & LBITMASK) != lskipval)
- break;
- plong++;
- }
- if ((unsigned char *)plong < end) {
- byte = (const uint8_t *)plong;
- misaligned += sizeof(unsigned long) - 1;
- goto misaligned;
+ unsigned long spoint = (goal << 1) & ((8 * sizeof(unsigned long)) - 1);
+ const unsigned long long *ptr = ((unsigned long long *)buf) + (goal >> 5);
+ const unsigned long long *end = (unsigned long long *)
+ (buf + ALIGN(len, sizeof(unsigned long long)));
+ unsigned long long tmp;
+ unsigned long long mask = 0x5555555555555555ULL;
+ unsigned long bit;
+
+ if (state > 3)
+ return 0;
+
+ /* Mask off bits we don't care about at the start of the search */
+ mask <<= spoint;
+ tmp = gfs2_bit_search(ptr, mask, state);
+ ptr++;
+ while(tmp == 0 && ptr < end) {
+ tmp = gfs2_bit_search(ptr, 0x5555555555555555ULL, state);
+ ptr++;
}
- return BFITNOENT;
+ /* Mask off any bits which are more than len bytes from the start */
+ if (ptr == end && (len & (sizeof(unsigned long long) - 1)))
+ tmp &= (((unsigned long long)~0) >>
+ (64 - 8 * (len & (sizeof(unsigned long long) - 1))));
+ /* Didn't find anything, so return */
+ if (tmp == 0)
+ return BFITNOENT;
+ ptr--;
+ bit = ffsll(tmp);
+ bit /= 2; /* two bits per entry in the bitmap */
+ return (((const unsigned char *)ptr - buf) * GFS2_NBBY) + bit;
}
/**
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 0c4bc8a..8835a4f 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -395,8 +395,9 @@ extern int fix_device_geometry(struct gfs2_sbd *sdp);
/* functions with blk #'s that are buffer relative */
extern uint32_t gfs2_bitcount(unsigned char *buffer, unsigned int buflen,
unsigned char state);
-extern uint32_t gfs2_bitfit(unsigned char *buffer, unsigned int buflen,
- uint32_t goal, unsigned char old_state);
+extern unsigned long gfs2_bitfit(const unsigned char *buffer,
+ const unsigned int buflen,
+ unsigned long goal, unsigned char old_state);
/* functions with blk #'s that are rgrp relative */
extern uint32_t gfs2_blkalloc_internal(struct rgrp_list *rgd, uint32_t goal,
13 years, 11 months
gfs2-utils: master - fsck.gfs2: unaligned access on ia64
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitd...
Commit: 3fce665dffac8537f520e33674020988ae011fcf
Parent: 5395532f6ba4b69218f35e9624609b9c44e733ed
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Mon Jun 28 17:23:25 2010 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Mon Jun 28 17:28:19 2010 -0500
fsck.gfs2: unaligned access on ia64
This patch ports the kernel version of the latest gfs2_bitfit function
back to user space. This is more efficient and avoids the unaligned
access errors on ia64.
rhbz#608154
---
gfs2/fsck/fs_bits.h | 11 -----
gfs2/fsck/pass5.c | 1 -
gfs2/libgfs2/fs_bits.c | 115 ++++++++++++++++++++++++++---------------------
gfs2/libgfs2/libgfs2.h | 5 +-
4 files changed, 67 insertions(+), 65 deletions(-)
diff --git a/gfs2/fsck/fs_bits.h b/gfs2/fsck/fs_bits.h
index 371c6c6..d4f262e 100644
--- a/gfs2/fsck/fs_bits.h
+++ b/gfs2/fsck/fs_bits.h
@@ -14,15 +14,4 @@ struct fs_bitmap
};
typedef struct fs_bitmap fs_bitmap_t;
-/* functions with blk #'s that are buffer relative */
-uint32_t gfs2_bitcount(unsigned char *buffer, unsigned int buflen,
- unsigned char state);
-uint32_t gfs2_bitfit(unsigned char *buffer, unsigned int buflen,
- uint32_t goal, unsigned char old_state);
-
-/* functions with blk #'s that are rgrp relative */
-uint32_t gfs2_blkalloc_internal(struct rgrp_list *rgd, uint32_t goal,
- unsigned char old_state,
- unsigned char new_state, int do_it);
-
#endif /* __FS_BITS_H__ */
diff --git a/gfs2/fsck/pass5.c b/gfs2/fsck/pass5.c
index f2ce584..df90d5e 100644
--- a/gfs2/fsck/pass5.c
+++ b/gfs2/fsck/pass5.c
@@ -9,7 +9,6 @@
#include "libgfs2.h"
#include "fsck.h"
-#include "fs_bits.h"
#include "util.h"
static int convert_mark(uint8_t q, uint32_t *count)
diff --git a/gfs2/libgfs2/fs_bits.c b/gfs2/libgfs2/fs_bits.c
index 2574412..d98919a 100644
--- a/gfs2/libgfs2/fs_bits.c
+++ b/gfs2/libgfs2/fs_bits.c
@@ -20,6 +20,41 @@
#define ALIGN(x,a) (((x)+(a)-1)&~((a)-1))
/**
+ * gfs2_bit_search
+ * @ptr: Pointer to bitmap data
+ * @mask: Mask to use (normally 0x55555.... but adjusted for search start)
+ * @state: The state we are searching for
+ *
+ * We xor the bitmap data with a patter which is the bitwise opposite
+ * of what we are looking for, this gives rise to a pattern of ones
+ * wherever there is a match. Since we have two bits per entry, we
+ * take this pattern, shift it down by one place and then and it with
+ * the original. All the even bit positions (0,2,4, etc) then represent
+ * successful matches, so we mask with 0x55555..... to remove the unwanted
+ * odd bit positions.
+ *
+ * This allows searching of a whole u64 at once (32 blocks) with a
+ * single test (on 64 bit arches).
+ */
+
+static inline uint64_t gfs2_bit_search(const unsigned long long *ptr,
+ unsigned long long mask,
+ uint8_t state)
+{
+ unsigned long long tmp;
+ static const unsigned long long search[] = {
+ [0] = 0xffffffffffffffffULL,
+ [1] = 0xaaaaaaaaaaaaaaaaULL,
+ [2] = 0x5555555555555555ULL,
+ [3] = 0x0000000000000000ULL,
+ };
+ tmp = le64_to_cpu(*ptr) ^ search[state];
+ tmp &= (tmp >> 1);
+ tmp &= mask;
+ return tmp;
+}
+
+/**
* gfs2_bitfit - Find a free block in the bitmaps
* @buffer: the buffer that holds the bitmaps
* @buflen: the length (in bytes) of the buffer
@@ -28,61 +63,39 @@
*
* Return: the block number that was allocated
*/
-
-uint32_t gfs2_bitfit(unsigned char *buffer, unsigned int buflen,
- uint32_t goal, unsigned char old_state)
+unsigned long gfs2_bitfit(const unsigned char *buf, const unsigned int len,
+ unsigned long goal, unsigned char state)
{
- const uint8_t *byte, *start, *end;
- int bit, startbit;
- uint32_t g1, g2, misaligned;
- unsigned long *plong;
- unsigned long lskipval;
-
- lskipval = (old_state & GFS2_BLKST_USED) ? LBITSKIP00 : LBITSKIP55;
- g1 = (goal / GFS2_NBBY);
- start = buffer + g1;
- byte = start;
- end = buffer + buflen;
- g2 = ALIGN(g1, sizeof(unsigned long));
- plong = (unsigned long *)(buffer + g2);
- startbit = bit = (goal % GFS2_NBBY) * GFS2_BIT_SIZE;
- misaligned = g2 - g1;
- if (!misaligned)
- goto ulong_aligned;
-/* parse the bitmap a byte at a time */
-misaligned:
- while (byte < end) {
- if (((*byte >> bit) & GFS2_BIT_MASK) == old_state) {
- return goal +
- (((byte - start) * GFS2_NBBY) +
- ((bit - startbit) >> 1));
- }
- bit += GFS2_BIT_SIZE;
- if (bit >= GFS2_NBBY * GFS2_BIT_SIZE) {
- bit = 0;
- byte++;
- misaligned--;
- if (!misaligned) {
- plong = (unsigned long *)byte;
- goto ulong_aligned;
- }
- }
- }
- return BFITNOENT;
-
-/* parse the bitmap a unsigned long at a time */
-ulong_aligned:
- while ((unsigned char *)plong < end) {
- if (((*plong) & LBITMASK) != lskipval)
- break;
- plong++;
- }
- if ((unsigned char *)plong < end) {
- byte = (const uint8_t *)plong;
- misaligned += sizeof(unsigned long) - 1;
- goto misaligned;
+ unsigned long spoint = (goal << 1) & ((8 * sizeof(unsigned long)) - 1);
+ const unsigned long long *ptr = ((unsigned long long *)buf) + (goal >> 5);
+ const unsigned long long *end = (unsigned long long *)
+ (buf + ALIGN(len, sizeof(unsigned long long)));
+ unsigned long long tmp;
+ unsigned long long mask = 0x5555555555555555ULL;
+ unsigned long bit;
+
+ if (state > 3)
+ return 0;
+
+ /* Mask off bits we don't care about at the start of the search */
+ mask <<= spoint;
+ tmp = gfs2_bit_search(ptr, mask, state);
+ ptr++;
+ while(tmp == 0 && ptr < end) {
+ tmp = gfs2_bit_search(ptr, 0x5555555555555555ULL, state);
+ ptr++;
}
- return BFITNOENT;
+ /* Mask off any bits which are more than len bytes from the start */
+ if (ptr == end && (len & (sizeof(unsigned long long) - 1)))
+ tmp &= (((unsigned long long)~0) >>
+ (64 - 8 * (len & (sizeof(unsigned long long) - 1))));
+ /* Didn't find anything, so return */
+ if (tmp == 0)
+ return BFITNOENT;
+ ptr--;
+ bit = ffsll(tmp);
+ bit /= 2; /* two bits per entry in the bitmap */
+ return (((const unsigned char *)ptr - buf) * GFS2_NBBY) + bit;
}
/**
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 0c4bc8a..8835a4f 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -395,8 +395,9 @@ extern int fix_device_geometry(struct gfs2_sbd *sdp);
/* functions with blk #'s that are buffer relative */
extern uint32_t gfs2_bitcount(unsigned char *buffer, unsigned int buflen,
unsigned char state);
-extern uint32_t gfs2_bitfit(unsigned char *buffer, unsigned int buflen,
- uint32_t goal, unsigned char old_state);
+extern unsigned long gfs2_bitfit(const unsigned char *buffer,
+ const unsigned int buflen,
+ unsigned long goal, unsigned char old_state);
/* functions with blk #'s that are rgrp relative */
extern uint32_t gfs2_blkalloc_internal(struct rgrp_list *rgd, uint32_t goal,
13 years, 11 months
gfs2-utils: master - gfs2_edit restoremeta should not return 0 on failure
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitd...
Commit: 5395532f6ba4b69218f35e9624609b9c44e733ed
Parent: 3b88306556547f881df33a99858ef3d26d616b43
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Mon Jun 28 16:23:58 2010 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Mon Jun 28 16:38:25 2010 -0500
gfs2_edit restoremeta should not return 0 on failure
The gfs2_edit "restoremeta" function was always returning zero,
even when the restore was not successful. This made it difficult
to automate some gfs2 testing. This patch makes gfs2_edit return
the correct result from restoremeta.
rhbz#607321
---
gfs2/edit/savemeta.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 7af9e48..23c9fdc 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -911,5 +911,5 @@ void restoremeta(const char *in_fn, const char *out_device,
if (!printblocksonly)
close(sbd.device_fd);
- exit(0);
+ exit(error);
}
13 years, 11 months
cluster: RHEL6 - gfs2_edit restoremeta should not return 0 on failure
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 6571b0c8747f33ec244917bad1720ddab967c185
Parent: 4c496caf07b0254c7c604485d458b1b231255523
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Mon Jun 28 16:23:58 2010 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Mon Jun 28 16:27:46 2010 -0500
gfs2_edit restoremeta should not return 0 on failure
The gfs2_edit "restoremeta" function was always returning zero,
even when the restore was not successful. This made it difficult
to automate some gfs2 testing. This patch makes gfs2_edit return
the correct result from restoremeta.
rhbz#607321
---
gfs2/edit/savemeta.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 4f5b3c4..c052acf 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -909,5 +909,5 @@ void restoremeta(const char *in_fn, const char *out_device,
if (!printblocksonly)
close(sbd.device_fd);
- exit(0);
+ exit(error);
}
13 years, 11 months
cluster: STABLE3 - gfs2_edit restoremeta should not return 0 on failure
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 34e25eaec43373a8438b0985d8d98aaaa5edc3f5
Parent: 65a0fb947f3b6ca626fd6a75e05dffe786fe6747
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Mon Jun 28 16:23:58 2010 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Mon Jun 28 16:23:58 2010 -0500
gfs2_edit restoremeta should not return 0 on failure
The gfs2_edit "restoremeta" function was always returning zero,
even when the restore was not successful. This made it difficult
to automate some gfs2 testing. This patch makes gfs2_edit return
the correct result from restoremeta.
rhbz#607321
---
gfs2/edit/savemeta.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 4f5b3c4..c052acf 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -909,5 +909,5 @@ void restoremeta(const char *in_fn, const char *out_device,
if (!printblocksonly)
close(sbd.device_fd);
- exit(0);
+ exit(error);
}
13 years, 11 months
cluster: RHEL6 - gfs2 manual pages: gfs2_convert manpage and documentation updates
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 4c496caf07b0254c7c604485d458b1b231255523
Parent: 3d36ee013e11043800214f400fae6a6bebd2af41
Author: Abhijith Das <adas(a)redhat.com>
AuthorDate: Fri Jun 25 16:29:47 2010 -0500
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Mon Jun 28 17:23:37 2010 -0400
gfs2 manual pages: gfs2_convert manpage and documentation updates
The recent fixes/updates to gfs2_convert change its behavior
in a few cases such as handling of CDPNs, converting full
filesystems etc. This updates the manpage to reflect that.
Resolves: rhbz#601315
Signed-off-by: Abhi Das <adas(a)redhat.com>
---
gfs2/man/gfs2_convert.8 | 38 +++++++++++++++++++++++---------------
1 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/gfs2/man/gfs2_convert.8 b/gfs2/man/gfs2_convert.8
index a05a690..5969432 100644
--- a/gfs2/man/gfs2_convert.8
+++ b/gfs2/man/gfs2_convert.8
@@ -8,21 +8,13 @@ gfs2_convert - Convert a GFS1 filesystem to GFS2
[\fIOPTION\fR]... \fIDEVICE\fR
.SH DESCRIPTION
-gfs2_convert is used to convert a filesystem from GFS1 to GFS2. Do not
-attempt to convert a GFS1 filesystem which is not clean - the process
-of conversion will reinitialise the journals. We highly recommend that
-.B fsck.gfs
-is run successfully before attempting to convert a filesystem. Many
-of the on-disk structures are identical between GFS1 and GFS2, so
-the conversion process updates the journals, a few items of incompatible
-metadata (mostly indirect pointers and inodes) and adds the per-node
-directories required by the gfs2meta filesystem. The conversion process
-is performed in-place and does not require any extra disk space so that
-it is possible to successfully convert a GFS1 filesystem that is
-completely full.
-
-Always ensure you have a complete backup of the data on any filesystem
-before starting the conversion process.
+gfs2_convert is used to convert a filesystem from GFS1 to GFS2. It is
+required that the GFS1 filesystem be checked and fixed for errors using
+\fBgfs_fsck\fP and that the filesystem be backed up before
+attempting to convert it. The convert process is irreversible and any
+error encountered during the conversion can result in the abrupt
+termination of the program and consequently an unusable filesystem.
+See \fBNOTES\fP section below for more information.
.SH OPTIONS
.TP
@@ -58,3 +50,19 @@ changes.
gfs2_convert /dev/vg0/lvol0
This will convert the Global File System on the block device
"/dev/vg0/lvol0" to gfs2 format.
+
+.SH NOTES
+If gfs2_convert is interrupted for some reason other than a conversion
+failure, DO NOT run \fBgfs2_fsck\fP on this partially converted filesystem.
+When this occurs, reissue the gfs2_convert command on the partially converted
+filesystem to complete the conversion process.
+
+The GFS2 filesystem does not support Context-Dependent Path Names (CDPNs).
+gfs2_convert identifies such CDPNs and replaces them with empty directories
+with the same name. The administrator can use bind mounts on these
+directories to get the same effect as CDPNs.
+
+When converting full or nearly full filesystems, it is possible that there
+won't be enough space available to fit all the GFS2 filesystem data
+structures. In such cases, the size of all the journals is reduced uniformly
+such that everything fits in the available space.
13 years, 11 months
cluster: STABLE3 - Fix open flags so that logfile won't be truncated each time we open it.
by rohara
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 65a0fb947f3b6ca626fd6a75e05dffe786fe6747
Parent: 49d1ad101092e05efa2346917f3f0907ffdd3f28
Author: Ryan O'Hara <rohara(a)redhat.com>
AuthorDate: Mon Jun 28 15:59:27 2010 -0500
Committer: Ryan O'Hara <rohara(a)redhat.com>
CommitterDate: Mon Jun 28 16:03:45 2010 -0500
Fix open flags so that logfile won't be truncated each time we open it.
rhbz#608887
Signed-off-by: Ryan O'Hara <rohara(a)redhat.com>
---
fence/agents/scsi/fence_scsi.pl | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
index 59259cf..992a3eb 100644
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -583,7 +583,7 @@ else {
## and redirect STDOUT and STDERR to the logfile.
##
if (defined $opt_f) {
- open (LOG, ">$opt_f") or die "$!\n";
+ open (LOG, >">$opt_f") or die "$!\n";
open (STDOUT, ">&LOG");
open (STDERR, ">&LOG");
}
13 years, 11 months
cluster: RHEL6 - Fix open flags so that logfile won't be truncated each time we open it.
by rohara
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 3d36ee013e11043800214f400fae6a6bebd2af41
Parent: bb9f20a6bd89d4b018d5f1df8bbbfcd402061738
Author: Ryan O'Hara <rohara(a)redhat.com>
AuthorDate: Mon Jun 28 15:59:27 2010 -0500
Committer: Ryan O'Hara <rohara(a)redhat.com>
CommitterDate: Mon Jun 28 15:59:27 2010 -0500
Fix open flags so that logfile won't be truncated each time we open it.
rhbz#608887
Signed-off-by: Ryan O'Hara <rohara(a)redhat.com>
---
fence/agents/scsi/fence_scsi.pl | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
index 59259cf..992a3eb 100644
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -583,7 +583,7 @@ else {
## and redirect STDOUT and STDERR to the logfile.
##
if (defined $opt_f) {
- open (LOG, ">$opt_f") or die "$!\n";
+ open (LOG, >">$opt_f") or die "$!\n";
open (STDOUT, ">&LOG");
open (STDERR, ">&LOG");
}
13 years, 11 months