Add the fields to inode v5 to track the parent inode number
and this entry's offset in the parent inode leaving the entries
in disk format.
---
fs/xfs/xfs_dinode.h | 4 +++-
fs/xfs/xfs_inode_buf.c | 6 ++++++
fs/xfs/xfs_log_format.h | 4 +++-
3 files changed, 12 insertions(+), 2 deletions(-)
Index: b/fs/xfs/xfs_dinode.h
===================================================================
--- a/fs/xfs/xfs_dinode.h
+++ b/fs/xfs/xfs_dinode.h
@@ -79,7 +79,9 @@ typedef struct xfs_dinode {
__be64 di_changecount; /* number of attribute changes */
__be64 di_lsn; /* flush sequence */
__be64 di_flags2; /* more random flags */
- __u8 di_pad2[16]; /* more padding for future expansion */
+ __be64 di_parent; /* inode of parent directory */
+ __be32 di_poffset; /* offset into parent directory */
+ __u8 di_pad2[4]; /* more padding for future expansion */
/* fields only written to during inode creation */
xfs_timestamp_t di_crtime; /* time created */
Index: b/fs/xfs/xfs_inode_buf.c
===================================================================
--- a/fs/xfs/xfs_inode_buf.c
+++ b/fs/xfs/xfs_inode_buf.c
@@ -238,6 +238,9 @@ xfs_dinode_from_disk(
to->di_lsn = be64_to_cpu(from->di_lsn);
memcpy(to->di_pad2, from->di_pad2, sizeof(to->di_pad2));
uuid_copy(&to->di_uuid, &from->di_uuid);
+ /* parent pointer information is left in disk order */
+ to->di_parent = from->di_parent;
+ to->di_poffset = from->di_poffset;
}
}
@@ -285,6 +288,9 @@ xfs_dinode_to_disk(
memcpy(to->di_pad2, from->di_pad2, sizeof(to->di_pad2));
uuid_copy(&to->di_uuid, &from->di_uuid);
to->di_flushiter = 0;
+ /* parent pointer information is in disk order */
+ to->di_parent = from->di_parent;
+ to->di_poffset = from->di_poffset;
} else {
to->di_flushiter = cpu_to_be16(from->di_flushiter);
}
Index: b/fs/xfs/xfs_log_format.h
===================================================================
--- a/fs/xfs/xfs_log_format.h
+++ b/fs/xfs/xfs_log_format.h
@@ -399,7 +399,9 @@ typedef struct xfs_icdinode {
__uint64_t di_changecount; /* number of attribute changes */
xfs_lsn_t di_lsn; /* flush sequence */
__uint64_t di_flags2; /* more random flags */
- __uint8_t di_pad2[16]; /* more padding for future expansion */
+ __uint64_t di_parent; /* inode of parent directory */
+ __uint32_t di_poffset; /* offset into parent directory */
+ __uint8_t di_pad2[4]; /* more padding for future expansion */
/* fields only written to during inode creation */
xfs_ictimestamp_t di_crtime; /* time created */
|