diff options
-rw-r--r-- | fs/gfs2/dir.c | 36 | ||||
-rw-r--r-- | include/linux/gfs2_ondisk.h | 42 |
2 files changed, 40 insertions, 38 deletions
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c index c77e18048d98..c32f7b3de662 100644 --- a/fs/gfs2/dir.c +++ b/fs/gfs2/dir.c | |||
@@ -397,11 +397,11 @@ static int dirent_next(struct gfs2_inode *dip, struct buffer_head *bh, | |||
397 | { | 397 | { |
398 | struct gfs2_dirent *tmp, *cur; | 398 | struct gfs2_dirent *tmp, *cur; |
399 | char *bh_end; | 399 | char *bh_end; |
400 | uint32_t cur_rec_len; | 400 | uint16_t cur_rec_len; |
401 | 401 | ||
402 | cur = *dent; | 402 | cur = *dent; |
403 | bh_end = bh->b_data + bh->b_size; | 403 | bh_end = bh->b_data + bh->b_size; |
404 | cur_rec_len = be32_to_cpu(cur->de_rec_len); | 404 | cur_rec_len = be16_to_cpu(cur->de_rec_len); |
405 | 405 | ||
406 | if ((char *)cur + cur_rec_len >= bh_end) { | 406 | if ((char *)cur + cur_rec_len >= bh_end) { |
407 | if ((char *)cur + cur_rec_len > bh_end) { | 407 | if ((char *)cur + cur_rec_len > bh_end) { |
@@ -413,7 +413,7 @@ static int dirent_next(struct gfs2_inode *dip, struct buffer_head *bh, | |||
413 | 413 | ||
414 | tmp = (struct gfs2_dirent *)((char *)cur + cur_rec_len); | 414 | tmp = (struct gfs2_dirent *)((char *)cur + cur_rec_len); |
415 | 415 | ||
416 | if ((char *)tmp + be32_to_cpu(tmp->de_rec_len) > bh_end) { | 416 | if ((char *)tmp + be16_to_cpu(tmp->de_rec_len) > bh_end) { |
417 | gfs2_consist_inode(dip); | 417 | gfs2_consist_inode(dip); |
418 | return -EIO; | 418 | return -EIO; |
419 | } | 419 | } |
@@ -440,7 +440,7 @@ static int dirent_next(struct gfs2_inode *dip, struct buffer_head *bh, | |||
440 | static void dirent_del(struct gfs2_inode *dip, struct buffer_head *bh, | 440 | static void dirent_del(struct gfs2_inode *dip, struct buffer_head *bh, |
441 | struct gfs2_dirent *prev, struct gfs2_dirent *cur) | 441 | struct gfs2_dirent *prev, struct gfs2_dirent *cur) |
442 | { | 442 | { |
443 | uint32_t cur_rec_len, prev_rec_len; | 443 | uint16_t cur_rec_len, prev_rec_len; |
444 | 444 | ||
445 | if (!cur->de_inum.no_addr) { | 445 | if (!cur->de_inum.no_addr) { |
446 | gfs2_consist_inode(dip); | 446 | gfs2_consist_inode(dip); |
@@ -460,8 +460,8 @@ static void dirent_del(struct gfs2_inode *dip, struct buffer_head *bh, | |||
460 | 460 | ||
461 | /* Combine this dentry with the previous one. */ | 461 | /* Combine this dentry with the previous one. */ |
462 | 462 | ||
463 | prev_rec_len = be32_to_cpu(prev->de_rec_len); | 463 | prev_rec_len = be16_to_cpu(prev->de_rec_len); |
464 | cur_rec_len = be32_to_cpu(cur->de_rec_len); | 464 | cur_rec_len = be16_to_cpu(cur->de_rec_len); |
465 | 465 | ||
466 | if ((char *)prev + prev_rec_len != (char *)cur) | 466 | if ((char *)prev + prev_rec_len != (char *)cur) |
467 | gfs2_consist_inode(dip); | 467 | gfs2_consist_inode(dip); |
@@ -469,7 +469,7 @@ static void dirent_del(struct gfs2_inode *dip, struct buffer_head *bh, | |||
469 | gfs2_consist_inode(dip); | 469 | gfs2_consist_inode(dip); |
470 | 470 | ||
471 | prev_rec_len += cur_rec_len; | 471 | prev_rec_len += cur_rec_len; |
472 | prev->de_rec_len = cpu_to_be32(prev_rec_len); | 472 | prev->de_rec_len = cpu_to_be16(prev_rec_len); |
473 | } | 473 | } |
474 | 474 | ||
475 | /** | 475 | /** |
@@ -513,7 +513,7 @@ int gfs2_dirent_alloc(struct gfs2_inode *dip, struct buffer_head *bh, | |||
513 | gfs2_trans_add_bh(dip->i_gl, bh, 1); | 513 | gfs2_trans_add_bh(dip->i_gl, bh, 1); |
514 | 514 | ||
515 | dent->de_rec_len = bh->b_size - offset; | 515 | dent->de_rec_len = bh->b_size - offset; |
516 | dent->de_rec_len = cpu_to_be32(dent->de_rec_len); | 516 | dent->de_rec_len = cpu_to_be16(dent->de_rec_len); |
517 | dent->de_name_len = name_len; | 517 | dent->de_name_len = name_len; |
518 | 518 | ||
519 | *dent_out = dent; | 519 | *dent_out = dent; |
@@ -521,9 +521,10 @@ int gfs2_dirent_alloc(struct gfs2_inode *dip, struct buffer_head *bh, | |||
521 | } | 521 | } |
522 | 522 | ||
523 | do { | 523 | do { |
524 | uint32_t cur_rec_len, cur_name_len; | 524 | uint16_t cur_rec_len; |
525 | uint32_t cur_name_len; | ||
525 | 526 | ||
526 | cur_rec_len = be32_to_cpu(dent->de_rec_len); | 527 | cur_rec_len = be16_to_cpu(dent->de_rec_len); |
527 | cur_name_len = dent->de_name_len; | 528 | cur_name_len = dent->de_name_len; |
528 | 529 | ||
529 | if ((!dent->de_inum.no_addr && cur_rec_len >= rec_len) || | 530 | if ((!dent->de_inum.no_addr && cur_rec_len >= rec_len) || |
@@ -536,11 +537,11 @@ int gfs2_dirent_alloc(struct gfs2_inode *dip, struct buffer_head *bh, | |||
536 | memset(new, 0, sizeof(struct gfs2_dirent)); | 537 | memset(new, 0, sizeof(struct gfs2_dirent)); |
537 | 538 | ||
538 | new->de_rec_len = cur_rec_len - GFS2_DIRENT_SIZE(cur_name_len); | 539 | new->de_rec_len = cur_rec_len - GFS2_DIRENT_SIZE(cur_name_len); |
539 | new->de_rec_len = cpu_to_be32(new->de_rec_len); | 540 | new->de_rec_len = cpu_to_be16(new->de_rec_len); |
540 | new->de_name_len = name_len; | 541 | new->de_name_len = name_len; |
541 | 542 | ||
542 | dent->de_rec_len = cur_rec_len - be32_to_cpu(new->de_rec_len); | 543 | dent->de_rec_len = cur_rec_len - be16_to_cpu(new->de_rec_len); |
543 | dent->de_rec_len = cpu_to_be32(dent->de_rec_len); | 544 | dent->de_rec_len = cpu_to_be16(dent->de_rec_len); |
544 | 545 | ||
545 | *dent_out = new; | 546 | *dent_out = new; |
546 | return 0; | 547 | return 0; |
@@ -589,9 +590,10 @@ static int dirent_fits(struct gfs2_inode *dip, struct buffer_head *bh, | |||
589 | return 1; | 590 | return 1; |
590 | 591 | ||
591 | do { | 592 | do { |
592 | uint32_t cur_rec_len, cur_name_len; | 593 | uint16_t cur_rec_len; |
594 | uint32_t cur_name_len; | ||
593 | 595 | ||
594 | cur_rec_len = be32_to_cpu(dent->de_rec_len); | 596 | cur_rec_len = be16_to_cpu(dent->de_rec_len); |
595 | cur_name_len = dent->de_name_len; | 597 | cur_name_len = dent->de_name_len; |
596 | 598 | ||
597 | if ((!dent->de_inum.no_addr && cur_rec_len >= rec_len) || | 599 | if ((!dent->de_inum.no_addr && cur_rec_len >= rec_len) || |
@@ -832,10 +834,10 @@ static int dir_make_exhash(struct gfs2_inode *dip) | |||
832 | /* Adjust the last dirent's record length | 834 | /* Adjust the last dirent's record length |
833 | (Remember that dent still points to the last entry.) */ | 835 | (Remember that dent still points to the last entry.) */ |
834 | 836 | ||
835 | dent->de_rec_len = be32_to_cpu(dent->de_rec_len) + | 837 | dent->de_rec_len = be16_to_cpu(dent->de_rec_len) + |
836 | sizeof(struct gfs2_dinode) - | 838 | sizeof(struct gfs2_dinode) - |
837 | sizeof(struct gfs2_leaf); | 839 | sizeof(struct gfs2_leaf); |
838 | dent->de_rec_len = cpu_to_be32(dent->de_rec_len); | 840 | dent->de_rec_len = cpu_to_be16(dent->de_rec_len); |
839 | 841 | ||
840 | brelse(bh); | 842 | brelse(bh); |
841 | 843 | ||
diff --git a/include/linux/gfs2_ondisk.h b/include/linux/gfs2_ondisk.h index 99d7ae4f6b7e..ec432e0c208d 100644 --- a/include/linux/gfs2_ondisk.h +++ b/include/linux/gfs2_ondisk.h | |||
@@ -1,11 +1,11 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. | 2 | * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. |
3 | * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. | 3 | * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. |
4 | * | 4 | * |
5 | * This copyrighted material is made available to anyone wishing to use, | 5 | * This copyrighted material is made available to anyone wishing to use, |
6 | * modify, copy, or redistribute it subject to the terms and conditions | 6 | * modify, copy, or redistribute it subject to the terms and conditions |
7 | * of the GNU General Public License v.2. | 7 | * of the GNU General Public License v.2. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #ifndef __GFS2_ONDISK_DOT_H__ | 10 | #ifndef __GFS2_ONDISK_DOT_H__ |
11 | #define __GFS2_ONDISK_DOT_H__ | 11 | #define __GFS2_ONDISK_DOT_H__ |
@@ -34,14 +34,14 @@ | |||
34 | #define GFS2_FORMAT_LH 800 | 34 | #define GFS2_FORMAT_LH 800 |
35 | #define GFS2_FORMAT_LD 900 | 35 | #define GFS2_FORMAT_LD 900 |
36 | #define GFS2_FORMAT_LB 1000 | 36 | #define GFS2_FORMAT_LB 1000 |
37 | #define GFS2_FORMAT_EA 1100 | 37 | #define GFS2_FORMAT_EA 1600 |
38 | #define GFS2_FORMAT_ED 1200 | 38 | #define GFS2_FORMAT_ED 1700 |
39 | #define GFS2_FORMAT_UT 1300 | 39 | #define GFS2_FORMAT_UT 1300 |
40 | #define GFS2_FORMAT_QC 1400 | 40 | #define GFS2_FORMAT_QC 1400 |
41 | /* These are format numbers for entities contained in files */ | 41 | /* These are format numbers for entities contained in files */ |
42 | #define GFS2_FORMAT_RI 1500 | 42 | #define GFS2_FORMAT_RI 1100 |
43 | #define GFS2_FORMAT_DE 1600 | 43 | #define GFS2_FORMAT_DE 1200 |
44 | #define GFS2_FORMAT_QU 1700 | 44 | #define GFS2_FORMAT_QU 1500 |
45 | /* These are part of the superblock */ | 45 | /* These are part of the superblock */ |
46 | #define GFS2_FORMAT_FS 1801 | 46 | #define GFS2_FORMAT_FS 1801 |
47 | #define GFS2_FORMAT_MULTI 1900 | 47 | #define GFS2_FORMAT_MULTI 1900 |
@@ -74,9 +74,9 @@ struct gfs2_inum { | |||
74 | #define GFS2_METATYPE_JD 7 | 74 | #define GFS2_METATYPE_JD 7 |
75 | #define GFS2_METATYPE_LH 8 | 75 | #define GFS2_METATYPE_LH 8 |
76 | #define GFS2_METATYPE_LD 9 | 76 | #define GFS2_METATYPE_LD 9 |
77 | #define GFS2_METATYPE_LB 10 | 77 | #define GFS2_METATYPE_LB 12 |
78 | #define GFS2_METATYPE_EA 11 | 78 | #define GFS2_METATYPE_EA 10 |
79 | #define GFS2_METATYPE_ED 12 | 79 | #define GFS2_METATYPE_ED 11 |
80 | #define GFS2_METATYPE_UT 13 | 80 | #define GFS2_METATYPE_UT 13 |
81 | #define GFS2_METATYPE_QC 14 | 81 | #define GFS2_METATYPE_QC 14 |
82 | 82 | ||
@@ -181,6 +181,7 @@ struct gfs2_quota { | |||
181 | __be64 qu_limit; | 181 | __be64 qu_limit; |
182 | __be64 qu_warn; | 182 | __be64 qu_warn; |
183 | __be64 qu_value; | 183 | __be64 qu_value; |
184 | __u8 qu_reserved[64]; | ||
184 | }; | 185 | }; |
185 | 186 | ||
186 | /* | 187 | /* |
@@ -260,11 +261,10 @@ struct gfs2_dinode { | |||
260 | struct gfs2_dirent { | 261 | struct gfs2_dirent { |
261 | struct gfs2_inum de_inum; | 262 | struct gfs2_inum de_inum; |
262 | __be32 de_hash; | 263 | __be32 de_hash; |
263 | __be32 de_rec_len; | 264 | __be16 de_rec_len; |
264 | __u8 de_name_len; | 265 | __be16 de_name_len; |
265 | __u8 de_type; | 266 | __be16 de_type; |
266 | __u16 __pad1; | 267 | __u8 __pad[14]; |
267 | __u32 __pad2; | ||
268 | }; | 268 | }; |
269 | 269 | ||
270 | /* | 270 | /* |
@@ -279,7 +279,7 @@ struct gfs2_leaf { | |||
279 | __be32 lf_dirent_format; /* Format of the dirents */ | 279 | __be32 lf_dirent_format; /* Format of the dirents */ |
280 | __be64 lf_next; /* Next leaf, if overflow */ | 280 | __be64 lf_next; /* Next leaf, if overflow */ |
281 | 281 | ||
282 | __u8 lf_reserved[32]; | 282 | __u8 lf_reserved[64]; |
283 | }; | 283 | }; |
284 | 284 | ||
285 | /* | 285 | /* |