aboutsummaryrefslogtreecommitdiff
path: root/fs/gfs2
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-03-30 15:46:23 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2006-03-30 15:46:23 -0500
commite3167ded1f1b16424bc14d5673cdc5414f179970 (patch)
tree1b995e6387b230b1f447aabe30b689d091ee0b52 /fs/gfs2
parentcd45697f0ddbb58f3f83c29fe164713ee7765e21 (diff)
[GFS] Fix bug in endian conversion for metadata header
In some cases 16 bit functions were being used rather than 32 bit functions. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/dir.c6
-rw-r--r--fs/gfs2/log.c4
-rw-r--r--fs/gfs2/lops.c16
-rw-r--r--fs/gfs2/ondisk.c8
-rw-r--r--fs/gfs2/recovery.c4
-rw-r--r--fs/gfs2/util.h7
6 files changed, 22 insertions, 23 deletions
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index 9f17e7d05af..66917f2c64a 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -462,7 +462,7 @@ static int gfs2_dirent_offset(const void *buf)
BUG_ON(buf == NULL);
- switch(be16_to_cpu(h->mh_type)) {
+ switch(be32_to_cpu(h->mh_type)) {
case GFS2_METATYPE_LF:
offset = sizeof(struct gfs2_leaf);
break;
@@ -475,7 +475,7 @@ static int gfs2_dirent_offset(const void *buf)
return offset;
wrong_type:
printk(KERN_WARNING "gfs2_scan_dirent: wrong block type %u\n",
- be16_to_cpu(h->mh_type));
+ be32_to_cpu(h->mh_type));
return -1;
}
@@ -548,7 +548,7 @@ static int dirent_first(struct gfs2_inode *dip, struct buffer_head *bh,
{
struct gfs2_meta_header *h = (struct gfs2_meta_header *)bh->b_data;
- if (be16_to_cpu(h->mh_type) == GFS2_METATYPE_LF) {
+ if (be32_to_cpu(h->mh_type) == GFS2_METATYPE_LF) {
if (gfs2_meta_check(dip->i_sbd, bh))
return -EIO;
*dent = (struct gfs2_dirent *)(bh->b_data +
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index b103d9acf40..ea69376c00d 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -377,8 +377,8 @@ static void log_write_header(struct gfs2_sbd *sdp, uint32_t flags, int pull)
lh = (struct gfs2_log_header *)bh->b_data;
memset(lh, 0, sizeof(struct gfs2_log_header));
lh->lh_header.mh_magic = cpu_to_be32(GFS2_MAGIC);
- lh->lh_header.mh_type = cpu_to_be16(GFS2_METATYPE_LH);
- lh->lh_header.mh_format = cpu_to_be16(GFS2_FORMAT_LH);
+ lh->lh_header.mh_type = cpu_to_be32(GFS2_METATYPE_LH);
+ lh->lh_header.mh_format = cpu_to_be32(GFS2_FORMAT_LH);
lh->lh_sequence = be64_to_cpu(sdp->sd_log_sequence++);
lh->lh_flags = be32_to_cpu(flags);
lh->lh_tail = be32_to_cpu(tail);
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c
index 9d40e21f6ea..689c9101c0f 100644
--- a/fs/gfs2/lops.c
+++ b/fs/gfs2/lops.c
@@ -133,8 +133,8 @@ static void buf_lo_before_commit(struct gfs2_sbd *sdp)
ld = (struct gfs2_log_descriptor *)bh->b_data;
ptr = (__be64 *)(bh->b_data + offset);
ld->ld_header.mh_magic = cpu_to_be32(GFS2_MAGIC);
- ld->ld_header.mh_type = cpu_to_be16(GFS2_METATYPE_LD);
- ld->ld_header.mh_format = cpu_to_be16(GFS2_FORMAT_LD);
+ ld->ld_header.mh_type = cpu_to_be32(GFS2_METATYPE_LD);
+ ld->ld_header.mh_format = cpu_to_be32(GFS2_FORMAT_LD);
ld->ld_type = cpu_to_be32(GFS2_LOG_DESC_METADATA);
ld->ld_length = cpu_to_be32(num + 1);
ld->ld_data1 = cpu_to_be32(num);
@@ -291,8 +291,8 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp)
bh = gfs2_log_get_buf(sdp);
ld = (struct gfs2_log_descriptor *)bh->b_data;
ld->ld_header.mh_magic = cpu_to_be32(GFS2_MAGIC);
- ld->ld_header.mh_type = cpu_to_be16(GFS2_METATYPE_LD);
- ld->ld_header.mh_format = cpu_to_be16(GFS2_FORMAT_LD);
+ ld->ld_header.mh_type = cpu_to_be32(GFS2_METATYPE_LD);
+ ld->ld_header.mh_format = cpu_to_be32(GFS2_FORMAT_LD);
ld->ld_type = cpu_to_be32(GFS2_LOG_DESC_REVOKE);
ld->ld_length = cpu_to_be32(gfs2_struct2blk(sdp, sdp->sd_log_num_revoke,
sizeof(uint64_t)));
@@ -313,8 +313,8 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp)
bh = gfs2_log_get_buf(sdp);
mh = (struct gfs2_meta_header *)bh->b_data;
mh->mh_magic = cpu_to_be32(GFS2_MAGIC);
- mh->mh_type = cpu_to_be16(GFS2_METATYPE_LB);
- mh->mh_format = cpu_to_be16(GFS2_FORMAT_LB);
+ mh->mh_type = cpu_to_be32(GFS2_METATYPE_LB);
+ mh->mh_format = cpu_to_be32(GFS2_FORMAT_LB);
offset = sizeof(struct gfs2_meta_header);
}
@@ -576,9 +576,9 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp)
ld->ld_header.mh_magic =
cpu_to_be32(GFS2_MAGIC);
ld->ld_header.mh_type =
- cpu_to_be16(GFS2_METATYPE_LD);
+ cpu_to_be32(GFS2_METATYPE_LD);
ld->ld_header.mh_format =
- cpu_to_be16(GFS2_FORMAT_LD);
+ cpu_to_be32(GFS2_FORMAT_LD);
ld->ld_type =
cpu_to_be32(GFS2_LOG_DESC_JDATA);
ld->ld_length = cpu_to_be32(num + 1);
diff --git a/fs/gfs2/ondisk.c b/fs/gfs2/ondisk.c
index 3be060f1cbe..acfc944ce13 100644
--- a/fs/gfs2/ondisk.c
+++ b/fs/gfs2/ondisk.c
@@ -83,8 +83,8 @@ static void gfs2_meta_header_in(struct gfs2_meta_header *mh, char *buf)
struct gfs2_meta_header *str = (struct gfs2_meta_header *)buf;
mh->mh_magic = be32_to_cpu(str->mh_magic);
- mh->mh_type = be16_to_cpu(str->mh_type);
- mh->mh_format = be16_to_cpu(str->mh_format);
+ mh->mh_type = be32_to_cpu(str->mh_type);
+ mh->mh_format = be32_to_cpu(str->mh_format);
}
static void gfs2_meta_header_out(struct gfs2_meta_header *mh, char *buf)
@@ -92,8 +92,8 @@ static void gfs2_meta_header_out(struct gfs2_meta_header *mh, char *buf)
struct gfs2_meta_header *str = (struct gfs2_meta_header *)buf;
str->mh_magic = cpu_to_be32(mh->mh_magic);
- str->mh_type = cpu_to_be16(mh->mh_type);
- str->mh_format = cpu_to_be16(mh->mh_format);
+ str->mh_type = cpu_to_be32(mh->mh_type);
+ str->mh_format = cpu_to_be32(mh->mh_format);
}
void gfs2_meta_header_print(struct gfs2_meta_header *mh)
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c
index 6c7e2e880e3..68c85610fb5 100644
--- a/fs/gfs2/recovery.c
+++ b/fs/gfs2/recovery.c
@@ -324,7 +324,7 @@ static int foreach_descriptor(struct gfs2_jdesc *jd, unsigned int start,
ld = (struct gfs2_log_descriptor *)bh->b_data;
length = be32_to_cpu(ld->ld_length);
- if (be16_to_cpu(ld->ld_header.mh_type) == GFS2_METATYPE_LH) {
+ if (be32_to_cpu(ld->ld_header.mh_type) == GFS2_METATYPE_LH) {
struct gfs2_log_header lh;
error = get_log_header(jd, start, &lh);
if (!error) {
@@ -400,7 +400,7 @@ static int clean_journal(struct gfs2_jdesc *jd, struct gfs2_log_header *head)
memset(lh, 0, sizeof(struct gfs2_log_header));
lh->lh_header.mh_magic = cpu_to_be32(GFS2_MAGIC);
lh->lh_header.mh_type = cpu_to_be16(GFS2_METATYPE_LH);
- lh->lh_header.mh_format = cpu_to_be16(GFS2_FORMAT_LH);
+ lh->lh_header.mh_format = cpu_to_be32(GFS2_FORMAT_LH);
lh->lh_sequence = cpu_to_be64(head->lh_sequence + 1);
lh->lh_flags = cpu_to_be32(GFS2_LOG_HEAD_UNMOUNT);
lh->lh_blkno = cpu_to_be32(lblock);
diff --git a/fs/gfs2/util.h b/fs/gfs2/util.h
index addbe304993..4532dbab0a2 100644
--- a/fs/gfs2/util.h
+++ b/fs/gfs2/util.h
@@ -107,12 +107,11 @@ static inline int gfs2_metatype_check_i(struct gfs2_sbd *sdp,
{
struct gfs2_meta_header *mh = (struct gfs2_meta_header *)bh->b_data;
uint32_t magic = mh->mh_magic;
- uint16_t t = mh->mh_type;
+ uint16_t t = be32_to_cpu(mh->mh_type);
magic = be32_to_cpu(magic);
if (unlikely(magic != GFS2_MAGIC))
return gfs2_meta_check_ii(sdp, bh, "magic number", function,
file, line);
- t = be16_to_cpu(t);
if (unlikely(t != type))
return gfs2_metatype_check_ii(sdp, bh, type, t, function,
file, line);
@@ -127,8 +126,8 @@ static inline void gfs2_metatype_set(struct buffer_head *bh, uint16_t type,
{
struct gfs2_meta_header *mh;
mh = (struct gfs2_meta_header *)bh->b_data;
- mh->mh_type = cpu_to_be16(type);
- mh->mh_format = cpu_to_be16(format);
+ mh->mh_type = cpu_to_be32(type);
+ mh->mh_format = cpu_to_be32(format);
}