aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/gfs2/inode.c25
-rw-r--r--fs/gfs2/ondisk.c22
-rw-r--r--include/linux/gfs2_ondisk.h5
3 files changed, 20 insertions, 32 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 4c5d286fefdb..7ba05fc553aa 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -208,13 +208,18 @@ fail:
208 return ERR_PTR(error); 208 return ERR_PTR(error);
209} 209}
210 210
211static void gfs2_dinode_in(struct gfs2_inode *ip, const void *buf) 211static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
212{ 212{
213 struct gfs2_dinode_host *di = &ip->i_di; 213 struct gfs2_dinode_host *di = &ip->i_di;
214 const struct gfs2_dinode *str = buf; 214 const struct gfs2_dinode *str = buf;
215 215
216 gfs2_meta_header_in(&di->di_header, buf); 216 if (ip->i_num.no_addr != be64_to_cpu(str->di_num.no_addr)) {
217 gfs2_inum_in(&di->di_num, &str->di_num); 217 if (gfs2_consist_inode(ip))
218 gfs2_dinode_print(ip);
219 return -EIO;
220 }
221 if (ip->i_num.no_formal_ino != be64_to_cpu(str->di_num.no_formal_ino))
222 return -ESTALE;
218 223
219 di->di_mode = be32_to_cpu(str->di_mode); 224 di->di_mode = be32_to_cpu(str->di_mode);
220 di->di_uid = be32_to_cpu(str->di_uid); 225 di->di_uid = be32_to_cpu(str->di_uid);
@@ -240,6 +245,7 @@ static void gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
240 di->di_entries = be32_to_cpu(str->di_entries); 245 di->di_entries = be32_to_cpu(str->di_entries);
241 246
242 di->di_eattr = be64_to_cpu(str->di_eattr); 247 di->di_eattr = be64_to_cpu(str->di_eattr);
248 return 0;
243} 249}
244 250
245/** 251/**
@@ -263,21 +269,12 @@ int gfs2_inode_refresh(struct gfs2_inode *ip)
263 return -EIO; 269 return -EIO;
264 } 270 }
265 271
266 gfs2_dinode_in(ip, dibh->b_data); 272 error = gfs2_dinode_in(ip, dibh->b_data);
267 273
268 brelse(dibh); 274 brelse(dibh);
269
270 if (ip->i_num.no_addr != ip->i_di.di_num.no_addr) {
271 if (gfs2_consist_inode(ip))
272 gfs2_dinode_print(ip);
273 return -EIO;
274 }
275 if (ip->i_num.no_formal_ino != ip->i_di.di_num.no_formal_ino)
276 return -ESTALE;
277
278 ip->i_vn = ip->i_gl->gl_vn; 275 ip->i_vn = ip->i_gl->gl_vn;
279 276
280 return 0; 277 return error;
281} 278}
282 279
283int gfs2_dinode_dealloc(struct gfs2_inode *ip) 280int gfs2_dinode_dealloc(struct gfs2_inode *ip)
diff --git a/fs/gfs2/ondisk.c b/fs/gfs2/ondisk.c
index 77bed440833d..4bc590edb60e 100644
--- a/fs/gfs2/ondisk.c
+++ b/fs/gfs2/ondisk.c
@@ -56,7 +56,7 @@ static void gfs2_inum_print(const struct gfs2_inum_host *no)
56 printk(KERN_INFO " no_addr = %llu\n", (unsigned long long)no->no_addr); 56 printk(KERN_INFO " no_addr = %llu\n", (unsigned long long)no->no_addr);
57} 57}
58 58
59void gfs2_meta_header_in(struct gfs2_meta_header_host *mh, const void *buf) 59static void gfs2_meta_header_in(struct gfs2_meta_header_host *mh, const void *buf)
60{ 60{
61 const struct gfs2_meta_header *str = buf; 61 const struct gfs2_meta_header *str = buf;
62 62
@@ -74,13 +74,6 @@ static void gfs2_meta_header_out(const struct gfs2_meta_header_host *mh, void *b
74 str->mh_format = cpu_to_be32(mh->mh_format); 74 str->mh_format = cpu_to_be32(mh->mh_format);
75} 75}
76 76
77static void gfs2_meta_header_print(const struct gfs2_meta_header_host *mh)
78{
79 pv(mh, mh_magic, "0x%.8X");
80 pv(mh, mh_type, "%u");
81 pv(mh, mh_format, "%u");
82}
83
84void gfs2_sb_in(struct gfs2_sb_host *sb, const void *buf) 77void gfs2_sb_in(struct gfs2_sb_host *sb, const void *buf)
85{ 78{
86 const struct gfs2_sb *str = buf; 79 const struct gfs2_sb *str = buf;
@@ -160,8 +153,13 @@ void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf)
160 const struct gfs2_dinode_host *di = &ip->i_di; 153 const struct gfs2_dinode_host *di = &ip->i_di;
161 struct gfs2_dinode *str = buf; 154 struct gfs2_dinode *str = buf;
162 155
163 gfs2_meta_header_out(&di->di_header, buf); 156 str->di_header.mh_magic = cpu_to_be32(GFS2_MAGIC);
164 gfs2_inum_out(&di->di_num, (char *)&str->di_num); 157 str->di_header.mh_type = cpu_to_be32(GFS2_METATYPE_DI);
158 str->di_header.__pad0 = 0;
159 str->di_header.mh_format = cpu_to_be32(GFS2_FORMAT_DI);
160 str->di_header.__pad1 = 0;
161
162 gfs2_inum_out(&ip->i_num, &str->di_num);
165 163
166 str->di_mode = cpu_to_be32(di->di_mode); 164 str->di_mode = cpu_to_be32(di->di_mode);
167 str->di_uid = cpu_to_be32(di->di_uid); 165 str->di_uid = cpu_to_be32(di->di_uid);
@@ -187,15 +185,13 @@ void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf)
187 str->di_entries = cpu_to_be32(di->di_entries); 185 str->di_entries = cpu_to_be32(di->di_entries);
188 186
189 str->di_eattr = cpu_to_be64(di->di_eattr); 187 str->di_eattr = cpu_to_be64(di->di_eattr);
190
191} 188}
192 189
193void gfs2_dinode_print(const struct gfs2_inode *ip) 190void gfs2_dinode_print(const struct gfs2_inode *ip)
194{ 191{
195 const struct gfs2_dinode_host *di = &ip->i_di; 192 const struct gfs2_dinode_host *di = &ip->i_di;
196 193
197 gfs2_meta_header_print(&di->di_header); 194 gfs2_inum_print(&ip->i_num);
198 gfs2_inum_print(&di->di_num);
199 195
200 pv(di, di_mode, "0%o"); 196 pv(di, di_mode, "0%o");
201 pv(di, di_uid, "%u"); 197 pv(di, di_uid, "%u");
diff --git a/include/linux/gfs2_ondisk.h b/include/linux/gfs2_ondisk.h
index cf4c655d0d5f..c0e76fc718c7 100644
--- a/include/linux/gfs2_ondisk.h
+++ b/include/linux/gfs2_ondisk.h
@@ -322,10 +322,6 @@ struct gfs2_dinode {
322}; 322};
323 323
324struct gfs2_dinode_host { 324struct gfs2_dinode_host {
325 struct gfs2_meta_header_host di_header;
326
327 struct gfs2_inum_host di_num;
328
329 __u32 di_mode; /* mode of file */ 325 __u32 di_mode; /* mode of file */
330 __u32 di_uid; /* owner's user id */ 326 __u32 di_uid; /* owner's user id */
331 __u32 di_gid; /* owner's group id */ 327 __u32 di_gid; /* owner's group id */
@@ -528,7 +524,6 @@ struct gfs2_quota_change_host {
528 524
529extern void gfs2_inum_in(struct gfs2_inum_host *no, const void *buf); 525extern void gfs2_inum_in(struct gfs2_inum_host *no, const void *buf);
530extern void gfs2_inum_out(const struct gfs2_inum_host *no, void *buf); 526extern void gfs2_inum_out(const struct gfs2_inum_host *no, void *buf);
531extern void gfs2_meta_header_in(struct gfs2_meta_header_host *mh, const void *buf);
532extern void gfs2_sb_in(struct gfs2_sb_host *sb, const void *buf); 527extern void gfs2_sb_in(struct gfs2_sb_host *sb, const void *buf);
533extern void gfs2_rindex_in(struct gfs2_rindex_host *ri, const void *buf); 528extern void gfs2_rindex_in(struct gfs2_rindex_host *ri, const void *buf);
534extern void gfs2_rindex_out(const struct gfs2_rindex_host *ri, void *buf); 529extern void gfs2_rindex_out(const struct gfs2_rindex_host *ri, void *buf);