diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/xfs_dinode.h | 104 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_sf.h | 7 | ||||
-rw-r--r-- | fs/xfs/xfs_ialloc.c | 8 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.c | 85 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.h | 7 | ||||
-rw-r--r-- | fs/xfs/xfs_inode_item.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_itable.c | 20 | ||||
-rw-r--r-- | fs/xfs/xfs_log_recover.c | 29 | ||||
-rw-r--r-- | fs/xfs/xfs_mount.c | 3 |
9 files changed, 124 insertions, 141 deletions
diff --git a/fs/xfs/xfs_dinode.h b/fs/xfs/xfs_dinode.h index 10f9204b81eb..0b7ebf922aff 100644 --- a/fs/xfs/xfs_dinode.h +++ b/fs/xfs/xfs_dinode.h | |||
@@ -18,32 +18,32 @@ | |||
18 | #ifndef __XFS_DINODE_H__ | 18 | #ifndef __XFS_DINODE_H__ |
19 | #define __XFS_DINODE_H__ | 19 | #define __XFS_DINODE_H__ |
20 | 20 | ||
21 | struct xfs_buf; | ||
22 | struct xfs_mount; | ||
23 | |||
24 | #define XFS_DINODE_VERSION_1 1 | 21 | #define XFS_DINODE_VERSION_1 1 |
25 | #define XFS_DINODE_VERSION_2 2 | 22 | #define XFS_DINODE_VERSION_2 2 |
26 | #define XFS_DINODE_GOOD_VERSION(v) \ | 23 | #define XFS_DINODE_GOOD_VERSION(v) \ |
27 | (((v) == XFS_DINODE_VERSION_1 || (v) == XFS_DINODE_VERSION_2)) | 24 | (((v) == XFS_DINODE_VERSION_1 || (v) == XFS_DINODE_VERSION_2)) |
28 | #define XFS_DINODE_MAGIC 0x494e /* 'IN' */ | 25 | #define XFS_DINODE_MAGIC 0x494e /* 'IN' */ |
29 | 26 | ||
30 | /* | ||
31 | * Disk inode structure. | ||
32 | * This is just the header; the inode is expanded to fill a variable size | ||
33 | * with the last field expanding. It is split into the core and "other" | ||
34 | * because we only need the core part in the in-core inode. | ||
35 | */ | ||
36 | typedef struct xfs_timestamp { | 27 | typedef struct xfs_timestamp { |
37 | __be32 t_sec; /* timestamp seconds */ | 28 | __be32 t_sec; /* timestamp seconds */ |
38 | __be32 t_nsec; /* timestamp nanoseconds */ | 29 | __be32 t_nsec; /* timestamp nanoseconds */ |
39 | } xfs_timestamp_t; | 30 | } xfs_timestamp_t; |
40 | 31 | ||
41 | /* | 32 | /* |
42 | * Note: Coordinate changes to this structure with the XFS_DI_* #defines | 33 | * On-disk inode structure. |
43 | * below, the offsets table in xfs_ialloc_log_di() and struct xfs_icdinode | 34 | * |
44 | * in xfs_inode.h. | 35 | * This is just the header or "dinode core", the inode is expanded to fill a |
36 | * variable size the leftover area split into a data and an attribute fork. | ||
37 | * The format of the data and attribute fork depends on the format of the | ||
38 | * inode as indicated by di_format and di_aformat. To access the data and | ||
39 | * attribute use the XFS_DFORK_PTR, XFS_DFORK_DPTR, and XFS_DFORK_PTR macros | ||
40 | * below. | ||
41 | * | ||
42 | * There is a very similar struct icdinode in xfs_inode which matches the | ||
43 | * layout of the first 96 bytes of this structure, but is kept in native | ||
44 | * format instead of big endian. | ||
45 | */ | 45 | */ |
46 | typedef struct xfs_dinode_core { | 46 | typedef struct xfs_dinode { |
47 | __be16 di_magic; /* inode magic # = XFS_DINODE_MAGIC */ | 47 | __be16 di_magic; /* inode magic # = XFS_DINODE_MAGIC */ |
48 | __be16 di_mode; /* mode and type of file */ | 48 | __be16 di_mode; /* mode and type of file */ |
49 | __u8 di_version; /* inode version */ | 49 | __u8 di_version; /* inode version */ |
@@ -69,33 +69,12 @@ typedef struct xfs_dinode_core { | |||
69 | __be16 di_dmstate; /* DMIG state info */ | 69 | __be16 di_dmstate; /* DMIG state info */ |
70 | __be16 di_flags; /* random flags, XFS_DIFLAG_... */ | 70 | __be16 di_flags; /* random flags, XFS_DIFLAG_... */ |
71 | __be32 di_gen; /* generation number */ | 71 | __be32 di_gen; /* generation number */ |
72 | } xfs_dinode_core_t; | ||
73 | 72 | ||
74 | #define DI_MAX_FLUSH 0xffff | 73 | /* di_next_unlinked is the only non-core field in the old dinode */ |
74 | __be32 di_next_unlinked;/* agi unlinked list ptr */ | ||
75 | } __attribute__((packed)) xfs_dinode_t; | ||
75 | 76 | ||
76 | typedef struct xfs_dinode | 77 | #define DI_MAX_FLUSH 0xffff |
77 | { | ||
78 | xfs_dinode_core_t di_core; | ||
79 | /* | ||
80 | * In adding anything between the core and the union, be | ||
81 | * sure to update the macros like XFS_LITINO below. | ||
82 | */ | ||
83 | __be32 di_next_unlinked;/* agi unlinked list ptr */ | ||
84 | union { | ||
85 | xfs_bmdr_block_t di_bmbt; /* btree root block */ | ||
86 | xfs_bmbt_rec_32_t di_bmx[1]; /* extent list */ | ||
87 | xfs_dir2_sf_t di_dir2sf; /* shortform directory v2 */ | ||
88 | char di_c[1]; /* local contents */ | ||
89 | __be32 di_dev; /* device for S_IFCHR/S_IFBLK */ | ||
90 | uuid_t di_muuid; /* mount point value */ | ||
91 | char di_symlink[1]; /* local symbolic link */ | ||
92 | } di_u; | ||
93 | union { | ||
94 | xfs_bmdr_block_t di_abmbt; /* btree root block */ | ||
95 | xfs_bmbt_rec_32_t di_abmx[1]; /* extent list */ | ||
96 | xfs_attr_shortform_t di_attrsf; /* shortform attribute list */ | ||
97 | } di_a; | ||
98 | } xfs_dinode_t; | ||
99 | 78 | ||
100 | /* | 79 | /* |
101 | * The 32 bit link count in the inode theoretically maxes out at UINT_MAX. | 80 | * The 32 bit link count in the inode theoretically maxes out at UINT_MAX. |
@@ -108,14 +87,12 @@ typedef struct xfs_dinode | |||
108 | /* | 87 | /* |
109 | * Values for di_format | 88 | * Values for di_format |
110 | */ | 89 | */ |
111 | typedef enum xfs_dinode_fmt | 90 | typedef enum xfs_dinode_fmt { |
112 | { | 91 | XFS_DINODE_FMT_DEV, /* xfs_dev_t */ |
113 | XFS_DINODE_FMT_DEV, /* CHR, BLK: di_dev */ | 92 | XFS_DINODE_FMT_LOCAL, /* bulk data */ |
114 | XFS_DINODE_FMT_LOCAL, /* DIR, REG: di_c */ | 93 | XFS_DINODE_FMT_EXTENTS, /* struct xfs_bmbt_rec */ |
115 | /* LNK: di_symlink */ | 94 | XFS_DINODE_FMT_BTREE, /* struct xfs_bmdr_block */ |
116 | XFS_DINODE_FMT_EXTENTS, /* DIR, REG, LNK: di_bmx */ | 95 | XFS_DINODE_FMT_UUID /* uuid_t */ |
117 | XFS_DINODE_FMT_BTREE, /* DIR, REG, LNK: di_bmbt */ | ||
118 | XFS_DINODE_FMT_UUID /* MNT: di_uuid */ | ||
119 | } xfs_dinode_fmt_t; | 96 | } xfs_dinode_fmt_t; |
120 | 97 | ||
121 | /* | 98 | /* |
@@ -136,8 +113,8 @@ typedef enum xfs_dinode_fmt | |||
136 | /* | 113 | /* |
137 | * Inode data & attribute fork sizes, per inode. | 114 | * Inode data & attribute fork sizes, per inode. |
138 | */ | 115 | */ |
139 | #define XFS_DFORK_Q(dip) ((dip)->di_core.di_forkoff != 0) | 116 | #define XFS_DFORK_Q(dip) ((dip)->di_forkoff != 0) |
140 | #define XFS_DFORK_BOFF(dip) ((int)((dip)->di_core.di_forkoff << 3)) | 117 | #define XFS_DFORK_BOFF(dip) ((int)((dip)->di_forkoff << 3)) |
141 | 118 | ||
142 | #define XFS_DFORK_DSIZE(dip,mp) \ | 119 | #define XFS_DFORK_DSIZE(dip,mp) \ |
143 | (XFS_DFORK_Q(dip) ? \ | 120 | (XFS_DFORK_Q(dip) ? \ |
@@ -152,23 +129,42 @@ typedef enum xfs_dinode_fmt | |||
152 | XFS_DFORK_DSIZE(dip, mp) : \ | 129 | XFS_DFORK_DSIZE(dip, mp) : \ |
153 | XFS_DFORK_ASIZE(dip, mp)) | 130 | XFS_DFORK_ASIZE(dip, mp)) |
154 | 131 | ||
155 | #define XFS_DFORK_DPTR(dip) ((dip)->di_u.di_c) | 132 | /* |
133 | * Return pointers to the data or attribute forks. | ||
134 | */ | ||
135 | #define XFS_DFORK_DPTR(dip) \ | ||
136 | ((char *)(dip) + sizeof(struct xfs_dinode)) | ||
156 | #define XFS_DFORK_APTR(dip) \ | 137 | #define XFS_DFORK_APTR(dip) \ |
157 | ((dip)->di_u.di_c + XFS_DFORK_BOFF(dip)) | 138 | (XFS_DFORK_DPTR(dip) + XFS_DFORK_BOFF(dip)) |
158 | #define XFS_DFORK_PTR(dip,w) \ | 139 | #define XFS_DFORK_PTR(dip,w) \ |
159 | ((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR(dip) : XFS_DFORK_APTR(dip)) | 140 | ((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR(dip) : XFS_DFORK_APTR(dip)) |
141 | |||
160 | #define XFS_DFORK_FORMAT(dip,w) \ | 142 | #define XFS_DFORK_FORMAT(dip,w) \ |
161 | ((w) == XFS_DATA_FORK ? \ | 143 | ((w) == XFS_DATA_FORK ? \ |
162 | (dip)->di_core.di_format : \ | 144 | (dip)->di_format : \ |
163 | (dip)->di_core.di_aformat) | 145 | (dip)->di_aformat) |
164 | #define XFS_DFORK_NEXTENTS(dip,w) \ | 146 | #define XFS_DFORK_NEXTENTS(dip,w) \ |
165 | ((w) == XFS_DATA_FORK ? \ | 147 | ((w) == XFS_DATA_FORK ? \ |
166 | be32_to_cpu((dip)->di_core.di_nextents) : \ | 148 | be32_to_cpu((dip)->di_nextents) : \ |
167 | be16_to_cpu((dip)->di_core.di_anextents)) | 149 | be16_to_cpu((dip)->di_anextents)) |
168 | 150 | ||
169 | #define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)XFS_BUF_PTR(bp)) | 151 | #define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)XFS_BUF_PTR(bp)) |
170 | 152 | ||
171 | /* | 153 | /* |
154 | * For block and character special files the 32bit dev_t is stored at the | ||
155 | * beginning of the data fork. | ||
156 | */ | ||
157 | static inline xfs_dev_t xfs_dinode_get_rdev(struct xfs_dinode *dip) | ||
158 | { | ||
159 | return be32_to_cpu(*(__be32 *)XFS_DFORK_DPTR(dip)); | ||
160 | } | ||
161 | |||
162 | static inline void xfs_dinode_put_rdev(struct xfs_dinode *dip, xfs_dev_t rdev) | ||
163 | { | ||
164 | *(__be32 *)XFS_DFORK_DPTR(dip) = cpu_to_be32(rdev); | ||
165 | } | ||
166 | |||
167 | /* | ||
172 | * Values for di_flags | 168 | * Values for di_flags |
173 | * There should be a one-to-one correspondence between these flags and the | 169 | * There should be a one-to-one correspondence between these flags and the |
174 | * XFS_XFLAG_s. | 170 | * XFS_XFLAG_s. |
diff --git a/fs/xfs/xfs_dir2_sf.h b/fs/xfs/xfs_dir2_sf.h index deecc9d238f8..6ac44b550d39 100644 --- a/fs/xfs/xfs_dir2_sf.h +++ b/fs/xfs/xfs_dir2_sf.h | |||
@@ -34,13 +34,6 @@ struct xfs_mount; | |||
34 | struct xfs_trans; | 34 | struct xfs_trans; |
35 | 35 | ||
36 | /* | 36 | /* |
37 | * Maximum size of a shortform directory. | ||
38 | */ | ||
39 | #define XFS_DIR2_SF_MAX_SIZE \ | ||
40 | (XFS_DINODE_MAX_SIZE - (uint)sizeof(xfs_dinode_core_t) - \ | ||
41 | (uint)sizeof(xfs_agino_t)) | ||
42 | |||
43 | /* | ||
44 | * Inode number stored as 8 8-bit values. | 37 | * Inode number stored as 8 8-bit values. |
45 | */ | 38 | */ |
46 | typedef struct { __uint8_t i[8]; } xfs_dir2_ino8_t; | 39 | typedef struct { __uint8_t i[8]; } xfs_dir2_ino8_t; |
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c index 86d463ee7b9b..47e94288fcbf 100644 --- a/fs/xfs/xfs_ialloc.c +++ b/fs/xfs/xfs_ialloc.c | |||
@@ -355,12 +355,12 @@ xfs_ialloc_ag_alloc( | |||
355 | xfs_biozero(fbuf, 0, ninodes << args.mp->m_sb.sb_inodelog); | 355 | xfs_biozero(fbuf, 0, ninodes << args.mp->m_sb.sb_inodelog); |
356 | for (i = 0; i < ninodes; i++) { | 356 | for (i = 0; i < ninodes; i++) { |
357 | int ioffset = i << args.mp->m_sb.sb_inodelog; | 357 | int ioffset = i << args.mp->m_sb.sb_inodelog; |
358 | uint isize = sizeof(xfs_dinode_t) + sizeof(__be32); | 358 | uint isize = sizeof(struct xfs_dinode); |
359 | 359 | ||
360 | free = XFS_MAKE_IPTR(args.mp, fbuf, i); | 360 | free = XFS_MAKE_IPTR(args.mp, fbuf, i); |
361 | free->di_core.di_magic = cpu_to_be16(XFS_DINODE_MAGIC); | 361 | free->di_magic = cpu_to_be16(XFS_DINODE_MAGIC); |
362 | free->di_core.di_version = version; | 362 | free->di_version = version; |
363 | free->di_core.di_gen = cpu_to_be32(gen); | 363 | free->di_gen = cpu_to_be32(gen); |
364 | free->di_next_unlinked = cpu_to_be32(NULLAGINO); | 364 | free->di_next_unlinked = cpu_to_be32(NULLAGINO); |
365 | xfs_trans_log_buf(tp, fbuf, ioffset, ioffset + isize - 1); | 365 | xfs_trans_log_buf(tp, fbuf, ioffset, ioffset + isize - 1); |
366 | } | 366 | } |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 46b0526acd4e..1d2912dc5226 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -174,8 +174,8 @@ xfs_imap_to_bp( | |||
174 | 174 | ||
175 | dip = (xfs_dinode_t *)xfs_buf_offset(bp, | 175 | dip = (xfs_dinode_t *)xfs_buf_offset(bp, |
176 | (i << mp->m_sb.sb_inodelog)); | 176 | (i << mp->m_sb.sb_inodelog)); |
177 | di_ok = be16_to_cpu(dip->di_core.di_magic) == XFS_DINODE_MAGIC && | 177 | di_ok = be16_to_cpu(dip->di_magic) == XFS_DINODE_MAGIC && |
178 | XFS_DINODE_GOOD_VERSION(dip->di_core.di_version); | 178 | XFS_DINODE_GOOD_VERSION(dip->di_version); |
179 | if (unlikely(XFS_TEST_ERROR(!di_ok, mp, | 179 | if (unlikely(XFS_TEST_ERROR(!di_ok, mp, |
180 | XFS_ERRTAG_ITOBP_INOTOBP, | 180 | XFS_ERRTAG_ITOBP_INOTOBP, |
181 | XFS_RANDOM_ITOBP_INOTOBP))) { | 181 | XFS_RANDOM_ITOBP_INOTOBP))) { |
@@ -191,7 +191,7 @@ xfs_imap_to_bp( | |||
191 | "daddr %lld #%d (magic=%x)", | 191 | "daddr %lld #%d (magic=%x)", |
192 | XFS_BUFTARG_NAME(mp->m_ddev_targp), | 192 | XFS_BUFTARG_NAME(mp->m_ddev_targp), |
193 | (unsigned long long)imap->im_blkno, i, | 193 | (unsigned long long)imap->im_blkno, i, |
194 | be16_to_cpu(dip->di_core.di_magic)); | 194 | be16_to_cpu(dip->di_magic)); |
195 | #endif | 195 | #endif |
196 | xfs_trans_brelse(tp, bp); | 196 | xfs_trans_brelse(tp, bp); |
197 | return XFS_ERROR(EFSCORRUPTED); | 197 | return XFS_ERROR(EFSCORRUPTED); |
@@ -350,26 +350,26 @@ xfs_iformat( | |||
350 | XFS_IFORK_DSIZE(ip) / (uint)sizeof(xfs_bmbt_rec_t); | 350 | XFS_IFORK_DSIZE(ip) / (uint)sizeof(xfs_bmbt_rec_t); |
351 | error = 0; | 351 | error = 0; |
352 | 352 | ||
353 | if (unlikely(be32_to_cpu(dip->di_core.di_nextents) + | 353 | if (unlikely(be32_to_cpu(dip->di_nextents) + |
354 | be16_to_cpu(dip->di_core.di_anextents) > | 354 | be16_to_cpu(dip->di_anextents) > |
355 | be64_to_cpu(dip->di_core.di_nblocks))) { | 355 | be64_to_cpu(dip->di_nblocks))) { |
356 | xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, | 356 | xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, |
357 | "corrupt dinode %Lu, extent total = %d, nblocks = %Lu.", | 357 | "corrupt dinode %Lu, extent total = %d, nblocks = %Lu.", |
358 | (unsigned long long)ip->i_ino, | 358 | (unsigned long long)ip->i_ino, |
359 | (int)(be32_to_cpu(dip->di_core.di_nextents) + | 359 | (int)(be32_to_cpu(dip->di_nextents) + |
360 | be16_to_cpu(dip->di_core.di_anextents)), | 360 | be16_to_cpu(dip->di_anextents)), |
361 | (unsigned long long) | 361 | (unsigned long long) |
362 | be64_to_cpu(dip->di_core.di_nblocks)); | 362 | be64_to_cpu(dip->di_nblocks)); |
363 | XFS_CORRUPTION_ERROR("xfs_iformat(1)", XFS_ERRLEVEL_LOW, | 363 | XFS_CORRUPTION_ERROR("xfs_iformat(1)", XFS_ERRLEVEL_LOW, |
364 | ip->i_mount, dip); | 364 | ip->i_mount, dip); |
365 | return XFS_ERROR(EFSCORRUPTED); | 365 | return XFS_ERROR(EFSCORRUPTED); |
366 | } | 366 | } |
367 | 367 | ||
368 | if (unlikely(dip->di_core.di_forkoff > ip->i_mount->m_sb.sb_inodesize)) { | 368 | if (unlikely(dip->di_forkoff > ip->i_mount->m_sb.sb_inodesize)) { |
369 | xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, | 369 | xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, |
370 | "corrupt dinode %Lu, forkoff = 0x%x.", | 370 | "corrupt dinode %Lu, forkoff = 0x%x.", |
371 | (unsigned long long)ip->i_ino, | 371 | (unsigned long long)ip->i_ino, |
372 | dip->di_core.di_forkoff); | 372 | dip->di_forkoff); |
373 | XFS_CORRUPTION_ERROR("xfs_iformat(2)", XFS_ERRLEVEL_LOW, | 373 | XFS_CORRUPTION_ERROR("xfs_iformat(2)", XFS_ERRLEVEL_LOW, |
374 | ip->i_mount, dip); | 374 | ip->i_mount, dip); |
375 | return XFS_ERROR(EFSCORRUPTED); | 375 | return XFS_ERROR(EFSCORRUPTED); |
@@ -380,25 +380,25 @@ xfs_iformat( | |||
380 | case S_IFCHR: | 380 | case S_IFCHR: |
381 | case S_IFBLK: | 381 | case S_IFBLK: |
382 | case S_IFSOCK: | 382 | case S_IFSOCK: |
383 | if (unlikely(dip->di_core.di_format != XFS_DINODE_FMT_DEV)) { | 383 | if (unlikely(dip->di_format != XFS_DINODE_FMT_DEV)) { |
384 | XFS_CORRUPTION_ERROR("xfs_iformat(3)", XFS_ERRLEVEL_LOW, | 384 | XFS_CORRUPTION_ERROR("xfs_iformat(3)", XFS_ERRLEVEL_LOW, |
385 | ip->i_mount, dip); | 385 | ip->i_mount, dip); |
386 | return XFS_ERROR(EFSCORRUPTED); | 386 | return XFS_ERROR(EFSCORRUPTED); |
387 | } | 387 | } |
388 | ip->i_d.di_size = 0; | 388 | ip->i_d.di_size = 0; |
389 | ip->i_size = 0; | 389 | ip->i_size = 0; |
390 | ip->i_df.if_u2.if_rdev = be32_to_cpu(dip->di_u.di_dev); | 390 | ip->i_df.if_u2.if_rdev = xfs_dinode_get_rdev(dip); |
391 | break; | 391 | break; |
392 | 392 | ||
393 | case S_IFREG: | 393 | case S_IFREG: |
394 | case S_IFLNK: | 394 | case S_IFLNK: |
395 | case S_IFDIR: | 395 | case S_IFDIR: |
396 | switch (dip->di_core.di_format) { | 396 | switch (dip->di_format) { |
397 | case XFS_DINODE_FMT_LOCAL: | 397 | case XFS_DINODE_FMT_LOCAL: |
398 | /* | 398 | /* |
399 | * no local regular files yet | 399 | * no local regular files yet |
400 | */ | 400 | */ |
401 | if (unlikely((be16_to_cpu(dip->di_core.di_mode) & S_IFMT) == S_IFREG)) { | 401 | if (unlikely((be16_to_cpu(dip->di_mode) & S_IFMT) == S_IFREG)) { |
402 | xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, | 402 | xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, |
403 | "corrupt inode %Lu " | 403 | "corrupt inode %Lu " |
404 | "(local format for regular file).", | 404 | "(local format for regular file).", |
@@ -409,7 +409,7 @@ xfs_iformat( | |||
409 | return XFS_ERROR(EFSCORRUPTED); | 409 | return XFS_ERROR(EFSCORRUPTED); |
410 | } | 410 | } |
411 | 411 | ||
412 | di_size = be64_to_cpu(dip->di_core.di_size); | 412 | di_size = be64_to_cpu(dip->di_size); |
413 | if (unlikely(di_size > XFS_DFORK_DSIZE(dip, ip->i_mount))) { | 413 | if (unlikely(di_size > XFS_DFORK_DSIZE(dip, ip->i_mount))) { |
414 | xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, | 414 | xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, |
415 | "corrupt inode %Lu " | 415 | "corrupt inode %Lu " |
@@ -451,7 +451,7 @@ xfs_iformat( | |||
451 | ip->i_afp = kmem_zone_zalloc(xfs_ifork_zone, KM_SLEEP); | 451 | ip->i_afp = kmem_zone_zalloc(xfs_ifork_zone, KM_SLEEP); |
452 | ip->i_afp->if_ext_max = | 452 | ip->i_afp->if_ext_max = |
453 | XFS_IFORK_ASIZE(ip) / (uint)sizeof(xfs_bmbt_rec_t); | 453 | XFS_IFORK_ASIZE(ip) / (uint)sizeof(xfs_bmbt_rec_t); |
454 | switch (dip->di_core.di_aformat) { | 454 | switch (dip->di_aformat) { |
455 | case XFS_DINODE_FMT_LOCAL: | 455 | case XFS_DINODE_FMT_LOCAL: |
456 | atp = (xfs_attr_shortform_t *)XFS_DFORK_APTR(dip); | 456 | atp = (xfs_attr_shortform_t *)XFS_DFORK_APTR(dip); |
457 | size = be16_to_cpu(atp->hdr.totsize); | 457 | size = be16_to_cpu(atp->hdr.totsize); |
@@ -663,7 +663,7 @@ xfs_iformat_btree( | |||
663 | void | 663 | void |
664 | xfs_dinode_from_disk( | 664 | xfs_dinode_from_disk( |
665 | xfs_icdinode_t *to, | 665 | xfs_icdinode_t *to, |
666 | xfs_dinode_core_t *from) | 666 | xfs_dinode_t *from) |
667 | { | 667 | { |
668 | to->di_magic = be16_to_cpu(from->di_magic); | 668 | to->di_magic = be16_to_cpu(from->di_magic); |
669 | to->di_mode = be16_to_cpu(from->di_mode); | 669 | to->di_mode = be16_to_cpu(from->di_mode); |
@@ -697,7 +697,7 @@ xfs_dinode_from_disk( | |||
697 | 697 | ||
698 | void | 698 | void |
699 | xfs_dinode_to_disk( | 699 | xfs_dinode_to_disk( |
700 | xfs_dinode_core_t *to, | 700 | xfs_dinode_t *to, |
701 | xfs_icdinode_t *from) | 701 | xfs_icdinode_t *from) |
702 | { | 702 | { |
703 | to->di_magic = cpu_to_be16(from->di_magic); | 703 | to->di_magic = cpu_to_be16(from->di_magic); |
@@ -784,9 +784,7 @@ uint | |||
784 | xfs_dic2xflags( | 784 | xfs_dic2xflags( |
785 | xfs_dinode_t *dip) | 785 | xfs_dinode_t *dip) |
786 | { | 786 | { |
787 | xfs_dinode_core_t *dic = &dip->di_core; | 787 | return _xfs_dic2xflags(be16_to_cpu(dip->di_flags)) | |
788 | |||
789 | return _xfs_dic2xflags(be16_to_cpu(dic->di_flags)) | | ||
790 | (XFS_DFORK_Q(dip) ? XFS_XFLAG_HASATTR : 0); | 788 | (XFS_DFORK_Q(dip) ? XFS_XFLAG_HASATTR : 0); |
791 | } | 789 | } |
792 | 790 | ||
@@ -905,12 +903,12 @@ xfs_iread( | |||
905 | * If we got something that isn't an inode it means someone | 903 | * If we got something that isn't an inode it means someone |
906 | * (nfs or dmi) has a stale handle. | 904 | * (nfs or dmi) has a stale handle. |
907 | */ | 905 | */ |
908 | if (be16_to_cpu(dip->di_core.di_magic) != XFS_DINODE_MAGIC) { | 906 | if (be16_to_cpu(dip->di_magic) != XFS_DINODE_MAGIC) { |
909 | #ifdef DEBUG | 907 | #ifdef DEBUG |
910 | xfs_fs_cmn_err(CE_ALERT, mp, "xfs_iread: " | 908 | xfs_fs_cmn_err(CE_ALERT, mp, "xfs_iread: " |
911 | "dip->di_core.di_magic (0x%x) != " | 909 | "dip->di_magic (0x%x) != " |
912 | "XFS_DINODE_MAGIC (0x%x)", | 910 | "XFS_DINODE_MAGIC (0x%x)", |
913 | be16_to_cpu(dip->di_core.di_magic), | 911 | be16_to_cpu(dip->di_magic), |
914 | XFS_DINODE_MAGIC); | 912 | XFS_DINODE_MAGIC); |
915 | #endif /* DEBUG */ | 913 | #endif /* DEBUG */ |
916 | error = XFS_ERROR(EINVAL); | 914 | error = XFS_ERROR(EINVAL); |
@@ -924,8 +922,8 @@ xfs_iread( | |||
924 | * specific information. | 922 | * specific information. |
925 | * Otherwise, just get the truly permanent information. | 923 | * Otherwise, just get the truly permanent information. |
926 | */ | 924 | */ |
927 | if (dip->di_core.di_mode) { | 925 | if (dip->di_mode) { |
928 | xfs_dinode_from_disk(&ip->i_d, &dip->di_core); | 926 | xfs_dinode_from_disk(&ip->i_d, dip); |
929 | error = xfs_iformat(ip, dip); | 927 | error = xfs_iformat(ip, dip); |
930 | if (error) { | 928 | if (error) { |
931 | #ifdef DEBUG | 929 | #ifdef DEBUG |
@@ -936,10 +934,10 @@ xfs_iread( | |||
936 | goto out_brelse; | 934 | goto out_brelse; |
937 | } | 935 | } |
938 | } else { | 936 | } else { |
939 | ip->i_d.di_magic = be16_to_cpu(dip->di_core.di_magic); | 937 | ip->i_d.di_magic = be16_to_cpu(dip->di_magic); |
940 | ip->i_d.di_version = dip->di_core.di_version; | 938 | ip->i_d.di_version = dip->di_version; |
941 | ip->i_d.di_gen = be32_to_cpu(dip->di_core.di_gen); | 939 | ip->i_d.di_gen = be32_to_cpu(dip->di_gen); |
942 | ip->i_d.di_flushiter = be16_to_cpu(dip->di_core.di_flushiter); | 940 | ip->i_d.di_flushiter = be16_to_cpu(dip->di_flushiter); |
943 | /* | 941 | /* |
944 | * Make sure to pull in the mode here as well in | 942 | * Make sure to pull in the mode here as well in |
945 | * case the inode is released without being used. | 943 | * case the inode is released without being used. |
@@ -2295,7 +2293,7 @@ xfs_ifree( | |||
2295 | * This is a temporary hack that would require a proper fix | 2293 | * This is a temporary hack that would require a proper fix |
2296 | * in the future. | 2294 | * in the future. |
2297 | */ | 2295 | */ |
2298 | dip->di_core.di_mode = 0; | 2296 | dip->di_mode = 0; |
2299 | 2297 | ||
2300 | if (delete) { | 2298 | if (delete) { |
2301 | xfs_ifree_cluster(ip, tp, first_ino); | 2299 | xfs_ifree_cluster(ip, tp, first_ino); |
@@ -2909,15 +2907,16 @@ xfs_iflush_fork( | |||
2909 | case XFS_DINODE_FMT_DEV: | 2907 | case XFS_DINODE_FMT_DEV: |
2910 | if (iip->ili_format.ilf_fields & XFS_ILOG_DEV) { | 2908 | if (iip->ili_format.ilf_fields & XFS_ILOG_DEV) { |
2911 | ASSERT(whichfork == XFS_DATA_FORK); | 2909 | ASSERT(whichfork == XFS_DATA_FORK); |
2912 | dip->di_u.di_dev = cpu_to_be32(ip->i_df.if_u2.if_rdev); | 2910 | xfs_dinode_put_rdev(dip, ip->i_df.if_u2.if_rdev); |
2913 | } | 2911 | } |
2914 | break; | 2912 | break; |
2915 | 2913 | ||
2916 | case XFS_DINODE_FMT_UUID: | 2914 | case XFS_DINODE_FMT_UUID: |
2917 | if (iip->ili_format.ilf_fields & XFS_ILOG_UUID) { | 2915 | if (iip->ili_format.ilf_fields & XFS_ILOG_UUID) { |
2918 | ASSERT(whichfork == XFS_DATA_FORK); | 2916 | ASSERT(whichfork == XFS_DATA_FORK); |
2919 | memcpy(&dip->di_u.di_muuid, &ip->i_df.if_u2.if_uuid, | 2917 | memcpy(XFS_DFORK_DPTR(dip), |
2920 | sizeof(uuid_t)); | 2918 | &ip->i_df.if_u2.if_uuid, |
2919 | sizeof(uuid_t)); | ||
2921 | } | 2920 | } |
2922 | break; | 2921 | break; |
2923 | 2922 | ||
@@ -3295,11 +3294,11 @@ xfs_iflush_int( | |||
3295 | */ | 3294 | */ |
3296 | xfs_synchronize_atime(ip); | 3295 | xfs_synchronize_atime(ip); |
3297 | 3296 | ||
3298 | if (XFS_TEST_ERROR(be16_to_cpu(dip->di_core.di_magic) != XFS_DINODE_MAGIC, | 3297 | if (XFS_TEST_ERROR(be16_to_cpu(dip->di_magic) != XFS_DINODE_MAGIC, |
3299 | mp, XFS_ERRTAG_IFLUSH_1, XFS_RANDOM_IFLUSH_1)) { | 3298 | mp, XFS_ERRTAG_IFLUSH_1, XFS_RANDOM_IFLUSH_1)) { |
3300 | xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp, | 3299 | xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp, |
3301 | "xfs_iflush: Bad inode %Lu magic number 0x%x, ptr 0x%p", | 3300 | "xfs_iflush: Bad inode %Lu magic number 0x%x, ptr 0x%p", |
3302 | ip->i_ino, be16_to_cpu(dip->di_core.di_magic), dip); | 3301 | ip->i_ino, be16_to_cpu(dip->di_magic), dip); |
3303 | goto corrupt_out; | 3302 | goto corrupt_out; |
3304 | } | 3303 | } |
3305 | if (XFS_TEST_ERROR(ip->i_d.di_magic != XFS_DINODE_MAGIC, | 3304 | if (XFS_TEST_ERROR(ip->i_d.di_magic != XFS_DINODE_MAGIC, |
@@ -3362,7 +3361,7 @@ xfs_iflush_int( | |||
3362 | * because if the inode is dirty at all the core must | 3361 | * because if the inode is dirty at all the core must |
3363 | * be. | 3362 | * be. |
3364 | */ | 3363 | */ |
3365 | xfs_dinode_to_disk(&dip->di_core, &ip->i_d); | 3364 | xfs_dinode_to_disk(dip, &ip->i_d); |
3366 | 3365 | ||
3367 | /* Wrap, we never let the log put out DI_MAX_FLUSH */ | 3366 | /* Wrap, we never let the log put out DI_MAX_FLUSH */ |
3368 | if (ip->i_d.di_flushiter == DI_MAX_FLUSH) | 3367 | if (ip->i_d.di_flushiter == DI_MAX_FLUSH) |
@@ -3382,7 +3381,7 @@ xfs_iflush_int( | |||
3382 | * Convert it back. | 3381 | * Convert it back. |
3383 | */ | 3382 | */ |
3384 | ASSERT(ip->i_d.di_nlink <= XFS_MAXLINK_1); | 3383 | ASSERT(ip->i_d.di_nlink <= XFS_MAXLINK_1); |
3385 | dip->di_core.di_onlink = cpu_to_be16(ip->i_d.di_nlink); | 3384 | dip->di_onlink = cpu_to_be16(ip->i_d.di_nlink); |
3386 | } else { | 3385 | } else { |
3387 | /* | 3386 | /* |
3388 | * The superblock version has already been bumped, | 3387 | * The superblock version has already been bumped, |
@@ -3390,12 +3389,12 @@ xfs_iflush_int( | |||
3390 | * format permanent. | 3389 | * format permanent. |
3391 | */ | 3390 | */ |
3392 | ip->i_d.di_version = XFS_DINODE_VERSION_2; | 3391 | ip->i_d.di_version = XFS_DINODE_VERSION_2; |
3393 | dip->di_core.di_version = XFS_DINODE_VERSION_2; | 3392 | dip->di_version = XFS_DINODE_VERSION_2; |
3394 | ip->i_d.di_onlink = 0; | 3393 | ip->i_d.di_onlink = 0; |
3395 | dip->di_core.di_onlink = 0; | 3394 | dip->di_onlink = 0; |
3396 | memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad)); | 3395 | memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad)); |
3397 | memset(&(dip->di_core.di_pad[0]), 0, | 3396 | memset(&(dip->di_pad[0]), 0, |
3398 | sizeof(dip->di_core.di_pad)); | 3397 | sizeof(dip->di_pad)); |
3399 | ASSERT(ip->i_d.di_projid == 0); | 3398 | ASSERT(ip->i_d.di_projid == 0); |
3400 | } | 3399 | } |
3401 | } | 3400 | } |
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index ea691c738f2e..705083a8ffaf 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h | |||
@@ -19,7 +19,6 @@ | |||
19 | #define __XFS_INODE_H__ | 19 | #define __XFS_INODE_H__ |
20 | 20 | ||
21 | struct xfs_dinode; | 21 | struct xfs_dinode; |
22 | struct xfs_dinode_core; | ||
23 | struct xfs_inode; | 22 | struct xfs_inode; |
24 | 23 | ||
25 | /* | 24 | /* |
@@ -112,7 +111,7 @@ typedef struct xfs_ictimestamp { | |||
112 | } xfs_ictimestamp_t; | 111 | } xfs_ictimestamp_t; |
113 | 112 | ||
114 | /* | 113 | /* |
115 | * NOTE: This structure must be kept identical to struct xfs_dinode_core | 114 | * NOTE: This structure must be kept identical to struct xfs_dinode |
116 | * in xfs_dinode.h except for the endianess annotations. | 115 | * in xfs_dinode.h except for the endianess annotations. |
117 | */ | 116 | */ |
118 | typedef struct xfs_icdinode { | 117 | typedef struct xfs_icdinode { |
@@ -553,8 +552,8 @@ int xfs_itobp(struct xfs_mount *, struct xfs_trans *, | |||
553 | struct xfs_inode *, struct xfs_dinode **, | 552 | struct xfs_inode *, struct xfs_dinode **, |
554 | struct xfs_buf **, xfs_daddr_t, uint, uint); | 553 | struct xfs_buf **, xfs_daddr_t, uint, uint); |
555 | void xfs_dinode_from_disk(struct xfs_icdinode *, | 554 | void xfs_dinode_from_disk(struct xfs_icdinode *, |
556 | struct xfs_dinode_core *); | 555 | struct xfs_dinode *); |
557 | void xfs_dinode_to_disk(struct xfs_dinode_core *, | 556 | void xfs_dinode_to_disk(struct xfs_dinode *, |
558 | struct xfs_icdinode *); | 557 | struct xfs_icdinode *); |
559 | void xfs_idestroy_fork(struct xfs_inode *, int); | 558 | void xfs_idestroy_fork(struct xfs_inode *, int); |
560 | void xfs_idata_realloc(struct xfs_inode *, int, int); | 559 | void xfs_idata_realloc(struct xfs_inode *, int, int); |
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c index aa9bf05060c6..27f18c15e167 100644 --- a/fs/xfs/xfs_inode_item.c +++ b/fs/xfs/xfs_inode_item.c | |||
@@ -281,7 +281,7 @@ xfs_inode_item_format( | |||
281 | xfs_mark_inode_dirty_sync(ip); | 281 | xfs_mark_inode_dirty_sync(ip); |
282 | 282 | ||
283 | vecp->i_addr = (xfs_caddr_t)&ip->i_d; | 283 | vecp->i_addr = (xfs_caddr_t)&ip->i_d; |
284 | vecp->i_len = sizeof(xfs_dinode_core_t); | 284 | vecp->i_len = sizeof(struct xfs_icdinode); |
285 | XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_ICORE); | 285 | XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_ICORE); |
286 | vecp++; | 286 | vecp++; |
287 | nvecs++; | 287 | nvecs++; |
diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c index 35118032a5d6..b3578cdc33dd 100644 --- a/fs/xfs/xfs_itable.c +++ b/fs/xfs/xfs_itable.c | |||
@@ -125,13 +125,9 @@ STATIC void | |||
125 | xfs_bulkstat_one_dinode( | 125 | xfs_bulkstat_one_dinode( |
126 | xfs_mount_t *mp, /* mount point for filesystem */ | 126 | xfs_mount_t *mp, /* mount point for filesystem */ |
127 | xfs_ino_t ino, /* inode number to get data for */ | 127 | xfs_ino_t ino, /* inode number to get data for */ |
128 | xfs_dinode_t *dip, /* dinode inode pointer */ | 128 | xfs_dinode_t *dic, /* dinode inode pointer */ |
129 | xfs_bstat_t *buf) /* return buffer */ | 129 | xfs_bstat_t *buf) /* return buffer */ |
130 | { | 130 | { |
131 | xfs_dinode_core_t *dic; /* dinode core info pointer */ | ||
132 | |||
133 | dic = &dip->di_core; | ||
134 | |||
135 | /* | 131 | /* |
136 | * The inode format changed when we moved the link count and | 132 | * The inode format changed when we moved the link count and |
137 | * made it 32 bits long. If this is an old format inode, | 133 | * made it 32 bits long. If this is an old format inode, |
@@ -162,7 +158,7 @@ xfs_bulkstat_one_dinode( | |||
162 | buf->bs_mtime.tv_nsec = be32_to_cpu(dic->di_mtime.t_nsec); | 158 | buf->bs_mtime.tv_nsec = be32_to_cpu(dic->di_mtime.t_nsec); |
163 | buf->bs_ctime.tv_sec = be32_to_cpu(dic->di_ctime.t_sec); | 159 | buf->bs_ctime.tv_sec = be32_to_cpu(dic->di_ctime.t_sec); |
164 | buf->bs_ctime.tv_nsec = be32_to_cpu(dic->di_ctime.t_nsec); | 160 | buf->bs_ctime.tv_nsec = be32_to_cpu(dic->di_ctime.t_nsec); |
165 | buf->bs_xflags = xfs_dic2xflags(dip); | 161 | buf->bs_xflags = xfs_dic2xflags(dic); |
166 | buf->bs_extsize = be32_to_cpu(dic->di_extsize) << mp->m_sb.sb_blocklog; | 162 | buf->bs_extsize = be32_to_cpu(dic->di_extsize) << mp->m_sb.sb_blocklog; |
167 | buf->bs_extents = be32_to_cpu(dic->di_nextents); | 163 | buf->bs_extents = be32_to_cpu(dic->di_nextents); |
168 | buf->bs_gen = be32_to_cpu(dic->di_gen); | 164 | buf->bs_gen = be32_to_cpu(dic->di_gen); |
@@ -173,7 +169,7 @@ xfs_bulkstat_one_dinode( | |||
173 | 169 | ||
174 | switch (dic->di_format) { | 170 | switch (dic->di_format) { |
175 | case XFS_DINODE_FMT_DEV: | 171 | case XFS_DINODE_FMT_DEV: |
176 | buf->bs_rdev = be32_to_cpu(dip->di_u.di_dev); | 172 | buf->bs_rdev = xfs_dinode_get_rdev(dic); |
177 | buf->bs_blksize = BLKDEV_IOSIZE; | 173 | buf->bs_blksize = BLKDEV_IOSIZE; |
178 | buf->bs_blocks = 0; | 174 | buf->bs_blocks = 0; |
179 | break; | 175 | break; |
@@ -287,19 +283,19 @@ xfs_bulkstat_use_dinode( | |||
287 | * to disk yet. This is a temporary hack that would require a proper | 283 | * to disk yet. This is a temporary hack that would require a proper |
288 | * fix in the future. | 284 | * fix in the future. |
289 | */ | 285 | */ |
290 | if (be16_to_cpu(dip->di_core.di_magic) != XFS_DINODE_MAGIC || | 286 | if (be16_to_cpu(dip->di_magic) != XFS_DINODE_MAGIC || |
291 | !XFS_DINODE_GOOD_VERSION(dip->di_core.di_version) || | 287 | !XFS_DINODE_GOOD_VERSION(dip->di_version) || |
292 | !dip->di_core.di_mode) | 288 | !dip->di_mode) |
293 | return 0; | 289 | return 0; |
294 | if (flags & BULKSTAT_FG_QUICK) { | 290 | if (flags & BULKSTAT_FG_QUICK) { |
295 | *dipp = dip; | 291 | *dipp = dip; |
296 | return 1; | 292 | return 1; |
297 | } | 293 | } |
298 | /* BULKSTAT_FG_INLINE: if attr fork is local, or not there, use it */ | 294 | /* BULKSTAT_FG_INLINE: if attr fork is local, or not there, use it */ |
299 | aformat = dip->di_core.di_aformat; | 295 | aformat = dip->di_aformat; |
300 | if ((XFS_DFORK_Q(dip) == 0) || | 296 | if ((XFS_DFORK_Q(dip) == 0) || |
301 | (aformat == XFS_DINODE_FMT_LOCAL) || | 297 | (aformat == XFS_DINODE_FMT_LOCAL) || |
302 | (aformat == XFS_DINODE_FMT_EXTENTS && !dip->di_core.di_anextents)) { | 298 | (aformat == XFS_DINODE_FMT_EXTENTS && !dip->di_anextents)) { |
303 | *dipp = dip; | 299 | *dipp = dip; |
304 | return 1; | 300 | return 1; |
305 | } | 301 | } |
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 9abb96a7674d..4099618f5fa0 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
@@ -2320,7 +2320,7 @@ xlog_recover_do_inode_trans( | |||
2320 | * Make sure the place we're flushing out to really looks | 2320 | * Make sure the place we're flushing out to really looks |
2321 | * like an inode! | 2321 | * like an inode! |
2322 | */ | 2322 | */ |
2323 | if (unlikely(be16_to_cpu(dip->di_core.di_magic) != XFS_DINODE_MAGIC)) { | 2323 | if (unlikely(be16_to_cpu(dip->di_magic) != XFS_DINODE_MAGIC)) { |
2324 | xfs_buf_relse(bp); | 2324 | xfs_buf_relse(bp); |
2325 | xfs_fs_cmn_err(CE_ALERT, mp, | 2325 | xfs_fs_cmn_err(CE_ALERT, mp, |
2326 | "xfs_inode_recover: Bad inode magic number, dino ptr = 0x%p, dino bp = 0x%p, ino = %Ld", | 2326 | "xfs_inode_recover: Bad inode magic number, dino ptr = 0x%p, dino bp = 0x%p, ino = %Ld", |
@@ -2343,12 +2343,12 @@ xlog_recover_do_inode_trans( | |||
2343 | } | 2343 | } |
2344 | 2344 | ||
2345 | /* Skip replay when the on disk inode is newer than the log one */ | 2345 | /* Skip replay when the on disk inode is newer than the log one */ |
2346 | if (dicp->di_flushiter < be16_to_cpu(dip->di_core.di_flushiter)) { | 2346 | if (dicp->di_flushiter < be16_to_cpu(dip->di_flushiter)) { |
2347 | /* | 2347 | /* |
2348 | * Deal with the wrap case, DI_MAX_FLUSH is less | 2348 | * Deal with the wrap case, DI_MAX_FLUSH is less |
2349 | * than smaller numbers | 2349 | * than smaller numbers |
2350 | */ | 2350 | */ |
2351 | if (be16_to_cpu(dip->di_core.di_flushiter) == DI_MAX_FLUSH && | 2351 | if (be16_to_cpu(dip->di_flushiter) == DI_MAX_FLUSH && |
2352 | dicp->di_flushiter < (DI_MAX_FLUSH >> 1)) { | 2352 | dicp->di_flushiter < (DI_MAX_FLUSH >> 1)) { |
2353 | /* do nothing */ | 2353 | /* do nothing */ |
2354 | } else { | 2354 | } else { |
@@ -2408,7 +2408,7 @@ xlog_recover_do_inode_trans( | |||
2408 | error = EFSCORRUPTED; | 2408 | error = EFSCORRUPTED; |
2409 | goto error; | 2409 | goto error; |
2410 | } | 2410 | } |
2411 | if (unlikely(item->ri_buf[1].i_len > sizeof(xfs_dinode_core_t))) { | 2411 | if (unlikely(item->ri_buf[1].i_len > sizeof(struct xfs_icdinode))) { |
2412 | XFS_CORRUPTION_ERROR("xlog_recover_do_inode_trans(7)", | 2412 | XFS_CORRUPTION_ERROR("xlog_recover_do_inode_trans(7)", |
2413 | XFS_ERRLEVEL_LOW, mp, dicp); | 2413 | XFS_ERRLEVEL_LOW, mp, dicp); |
2414 | xfs_buf_relse(bp); | 2414 | xfs_buf_relse(bp); |
@@ -2420,23 +2420,24 @@ xlog_recover_do_inode_trans( | |||
2420 | } | 2420 | } |
2421 | 2421 | ||
2422 | /* The core is in in-core format */ | 2422 | /* The core is in in-core format */ |
2423 | xfs_dinode_to_disk(&dip->di_core, | 2423 | xfs_dinode_to_disk(dip, (xfs_icdinode_t *)item->ri_buf[1].i_addr); |
2424 | (xfs_icdinode_t *)item->ri_buf[1].i_addr); | ||
2425 | 2424 | ||
2426 | /* the rest is in on-disk format */ | 2425 | /* the rest is in on-disk format */ |
2427 | if (item->ri_buf[1].i_len > sizeof(xfs_dinode_core_t)) { | 2426 | if (item->ri_buf[1].i_len > sizeof(struct xfs_icdinode)) { |
2428 | memcpy((xfs_caddr_t) dip + sizeof(xfs_dinode_core_t), | 2427 | memcpy((xfs_caddr_t) dip + sizeof(struct xfs_icdinode), |
2429 | item->ri_buf[1].i_addr + sizeof(xfs_dinode_core_t), | 2428 | item->ri_buf[1].i_addr + sizeof(struct xfs_icdinode), |
2430 | item->ri_buf[1].i_len - sizeof(xfs_dinode_core_t)); | 2429 | item->ri_buf[1].i_len - sizeof(struct xfs_icdinode)); |
2431 | } | 2430 | } |
2432 | 2431 | ||
2433 | fields = in_f->ilf_fields; | 2432 | fields = in_f->ilf_fields; |
2434 | switch (fields & (XFS_ILOG_DEV | XFS_ILOG_UUID)) { | 2433 | switch (fields & (XFS_ILOG_DEV | XFS_ILOG_UUID)) { |
2435 | case XFS_ILOG_DEV: | 2434 | case XFS_ILOG_DEV: |
2436 | dip->di_u.di_dev = cpu_to_be32(in_f->ilf_u.ilfu_rdev); | 2435 | xfs_dinode_put_rdev(dip, in_f->ilf_u.ilfu_rdev); |
2437 | break; | 2436 | break; |
2438 | case XFS_ILOG_UUID: | 2437 | case XFS_ILOG_UUID: |
2439 | dip->di_u.di_muuid = in_f->ilf_u.ilfu_uuid; | 2438 | memcpy(XFS_DFORK_DPTR(dip), |
2439 | &in_f->ilf_u.ilfu_uuid, | ||
2440 | sizeof(uuid_t)); | ||
2440 | break; | 2441 | break; |
2441 | } | 2442 | } |
2442 | 2443 | ||
@@ -2452,12 +2453,12 @@ xlog_recover_do_inode_trans( | |||
2452 | switch (fields & XFS_ILOG_DFORK) { | 2453 | switch (fields & XFS_ILOG_DFORK) { |
2453 | case XFS_ILOG_DDATA: | 2454 | case XFS_ILOG_DDATA: |
2454 | case XFS_ILOG_DEXT: | 2455 | case XFS_ILOG_DEXT: |
2455 | memcpy(&dip->di_u, src, len); | 2456 | memcpy(XFS_DFORK_DPTR(dip), src, len); |
2456 | break; | 2457 | break; |
2457 | 2458 | ||
2458 | case XFS_ILOG_DBROOT: | 2459 | case XFS_ILOG_DBROOT: |
2459 | xfs_bmbt_to_bmdr(mp, (struct xfs_btree_block *)src, len, | 2460 | xfs_bmbt_to_bmdr(mp, (struct xfs_btree_block *)src, len, |
2460 | &dip->di_u.di_bmbt, | 2461 | (xfs_bmdr_block_t *)XFS_DFORK_DPTR(dip), |
2461 | XFS_DFORK_DSIZE(dip, mp)); | 2462 | XFS_DFORK_DSIZE(dip, mp)); |
2462 | break; | 2463 | break; |
2463 | 2464 | ||
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 177976dfea04..3f999b1c0385 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -575,8 +575,7 @@ xfs_mount_common(xfs_mount_t *mp, xfs_sb_t *sbp) | |||
575 | mp->m_sectbb_log = sbp->sb_sectlog - BBSHIFT; | 575 | mp->m_sectbb_log = sbp->sb_sectlog - BBSHIFT; |
576 | mp->m_agno_log = xfs_highbit32(sbp->sb_agcount - 1) + 1; | 576 | mp->m_agno_log = xfs_highbit32(sbp->sb_agcount - 1) + 1; |
577 | mp->m_agino_log = sbp->sb_inopblog + sbp->sb_agblklog; | 577 | mp->m_agino_log = sbp->sb_inopblog + sbp->sb_agblklog; |
578 | mp->m_litino = sbp->sb_inodesize - | 578 | mp->m_litino = sbp->sb_inodesize - sizeof(struct xfs_dinode); |
579 | ((uint)sizeof(xfs_dinode_core_t) + (uint)sizeof(xfs_agino_t)); | ||
580 | mp->m_blockmask = sbp->sb_blocksize - 1; | 579 | mp->m_blockmask = sbp->sb_blocksize - 1; |
581 | mp->m_blockwsize = sbp->sb_blocksize >> XFS_WORDLOG; | 580 | mp->m_blockwsize = sbp->sb_blocksize >> XFS_WORDLOG; |
582 | mp->m_blockwmask = mp->m_blockwsize - 1; | 581 | mp->m_blockwmask = mp->m_blockwsize - 1; |