diff options
author | Dave Chinner <dchinner@redhat.com> | 2016-02-09 00:54:58 -0500 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2016-02-09 00:54:58 -0500 |
commit | 93f958f9c41f0bfd10627a2279457df64004d957 (patch) | |
tree | d49a7d78779925fa7903aed47c77680746d78318 | |
parent | 3987848c7c2be112e03c82d03821b044f1c0edec (diff) |
xfs: cull unnecessary icdinode fields
Now that the struct xfs_icdinode is not directly related to the
on-disk format, we can cull things in it we really don't need to
store:
- magic number never changes
- padding is not necessary
- next_unlinked is never used
- inode number is redundant
- uuid is redundant
- lsn is accessed directly from dinode
- inode CRC is only accessed directly from dinode
Hence we can remove these from the struct xfs_icdinode and redirect
the code that uses them to the xfs_dinode appripriately. This
reduces the size of the struct icdinode from 152 bytes to 88 bytes,
and removes a fair chunk of unnecessary code, too.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
-rw-r--r-- | fs/xfs/libxfs/xfs_inode_buf.c | 39 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_inode_buf.h | 25 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.c | 19 | ||||
-rw-r--r-- | fs/xfs/xfs_inode_item.c | 19 |
4 files changed, 31 insertions, 71 deletions
diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c index e832bb2ab4f9..c0fe062b567a 100644 --- a/fs/xfs/libxfs/xfs_inode_buf.c +++ b/fs/xfs/libxfs/xfs_inode_buf.c | |||
@@ -202,7 +202,6 @@ xfs_inode_from_disk( | |||
202 | struct xfs_icdinode *to = &ip->i_d; | 202 | struct xfs_icdinode *to = &ip->i_d; |
203 | struct inode *inode = VFS_I(ip); | 203 | struct inode *inode = VFS_I(ip); |
204 | 204 | ||
205 | to->di_magic = be16_to_cpu(from->di_magic); | ||
206 | to->di_mode = be16_to_cpu(from->di_mode); | 205 | to->di_mode = be16_to_cpu(from->di_mode); |
207 | to->di_version = from ->di_version; | 206 | to->di_version = from ->di_version; |
208 | to->di_format = from->di_format; | 207 | to->di_format = from->di_format; |
@@ -212,7 +211,6 @@ xfs_inode_from_disk( | |||
212 | to->di_nlink = be32_to_cpu(from->di_nlink); | 211 | to->di_nlink = be32_to_cpu(from->di_nlink); |
213 | to->di_projid_lo = be16_to_cpu(from->di_projid_lo); | 212 | to->di_projid_lo = be16_to_cpu(from->di_projid_lo); |
214 | to->di_projid_hi = be16_to_cpu(from->di_projid_hi); | 213 | to->di_projid_hi = be16_to_cpu(from->di_projid_hi); |
215 | memcpy(to->di_pad, from->di_pad, sizeof(to->di_pad)); | ||
216 | to->di_flushiter = be16_to_cpu(from->di_flushiter); | 214 | to->di_flushiter = be16_to_cpu(from->di_flushiter); |
217 | 215 | ||
218 | /* | 216 | /* |
@@ -245,24 +243,22 @@ xfs_inode_from_disk( | |||
245 | to->di_crtime.t_sec = be32_to_cpu(from->di_crtime.t_sec); | 243 | to->di_crtime.t_sec = be32_to_cpu(from->di_crtime.t_sec); |
246 | to->di_crtime.t_nsec = be32_to_cpu(from->di_crtime.t_nsec); | 244 | to->di_crtime.t_nsec = be32_to_cpu(from->di_crtime.t_nsec); |
247 | to->di_flags2 = be64_to_cpu(from->di_flags2); | 245 | to->di_flags2 = be64_to_cpu(from->di_flags2); |
248 | to->di_ino = be64_to_cpu(from->di_ino); | ||
249 | to->di_lsn = be64_to_cpu(from->di_lsn); | ||
250 | memcpy(to->di_pad2, from->di_pad2, sizeof(to->di_pad2)); | ||
251 | uuid_copy(&to->di_uuid, &from->di_uuid); | ||
252 | } | 246 | } |
253 | } | 247 | } |
254 | 248 | ||
255 | void | 249 | void |
256 | xfs_inode_to_disk( | 250 | xfs_inode_to_disk( |
257 | struct xfs_inode *ip, | 251 | struct xfs_inode *ip, |
258 | struct xfs_dinode *to) | 252 | struct xfs_dinode *to, |
253 | xfs_lsn_t lsn) | ||
259 | { | 254 | { |
260 | struct xfs_icdinode *from = &ip->i_d; | 255 | struct xfs_icdinode *from = &ip->i_d; |
261 | struct inode *inode = VFS_I(ip); | 256 | struct inode *inode = VFS_I(ip); |
262 | 257 | ||
263 | to->di_magic = cpu_to_be16(from->di_magic); | 258 | to->di_magic = cpu_to_be16(XFS_DINODE_MAGIC); |
259 | |||
264 | to->di_mode = cpu_to_be16(from->di_mode); | 260 | to->di_mode = cpu_to_be16(from->di_mode); |
265 | to->di_version = from ->di_version; | 261 | to->di_version = from->di_version; |
266 | to->di_format = from->di_format; | 262 | to->di_format = from->di_format; |
267 | to->di_onlink = cpu_to_be16(from->di_onlink); | 263 | to->di_onlink = cpu_to_be16(from->di_onlink); |
268 | to->di_uid = cpu_to_be32(from->di_uid); | 264 | to->di_uid = cpu_to_be32(from->di_uid); |
@@ -270,8 +266,8 @@ xfs_inode_to_disk( | |||
270 | to->di_nlink = cpu_to_be32(from->di_nlink); | 266 | to->di_nlink = cpu_to_be32(from->di_nlink); |
271 | to->di_projid_lo = cpu_to_be16(from->di_projid_lo); | 267 | to->di_projid_lo = cpu_to_be16(from->di_projid_lo); |
272 | to->di_projid_hi = cpu_to_be16(from->di_projid_hi); | 268 | to->di_projid_hi = cpu_to_be16(from->di_projid_hi); |
273 | memcpy(to->di_pad, from->di_pad, sizeof(to->di_pad)); | ||
274 | 269 | ||
270 | memset(to->di_pad, 0, sizeof(to->di_pad)); | ||
275 | to->di_atime.t_sec = cpu_to_be32(inode->i_atime.tv_sec); | 271 | to->di_atime.t_sec = cpu_to_be32(inode->i_atime.tv_sec); |
276 | to->di_atime.t_nsec = cpu_to_be32(inode->i_atime.tv_nsec); | 272 | to->di_atime.t_nsec = cpu_to_be32(inode->i_atime.tv_nsec); |
277 | to->di_mtime.t_sec = cpu_to_be32(inode->i_mtime.tv_sec); | 273 | to->di_mtime.t_sec = cpu_to_be32(inode->i_mtime.tv_sec); |
@@ -296,10 +292,11 @@ xfs_inode_to_disk( | |||
296 | to->di_crtime.t_sec = cpu_to_be32(from->di_crtime.t_sec); | 292 | to->di_crtime.t_sec = cpu_to_be32(from->di_crtime.t_sec); |
297 | to->di_crtime.t_nsec = cpu_to_be32(from->di_crtime.t_nsec); | 293 | to->di_crtime.t_nsec = cpu_to_be32(from->di_crtime.t_nsec); |
298 | to->di_flags2 = cpu_to_be64(from->di_flags2); | 294 | to->di_flags2 = cpu_to_be64(from->di_flags2); |
299 | to->di_ino = cpu_to_be64(from->di_ino); | 295 | |
300 | to->di_lsn = cpu_to_be64(from->di_lsn); | 296 | to->di_ino = cpu_to_be64(ip->i_ino); |
301 | memcpy(to->di_pad2, from->di_pad2, sizeof(to->di_pad2)); | 297 | to->di_lsn = cpu_to_be64(lsn); |
302 | uuid_copy(&to->di_uuid, &from->di_uuid); | 298 | memset(to->di_pad2, 0, sizeof(to->di_pad2)); |
299 | uuid_copy(&to->di_uuid, &ip->i_mount->m_sb.sb_meta_uuid); | ||
303 | to->di_flushiter = 0; | 300 | to->di_flushiter = 0; |
304 | } else { | 301 | } else { |
305 | to->di_flushiter = cpu_to_be16(from->di_flushiter); | 302 | to->di_flushiter = cpu_to_be16(from->di_flushiter); |
@@ -434,13 +431,10 @@ xfs_iread( | |||
434 | !(mp->m_flags & XFS_MOUNT_IKEEP)) { | 431 | !(mp->m_flags & XFS_MOUNT_IKEEP)) { |
435 | /* initialise the on-disk inode core */ | 432 | /* initialise the on-disk inode core */ |
436 | memset(&ip->i_d, 0, sizeof(ip->i_d)); | 433 | memset(&ip->i_d, 0, sizeof(ip->i_d)); |
437 | ip->i_d.di_magic = XFS_DINODE_MAGIC; | ||
438 | ip->i_d.di_gen = prandom_u32(); | 434 | ip->i_d.di_gen = prandom_u32(); |
439 | if (xfs_sb_version_hascrc(&mp->m_sb)) { | 435 | if (xfs_sb_version_hascrc(&mp->m_sb)) |
440 | ip->i_d.di_version = 3; | 436 | ip->i_d.di_version = 3; |
441 | ip->i_d.di_ino = ip->i_ino; | 437 | else |
442 | uuid_copy(&ip->i_d.di_uuid, &mp->m_sb.sb_meta_uuid); | ||
443 | } else | ||
444 | ip->i_d.di_version = 2; | 438 | ip->i_d.di_version = 2; |
445 | return 0; | 439 | return 0; |
446 | } | 440 | } |
@@ -484,16 +478,10 @@ xfs_iread( | |||
484 | * Partial initialisation of the in-core inode. Just the bits | 478 | * Partial initialisation of the in-core inode. Just the bits |
485 | * that xfs_ialloc won't overwrite or relies on being correct. | 479 | * that xfs_ialloc won't overwrite or relies on being correct. |
486 | */ | 480 | */ |
487 | ip->i_d.di_magic = be16_to_cpu(dip->di_magic); | ||
488 | ip->i_d.di_version = dip->di_version; | 481 | ip->i_d.di_version = dip->di_version; |
489 | ip->i_d.di_gen = be32_to_cpu(dip->di_gen); | 482 | ip->i_d.di_gen = be32_to_cpu(dip->di_gen); |
490 | ip->i_d.di_flushiter = be16_to_cpu(dip->di_flushiter); | 483 | ip->i_d.di_flushiter = be16_to_cpu(dip->di_flushiter); |
491 | 484 | ||
492 | if (dip->di_version == 3) { | ||
493 | ip->i_d.di_ino = be64_to_cpu(dip->di_ino); | ||
494 | uuid_copy(&ip->i_d.di_uuid, &dip->di_uuid); | ||
495 | } | ||
496 | |||
497 | /* | 485 | /* |
498 | * Make sure to pull in the mode here as well in | 486 | * Make sure to pull in the mode here as well in |
499 | * case the inode is released without being used. | 487 | * case the inode is released without being used. |
@@ -514,7 +502,6 @@ xfs_iread( | |||
514 | */ | 502 | */ |
515 | if (ip->i_d.di_version == 1) { | 503 | if (ip->i_d.di_version == 1) { |
516 | ip->i_d.di_version = 2; | 504 | ip->i_d.di_version = 2; |
517 | memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad)); | ||
518 | ip->i_d.di_nlink = ip->i_d.di_onlink; | 505 | ip->i_d.di_nlink = ip->i_d.di_onlink; |
519 | ip->i_d.di_onlink = 0; | 506 | ip->i_d.di_onlink = 0; |
520 | xfs_set_projid(ip, 0); | 507 | xfs_set_projid(ip, 0); |
diff --git a/fs/xfs/libxfs/xfs_inode_buf.h b/fs/xfs/libxfs/xfs_inode_buf.h index adcc9bfe02e9..7b8b1b97918b 100644 --- a/fs/xfs/libxfs/xfs_inode_buf.h +++ b/fs/xfs/libxfs/xfs_inode_buf.h | |||
@@ -22,24 +22,22 @@ struct xfs_inode; | |||
22 | struct xfs_dinode; | 22 | struct xfs_dinode; |
23 | 23 | ||
24 | /* | 24 | /* |
25 | * In memory representation of the XFS inode. This is held in the in-core | 25 | * In memory representation of the XFS inode. This is held in the in-core struct |
26 | * struct xfs_inode to represent the on disk values, but no longer needs to be | 26 | * xfs_inode and represents the current on disk values but the structure is not |
27 | * identical to the on-disk structure as it is always translated to on-disk | 27 | * in on-disk format. That is, this structure is always translated to on-disk |
28 | * format specific structures at the appropriate time. | 28 | * format specific structures at the appropriate time. |
29 | */ | 29 | */ |
30 | struct xfs_icdinode { | 30 | struct xfs_icdinode { |
31 | __uint16_t di_magic; /* inode magic # = XFS_DINODE_MAGIC */ | ||
32 | __uint16_t di_mode; /* mode and type of file */ | 31 | __uint16_t di_mode; /* mode and type of file */ |
33 | __int8_t di_version; /* inode version */ | 32 | __int8_t di_version; /* inode version */ |
34 | __int8_t di_format; /* format of di_c data */ | 33 | __int8_t di_format; /* format of di_c data */ |
35 | __uint16_t di_onlink; /* old number of links to file */ | 34 | __uint16_t di_onlink; /* old number of links to file */ |
35 | __uint16_t di_flushiter; /* incremented on flush */ | ||
36 | __uint32_t di_uid; /* owner's user id */ | 36 | __uint32_t di_uid; /* owner's user id */ |
37 | __uint32_t di_gid; /* owner's group id */ | 37 | __uint32_t di_gid; /* owner's group id */ |
38 | __uint32_t di_nlink; /* number of links to file */ | 38 | __uint32_t di_nlink; /* number of links to file */ |
39 | __uint16_t di_projid_lo; /* lower part of owner's project id */ | 39 | __uint16_t di_projid_lo; /* lower part of owner's project id */ |
40 | __uint16_t di_projid_hi; /* higher part of owner's project id */ | 40 | __uint16_t di_projid_hi; /* higher part of owner's project id */ |
41 | __uint8_t di_pad[6]; /* unused, zeroed space */ | ||
42 | __uint16_t di_flushiter; /* incremented on flush */ | ||
43 | xfs_fsize_t di_size; /* number of bytes in file */ | 41 | xfs_fsize_t di_size; /* number of bytes in file */ |
44 | xfs_rfsblock_t di_nblocks; /* # of direct & btree blocks used */ | 42 | xfs_rfsblock_t di_nblocks; /* # of direct & btree blocks used */ |
45 | xfs_extlen_t di_extsize; /* basic/minimum extent size for file */ | 43 | xfs_extlen_t di_extsize; /* basic/minimum extent size for file */ |
@@ -52,22 +50,10 @@ struct xfs_icdinode { | |||
52 | __uint16_t di_flags; /* random flags, XFS_DIFLAG_... */ | 50 | __uint16_t di_flags; /* random flags, XFS_DIFLAG_... */ |
53 | __uint32_t di_gen; /* generation number */ | 51 | __uint32_t di_gen; /* generation number */ |
54 | 52 | ||
55 | /* di_next_unlinked is the only non-core field in the old dinode */ | ||
56 | xfs_agino_t di_next_unlinked;/* agi unlinked list ptr */ | ||
57 | |||
58 | /* start of the extended dinode, writable fields */ | ||
59 | __uint32_t di_crc; /* CRC of the inode */ | ||
60 | __uint64_t di_changecount; /* number of attribute changes */ | 53 | __uint64_t di_changecount; /* number of attribute changes */ |
61 | xfs_lsn_t di_lsn; /* flush sequence */ | ||
62 | __uint64_t di_flags2; /* more random flags */ | 54 | __uint64_t di_flags2; /* more random flags */ |
63 | __uint8_t di_pad2[16]; /* more padding for future expansion */ | ||
64 | 55 | ||
65 | /* fields only written to during inode creation */ | ||
66 | xfs_ictimestamp_t di_crtime; /* time created */ | 56 | xfs_ictimestamp_t di_crtime; /* time created */ |
67 | xfs_ino_t di_ino; /* inode number */ | ||
68 | uuid_t di_uuid; /* UUID of the filesystem */ | ||
69 | |||
70 | /* structure must be padded to 64 bit alignment */ | ||
71 | }; | 57 | }; |
72 | 58 | ||
73 | /* | 59 | /* |
@@ -86,7 +72,8 @@ int xfs_imap_to_bp(struct xfs_mount *, struct xfs_trans *, | |||
86 | int xfs_iread(struct xfs_mount *, struct xfs_trans *, | 72 | int xfs_iread(struct xfs_mount *, struct xfs_trans *, |
87 | struct xfs_inode *, uint); | 73 | struct xfs_inode *, uint); |
88 | void xfs_dinode_calc_crc(struct xfs_mount *, struct xfs_dinode *); | 74 | void xfs_dinode_calc_crc(struct xfs_mount *, struct xfs_dinode *); |
89 | void xfs_inode_to_disk(struct xfs_inode *ip, struct xfs_dinode *to); | 75 | void xfs_inode_to_disk(struct xfs_inode *ip, struct xfs_dinode *to, |
76 | xfs_lsn_t lsn); | ||
90 | void xfs_inode_from_disk(struct xfs_inode *ip, struct xfs_dinode *from); | 77 | void xfs_inode_from_disk(struct xfs_inode *ip, struct xfs_dinode *from); |
91 | void xfs_log_dinode_to_disk(struct xfs_log_dinode *from, | 78 | void xfs_log_dinode_to_disk(struct xfs_log_dinode *from, |
92 | struct xfs_dinode *to); | 79 | struct xfs_dinode *to); |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 9ad9e355a1c0..45acdee98983 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -809,7 +809,6 @@ xfs_ialloc( | |||
809 | ip->i_d.di_uid = xfs_kuid_to_uid(current_fsuid()); | 809 | ip->i_d.di_uid = xfs_kuid_to_uid(current_fsuid()); |
810 | ip->i_d.di_gid = xfs_kgid_to_gid(current_fsgid()); | 810 | ip->i_d.di_gid = xfs_kgid_to_gid(current_fsgid()); |
811 | xfs_set_projid(ip, prid); | 811 | xfs_set_projid(ip, prid); |
812 | memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad)); | ||
813 | 812 | ||
814 | if (pip && XFS_INHERIT_GID(pip)) { | 813 | if (pip && XFS_INHERIT_GID(pip)) { |
815 | ip->i_d.di_gid = pip->i_d.di_gid; | 814 | ip->i_d.di_gid = pip->i_d.di_gid; |
@@ -847,13 +846,8 @@ xfs_ialloc( | |||
847 | ip->i_d.di_flags = 0; | 846 | ip->i_d.di_flags = 0; |
848 | 847 | ||
849 | if (ip->i_d.di_version == 3) { | 848 | if (ip->i_d.di_version == 3) { |
850 | ASSERT(ip->i_d.di_ino == ino); | ||
851 | ASSERT(uuid_equal(&ip->i_d.di_uuid, &mp->m_sb.sb_meta_uuid)); | ||
852 | ip->i_d.di_crc = 0; | ||
853 | ip->i_d.di_changecount = 1; | 849 | ip->i_d.di_changecount = 1; |
854 | ip->i_d.di_lsn = 0; | ||
855 | ip->i_d.di_flags2 = 0; | 850 | ip->i_d.di_flags2 = 0; |
856 | memset(&(ip->i_d.di_pad2[0]), 0, sizeof(ip->i_d.di_pad2)); | ||
857 | ip->i_d.di_crtime.t_sec = (__int32_t)tv.tv_sec; | 851 | ip->i_d.di_crtime.t_sec = (__int32_t)tv.tv_sec; |
858 | ip->i_d.di_crtime.t_nsec = (__int32_t)tv.tv_nsec; | 852 | ip->i_d.di_crtime.t_nsec = (__int32_t)tv.tv_nsec; |
859 | } | 853 | } |
@@ -3464,13 +3458,6 @@ xfs_iflush_int( | |||
3464 | __func__, ip->i_ino, be16_to_cpu(dip->di_magic), dip); | 3458 | __func__, ip->i_ino, be16_to_cpu(dip->di_magic), dip); |
3465 | goto corrupt_out; | 3459 | goto corrupt_out; |
3466 | } | 3460 | } |
3467 | if (XFS_TEST_ERROR(ip->i_d.di_magic != XFS_DINODE_MAGIC, | ||
3468 | mp, XFS_ERRTAG_IFLUSH_2, XFS_RANDOM_IFLUSH_2)) { | ||
3469 | xfs_alert_tag(mp, XFS_PTAG_IFLUSH, | ||
3470 | "%s: Bad inode %Lu, ptr 0x%p, magic number 0x%x", | ||
3471 | __func__, ip->i_ino, ip, ip->i_d.di_magic); | ||
3472 | goto corrupt_out; | ||
3473 | } | ||
3474 | if (S_ISREG(ip->i_d.di_mode)) { | 3461 | if (S_ISREG(ip->i_d.di_mode)) { |
3475 | if (XFS_TEST_ERROR( | 3462 | if (XFS_TEST_ERROR( |
3476 | (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) && | 3463 | (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) && |
@@ -3529,7 +3516,7 @@ xfs_iflush_int( | |||
3529 | * copy out the core of the inode, because if the inode is dirty at all | 3516 | * copy out the core of the inode, because if the inode is dirty at all |
3530 | * the core must be. | 3517 | * the core must be. |
3531 | */ | 3518 | */ |
3532 | xfs_inode_to_disk(ip, dip); | 3519 | xfs_inode_to_disk(ip, dip, iip->ili_item.li_lsn); |
3533 | 3520 | ||
3534 | /* Wrap, we never let the log put out DI_MAX_FLUSH */ | 3521 | /* Wrap, we never let the log put out DI_MAX_FLUSH */ |
3535 | if (ip->i_d.di_flushiter == DI_MAX_FLUSH) | 3522 | if (ip->i_d.di_flushiter == DI_MAX_FLUSH) |
@@ -3581,10 +3568,6 @@ xfs_iflush_int( | |||
3581 | */ | 3568 | */ |
3582 | xfs_buf_attach_iodone(bp, xfs_iflush_done, &iip->ili_item); | 3569 | xfs_buf_attach_iodone(bp, xfs_iflush_done, &iip->ili_item); |
3583 | 3570 | ||
3584 | /* update the lsn in the on disk inode if required */ | ||
3585 | if (ip->i_d.di_version == 3) | ||
3586 | dip->di_lsn = cpu_to_be64(iip->ili_item.li_lsn); | ||
3587 | |||
3588 | /* generate the checksum. */ | 3571 | /* generate the checksum. */ |
3589 | xfs_dinode_calc_crc(mp, dip); | 3572 | xfs_dinode_calc_crc(mp, dip); |
3590 | 3573 | ||
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c index 9dcbf584a336..588d1b4523cb 100644 --- a/fs/xfs/xfs_inode_item.c +++ b/fs/xfs/xfs_inode_item.c | |||
@@ -325,12 +325,14 @@ xfs_inode_item_format_attr_fork( | |||
325 | static void | 325 | static void |
326 | xfs_inode_to_log_dinode( | 326 | xfs_inode_to_log_dinode( |
327 | struct xfs_inode *ip, | 327 | struct xfs_inode *ip, |
328 | struct xfs_log_dinode *to) | 328 | struct xfs_log_dinode *to, |
329 | xfs_lsn_t lsn) | ||
329 | { | 330 | { |
330 | struct xfs_icdinode *from = &ip->i_d; | 331 | struct xfs_icdinode *from = &ip->i_d; |
331 | struct inode *inode = VFS_I(ip); | 332 | struct inode *inode = VFS_I(ip); |
332 | 333 | ||
333 | to->di_magic = from->di_magic; | 334 | to->di_magic = XFS_DINODE_MAGIC; |
335 | |||
334 | to->di_mode = from->di_mode; | 336 | to->di_mode = from->di_mode; |
335 | to->di_version = from->di_version; | 337 | to->di_version = from->di_version; |
336 | to->di_format = from->di_format; | 338 | to->di_format = from->di_format; |
@@ -340,8 +342,8 @@ xfs_inode_to_log_dinode( | |||
340 | to->di_nlink = from->di_nlink; | 342 | to->di_nlink = from->di_nlink; |
341 | to->di_projid_lo = from->di_projid_lo; | 343 | to->di_projid_lo = from->di_projid_lo; |
342 | to->di_projid_hi = from->di_projid_hi; | 344 | to->di_projid_hi = from->di_projid_hi; |
343 | memcpy(to->di_pad, from->di_pad, sizeof(to->di_pad)); | ||
344 | 345 | ||
346 | memset(to->di_pad, 0, sizeof(to->di_pad)); | ||
345 | to->di_atime.t_sec = inode->i_atime.tv_sec; | 347 | to->di_atime.t_sec = inode->i_atime.tv_sec; |
346 | to->di_atime.t_nsec = inode->i_atime.tv_nsec; | 348 | to->di_atime.t_nsec = inode->i_atime.tv_nsec; |
347 | to->di_mtime.t_sec = inode->i_mtime.tv_sec; | 349 | to->di_mtime.t_sec = inode->i_mtime.tv_sec; |
@@ -366,10 +368,11 @@ xfs_inode_to_log_dinode( | |||
366 | to->di_crtime.t_sec = from->di_crtime.t_sec; | 368 | to->di_crtime.t_sec = from->di_crtime.t_sec; |
367 | to->di_crtime.t_nsec = from->di_crtime.t_nsec; | 369 | to->di_crtime.t_nsec = from->di_crtime.t_nsec; |
368 | to->di_flags2 = from->di_flags2; | 370 | to->di_flags2 = from->di_flags2; |
369 | to->di_ino = from->di_ino; | 371 | |
370 | to->di_lsn = from->di_lsn; | 372 | to->di_ino = ip->i_ino; |
371 | memcpy(to->di_pad2, from->di_pad2, sizeof(to->di_pad2)); | 373 | to->di_lsn = lsn; |
372 | uuid_copy(&to->di_uuid, &from->di_uuid); | 374 | memset(to->di_pad2, 0, sizeof(to->di_pad2)); |
375 | uuid_copy(&to->di_uuid, &ip->i_mount->m_sb.sb_meta_uuid); | ||
373 | to->di_flushiter = 0; | 376 | to->di_flushiter = 0; |
374 | } else { | 377 | } else { |
375 | to->di_flushiter = from->di_flushiter; | 378 | to->di_flushiter = from->di_flushiter; |
@@ -390,7 +393,7 @@ xfs_inode_item_format_core( | |||
390 | struct xfs_log_dinode *dic; | 393 | struct xfs_log_dinode *dic; |
391 | 394 | ||
392 | dic = xlog_prepare_iovec(lv, vecp, XLOG_REG_TYPE_ICORE); | 395 | dic = xlog_prepare_iovec(lv, vecp, XLOG_REG_TYPE_ICORE); |
393 | xfs_inode_to_log_dinode(ip, dic); | 396 | xfs_inode_to_log_dinode(ip, dic, ip->i_itemp->ili_item.li_lsn); |
394 | xlog_finish_iovec(lv, *vecp, xfs_log_dinode_size(ip->i_d.di_version)); | 397 | xlog_finish_iovec(lv, *vecp, xfs_log_dinode_size(ip->i_d.di_version)); |
395 | } | 398 | } |
396 | 399 | ||